Shop OBEX P1 Docs P2 Docs Learn Events
Soleniod feedback? — Parallax Forums

Soleniod feedback?

JsavJsav Posts: 25
edited 2009-04-22 21:25 in BASIC Stamp
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.

Comments

  • Mike2545Mike2545 Posts: 433
    edited 2009-04-15 20:30
    Check the current draw, It sounds like the stamp is shutting down when the solenoids are powered on, thus resetting the stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike2545

    This message sent to you on 100% recycled electrons.
  • JsavJsav Posts: 25
    edited 2009-04-16 12:15
    The current shouldn't be a problem, I have the stamp controlling transistors, controlling relays, controlling the solenoids, it's all rated/should be in order. The solenoids to turn on/off fine, it's just that when they turn off, the program resets or skips the code under that LOW line. The actuator has more of a current draw (controlled by two, but different relays than the solenoids) and it works just fine telescoping or retracting.
  • JsavJsav Posts: 25
    edited 2009-04-16 13:13
    So I think the problem was that all the relays running off VCC of the stamp sent it over it's limit. I'm assuming it runs from a 9V cube with the 5V regulator for VCC, and the current draw WAS too much. I don't know why as they all run individually and at different times, but setting one side of the coil on the relays to the 5V regulator on MY board (not the stamps), seemed to fix the problem. I also don't know why the spike only occured (reset the stamp) when the solenoid dropped low, I think that the coil was attempting to discharge through the stamp, and though I measured it with an oscilliscope and the spike was in the n/s and very low, it was apparently enough to disrupt VCC on the stamp.

    Problem seems to be fixed but questions remain...


    Thanks for the replay Mike.
  • JsavJsav Posts: 25
    edited 2009-04-16 13:32
    I should note that it was the relays that were sending the VCC on the stamp over its limit, not the solenoid or actuator, as the problem remained when they were isolated.
  • Gunstar1Gunstar1 Posts: 18
    edited 2009-04-21 20:32
    I don't think you·are supposed·drive the tranistor's collector from the stamp's·power... it should be it's own seperate source.· It could be dropping the power availible to·the stamp·at a level lower than·the stamp·can be powered by and it shuts off/resets.· Also I don't think a·flyback diode would·work correctly in that configuration as it is shunting power away from the stamp's pin but still going·into the stamp itself.

    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
  • SamWSamW Posts: 27
    edited 2009-04-22 00:37
    Jsav,

    I was wanting to know how you set up your solenoid. I am trying to do the same but with a "flapper solenoid".

    SamW
  • Alan BradfordAlan Bradford Posts: 172
    edited 2009-04-22 21:25
    Hi,
    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
Sign In or Register to comment.