In order to control the circuit presented on Day 23 with the Raspberry Pi, I used the L293D motor driver.
The relay requires 40 mA and the GPIO can provide up to 16 mA. Using the L293D motor is a little overkill since it can handle up to 600 mA. I believe that the ideal solution would be using a transistor as shown in this article but I don’t have one now.
It is extremely important to use the protection diode in the proper position. I have been told that the 1N4148 is more suitable for this because it has a better response time. By now, I only have a 1N4001. I have read in some blogs people saying they use the 1N4001 without problems, so I gave it a chance.
I used the GPIO #17 pin to activate the relay through the L293D. I connected +5V from a external power source to the line in the top of the image and its ground to the line in the bottom of the image.
As usual, I used my PiEater library to control the GPIO from my desktop computer. Since this is just a quick test, I added a new check box in my previous Truck Driver program: