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.