Introduction: Relay Module Input Modified
This is a small instructable to modify the front end of the simple relay modules commonly used in projects.
My motivation for doing this is threefold
1. The ones I have are active low and require significant sink current to operate
2. The sink current is determined by a chain consisting of a resistor, an opto-isolator diode and a resistor. This makes the current vary quite strongly with the supply voltage. If one wants to lower the supply voltage this becomes a limiting factor.
3. The off voltage at the input can be a bit too high for low level voltage devices at the input.
Step 1: Input Modification Design
The design of a common type is shown in the schematic 'Before'. An opto-isolator is used to interface the input logic to a bipolar drive transistor. The bipolar device needs a decent amount of base current to keep it well into saturation when turned on. This in turn needs a decent amount of input current through the opto input diode.
Some modules are active high where the input pushes current through the opto input which istself is connected to ground. In a lot of the modules the use of an opto-isolator is actually fairly pointless. The relay is what provides the isolation. The opto in most designs has a common ground with the drive transistor making its isolation non existent. Some modules do have complete isolation where the input drive is completely independent of the relay drive supply but these are fairly rare and necessitate using different power supplies for the relay and the logic.
What I do with my modules is a modification of the input circuitry as shown in the 'After' schematic. This is significantly simpler. The opto-isolator is gone and the drive transistor is replaced by a MOSFET. The use of a MOSFET gives a natural very high input impedance and actually a lower voltage loss than a bipolar when the relay is on.
I rewire the relay-on LED so it is driven by the driver rather than place a burden on the input. Although the input impedance can be high I normally choose to put a 4k7 pull down to ensure the input is off even with floating drive pins during start up. One can increase this to say 100K if you know that the microcontroller does not have default pull ups which might allow the relay to turn on when the microcontroller is powered up.
Step 2: Modification Steps
To make the modification I do the following steps.
- Remove the Opto-Isolator. I clip through the pins first to make this easier.
- Replace the drive transistor.
- I use a blade first to cut through the legs of the original.
- Solder in MOSFET in place of bipolar.
- I use AO3400 devices which are package and pin compatible. They have a low turn on voltage meaning that 3.3V logic can easily drive these hard on. They have very low on resistance. They are also very cheap and easily available.
- Break track from input to the current input logic with a blade.
- Replace the base resistor (510R) with a 4k7. This will become the pull down.
- Add link from input track to gate of MOSFET. One can connect to the 4k7 resistor to make this connection.
- Add link from output side opto pin that is connected to the other side of the 4k7 resistor to 0V. This makes the pull down connection.
- Add link from LED indicator to drain connection of the MOSFET driver.
- Complete LED indicator chain by connecting input opto pads together.
Steps 7 and 8 may need to change if the components are connected together differently on other modules.