Shop OBEX P1 Docs P2 Docs Learn Events
BS2 to run a 12 volt relay in my car — Parallax Forums

BS2 to run a 12 volt relay in my car

ArchiverArchiver Posts: 46,084
edited 2003-01-14 23:02 in General Discussion
I want to use the BS2 to power my computer in the car, which is
powered off a 12 volt relay. The BS2 outputs 5 volts, how do i make
that 5 volt output to 12 volts? I have searched and read, but I
can't find out how to wire a transistor or whatever is needed.
Please help.

amrit

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 03:36
    Amrit,

    You can find all that you need to know on this on the Parallax website. Look
    for the Nuts and Volts article titled something like "Silicon Steriods for
    your Stamp".

    Jonathan

    www.madlabs.info


    Original Message
    From: <amrit50@f...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, January 13, 2003 5:30 PM
    Subject: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car


    > I want to use the BS2 to power my computer in the car, which is
    > powered off a 12 volt relay. The BS2 outputs 5 volts, how do i make
    > that 5 volt output to 12 volts? I have searched and read, but I
    > can't find out how to wire a transistor or whatever is needed.
    > Please help.
    >
    > amrit
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 07:13
    the stamp will have to get its juice from the car's 12 volts somehow
    right?........... it seems like there is plenty of 12 volt power available.
    Or am I missing something? Otherwise, Im sure that others here will tell
    you that you need to build a power supply circuit, that has all the voltages
    you are going to need.

    Dave
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 13:42
    In a message dated 1/13/2003 11:08:55 PM Pacific Standard Time,
    davelewis@d... writes:

    > the stamp will have to get its juice from the car's 12 volts somehow
    > right?........... it seems like there is plenty of 12 volt power available.
    > Or am I missing something? Otherwise, Im sure that others here will tell
    > you that you need to build a power supply circuit, that has all the
    > voltages
    > you are going to need.
    >

    What you want to do is relatively easy, but cumbersome to explain in an
    email. Email a fax# and I will fax you a schematic of how to power your stamp
    from your vehicle 12 volt system and run the relay using your stamp......


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 19:11
    i don't really have a fax number...

    Here's what I understand:

    You put the 12 volt + to pin 24 and the ground into pin 23.

    The output pin to run a relay goes to some sort of transistor that also
    has a 5 and a 12 volt input. I just can't figure out how to to wire the
    transistor w/ the 2 voltages and the relay.

    Amrit

    Original Message
    From: smartdim@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=gpB1VmATI19oUQW--_iVJP0FZJyc2DmGO7xHd2rwaUG3K6AgNxDZ8W7v0efKlREr7ooU62yz3JTxX0A]smartdim@a...[/url
    Sent: Tuesday, January 14, 2003 8:42 AM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car

    In a message dated 1/13/2003 11:08:55 PM Pacific Standard Time,
    davelewis@d... writes:

    > the stamp will have to get its juice from the car's 12 volts somehow
    > right?........... it seems like there is plenty of 12 volt power
    available.
    > Or am I missing something? Otherwise, Im sure that others here will
    tell
    > you that you need to build a power supply circuit, that has all the
    > voltages
    > you are going to need.
    >

    What you want to do is relatively easy, but cumbersome to explain in an
    email. Email a fax# and I will fax you a schematic of how to power your
    stamp
    from your vehicle 12 volt system and run the relay using your
    stamp......


    [noparse][[/noparse]Non-text portions of this message have been removed]


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 19:34
    Hi Amrit,

    To select a transistor with enough current carrying ability, you need to
    know the rated resistance or current of your 12V relay coil. A popular and
    inexpensive transistor is the PN2222, which will handle up to 500mA or so
    continuously. Chances are that your relay coil will use less current than
    that, but you should check.

    Here are the connections:

    Connect a 1k ohm resistor from the stamp pin to the base of the transistor.
    Connect the emitter of the transistor to ground. Connect the collector of
    the transistor to one side of the relay coil. Connect the other side of the
    relay coil to the +12 volt vehicle system. When the stamp pin outputs a
    "high" the relay will be energized.

    A couple additional notes: 1) The 1k ohm resistor might need to be a
    different value if your relay coil requires a large current. Actually, if
    it needs more than 300 to 400mA, a "bigger" transistor would be better. 2)
    Automotive electrical systems are full of nasty electrical spikes, etc. I'm
    not too sure how the regulator in the standard BS2 handles all that stuff,
    so you might want to consider a more robust 5V regulator/supply, and feed
    it's output to the Stamp's 5V input pin directly.

    Randy
    www.glitchbuster.com


    Original Message
    From: "Amrit " <amrit50@f...>
    To: <basicstamps@yahoogroups.com>
    Sent: Tuesday, January 14, 2003 11:11 AM
    Subject: RE: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car


    > i don't really have a fax number...
    >
    > Here's what I understand:
    >
    > You put the 12 volt + to pin 24 and the ground into pin 23.
    >
    > The output pin to run a relay goes to some sort of transistor that also
    > has a 5 and a 12 volt input. I just can't figure out how to to wire the
    > transistor w/ the 2 voltages and the relay.
    >
    > Amrit
    >
    >
    Original Message
    > From: smartdim@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=nGCbHToRsUxchB29SEvM5g8hmP6a0yX3KPjcUJW1xTiiPwqeyikZmaeyjiWYJLicVz4k9sTqiVFgvX8]smartdim@a...[/url
    > Sent: Tuesday, January 14, 2003 8:42 AM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car
    >
    > In a message dated 1/13/2003 11:08:55 PM Pacific Standard Time,
    > davelewis@d... writes:
    >
    > > the stamp will have to get its juice from the car's 12 volts somehow
    > > right?........... it seems like there is plenty of 12 volt power
    > available.
    > > Or am I missing something? Otherwise, Im sure that others here will
    > tell
    > > you that you need to build a power supply circuit, that has all the
    > > voltages
    > > you are going to need.
    > >
    >
    > What you want to do is relatively easy, but cumbersome to explain in an
    > email. Email a fax# and I will fax you a schematic of how to power your
    > stamp
    > from your vehicle 12 volt system and run the relay using your
    > stamp......
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject
    > and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 19:39
    In a message dated 1/14/2003 11:13:19 AM Pacific Standard Time,
    amrit50@f... writes:

    > i don't really have a fax number...
    >
    > Here's what I understand:
    >
    > You put the 12 volt + to pin 24 and the ground into pin 23.
    >
    > The output pin to run a relay goes to some sort of transistor that also
    > has a 5 and a 12 volt input. I just can't figure out how to to wire the
    > transistor w/ the 2 voltages and the relay.
    >

    Ok, got it....Your +12 to pin 24 and ground to pin 23 is correct

    Get yourself a 2N2222 transistor (or 2N3904) from radio shack or your local
    electronics store. Make sure before you leave you know which lead is the
    BASE, EMITTER and COLLECTOR....

    1.Connect the EMITTER to ground
    2.Connect a resistor (4.7k, thats 4,700 ohms) to your output pin of the
    stamp. Connect the other end of the resistor to the base lead of the
    transistor

    Stamp pin XXXXXXXX Transistor base (XXXX = the resistor)

    On your relay, you will need to know which two leads are the "coil".

    3.Connect one end of the coil to your car +12 volts, connect the other lead
    of the coil to the transistor collector.

    4.Also get a diode (1N4001 will do) Connect the diode across the relay coil.
    One end of the diode has a line on it. The end with the line goes to the side
    of the coil that is connected to the +12 volts, and the other end of the
    diode goes to the transistor collector.

    Your program.....When the stamp output pin is high, the relay will be on.
    Conversely, when the stamp output pin is low, the relay will be off.

    Therefore, the transitor base has one connection, 4.7k ohms.
    The transistor emitter has one connection, to ground.
    The transistor collector has two connections. Those are: One end of the relay
    coil, and the non-stripe side of the diode
    Don't hesitate to write back if you don't undersand or need clarification.

    Ken


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 19:44
    In a message dated 1/14/2003 11:34:00 AM Pacific Standard Time,
    randyjones@w... writes:

    > Hi Amrit,
    >
    > To select a transistor with enough current carrying ability, you need to
    > know the rated resistance or current of your 12V relay coil. A popular and
    > inexpensive transistor is the PN2222, which will handle up to 500mA or so
    > continuously. Chances are that your relay coil will use less current than
    > that, but you should check.
    >
    > Here are the connections:
    >
    > Connect a 1k ohm resistor from the stamp pin to the base of the transistor.
    > Connect the emitter of the transistor to ground. Connect the collector of
    > the transistor to one side of the relay coil. Connect the other side of
    > the
    > relay coil to the +12 volt vehicle system. When the stamp pin outputs a
    > "high" the relay will be energized.
    >
    > A couple additional notes: 1) The 1k ohm resistor might need to be a
    > different value if your relay coil requires a large current. Actually, if
    > it needs more than 300 to 400mA, a "bigger" transistor would be better. 2)
    > Automotive electrical systems are full of nasty electrical spikes, etc.
    > I'm
    > not too sure how the regulator in the standard BS2 handles all that stuff,
    > so you might want to consider a more robust 5V regulator/supply, and feed
    > it's output to the Stamp's 5V input pin directly.
    >
    > Randy
    > www.glitchbuster.com
    >

    And a diode across the relay coil, Anode to the transitor collector.....


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 21:15
    > And a diode across the relay coil, Anode to the transitor collector.....

    Yes! I was planning to mention that when I began typing the message, but
    forgot it along the way.

    Thanks!
    Randy
    www.glitchbuster.com
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 21:19
    Thanks for all your help randy.

    Amrit

    Original Message
    From: Randy Jones [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ABCDi-7EKDfW_QBzNQQtG_6uBz-5NPjQKYe6ll8ZSXJRLSAYCqHEbEmGYtDDWQf9R3h5HFbskuJDFDcLvIQ9HZSC]randyjones@w...[/url
    Sent: Tuesday, January 14, 2003 2:35 PM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car

    Hi Amrit,

    To select a transistor with enough current carrying ability, you need to
    know the rated resistance or current of your 12V relay coil. A popular and
    inexpensive transistor is the PN2222, which will handle up to 500mA or so
    continuously. Chances are that your relay coil will use less current than
    that, but you should check.

    Here are the connections:

    Connect a 1k ohm resistor from the stamp pin to the base of the transistor.
    Connect the emitter of the transistor to ground. Connect the collector of
    the transistor to one side of the relay coil. Connect the other side of the
    relay coil to the +12 volt vehicle system. When the stamp pin outputs a
    "high" the relay will be energized.

    A couple additional notes: 1) The 1k ohm resistor might need to be a
    different value if your relay coil requires a large current. Actually, if
    it needs more than 300 to 400mA, a "bigger" transistor would be better. 2)
    Automotive electrical systems are full of nasty electrical spikes, etc. I'm
    not too sure how the regulator in the standard BS2 handles all that stuff,
    so you might want to consider a more robust 5V regulator/supply, and feed
    it's output to the Stamp's 5V input pin directly.

    Randy
    www.glitchbuster.com


    Original Message
    From: "Amrit " <amrit50@f...>
    To: <basicstamps@yahoogroups.com>
    Sent: Tuesday, January 14, 2003 11:11 AM
    Subject: RE: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car


    > i don't really have a fax number...
    >
    > Here's what I understand:
    >
    > You put the 12 volt + to pin 24 and the ground into pin 23.
    >
    > The output pin to run a relay goes to some sort of transistor that also
    > has a 5 and a 12 volt input. I just can't figure out how to to wire the
    > transistor w/ the 2 voltages and the relay.
    >
    > Amrit
    >
    >
    Original Message
    > From: smartdim@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=fBDRvrs2J5wDQuOAWLwXac4pohNCRdlH3cMTnX2tSa-YGoyeustBUd92F9yKay_RZ-snMdA59cS-TCg]smartdim@a...[/url
    > Sent: Tuesday, January 14, 2003 8:42 AM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car
    >
    > In a message dated 1/13/2003 11:08:55 PM Pacific Standard Time,
    > davelewis@d... writes:
    >
    > > the stamp will have to get its juice from the car's 12 volts somehow
    > > right?........... it seems like there is plenty of 12 volt power
    > available.
    > > Or am I missing something? Otherwise, Im sure that others here will
    > tell
    > > you that you need to build a power supply circuit, that has all the
    > > voltages
    > > you are going to need.
    > >
    >
    > What you want to do is relatively easy, but cumbersome to explain in an
    > email. Email a fax# and I will fax you a schematic of how to power your
    > stamp
    > from your vehicle 12 volt system and run the relay using your
    > stamp......
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject
    > and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 23:02
    I have had great success interfacing outputs from the Basic Stamp using a
    ULN2803A IC. It contains an array of transistors that provide a nice
    current gain large enough to drive most relays or lamps etc, and best of
    all, it's damn simple to wire, requiring no extra components.

    I will try to describe:-

    A high input from the stamp to the ULN2803 will cause the corresponding
    output pin on the ULN2803A to go low.

    I you have one side of the relay coil connected to +12VDC (or any voltage up
    to 50V for that matter), when you ground the other side, it will activate,
    so if you now connect that to the output of the ULN2803, it will drive the
    relay.

    EASY - Eight terminations and you are done!!

    Example

    Basic Stamp ULN2803A RELAY



    O/P 8
    1
    16
    COIL
    +12VDC
    9
    GROUND


    A High on pin 8 of the stamp is input to pin 1 of the ULN2803. With pin 1 of
    the ULN high, pin 16 is driven low, current flows through the coil, and the
    relay activates.

    You can drive quite some stuff with these little suckers by parallelling the
    individual inputs/outputs for increased oomph. Here is a link to the data
    sheet http://www.allegromicro.com/datafile/2801.pdf

    I don't often reply to questions here because there are so many ppl here who
    are infinitely more qualified to answer questions than me, however, I think
    that this IC just makes it so damn easy, and nobody ever suggests it!!
    (Having said that, It does appear in the Basic Stamp manual, a search on the
    Parallax webpage might also be handy for you).

    Regards,

    Dwain.
    Original Message
    From: "Amrit " <amrit50@f...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, January 15, 2003 8:19 AM
    Subject: RE: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car


    > Thanks for all your help randy.
    >
    > Amrit
    >
    >
    Original Message
    > From: Randy Jones [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=LAzt8uvWTwG8i0EjgD2BeFGKybn-nGuyslqus_WpUUX7s19VfIH1Frg9royZ08ZTJ-nssOcAdWhQMElZDRiMR4te7sMg]randyjones@w...[/url
    > Sent: Tuesday, January 14, 2003 2:35 PM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car
    >
    > Hi Amrit,
    >
    > To select a transistor with enough current carrying ability, you need to
    > know the rated resistance or current of your 12V relay coil. A popular
    and
    > inexpensive transistor is the PN2222, which will handle up to 500mA or so
    > continuously. Chances are that your relay coil will use less current than
    > that, but you should check.
    >
    > Here are the connections:
    >
    > Connect a 1k ohm resistor from the stamp pin to the base of the
    transistor.
    > Connect the emitter of the transistor to ground. Connect the collector of
    > the transistor to one side of the relay coil. Connect the other side of
    the
    > relay coil to the +12 volt vehicle system. When the stamp pin outputs a
    > "high" the relay will be energized.
    >
    > A couple additional notes: 1) The 1k ohm resistor might need to be a
    > different value if your relay coil requires a large current. Actually, if
    > it needs more than 300 to 400mA, a "bigger" transistor would be better.
    2)
    > Automotive electrical systems are full of nasty electrical spikes, etc.
    I'm
    > not too sure how the regulator in the standard BS2 handles all that stuff,
    > so you might want to consider a more robust 5V regulator/supply, and feed
    > it's output to the Stamp's 5V input pin directly.
    >
    > Randy
    > www.glitchbuster.com
    >
    >
    >
    Original Message
    > From: "Amrit " <amrit50@f...>
    > To: <basicstamps@yahoogroups.com>
    > Sent: Tuesday, January 14, 2003 11:11 AM
    > Subject: RE: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car
    >
    >
    > > i don't really have a fax number...
    > >
    > > Here's what I understand:
    > >
    > > You put the 12 volt + to pin 24 and the ground into pin 23.
    > >
    > > The output pin to run a relay goes to some sort of transistor that also
    > > has a 5 and a 12 volt input. I just can't figure out how to to wire the
    > > transistor w/ the 2 voltages and the relay.
    > >
    > > Amrit
    > >
    > >
    Original Message
    > > From: smartdim@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=VkqxCHhjAHDkMvd79LcOXl_e37glol7wnVtiuVbZTXwR87giRnPB3-qfwjbCqI0upOzIRE7lUXriGt8]smartdim@a...[/url
    > > Sent: Tuesday, January 14, 2003 8:42 AM
    > > To: basicstamps@yahoogroups.com
    > > Subject: Re: [noparse][[/noparse]basicstamps] BS2 to run a 12 volt relay in my car
    > >
    > > In a message dated 1/13/2003 11:08:55 PM Pacific Standard Time,
    > > davelewis@d... writes:
    > >
    > > > the stamp will have to get its juice from the car's 12 volts somehow
    > > > right?........... it seems like there is plenty of 12 volt power
    > > available.
    > > > Or am I missing something? Otherwise, Im sure that others here will
    > > tell
    > > > you that you need to build a power supply circuit, that has all the
    > > > voltages
    > > > you are going to need.
    > > >
    > >
    > > What you want to do is relatively easy, but cumbersome to explain in an
    > > email. Email a fax# and I will fax you a schematic of how to power your
    > > stamp
    > > from your vehicle 12 volt system and run the relay using your
    > > stamp......
    > >
    > >
    > > [noparse][[/noparse]Non-text portions of this message have been removed]
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > > from the same email address that you subscribed. Text in the Subject
    > > and Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    > > http://docs.yahoo.com/info/terms/
    > >
    > >
    > >
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > > from the same email address that you subscribed. Text in the Subject
    and
    > Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    > >
    > >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    > Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
Sign In or Register to comment.