5V Relay Module Mod to Work With Raspberry Pi

About: Passionate maker

It's really easy these days to get your hands on a relay board but you'll quickly find out that most of them are designed for 5V which can a problem for a poor raspberry pi or any other microcontroller running on 3.3V, They just don't have the voltage required to trigger the transistor controlling the relay. So in this tutorial, I'll show you a simple modification of these relay boards to make them 3V3 compatible.

Step 1: Material

Just one component is required and that's a trimmer. The resistance should be anywhere from 10K-100K ohms. I went with 100K. I'd suggest getting a really small one but if your relay board has the room for a big one, get a big one. And you'll of course also need a soldering iron.

Step 2: Swapping Parts

Find the resistor connecting the input pin and the base of the transistor. Simply follow the track on the PCB from the input pin to the resistor. It shouldn't be far away. Other side of the resistor should lead to a transistor which you can verify with a multimeter in a continuity mode. Desolder this resistor. Solder the trimmer in its place. The middle of the trimmer pin must the soldered on the transistor side pad of the removed resistor. Solder the left or right pin(it doesn't matter which one) of the trimmer to the other pad of the removed resistor. The remaining pin of the trimmer must be soldered to the Vcc(5V) pin. If the explanation sounds complicated just watch the video. It's actually pretty straightforward.

Step 3: Setting the Trimmer

Just because you have the trimmer soldered, the job isn’t done yet. We need to set it in the right position. Let’s start by setting it in a roughly middle position. Connect the relay to a raspberry pi or whatever you're using in a normal way. By that I mean Vcc to 5V, ground to ground and input pin to the GPIO pin you’re using. Turn the GPIO pin low and the relay should turn on. It probably won’t though and that’s fine. Simply adjust the trimmer until it does. You should hear an audible click as the relay switches position. Now turn the GPIO high and the relay should turn off. Again it might not and you need to adjust it again but this time, go really slow because you’re probably not too far off. You should hear the click again and you’re done. Try switching the GPIO pin and the relay should switch too. If it still doesn’t work reliably you might have to tweak it some more.

Step 4: Conclusion

I have done this mod just on this very popular design of a relay board but it should work on others as well since the electronics is pretty much the same. I have done this on 4 different boards and it worked on every single one. More surprising was the fact that each one had slightly different resistances despite being made by the same manufacturer. But in the schematic, I’ve included values of resistors that worked for at least one of my boards if you’re in a pinch and don’t have a trimmer on hand.

Share

    Recommendations

    • Remix Contest

      Remix Contest
    • Faux-Real Contest

      Faux-Real Contest
    • Build a Tool Contest

      Build a Tool Contest

    7 Discussions

    0
    None
    Julius217

    Question 8 days ago

    I got a couple more questions.
    1) Would replacing the 5V relay with a 3V version work?
    2) Would using the 5V pin on an Arduino MKR1000 be fine without the MKR1000 recieving to much voltage?

    4 answers
    0
    None
    _GyroJulius217

    Reply 7 days ago

    1) yes. In fact it'd a lot better
    2) Not sure what you mean by that and I don't know much about MKR1000 but 5V pin should be able to handle 5V :D

    0
    None
    Julius217_Gyro

    Reply 7 days ago

    The MKR1000 can't receive more than 3.3V except via the ground pin. And I want to make sure that the relay will not feed 5V through a data pin.

    0
    None
    _GyroJulius217

    Reply 7 days ago

    Don't worry if you're using transistor it won't feed 5V on the data pin. If you're using 3V relay it's completely irrelevant.

    0
    None
    Julius217_Gyro

    Reply 7 days ago

    I plan on doing some testing with a 5V relay that I'll be borrowing from my instructor until I can buy my own relay module.

    0
    None
    _GyroJulius217

    Reply 8 days ago

    you don't really need to combine them. Looking at the instructable it's fine except it's missing a resistor going from the base of the transistor to raspberry pi in your case. You'll have to try different values. The transistor shouldn't get hot and the relay should be switching. I'd start with 1K.