what is the current rating max on an i/o pin for the bs2?· can i control a 5v relay directly from the pin or do i need to make a special circuit for that purpose?
It depends on the relay. The SX series processors (which most of the Stamps are based on) are rated for 30ma per pin, but probably limited to 10-15 times that overall (total for all pins). Some relays will work at 5V and draw less than 30ma, but many will not. Usually 5V reed relays will work and some PC mount non-reed relays. Check the datasheet. If your relay takes too much, you will need a transistor and a resistor. Look at the "What's a microcontroller?" book in the Stamps in Class section of the Parallax website for examples.
I am working through the same questions - and I wonder if you could suggest an "all purpose" relay to use (with transistor too would be great). I would like to turn on and off an small video screen and video signal receiver for wireless video with a couple output pins from my bs2.
If I understand it all correctly, the relay is a switch that I can trigger with an output pin - the switch then allows current from another source through to my loads. If the relay itself draws too much to trigger with a basic stamp pin, then I will need a transistor to switch on a higher current that will then trigger the relay (and its still-higher current)? I'm reading through the documentation in WAM and other places too.
For example, Hamlin makes a line of reed relays that mount on a PC board (or breadboard). Coto is another manufacturer of 5V reed relays with coil currents under 20-25ma. You will need a protective diode either built into the relay or supplied by yourself externally. This protects the Stamp from the voltage surge when the relay turns off. The "What's a Microcontroller?" book show how this is used. Most of these relays can switch up to 100V at 1/2 amp. I found these in Digi-Key's catalog, but Mouser is another excellent electronics supplier, both with on-line stores where you can buy small quantities.
If you need to switch more current or a higher voltage, you will need a transistor to control the larger relay and WAM does show how to do this. Typical transistors include the 2N2222 or the 2N3904. You will need a current limiting resistor in the base lead, typically something like 470 ohms will do. If you're switching a motor or relay, you will again need a diode across the motor or relay with the cathode (bar) attached to the + supply and the anode (triangle) attached to the collector of the transistor.
The maximum current is just that. The reed and the contacts are designed to carry the 1/2 amp. There'll be arcing and burning of the contacts at higher currents. Usually the voltage limit is set by the kind and amount of insulation between the relay contacts where they're mounted together. The contact life can also be affected by the maximum switched voltage since any arc can be sustained longer at higher voltages.
I have (almost) finished my first diagram of a a circuit which I THINK will handle relays up to 0.5A. I drew it using Visio, with which I am not too familiar. I tried saving it in jpg format and that LOOKS like it well and truly sucks. I will clean it up and (somehow) post it here for everyone to disect and hopefully correct all my mistakes.
Basically, it is a BS2p40/74HC595/ULN2803 concoction that I think (hope! guess!) will extend the output ability of a BS2. It will look very "busy" as I included every pin on all three ICs. It was only later that I think I understood the fact that you are only supposed to include the pins you actually use . . . and to place those pins logically, not physically where they really belong.
I am posting this now to save me time later. If you see errors in my thinking, please tell me.
smkbayn, · ·· If the relay is a Solid State Relay (SSR) and the input requirements for voltage and current can be met by the I/O pin then you can directly drive it.· On a mechanical relay with a coil, even if the relay only takes 5V @ 10mA I would never recommend driving it directly.· Any inductive devices like this should be switched using a transistor and a diode should be placed across the relay terminals to clamp any back EMF generated by the relay when de-energized.· Please see the attached schematic example.· I hope this helps.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Chris Savage Parallax Tech Support
if i am not mistaken that is an NPN transistor so when i output my +5 volts on the pin it will conduct firing the coil correct?· its been a while since basic electroinics and i dont use it ever.· thanks.
Chris I have several stamps 1 rev D firing solid state relays direct. The last two stamps I tried I had a problem and the stamps quit working. The last relays were Kodak brand and I am sure that they use a led. I was using a 9 volt battery Would it be possable if I was firing 2 or 3 at a time it could cause the regulator to get hot?
viking, · ·· Sure, it is possible for the regulator to get hot from that.· Different Solid State Relays have different electrical characteristics.· The ‘LED’ on one may require more or less current than another.· If you exceed the total current draw from the on-board regulator it will get very hot.· You could try to determine how much current they are drawing, or you could use an inline resistor from the I/O pin to limit the current yourself.· The SSR should still work with reduced current.· I hope this helps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Chris Savage Parallax Tech Support
Comments
You may find the attached Stamp Comparison Document a handy thing to keep around.
Regards,
Bruce Bates
I am working through the same questions - and I wonder if you could suggest an "all purpose" relay to use (with transistor too would be great). I would like to turn on and off an small video screen and video signal receiver for wireless video with a couple output pins from my bs2.
If I understand it all correctly, the relay is a switch that I can trigger with an output pin - the switch then allows current from another source through to my loads. If the relay itself draws too much to trigger with a basic stamp pin, then I will need a transistor to switch on a higher current that will then trigger the relay (and its still-higher current)? I'm reading through the documentation in WAM and other places too.
Thanks,
Carlos Ferguson
If you need to switch more current or a higher voltage, you will need a transistor to control the larger relay and WAM does show how to do this. Typical transistors include the 2N2222 or the 2N3904. You will need a current limiting resistor in the base lead, typically something like 470 ohms will do. If you're switching a motor or relay, you will again need a diode across the motor or relay with the cathode (bar) attached to the + supply and the anode (triangle) attached to the collector of the transistor.
Carlos
I have (almost) finished my first diagram of a a circuit which I THINK will handle relays up to 0.5A. I drew it using Visio, with which I am not too familiar. I tried saving it in jpg format and that LOOKS like it well and truly sucks. I will clean it up and (somehow) post it here for everyone to disect and hopefully correct all my mistakes.
Basically, it is a BS2p40/74HC595/ULN2803 concoction that I think (hope! guess!) will extend the output ability of a BS2. It will look very "busy" as I included every pin on all three ICs. It was only later that I think I understood the fact that you are only supposed to include the pins you actually use . . . and to place those pins logically, not physically where they really belong.
I am posting this now to save me time later. If you see errors in my thinking, please tell me.
Thanks.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Mike
thanks again,
Carlos
·
·· If the relay is a Solid State Relay (SSR) and the input requirements for voltage and current can be met by the I/O pin then you can directly drive it.· On a mechanical relay with a coil, even if the relay only takes 5V @ 10mA I would never recommend driving it directly.· Any inductive devices like this should be switched using a transistor and a diode should be placed across the relay terminals to clamp any back EMF generated by the relay when de-energized.· Please see the attached schematic example.· I hope this helps.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
·
·· Sure, it is possible for the regulator to get hot from that.· Different Solid State Relays have different electrical characteristics.· The ‘LED’ on one may require more or less current than another.· If you exceed the total current draw from the on-board regulator it will get very hot.· You could try to determine how much current they are drawing, or you could use an inline resistor from the I/O pin to limit the current yourself.· The SSR should still work with reduced current.· I hope this helps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support