Shop OBEX P1 Docs P2 Docs Learn Events
Yet another solenoid question — Parallax Forums

Yet another solenoid question

AcidshockAcidshock Posts: 7
edited 2005-12-13 21:16 in BASIC Stamp
Hi guys, got myself into a dilemma. I got an electronic valve that is powered by a solenoid(9-24VDC). I am using it to create a somewhat realistic water flow in my aquarium to simulate ocean waves. Well anyways I made myself a circuit using a 555 Timer and it worked well but of course its steady and never waivers;not very realistic.

·So I have gone to work on my Basic stamp, the one from the "What is a microcontroller?" book and have managed to make a program that randomizes things up a bit by adding or subtracting a few seconds from a few random waves and then figures in high tide, low tide, etc.·

·I have ran into a problem. I am able to supply enough voltage from Vin, and Vss however once I move to a pin so that I can control it, I am unable to power the solenoid. I am pretty sure its cause of the internal 220 Ohm resistors. So my next though was to use a simple relay and just use a separate power source for the solenoid, the only problem is that the relay I have appears to not receive enough power to switch it either(tested using another power source). So pretty much I am stumped here, I would prefer working with what I have considering that everytime I goto radioshack I end up buying a ton components out of impulse :P Anyone have any ideas?
I was thinking of maybe using a 555 Timer and an external power source and control it with the stamp however I havent quite figured out how to do that yet. I managed to get the 555 Timer working by itself but was unable to repeat the process on the stamp.

Items I have for sure:

Good range of capacitors, 104nF to 3300uF
REsistors 1 Ohm to 1 MOhm
Ton of NPN and PNP Transistors
Bunch of POTs
2 555 Timers
1 556
Everything that came with the "What is a microcontroller" kit

Again, if anyone has any suggestions it would be appreciated. Also any diagrams or examples would be appreciated as well.

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-06-26 11:23
    Acidshock -

    I'll probably be shot at sunrise by the electrical engineering pursits who might be lurking, for the folowing suggestion, but here goes. I'd find the lousiest, leakiest, poorest tolerance capacitor I could find, and stick that in your 555 circuit. If possible, I'd mount the capacitor as close as I safely could to heat of the aquariaum heater as well. Do the same thing with the external resistor. I can all but GUARANTEE you'll get lots of random timing smile.gif

    My Grandfather used to remark about suggestions like this, that it was "featuring a fault"! Normally what I've suggested is the LAST thing you want to do with the external components of a 555. BTW, don't use the CMOS version of the 555, if you can avoid it. They tend to be more accurate smile.gif

    Regards,

    Bruce Bates
  • JonathanJonathan Posts: 1,023
    edited 2005-06-26 13:24
    Acid,

    Are you powering the solenoid from a Stamp pin? If so STOP. You can easily damage the pin that way. Use a transistor to power either the solenoid or the relay. Also, do you have back EMF diodes installed? These are important too. Then I would make a psuedo random program using just the Stamp, no 555. The fish won't know if it is *really* random or not ;-0

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-26 13:41
    As Jonathan points out, connecting a relay or solenoid coil directly to the output of a microcontroller is a very bad idea.· I've attached a circuit that you can use.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    453 x 415 - 4K
  • El PaisaEl Paisa Posts: 375
    edited 2005-06-26 15:13
    nono.gif·Have this question has been posted several times before?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-26 16:19
    Countless. But to be fair, our Search function isn't quite working as well as we'd like so it can be a little tough to find topics in existing threads.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • AcidshockAcidshock Posts: 7
    edited 2005-06-27 00:38
    Yes I am using a diode, I also searched for 555 and solenoid in the search term but didnt quite come up with something that was suitable, close or similar but not quite suitable.
  • MrDude_1MrDude_1 Posts: 1
    edited 2005-12-12 19:53
    Jon Williams (Parallax) said...
    Countless. But to be fair, our Search function isn't quite working as well as we'd like so it can be a little tough to find topics in existing threads.

    i agree 100%.....

    any plans to fix it anytime soon?· because i pretty much have to go elsewhere unless someone re-asks what im looking for every so often..... tongue.gif
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-12-12 20:54
    There already is a functioning search engine: http://search.parallax.com·terms: solenoid forums.parallax.com

    Click "repeat the search with the omitted results included", 3rd link (there maybe other applicable links).

    The fact that search.parallax.com is a functional search engine should be in a sticky post and not buried in the support forum, or better yet, provide a link in the page for the search dialog explaining it is a more reliable method of searching the forums.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 12/12/2005 8:59:54 PM GMT
  • C.MoherC.Moher Posts: 35
    edited 2005-12-13 03:37
    Did you get what you're looking for ? I just built the exact thing you're describing. There's a nice little 5V relay I got for a couple of bucks. I can mail you one, but, as Mr. Williams has already shown, via his posted schematic, you need to drive it with a 2N2222 transistor. You will need a 24 V adaptor to power the actual solenoid. Cheers.

    cmoher3@hotmail.com
  • GenesisGenesis Posts: 42
    edited 2005-12-13 05:16
    Watch out if you use a 2N2222 directly for driving·a solenoid.

    The hFE (gain)·of those little switching transistors isn't all that high (and varies a LOT depending on where you get them and how much you spend - the ones at Radio Shack can be all over the board!)

    The problem here is that if you use the transistor directly (e.g. without a relay) you may not fully saturate the junction.· In that case the transistor can be required to dissipate pretty significant amounts of power and it may smoke on you.

    The iC (collector current limit) on those is typically around 600ma, which may look ok on its face (that's ~7 watts) BUT you have to check the dissipation as well if the junction is not fully saturated.· When I've run the computations for typical switching applications like this with solenoids I usually find that the hFE is not hign enough for me to be happy with the safety factor.· (I've burned one by not doing the calculations to see if the hFE was in the "safe" range before - it wasn't, and it smoked.· The good news is that 2n2222s are dirt cheap [noparse]:)[/noparse] )

    If you can afford the voltage drop (~1.5V .vs. 0.7v for a single transistor) I'd probably use a power Darlington in that application - that will also keep the current draw down to almost nothing off the BS output pin as well by choosing a much larger series resistance for the output.· It would also permit (assuming dissipation limits and such are ok) driving the solenoid directly without having to run a relay in between.

    Another possibility·is the L293; that's a quad-channel IC high-current driver (600ma per channel with supply voltage allowed up to 36v.)· Its original application is driving things like stepper motors but it works pretty well for this sort of application·provided you're within·its current limits.· They're pretty cost-competitive with a power darlington (Digikey wants $2.75 each for 'em) and you get four outputs instead of one.· In theory you could parallel outputs for more current capacity so long as you remain within the device's total dissipation limits.

    In any case you need a snubber (back-biased diode) across the coil or you'll destroy the·driver when it turns off due to back-EMF from the relay or solenoid, as was noted in the posted schematic.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-12-13 21:11
    Paul Baker said...(trimmed)
    There already is a functioning search engine: http://search.parallax.com·terms: solenoid forums.parallax.com
    The fact that search.parallax.com is a functional search engine should be in a sticky post and not buried in the support forum, or better yet, provide a link in the page for the search dialog explaining it is a more reliable method of searching the forums.
    Paul,

    ·· You are correct!· See the following link...

    http://forums.parallax.com/showthread.php?p=562370

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-12-13 21:16
    Thanks Chris.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
Sign In or Register to comment.