Soleniod feedback?
Jsav
Posts: 25
I've got a project set up that uses the BS2p to control an actuator and two solenoids based on user input via pushbutton/LED circuits. Using a 12V power supply. I have the basic stamp connected to an npn transistor through a resistor for protection, the transistor to a relay to drive the actuator or soleniods.
My problem is that when the solenoids (either of them) are told to close, or <thatpin> low, the code under this point doesn't execute and the program starts over after the solenoid closes.·The actuator will telescope/retract just fine.
To check the solenoids and the connections were correct I placed a voltage divider in place of the solenoid (10k/10k). Reading the voltage it does indeed read 6V out when the solenoid is supposed to be on (the relay is flipped), but when it goes low again the program still restarts, so it can't be the solenoid.
I have tried switching the direction of the relay, with a flyback diode across the relay so when it goes low it discharges to the +12V source, but still get the same problem: whenever I tell one of those pins to go low, it restarts my program.
An·example of this section of code is below where PIN5 and PIN4 are connected to relay/npn's to control the actuator, PIN6 is connected to the base of an NPN transistor via a 390ohm resistor. The emitter to ground and the C pin to one side of the coil of the relay, the other side of this coil is hooked to the VCC pin on the stamp for +5v.· Therefore, the COM pin on the relay is hooked to the 12V source, so when the relay closes, the solenoid on the other end sees +12V. (unless connected with the flyback diode as described above.) This is just an example so the second solenoid is left out (it just gets skipped like anything else after the LOW6 command).
cycle:
· LOW 5
· HIGH 4
· DEBUG CR, ? IN5
· DEBUG CR, ? IN4
· PAUSE 11000
· HIGH 6
· DEBUG CR, ? IN6
· PAUSE 5000
· DEBUG CR, ? IN6
·' LOW 6
· DEBUG CR, ? IN6
· PAUSE 5000
· DEBUG CR, ? IN6
· LOW 10
· HIGH 12
· HIGH 14
· PAUSE 5000
· LOW 12
· LOW 14
· LOW 6
· DEBUG CR, ? IN6
·GOSUB main
RETURN
This will display the proper pins being high or low up till LOW6. PINs 10, 12, and 14 are connected to LED's, I just wanted to see if they turned on before/after the LOW6 command, where the top one is commented out. The debug line above GOSUB main, will not display on the screen when LOW6 is placed at the bottom, and nothing below the commented LOW6 will display when it's active.
I do not understand why sending this low signal reset the program, but it prevents any further action in the program after this point, though controlling the solenoids is the LAST thing i need to do with the program, since I need to control two, I'm stuck at only being able to control one.
After the aforementioned troubleshooting, the only thing I can think of is that the other side of the coil on the relay should be hooked to +5V from a regulator and not the VCC of the stamp? All in all FOUR pins from relays (two for the actuator, and one for each of the solenoids) are connected to the VCC pin on the stamp, only one of any of these three things is operational at one time though.
Any other suggestions on why this could be occuring? If something was hooked up incorrectly I feel as though the solenoids wouldn't open/close as they are told, reguardless of the program reset.
My problem is that when the solenoids (either of them) are told to close, or <thatpin> low, the code under this point doesn't execute and the program starts over after the solenoid closes.·The actuator will telescope/retract just fine.
To check the solenoids and the connections were correct I placed a voltage divider in place of the solenoid (10k/10k). Reading the voltage it does indeed read 6V out when the solenoid is supposed to be on (the relay is flipped), but when it goes low again the program still restarts, so it can't be the solenoid.
I have tried switching the direction of the relay, with a flyback diode across the relay so when it goes low it discharges to the +12V source, but still get the same problem: whenever I tell one of those pins to go low, it restarts my program.
An·example of this section of code is below where PIN5 and PIN4 are connected to relay/npn's to control the actuator, PIN6 is connected to the base of an NPN transistor via a 390ohm resistor. The emitter to ground and the C pin to one side of the coil of the relay, the other side of this coil is hooked to the VCC pin on the stamp for +5v.· Therefore, the COM pin on the relay is hooked to the 12V source, so when the relay closes, the solenoid on the other end sees +12V. (unless connected with the flyback diode as described above.) This is just an example so the second solenoid is left out (it just gets skipped like anything else after the LOW6 command).
cycle:
· LOW 5
· HIGH 4
· DEBUG CR, ? IN5
· DEBUG CR, ? IN4
· PAUSE 11000
· HIGH 6
· DEBUG CR, ? IN6
· PAUSE 5000
· DEBUG CR, ? IN6
·' LOW 6
· DEBUG CR, ? IN6
· PAUSE 5000
· DEBUG CR, ? IN6
· LOW 10
· HIGH 12
· HIGH 14
· PAUSE 5000
· LOW 12
· LOW 14
· LOW 6
· DEBUG CR, ? IN6
·GOSUB main
RETURN
This will display the proper pins being high or low up till LOW6. PINs 10, 12, and 14 are connected to LED's, I just wanted to see if they turned on before/after the LOW6 command, where the top one is commented out. The debug line above GOSUB main, will not display on the screen when LOW6 is placed at the bottom, and nothing below the commented LOW6 will display when it's active.
I do not understand why sending this low signal reset the program, but it prevents any further action in the program after this point, though controlling the solenoids is the LAST thing i need to do with the program, since I need to control two, I'm stuck at only being able to control one.
After the aforementioned troubleshooting, the only thing I can think of is that the other side of the coil on the relay should be hooked to +5V from a regulator and not the VCC of the stamp? All in all FOUR pins from relays (two for the actuator, and one for each of the solenoids) are connected to the VCC pin on the stamp, only one of any of these three things is operational at one time though.
Any other suggestions on why this could be occuring? If something was hooked up incorrectly I feel as though the solenoids wouldn't open/close as they are told, reguardless of the program reset.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
Problem seems to be fixed but questions remain...
Thanks for the replay Mike.
There is a Nuts and Volts column that talks about relays:
http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol1/col/nv6.pdf
I was wanting to know how you set up your solenoid. I am trying to do the same but with a "flapper solenoid".
SamW
Here is how I drive Solenoids and Relays.
The attached schematic shows the Main power isolated to supply +5 volts to the stamp.
I use a ULN2803 Driver chip opn the Stamp output pins. Each Driver can handle 500 MA and it has a flyback diode built in.
I use +24 Volts as my designs are for industrial controls, but you can use 10-38 Volts with the TI 5101 Switching Regulator
The pull up resistors are needed for the driver chip.
In this configuration a High turns on the Solenoid/Relay/Output.
You do need to make sure your power supply can put out enough current for your total worst case load.
A relay/Solenoid also takes· around 2 times more current to energize than it takes to hold it in.
Hope this helps
Alan Bradford
Plasma Technologies
www.plasmatechnologies.com