I have a tiny latching valve that I want to run with a Stamp. Can I use a
74HC595 shift register to do this? I would be withing the source/sink current limitations. If I do so, do I need to implement EMF spike diodes for the coil, and if so, how do I do it, considering I have to reverse the polarity to actuate the device?
Yes, I've done as much before (if I understand your "latching valve" as meaning something driven similar to a "latching relay.") In fact, it was using latching COTO relays.
Is this a three terminal coil? The COTO arrangement I've used before (latching each way) uses a center tap which is wired to ground or Vcc and then you either drive one side or the other side to effect the latching behavior. Is this the arrangement? Or do you have a data sheet or other description?
No data sheet. But the valve has 2 pins, and reversing the polarity changes the valve state. So I can't use the usual spike diodes, as they would prevent changing states in one diredtion or the other, depending on which way they were pointed. Will the '595 prevent spikes from whacking the Stamp?
Okay. It will probably work out. But if you disable the outputs during the unpowered times, using the /OE pin, there may be a problem since that energy needs to be dumped.
I imagine you are setting this up with two of the '595 outputs per valve. I think it will work okay, something like this:
Both outputs, 1 and 2, are HI. Relay is not energized but is in STATE A. You want to switch to STATE B, so set output 2 LO for the required period of time. Then set output 1 to LO to complete the operation. You are now in STATE B, not energized. You want to switch to STATE A, again, so set output 2 to HI for the required period of time. The set output 1 to HI to complete the operation. Something like that?
I don't know if the '595 has protection diodes on the outputs. Might not, can't say. I'll If you want, you can add an RC snubber across the coil, I suppose. Or you can add some diodes externally:
The valve only requires a brief pulse to change it's state, like 200mS or something. It has 2 leads, and switching the polarity changes the state of the valve. So, if OUT1 is high, and OUT2 is low for >200mS, it will open the valve. Then both pins can be set to float until it is desired to close the valve, at which time OUT1 is low and OUT2 is high for > 200mS.
Hope that made sense. I guess I'll have to just try it and see. I still worry about the EMF spikes, but I dont see how I can guard against them.
Johnathan, Good point, I suppose. I have used shift registers in "johnson counter" configurations to drive small steppers, so I can relate. Anyways, your question about inductive kickback... the inductive kickback would likely be an ac source, so a capacitor would be a good way to route the current towards ground.
More complex (or less complex, depending on how you look at it) would be to use another coil. The characteristic of a coil is to resist large changes in current (used as a choke.)
BTW, have you either measured or tried to calculate what the inductive kickback could potentially be?