if and how to use a relay controlled by a basic stamp
Lucipher
Posts: 15
I am using a basic stamp 2 to control an air conditioning unit made out on an old mini fridge. i have a thermo couplr hoooked up to the stamp and all programmed and is workin fine.
I was wondering if it was possible to use a relay some how to kick on the home made A/C unit once it receives a certain temperature reading from the thermo couple.
my program being used for the thermo couple is attached, and i am stumped on how to maybe add another loop to turn on the relay if it is possible.
I was wondering if it was possible to use a relay some how to kick on the home made A/C unit once it receives a certain temperature reading from the thermo couple.
my program being used for the thermo couple is attached, and i am stumped on how to maybe add another loop to turn on the relay if it is possible.
Comments
Just in passing, it appears from the program that you're using a BS-2pe not a BS-2.
Use the attached program as a prototype, as I'm not sure it does exactly what you want, but it does compile cleanly. No guarantees however :-)
Regards,
Bruce Bates
thanks for all the help
Lucipher
the stamps typically don't generate enough current to trigger a relay....and it's sometimes nice to buffer your stamp pins to what you connect them to (either thru a transistor or optoisolator).
Here's a quick drawing that floats around on this board for connecting a relay up.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://ca.geocities.com/steve.brady@rogers.com/index.html
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
·· That circuit is common for 5 Volt Relays.· Parallax Technical Support recommends using a 1K resistor on the base of the transistor if Vdd is more than 5 Volts.· For example, if Vdd is 12 Volts.· This is to protect the Stamp pin in the event the Relay Coil or Diode·should short and destroy the transistor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
i have seen this done before with a basic stamp and figured i would be able to use the same set up.
thanks again for all the help.
Lucipher
·· No, you should control the 12V Relay directly.· If you're driving a 12V Relay, it can be done with a 2N3904 NPN Transistor no problem, as long as the current rating of the coil is around 100mA or less.· Don't forget the Diode across the Relays coils.· It will help to protect the transistor from the effects of the Relay coil when it de-energizes.
·· By the way, the reason you shouldn't use one Relay to control another if you can help it is noise.· This seems to be a growing problem recently with people using, for example, a 5V Relay to control a 12V Relay, which controls a 120V Relay.· In this case I can't help but wonder if an SSR could possibly be so much more expensive that 3 mechanical Relays doing the same job, but generating more noise (Using more current when turning on).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
and with the transistor, by lookin at it how can you tell when pin is which, the B-C-E pins, Its so dinky i can barely read the part number.
Lucipher
google the part number and look for a datasheet!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://ca.geocities.com/steve.brady@rogers.com/index.html
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
Now i have a new problem, i had the thermocouple part working correctly then needed to move it all down a few rows on my bread board thats attached and now when i try to check it its all over the map. soetimes it works its way down to 0 then back up to like 80 degrees celsius.
i have taken it apart and rebuilt the circuit multiple times making sure all wires arent touching and each were in the nodes all the way and what not and cant figure out, any helo would be awesome.
Lucipher
·· The part number is important to know.· Two transistors can look exactly alike and have different pinouts.· Even if they have the same pinouts, they can be different types.· For example one might be NPN and the other PNP.· If the one you have is a 2N3904, and you're looking at the transistor with the leads aiming down and the flat surface toward you, the pins should be Emitter, Base, Collector.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
lucipher
·
·· If it's a 2N3904 transistor, and you're switching a 9V Relay, these are the recommended connections.· The left lead (Emitter) connects to ground.· The center pin (Base) connects to a 1K resistor and that connects to your Stamp PIN.· The right pin (Collector) connects to one side of the Relay, and the other side of the Relay connects to your 9V source.· You will also need a diode (like a 1N4001) across the Relay leads, Cathode toward the 9V side.
··· When the Stamp PIN is high, it will turn the Relay on.· Let me know how it goes.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Lucipher
·· That should turn on the Relay for·two seconds, then off.· See if that works.· If it does, it's not the circuit, but the code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
And if i put too much current or apply to much voltage to the relay coil will it get stuck closed if it is a normally open relay?
Lucipher
Lucipher
The reason this is happening is because the raw value of Cur_Temp is always going to show higher than your Max_Temp.· The reason is that the value returned is not the same value you are displaying in your DEBUG code.· There you are re-formetting the code for the decimal point by dividing it by 100, displaying that part in decimal, displaying the decimal point, etc.· That value itself is not suitable for your calculation without extracting the whole value (Left of the decimal point), which you should be able to do, since technically you're doing it in the code already.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
but how would i·use the·values then? would i just multiply them by 100 and make the max_temp 2500 and the Min_temp to 2000?
Lucipher
the 9v relay is connected to the battery itself and one of the open sides of the 5v relay which then goes to the positive side of the battery completing the circuit so the 9v should close for the fan and compressor to kick on. but im not sure where i messed up since the LED was working with it fine......
Lucipher
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Lucipher
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Lucipher
to determine the proper value of the current limiting resistor on the base of your transistor.
http://forums.parallax.com/showthread.php?p=534806
...See my FAQ01.gif from the above link.
First of all, the microcontroller does not drive the relay. It drives the transistor. If you connect
your relay as shown, using an NPN with the Emitter tied to GND, then the relay can have a source
voltage HIGHER than 5V on the Collector side of the transistor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe - Mask Designer III
National Semiconductor Corporation
Latest Company News
(Communication Interface Division)
500 Pinnacle Court, Suite 525
Mail Stop GA1
Norcross,GA 30071