Shop OBEX P1 Docs P2 Docs Learn Events
Using a 9v relay with Basic Stamp — Parallax Forums

Using a 9v relay with Basic Stamp

BuddieBuddie Posts: 29
edited 2009-03-22 23:26 in BASIC Stamp
Hello,

I am building a project and I need to use my BS2px to control 9 and 12 volt relays. To hook them up, is it okay to use just a transitor with the base connected to the stamp through a 10k resitor, the collector connected through the relay to 12v and the emitter connected to ground? I also have a diode across the relay for protection. The stamp is powered through a 5v regulator, and the 12v comes from the unregulated supply. Is this setup okay, or do I need something more complicated, like an emitter-follower? Any help is greatly appreciated!

Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-28 20:22
    Your setup sounds good except that the 10K resistor is too high. It depends on the amount of current needed by the relay and the current gain of the transistor (and the number of relays you need to turn on at the same time). You'd be pretty safe using a 6 to 8 mA base current. A 560 or 680 Ohm base resistor would be fine. If you're only turning on 1 or 2 relays at a time, you could use a base resistor as low as 220 Ohms for a base current of around 18 to 20mA.

    Have a look at Nuts and Volts Column #6. Go to the main Parallax webpage and click on the Resources tab and you'll see a link to the Nuts and Volts Columns index.
  • BuddieBuddie Posts: 29
    edited 2009-02-28 21:12
    Thank You.
  • MCGuy75MCGuy75 Posts: 4
    edited 2009-03-01 18:52
    I am doing something simular and need some help. i have combed the pages and this is the closest i come come up with. I Have a nine volt battery that i need to drive a dc motor. I am using the basic stamp program LEDON AND OFF to control the led throught the transister. this is proven to work. I then plug in the 9 volt in place of the VSS and VDD, this is in series with the motor. I know the motor works when directly hooked up to the batt. However it does not work and i am at a loss. Can someone show me my faults?

    Thanks
    Mike
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-01 20:30
    You need to include a drawing of your actual hookup and the source program you're actually using. Make sure you're using a fresh 9V battery. There may be important differences between what you're doing and what the books and sample code show. Also, 9V batteries have very little current capacity and easily become exhausted.
  • MCGuy75MCGuy75 Posts: 4
    edited 2009-03-03 02:29
    This is my code:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    DO
    HIGH 1
    PAUSE 2000
    LOW 1
    PAUSE 2000
    loop

    I have also·attached is a schematic.
    I hope that i will not have to redo my Project due to something overlooked/unexperieanced. I hope this will help. if you have and other ? let me know. i have used both npn and pnp s for the transister and have tried a fresh battery.

    thanx again
    mike
    2550 x 1480 - 162K
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-03 04:42
    Your setup won't work. Please read the Nuts and Volts article I mentioned. It gives some specific examples.

    1) The resistors are too large. Transistors are current amplifiers and very little current flows through 50K with 5V applied to it (about 100uA).

    2) You have to have a common ground with the Stamp power supply or the voltage on P1 has no meaning to the transistor and motor.

    3) The motor should be in the collector lead, not the emitter. Look up the difference between a common collector amplifier and a common emitter amplifier.
  • MCGuy75MCGuy75 Posts: 4
    edited 2009-03-04 01:10
    I will look that up thank you. i do have one ? can i hook up the 9 v ground to the board and not worry about frying something?

    Again thanx i will check it out.
  • MCGuy75MCGuy75 Posts: 4
    edited 2009-03-22 19:27
    OK its been awhile but have managed to review my curcuit and still not working. I decided to go with a 4 AA bats so i can get more current flow without killing my life of 9v. I also increased the Amp rating of my transister up to 10 Amps. I have hooked it up the same way as before. I get transfer of power when there is no base current. and even more when the current is applied.

    thanx mike
  • FranklinFranklin Posts: 4,747
    edited 2009-03-22 23:26
    McGuy75 said...
    I have hooked it up the same way as before. I get transfer of power when there is no base current. and even more when the current is applied.
    Mike said...
    Your setup won't work. Please read the Nuts and Volts article I mentioned. It gives some specific examples.

    1) The resistors are too large. Transistors are current amplifiers and very little current flows through 50K with 5V applied to it (about 100uA).

    2) You have to have a common ground with the Stamp power supply or the voltage on P1 has no meaning to the transistor and motor.

    3) The motor should be in the collector lead, not the emitter. Look up the difference between a common collector amplifier and a common emitter amplifier.
    Please follow Mike's advice.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.