Shop OBEX P1 Docs P2 Docs Learn Events
Small Relay Problem — Parallax Forums

Small Relay Problem

willthiswork89willthiswork89 Posts: 359
edited 2006-08-14 15:39 in BASIC Stamp
ive got everything working, basically i uses 3 NPN transistors... when i use low it activates the 5 volt relay(dont ask but for some reason when its low it activates not high?) thats one question... why is it the oposite of normal transistors? it activates the voltage when the base is low not high. THe next thing at hand,

DO
High LeftRelay 'Set to NC
pause 1000
Low LeftRelay 'Set to NO
pause 1000
LOOP

then works perfect, and it works the same with the right relay... but when i put both together one will not shoot.

i have one wire from each relay (3) soddered together and ran to the VDD then i have each of the other ones going to its own transistor with its own variable pin.

so why it is not able to fire them?· should i seperate the VDD wires from being 1 to 3 seperate? i notice the LIGHT dims when it goes to flick the relays. any help would be appreciated


-willthiswork89-
«1

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2006-08-02 12:01
    Where is the emitter of the npn transistor connected? Is there any possibility you've got a pnp transistor?
    Any chance you've got the NC and NO contacts interchanged?

    The connection should be: + voltage to one side of relay ' sounds like you do
    collector of npn to other side of relay 'make sure it is the collector
    emitter of npn to 0 volts
    base of transistor through 1K resistor to Stamp pin. 'you have to have some resistance here to protect he Stamp

    Tom
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-02 12:54
    Folks -

    I suspect you have to take what Kevin ("Will"), and possibly other folks new to electrical or electronics device·say, wth a grain of salt. This is especially true when he/they speaks of "NO" or "NC" contacts on anything. This can be a very deceiving concept to many new to electrical/electronics and electro-mechanical devices. I am not sure whether this is the case here or not with Kevin, but confusion is VERY prevalent.

    Having been in the wholesale electrical supply industry for a number of years, and having dealt with all sorts of customers - seasoned electricians and Saturday morning novices alike, let me offer my way of explaining NO and NC to those not familiar with the concept, or for those not presently comfortable with it.

    Nearly all folks have the concept of OPEN and CLOSED contacts down firmly. OPEN is OFF, and CLOSED is ON. Simple as that. The problem seems to come with the terminology "normal". That may seem odd to some, but until you're TOLD what "normal" is, how could anyone guess at the proper or appropriate definition? (rhetorical)

    Here's what I said to my customers, as an aid to understanding this concept:

    Regardless of the type of device you're speaking about, and regardless of whether it's electrical, electronic or otherwise, if you toss a device on my (sales) counter, without any wires attached to it, and no power applied to it, that's the "NORMAL' state of any such device, PERIOD. No arguments!

    No cutomer ever left my counter confused about "NO" and "NC" contacts after that explaination.·I don't say that to "toot my own horn" but to offer this as a practical, useful·and understandable definition of "normal" as it applies to electrical and electronic devices, regardless of their type or eventual use..

    At that juncture (in the "normal" state)·one can use a multimeter or continuity checker to determine the state or status of every contact on the device. This is definitive, and is NOT subject to ANY interpretation. In fact,·the definition above just removed any possible (mis-)interpretation that may have existed (in·one's mind)!

    One often hears something like the following, from an adamant customer or dis-beleiver, who wants to hang on to his/her old (and incorrect)·beliefs:

    "But my relay is ENERGIZED most of the time, so that's what's NORMAL". To that I say - ·HORSE FEATHERS, COW PIES and POPPYCOCK!! I really don't care how it's used later in the day!·"Normal" is the "dead" state, with no energy applied to it, COMPLETELY - COMPLETELY REGARDLESS of how it's used in a circuit!

    This was certainly NOT directed to you Tom ("Stamptrol"), but is just intended for "general consumption". <BURP> :-)

    Regards,

    Bruce Bates
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-02 17:30
    Im sure they are NPN its a 15 pack from radio shack, im pretty sure its hooked up correctly but ill double check.... the transistors are located on the bread board, the relays are on a little electrical tape plactic round thingy that i drilled holes in and soddered the wires to, the thing about it is when i only do Left

    the relay will go

    *Tick*
    pause
    *Tick*

    and ill take it from its pole and touch the negative of my source and it goes
    pause
    7.8
    pause
    0

    same thing with the right side. but when i try to control both of them one switches and the other doesnt...arnt all transiustors high for current to go through them?ill check my connections but hopefully someone can figure this out!
  • Philip GamblinPhilip Gamblin Posts: 202
    edited 2006-08-02 18:22
    http://http://www.parallax.com/dl/docs/cols/nv/vol1/col/nv6.pdf
    The above link is from the parallax site. Yours is possibly the most often asked question by novice STAMPers.
    That doesn't mena the answer is necessarily simple, it's just asked alot. Here areome suggestions. The RadioShack grab bag transistors are cheap for a reason. Keep them for spares, one you can identify the pin outs with a meter. For now go to the SHACK and purchase ( in single quantities ) it is radio shack Catalog #: 276-2016.· $0.69 each. You need a diode to connect exactly as shown in the above article.

    Dimming lights sound like you may be·overloading your power supply. YOU COULD BE DAMAGING YOUR STAMP If you are sinking the relay coil current via you stamp pin. Check you soldering, to be sure you soldered you connections securely.·The connections·should be·shiny without bubbles streaks or brown stuff. Parallax has TONs of usseful information on their website. Go to the home page and use their seach for Downloads> Nuts and volts. Lots of short,to the point articles with enough theory to explain without overwhelming you.

    Finally you might want to swap LEDs for your relays. They draw a lot less load and should test your program logic adequately. You may need a larger power supply for you relays, maybe even a separate one. Which may create additional issues.·I'm not trying to complicate things, I'd just hate to see you burn up your·STAMP. It's really·, really hard to get the smoke back in.
    Happy·Stamping
    Philip Gamblin·
  • Tom WalkerTom Walker Posts: 509
    edited 2006-08-02 18:27
    Again, it seems that you have been bitten by the "basic electronics theory not-quite-understood" bug. No, all transistors are not "activated" by a high signal...thus the previous question about whether they are NPN or PNP. Again, to try to minimize your frustration (and to fix basic concepts more firmly), try breaking your goal down into smaller pieces. Get a good understanding of how (and, to some extent, why) transistors do what they do. Believe it or not, throwing a relay into the mix can make things a whole lot more complex...try lighting an LED via a transistor...preferably trying with both kinds of transistors to see how they can be used. Then research relays (particularly, the need for a shunt diode to protect the other things in your circuit). After that, you should be able to make them "play nicely".

    Please do not interpret this as being condescending...this type of "step-by-step" approach usually works out for the best in the long run.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • T ChapT Chap Posts: 4,223
    edited 2006-08-02 19:46
    willthiswork

    you must post the exact scematic as you ACTUALLY have things hooked up for anyone to help. the schematics you have been drawing in other posts look, well, hard to follow. it is most likely you are hooking things up wrong.

    1. check that you are getting a logic high (1) off the PINS at the Stamp FIRST

    2. check that both relays actually will turn on by hard connections to the 7v

    3. make sure you have a wire ran from both grounds on both supllies, otherwise you may have two different ground references floating around in space causiong problems

    4. before connect any more stuff willy nilly, please do this leds test below and report back the result. you must start at square 1 before going forward, unless you love frustration and posting and no results. you cvan use 7 volts instead of the 24 shown, you can use any resistor between 220 and 1k on the led side).

    5. PLEASE check your rersults on this simple test with your NPN. Theen build two tests with two leds, and report the results.

    6. post your exact code

    If you don't wont to do it, no problem, you are asking for more of the same headaches. walk before you run as stated on numerous ocassions already.
    457 x 473 - 12K
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-02 20:51
    im not running the relays from the battery, im running the relays from the stamp.... the relays are 5VDC they arnt a grapbag they are all NPN transistors of the same type, i also have TIP31 and 42 transistors to try.. ill draw a schematic By Hand and scan it because i dont have any software besides paint!
  • T ChapT Chap Posts: 4,223
    edited 2006-08-02 21:42
    you can get free software at

    http://www.pcb123.com/pcb123benefits.php?source=button_index

    in my opinion, forget the relays till you can make leds work right with the schematic provided earlier
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-02 22:28
    regardless of the connections they work when im not trying to run both of them. only when im trying to run both of them is when thyey dont work. ill post the schematic after i get back from the store
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-03 00:47
    i cant figure that program out, most of the wiring is inadequet to the entire problem, each relay one side of the coil goes to a transistor, then the other three are soddered together and lead to the VDD, the transistors goo from the
    PIN -> 1k ohm->BASE
    VSS->Collector
    Relay-> Emitter

    basically one relay controls the positive end, without this relay turned to the normally open side there is no positive to the two other relays, so basically the positive goes to one pole on connector of the pole the other goes to nothing, the output of the relay goes to the two other relays both on oposite sides of the relay

    RELAY1->NO->Positive Battery
    Relay2->NC->Positive Battery

    then
    Relay1 ->NC->Negative Battery
    Relay2->NO->Negative battery

    that way when its on its NC it is both negative and positive allowing it to run one way(as long at the front relay is switched on) and then when i switch them to the normally open it goes the other way... but whats happening is that they both work but only when they arnt both having to be ran....
  • T ChapT Chap Posts: 4,223
    edited 2006-08-03 01:18
    Well, since you wont provide a schematic of any sort that can be read clearly, there is not much way to help out considering the extremely unclear explanation you have provided. Also your exact code is needed to as well. Beyond that, you will stay in a confused place and no one can help you unfortunately.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-03 03:00
    alright icolor coded paths hopefully you guys can read this, eventually i figure out that p[noparse][[/noparse]rogram and spend some time using it.





    heres the code





    ' {$STAMP BS2}
    ' {$PBASIC 2.5}


    PosSource PIN 15
    Right PIN 14
    Left PIN 13


    DO
    LOW PosSource
    HIGH Left
    PAUSE 1000




    PAUSE 1000
    LOW Left
    PAUSE 4000
    DEBUG "Firing Right",CR
    LOW Right



    PAUSE 2000
    LOOP



    lots of pauses for a little bit of a chance to listen for them actuating

    Post Edited (willthiswork89) : 8/3/2006 4:08:26 AM GMT
  • T ChapT Chap Posts: 4,223
    edited 2006-08-03 04:28
    Rather than try to unravel your "schematic", I drew something up from scatch.

    Try this, turn on pin 13 ONLY to make it run in one direction, turn on pin 14 ONLY to make it run the other direction. I put in a speaker since I don't have a motor illustration. Make sure your VSS(GND) is tied from both sources. It will run without the diode, but it is not a good idea. Try to turn off one output before switching on the other. You can do the same thing with motor #2.
    836 x 580 - 54K
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-03 04:36
    im not sure i understand what this is doing for me? i know that all the relays work the way i want them to just not at the same time. i thought color coding it would help a little sorry. i would try that but my wires are all soddered already so only as a final resort will i tear it apart. thanks originator

    i tested the transistors to see if my relays were telling the truth and
    DO
    HIGH 13
    DEBUG "HIGH",CR
    PAUSE 2000
    LOW 13
    DEBUG "LOW",CR
    PAUSE 2000
    LOOP

    when the debug menu says LOW the voltage is 5.0 volts

    vide versa for high...im guessing its the type of transistor because they ALL do it in the entire box of 15

    Post Edited (willthiswork89) : 8/3/2006 5:01:27 AM GMT
  • T ChapT Chap Posts: 4,223
    edited 2006-08-03 06:49
    You have left out some valuable info, for example, where are you taking the reading to arrive at 5 volts? If in fact you are taking the reading at the emitter, then you would be right to see 5 volts there if the pin is low. Why? Well using the transitor as shown, you are effectively switching one side of the coil to ground via the transitor to complete the circuit. Notice in your drawing that you have 5 volts to the coil? Ok, one side of the coil is always high then right? That being the case, to make the coil turn on, you need to switch the GND into the circuit. This is basic fundamental electronics that you are trying to skip over, which is causing you the woes. Yes, the emitter reflects LOW when the stamp pin is HIGH, because one side of the transistor is at GND. So that when the transistor is switched "ON" by the Stamp, it conducts to GND at the emitter, no different than a transistor. The 5 volts you are reading is coming through the coil which you can clearly see is at 5 volts all the time.

    What effect this has on your relays not working? Not sure, I would bet money your circuit is not functional, which is why I offered you one that would be simpler to build, and could be more easily understood.

    Breadboarding is the only way to go until you are sure of your circuit.
  • stamptrolstamptrol Posts: 1,731
    edited 2006-08-03 11:56
    ·· Hi,

    ···· I had a look at the schematic you posted. I couldn't tell exactly which relay pin is which, but I could tell that you've got the collectors of your transistors connected to Vss ( or 0 volts).

    ··· Several of us have asked, suggested and posted sketches which ALL show the collector going to the relay. And the EMITTER going to O volts!!!!!!

    ·· Based on the info shown in your sketch, interchange the leads on each transistor E and C and the circuit will work. You also should have diodes on each relay coil, as has been suggested.

    · Best o' luck
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-08-03 12:01
    I will note that will...89 uses a HomeWork Bd.· The HWB's VDD cannot supply all of the current for running two relay coils.· The sketch doesn't help.· will...89 writes that it "works" with one or the other,· but not with both.· It's hard to tell.· The missives and posts have the frantic flow of the "experiments" themselves.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-03 19:38
    no these are different looking at the back of the box it shows that the collector and emmitter are not the same as normal ones, they are reversed. the relays on my drawing are exactly like the relays they are microminis, 5vdc, the coil that acuated the relay is on the LEFT and you can see the bottom LEFT is the out from it. I have all three of the coils one side soddered together running to the same VDD Pin could that be the problem? im drawing all three supplies from one pin in the bread board. PJ it ineed will supply enough for two because in order to get the positive current i have a relay for that, which goes OUT to the other relays. so it is indeed throwing two but i dont think it can throw three?
  • NateNate Posts: 154
    edited 2006-08-03 22:21
    Price of box of 'special' NPN transistors from Radio Shack - $2.49

    Price of Basic Stamp 1 Starter Kit - $79.00

    Price of entertainment accorded by this discussion, particularly posted schematic and discussions of electronic·component theory of operation - PRICELESS.



    PS -·"What is a Microcontroller" is a free download from the Parallax Website.

    PPS - I am not making fun of your lack of electronic knowledge.· I am making fun of the fact that you are consistently ignoring the good advice that you are getting.

    Post Edited (Nate) : 8/5/2006 10:20:45 AM GMT
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-03 23:40
    hmm nate it seems everypost you make is completley useless and irrelevant to anything besides flaming others theres a forum for **** like you google it


    (insult removed by moderator)

    Post Edited By Moderator (Aristides Alvarez (Parallax)) : 8/4/2006 2:40:08 PM GMT
  • NateNate Posts: 154
    edited 2006-08-04 02:29
    "completley (sic) useless and irrelevant to anything"

    I would have to disagree - My advice for you to get and read WAM would help you a lot.· Also, if you ever do follow your inclinations and end up in some sort of Engineering career, you will be well advised to learn to write English with proper spelling and punctuation.


    Nate
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-04 02:41
    i give up on this stupid motor its giving me nothing but trouble and making me feel like ive learned absolutley nothing someday i suppose ill come back and laugh on this but right now its upsetting me and making me want to give up on this entire area
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-04 05:59
    i have confirmed my suspition and it is in fact that the stamp cannot provide enough voltage to run them, even from VIN and then· VSS to the transistor, i have although used an additional 9volt battery and hand did this, but for some reason when i connect the additional 9volt it does not let it all through, only 3 volts of it... which is not enough to run the relay... if i can figure out why my transistors are only letting this small ammount through i can use an additional 9volt to power my triggering relays.
  • FranklinFranklin Posts: 4,747
    edited 2006-08-04 15:50
    Can you show us what you are trying to do? **additional rude comments deleted after typing them to make me feel better**

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-04 21:19
    an hbridge is getting too hot, so im using three relays to control the way opf the motor, 2 control direction both which are SPDT and one SPST used to control the power to the direction

    Positive of 7.2 Motor Battery->Relay->RelayDirection1 and 2

    if relay is not turned on no power is going to the direction relay, thus not allowing the motor to move.
  • RinksCustomsRinksCustoms Posts: 531
    edited 2006-08-04 21:44
    Hello will, sorry for the delay, i'm in the middle of trying to finish and paint a friends car and visit my grandmother on her deathbed. Here's a scource for FREE schematic capture/PCB layout prog, a simplified approach to your relay delema, and a link to get you going in electronics. (The best way to learn is to tinker & experiment!)

    http://www.expresspcb.com/ExpressPCBHtm/Download.htm·· 'Free schematic software

    www.discovercircuits.com/··· 'a whole lotta circuits!,· eeeeeeeeeeeeeeeeeeh!

    Your code scheme should look something like:

    Foward· CON· 1

    Reverse·CON· 0

    speed··· VAR· WORD


    'set direction & speed to foward, ramp up speed and ramp down speed

    OUT1 = foward

    FOR speed = 1 TO 1000

    PULSEOUT 2, speed

    NEXT

    FOR speed = 1000 TO 1

    PULSEOUT 2, speed

    NEXT


    'set direction to reverse, quickly ramp up and slow down speed

    OUT1 = reverse

    FOR speed = 1 TO 1000 step 2

    PULSEOUT 2, speed

    NEXT

    FOR speed = 1000 TO 1

    PULSEOUT 2, speed

    NEXT



    This is a VERY dirty version and will need a lot of tweaking to work smoothly. This program will set the direction of the motor with either turning on the relays or not, and by adjusting the value of PULSEOUT, you can control the speed of the motor. Pin 1 goes to your transistor(s) for turning on the relays, and Pin 2 connects (prefferably through an optocoupler) to the MOSFET's gate pin. Note the Source, Gate, and Drain·connections of the MOSFET. Also since your porobably using the power from an onboard voltage regulator, you'll need a separate power supply going to this circuit and the transistors you use to turn on the relays. Best of luck!

    Another good rule of thumb when designing circuits is to choose components with double the required voltage,current, or power rating than you need. It'll reduce agrivation, and extend the life of the circuit.



    And to those who like to be lazy and unimaginative herefourth, if you do not have anything constructive to contribute, do not bother clicking the post reply button in the first place! You can very well see this person is just getting started in electronics & BStamps, sometimes they just need a lil wack to get the gears turning!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Definetly a E3 (Electronics Engineer Extrodinare!)
    "I laugh in the face of imposible,... not because i know it all, ... but because I don't know well enough!"
  • T ChapT Chap Posts: 4,223
    edited 2006-08-04 23:08
    While we are all feeling really generous lately and offering plenty of links and advice back and forth, I'd like to offer Nate the following link as he could sure use it. His post was tasteless and offered no humor or value to the problem at hand for willthiswork89 (who is obviously making a real effort to learn something, regardless of his methods). The arrogant post was totally incongruent with the standard of good taste and helpfulness that most here are familiar with. In other words: It was a low class attack. I personally have received plenty of good advice to set me straight on "dumb" issues, and that is what a public forum is for in many ways. I'd suggest that if someone doesn't like a thread, then go find a strictly "professional" engineering forum and enjoy yourself there, and spare others from the very poor attempt at being funny.


    http://www.writersstore.com/product.php?products_id=114
    312 x 475 - 30K
    114.jpg 29.5K
  • bennettdanbennettdan Posts: 614
    edited 2006-08-04 23:49
    willthiswork89,
    you state that you have a scanner for your computer so please scan the back of the box your relay and transistors came in and let us see if we can help with that info.

    I also agree with the drawing you gave the B and C are around backwards.

    When you look at the drawing on the back of the bock note that you are looking at the bottom of the transistor (leads facing you) not the top of the transistor.

    Another tip dont solder it all to a PCB before breadboarding it..

    Hope we can help you.
  • willthiswork89willthiswork89 Posts: 359
    edited 2006-08-05 02:44
    hi guys thank you so much for all the help, bennettdan you have said the LEADS facing me, and if this is correct the back of the box states

    PIN 1 Emitter
    PIN 2 Base
    PIN 3 Collector

    then it says Bottom View

    D(thats hat it looks like)

    and inside the D it goes
    3
    2
    1

    so, you can see that with the transistor leads facing up it indeed is backwards. the box says

    This PNP Transistor is designed as a general purpose amplifier and for switching applications at collector currents of 10ua to 100mA

    now... the box for the relays...

    Coil Voltage
    Nominal: 5VDC
    Maximum: 6.5 VDC

    Nominal Current: 89.3 mA
    Pick-Up Voltage: 3.5VDC
    Drop-Out Voltage: .25VDC
    Coil Resistance: 56 Ohms (+-) 10%
    Life:
    Electrical: 100,000 Cycles
    Mechanical: 10,000,000 Cycles

    now can somebody inform me on what some fo this stuff is, i know the coil voltage and i know the nominal current is what is draws to work but the rest im lost on... thanks!
  • bennettdanbennettdan Posts: 614
    edited 2006-08-05 22:49
    willthiswork89,
    ·· The reason why your transistor turns your relay on when the output pin is low means you have a PNP transistor which flows current through E to C when the B signal is low.
    ·I have added a schematic of a two relay curcuit for you to try. I dont know if the curcuit will operate off the WAM board so you may need to build a smal 5v powersupply to run the relays...the 5V on the schematic.
Sign In or Register to comment.