pin caracteristics

Hi
Can anyone tell me if an output is switched from high to low whether or not in the low state it can be used to sink current or if I need to use a dedicated earth.

Example

I have a small solenoid that needs to have its polarity changed depending on whether its position is extended or retracted.
If I can toggle 2 pins from either high to low it would be a much easier circuit than sharing an earth.

thanks
 

hippy

Ex-Staff (retired)
Yes, an I/O pin can sink and source current so you could use one resistor and two LED's in opposite direction across a pair of I/O and then light one or the other by setting one HIGH the other LOW.

The current sourced or sunk is limited though, 25mA max, and a solenoid may require more current than that. Go over the limit and you risk burning an I/O out whether sinking or sourcing, could even permanently destroy the chip.
 

erco

Senior Member
Use 2 pins and an H-bridge.

Low current HG7881 or L9110S, moderate current L298N, all under $2 on Ebay China. Not sure if you can use a flyback diode across the solenoid coil since you're reversing though.
 
Erco thanks for the info.
I sometimes see a small ceramic capacitor across to 2 poles on electric motors. I presume this is used in place of a flyback diode. Perhaps I could do the same with a solenoid?
 
Top