I'm driving a solenoid from a raspberry pi zero W. The solenoid doesn't work reliable, sometimes it doesn't move at all. When I position the solonoid so that it points downwards (so that gravity helps), it always works. When I drive the solenoid straight from the power supply it actuates reliably.
I'm using this schematic with some slightly different parts:
- single 5V 2.1A power supply instead of two separate ones
- 1k resistor (also tried 2.2k)
- 5V solenoid (measured coil resistance: 5.6 Ohm)
- TIP122 transistor
- 1n3001 diode
It seems like the voltage across the solenoid is too low, but I measured it, and
it's around 5V as it should be. Edit: I measured this without the solenoid, this is wrong. With the solenoid I'm measuring around 2V. This seems to be the problem.
Where am I going wrong?
So, thanks very much to all the answers, I realized that the voltage across the solenoid was simply too low (2.5V), due to the characteristics of the TIP122 resistor I was using. So I switched the TIP122 for a IRLB8721PbF mosfet, and It's working slightly better: around 3.15V across solenoid.
I would prefer to have the full 5V across the solenoid, but this seems hard to achieve given the 3.3V GPIO output on the raspberry, which will not turn a lot of transitors/mosfets fully on. I tried driving the mosfet using the transistor, but this gave an even lower voltage. If I read the datasheet correctly the IRLZ44N would give a better result, but that wasn't available here. See for more information: Using MOSFETS with 3.3 Volt.
Anyway, 3.15V seems enough to drive my small solenoid reliably, so that's good enough for me. Again, thanks very much for the answers!