Shop OBEX P1 Docs P2 Docs Learn Events
Getting a lamp to light — Parallax Forums

Getting a lamp to light

StampStumpedStampStumped Posts: 7
edited 2005-11-29 14:35 in BASIC Stamp
yeah.gif
·
Question: I am trying to get a 14volt 200 mA lamp to turn on using a mps2222a npn transistor and it does not seem to be working so well. ·I started out by running the Positive 12 volt side of an transformer though the lamp·and running the negative wire·to the transistor collector, I hooked the base of the transistor I hooked up the stamp though a 220 ohm resistor and a 570 ohm resistor set in series.· The emitter is hooked to the negitive side of the of the trasformer. The voltage seems to go high and low at the emitter and the collector but the light will not go on,· if there not enough current?· What am I doing wrong? do I need to get another kind of transistor
······· ·The spects on this transistor are
······· hfe (MIN.):50
······· Absolute maximum ratings
······· Vcbo:··· 75
······· Vceo:··· 40V
······· Vebo:··· 6V
······· Ic:····· 600mA
······· ft:····· 300MHz
······· Dissipation 625 mW
·
·
·The program I am using is:
·
·Start
·
HIGH 15
PAUSE 2000
LOW 15
PAUSE 2000
GOTO Start

Comments

  • MMISCOOLMMISCOOL Posts: 36
    edited 2005-11-26 22:29
    seems like i have been recomending this all day. use a relay
    hook up the circut in the diagram bleow and run the program. this is fail saif and shood work
    493 x 550 - 6K
  • NewzedNewzed Posts: 2,503
    edited 2005-11-26 22:29
    Connect 14 volts to one side of the lamp.· Connect the other side of the lamp to the collector.· Ground the emitter.· Connect the base of the transistor to a Stamp pin via a 1K resistor.· Make the Stamp pin an output.

    Stamp pin HIGH - lamp goes on.
    Stamp pin LOW - lamp goes off.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • NewzedNewzed Posts: 2,503
    edited 2005-11-26 22:31
    The transistor circut is for DC only.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-26 22:36
    You shouldn't connect a relay directly to any BASIC Stamp output pin; there is not enough current available (unless you actually found a relay that will run at 5 vdc and 15 mA).· Use a transistor driver.
    MMISCOOL said...
    seems like i have been recomending this all day. use a relay
    hook up the circut in the diagram bleow and run the program. this is fail saif and shood work
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-26 22:38
    I've attached a schematic of how to connect your lamp circuit.· Be sure to consult the data sheet to make sure you've identified the base, emitter, and collector pins on your transistor correctly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    309 x 402 - 14K
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-26 22:54
    If you need to drive a relay so that you can switch an AC lamp the circuit that's attached will do it for you.· Use the N.O. contacts to control the lamp circuit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Tricky NekroTricky Nekro Posts: 218
    edited 2005-11-26 23:07
    Use a BC547 npn for the relay...
    It should do the trick...scool.gif

    P.S.
    Instead of a 330Ω resistor, I use a 68Ω resistor connected to the base of the transistor(relay circuit)...
    Is it possible for my stamp to get fried...cry.gif

    Provas, GReece

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rule your Destiny-
    --Be Good. Be Bad. Be Provas--
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-26 23:11
    Provas,

    The 330 ohm resistor is specifically designed to allow enough current to flow through the emitter-base junction without doing damage to the BASIC Stamp.· With 330 ohms the base current will be 13 mA (safe); with 68 ohms the current would be a whopping·65 mA (max is supposed to be 20 mA)·and very soon you'd smell the acrid odor of a burning Stamp pin.· Don't do it.

    Ohm's law is easy to use and gives us the tool we need to design circuits that won't burn up.

    Follow-up: The BC547 is probably not a good choice as its spec is for 100 mA collector current -- most relays will take more than this.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax

    Post Edited (Jon Williams (Parallax)) : 11/26/2005 11:15:25 PM GMT
  • Tricky NekroTricky Nekro Posts: 218
    edited 2005-11-26 23:21
    I've been using this circuit for a while, for swithing on and off the servos main power supply...

    Is there any possibility to have damaged the pin...

    It seems to work right...



    P.S.

    There are many other devices that drain a lot of power from the +5V and there is a considerable voltage drop...Devices sush as this relay, a serial(74HC595) LCD(backlight) and other mischelenious compoment...


    I need the max current I can get...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rule your Destiny-
    --Be Good. Be Bad. Be Provas--
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-26 23:37
    Let me try this again:

    1) The maximum source current from a BS2 pin is specified at 20 mA.

    2) Using the BC547 with a 68-ohm resistor in the base, you're sourcing·62 mA (best case).· Here's the calculation:

    ··· (5.0 - 0.77) / 68 = 0.0622 A

    Is it possible that you're actually using a 680 ohm resistor?· This would limit the current to a safe level (6.2 mA).· If you are drawing more than 20 mA per pin you're eventually going to damage your BASIC Stamp.· Don't worry, when you do we will happily sell you a replacement! ·tongue.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • StampStumpedStampStumped Posts: 7
    edited 2005-11-27 16:04
    jumpin.gif·OK I still can not get the lamp to turn on and off.· The circuit seems to work ok when I use an led and power it from the stamp.· I have tryed using about 5 other npn transistors and have even tryed changing the transformer.· I have tryed wiring it different ways and I still can not get this to work.· what could I be doing wrong.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2005-11-27 16:27
    Transformer?
    How about posting a sketch of your circuit (exactly)?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When you get 1st Place in the "Darwin Awards", you're a Winner & a Loser.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-27 16:45
    If your transformer is providing AC then a simple transistor circuit will not work -- you'll have to use a relay or triac.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • StampStumpedStampStumped Posts: 7
    edited 2005-11-27 17:24
    Transformer +
    Lamp
    collector----Base
    emitter----|
    ········ -· ··········· ··································· ········ |·························· |
    ········ |············· ······················ ·330 Ohm Resistor ··············· ····|
    ······· ·|· ··········· ······················· ········· ···········|···························|
    ········ |············· ······· ··· ······················· Stamp Pin·············· ······ |
    ······ ··|·············································· ·········································|
    ········ |
    |

    ········This is what I was trying

    ···················································· |

    ·················································
  • StampStumpedStampStumped Posts: 7
    edited 2005-11-27 17:26
    The trasformer was outputing 12 volts dc
  • Benjamin_bakerBenjamin_baker Posts: 18
    edited 2005-11-27 17:30
    Are you sure the lamp lights?

    Did you make sure to put the basicstamp's voltage "through" the transistor and connect the transformer's voltage "through" the transistor? The negative terminal of your transformer should basically be wired to the ground of your basicstamp.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-27 17:30
    Are you connecting the ground side of the transformer to the Stamp's Vss line -- you have to or it won't work.· I've attached an updated schematic that shows the ground side of the 12 volt supply connected to the Stamp's Vss pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax

    Post Edited (Jon Williams (Parallax)) : 11/27/2005 5:41:50 PM GMT
    517 x 334 - 13K
  • StampStumpedStampStumped Posts: 7
    edited 2005-11-27 19:35
    Ok thats the trick thanks alot. There is still a little glow even with the pin set to the off position. should I use a pull down resistor or something?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-27 20:11
    Lack of common ground is, unfortunately, a common problem. It would probably be a good idea to tie the base of the transistor to ground to keep it off when the Stamp pin is floating.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • robdeadtechrobdeadtech Posts: 3
    edited 2005-11-29 06:20
    Jon Williams (Parallax) said...
    Are you connecting the ground side of the transformer to the Stamp's Vss line -- you have to or it won't work. I've attached an updated schematic that shows the ground side of the 12 volt supply connected to the Stamp's Vss pin.

    Hi Jon, thanks for the great advice. This thread has been a life saver.

    Quick question for you if you have a sec. In the schematic Relay Driver.jpg you provided a few posts up [noparse][[/noparse]Posted 11/26/2005 2:54 PM (GMT -8) - the one with the relay used to switch 120VAC] does the ground of the transistor need to be connected to the Stamps Vss pin as well?

    Also, will any NPN transistor work for this application or will one work better than another? I believe the original transistor in question was an mps2222a

    thanks much!
    Rob
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-29 06:34
    In the circuit that shows the relay, the ground symbol (connected to the transistor's emitter) would be connected to the Stamp's Vss, and that tied to the ground side of the relay supply (if it isn't already).

    Transistors come with specifications -- you'll need to select a transistor that meets your voltage and current switch requirements.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • nickynicky Posts: 1
    edited 2005-11-29 11:52
    another important thing why we should not directly connect a relay coil toa ny of the Stamp I/O pins is it may get damaged by EMF surge at the coil during sudden switch off ( transients). But I dont know, though, whether the ·stamp I/O pins are protected from surges like this(?).And for a better current gain, we can use the darlington pair transistors.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-11-29 14:35
    Nick -

    Indeed you make a very important point about the back-EMF surge which occurs when power is removed from a magnetic coil, and the magnetic field then collapses. The Stamp pins can NOT be expected to withstand such a surge, without some immediate or eventual damage, even as hardy as they generally are. The best protection is to install a reversed biased diode across the coil leads which will effectively shunt any harmful reverse currents directly to ground, in a harmless manner, thus protecting the Stamp pins, and anything else that might be in the coil circuit.

    I'm sure someone with more artistic skills than I have can provide a simple schematic showing how the diode should be installed. Many folks object to ACSII schematics, which·are·about the·only drawing skills of which I'm capable smile.gif

    Regards,

    Bruce Bates

    Post Edited (Bruce Bates) : 11/29/2005 2:50:29 PM GMT
Sign In or Register to comment.