Shop OBEX P1 Docs P2 Docs Learn Events
Difficult to understand why this simple circuit is not working. help? — Parallax Forums

Difficult to understand why this simple circuit is not working. help?

johnbotjohnbot Posts: 18
edited 2006-04-13 02:23 in BASIC Stamp
Hi everyone,

I have a simple question I'm hoping someone can answer. I'm building the very simple attached circuit, attempting to use the 3906 transistor to drive an led. Building the circuit as-is seems to work but if it swap the +5 going into the transistor for another higher voltage powersorce (9 volts), the light, instead of blinking , stays on permenantly. I gounded both power sources together to VSS.

When i simply disconnect and reconnect the base going from the stamp to the transitor it starts acting like a proper switch. When i check the voltage from the pin out of the stamp it's getting +5 and 0 so that seems ok.

The reason I'm using the transistor is to eventually drive a 6 volt light bulb.

Any suggestions?

lol.gif

Post Edited (johnbot) : 4/13/2006 5:34:33 AM GMT
399 x 296 - 58K

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-03 02:37
    Hello,

    ·· The simpler answer is to use a 2N3904 instead.· This will allow you a higher supply voltage for the circuit you're driving.· The reason the circuit isn't working for you on higher voltage is that the Stamp's I/O pin cannot go high enough to effectively turn off the transistor when you power it that way.· Use the 2N3904, use the same resistor (1K) for the base, connect the emitter to ground, and the collector to your load, then the other side to 9V.· Make sure the load can handle 9V.· The LED and resistor value shown won't be compatible.· You will need a bigger resistor for the same LED if you increase the voltage.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2005-10-03 03:04
    jonbot,

    If the I/O pin is LOW, then the equiv circuit would look something like this, and the transistor would be ON...
             1K     B  E
    GND >---/\/\-----|<---> +5V
            4.4V    0.6V
    
    



    If the I/O pin is HIGH, then the equiv circuit would look something like this, and the transistor would be OFF...
             1K     B  E
    +5V >---/\/\-----|<---> +5V
             0V      0V
    
    



    What would happen if you took the +5V connection to the emitter to 9V instead ?

    If the I/O pin is LOW, then the equiv circuit would look something like this, and the transistor would be ON...
             1K     B  E
    GND >---/\/\-----|<---> +9V
            8.4V    0.6V
    
    



    If the I/O pin is HIGH, then the equiv circuit would look something like this, and the transistor would be ON...
             1K     B  E
    +5V >---/\/\-----|<---> +9V
            3.4V    0.6V
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 10/3/2005 1:57:36 PM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-10-03 03:05
    To expand on what Chris said, when using a pnp transistor, in order for it to turn off you need to have the base to emitter voltage to be less than the turn on voltage (typically around 0.7V) for a pnp transistor the emitter is connected to the positive voltage supply (in npn it is connected to ground). So if the output high of the stamp is around 5V, the maximum Vdd you can use is about 5.5V. But using an npn transistor as Chris suggested, the Vbe is in reference to ground, so it doesn't matter what voltage you use, as long as the transistor can handle the max Vce (collector to emitter voltage).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • johnbotjohnbot Posts: 18
    edited 2005-10-03 05:40
    Thanks so much for the info. It finally makes sense. smilewinkgrin.gif
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-03 14:11
    ·· And finally, to expand a little on what all of us said, I would recommend reading up on transistor operation sometime when you get a chance.· You will it will make interfacing devices of different voltages and current requirements much easier and the information can only help you.· As you can see from the replies, we all understand the operation but each have a different perspective/way of approaching the concept.· It might help you even more to develop your own understanding.· I know that many people look at things in different ways, or go about solving problems in different ways.· One more thing related which would certainly help you is studying MOSFET operation.· Like transistors, there are two main types.· Experiment!· Have fun!· But beware of blue smoke!· =)


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • johnbotjohnbot Posts: 18
    edited 2005-10-07 23:07
    Thanks again. I'm currently spending this week reading up on transitor operation and the various differences with each type.

    Question, I built a matrixed grid with 122 6 volt bulbs and intended to access them by 22 transistors (11col X 11rows) but realized what i really want to do is control each light instead (since the light bulbs strobe much to slowly for persistance of vision to work). Will someone kindly point me in the right direction for doing this (not asking for a complete answer but maybe a hint). I'm assuming that the pins will have to be multiplexed to give me enough output and then amplified with a ULN2803A?

    The project is going to be a very very low res version of a display. I like the idea of using 6v bulbs instead of led's.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-07 23:16
    Johnbot,

    ·· If you are relying on strobing and POV for your display you will find that light bulbs are much slower than LEDs at lighting up.· This could affect your concept.· You might want to try it on a smaller scale first to get an idea of the performance you can expect.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • johnbotjohnbot Posts: 18
    edited 2005-10-07 23:48
    starting small is definatly the right thing to do. I'm going with the idea of not stobing the lights , but simply (on not so simply) using the stamp to activate individual pixels (lights). Will a standard BS2 even be able to multiplex outputs with the right IC's (122 outputs!!??) [noparse]:)[/noparse]
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-07 23:52
    Sure, why not?· You can use shift registers and current drivers or transistors.· Using shift registers you could easily create a 24 X 24 matrix.· Even 32 X 32 wouldn't be too hard.· You would need 8 bytes for the shift registers (4 for rows and 4 for columns).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • FreezeSukkaFreezeSukka Posts: 41
    edited 2005-10-10 00:05
    Hey John,
    Here's a site that I found useful in explaining transistors.· It even has animated examples and much more.

    http://www.williamson-labs.com/480_xtor.htm#darlington

    Maybe it'll help.

    ~Jeff

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    P.S. This is what this part of the alphabet would look like if "Q" and "R" were eliminated.
  • johnbotjohnbot Posts: 18
    edited 2006-01-28 17:22
    Hello again everyone,

    I've created the hardware for my 6 volt light board project and wanted to run the design by to see if I can improve upon it with your suggestions/hints. I currently have the basic stamp sending serial data to 5 shift registers and from there it goes to a few ULN2803 chips and finally to the 5x6 lightboard. I have 7.5V VDD running into the lightboard. I have both the '164 and the ULN2803 running off the same 5V supply (from the basic stamp board) and on the '164s I have pins 1 and 14 tied to positive as noted in the microcontroller cookbook.
    Everything seems to work but I suspect there might be a better way to handle the power supply issues since when it's running my stamp indicator led dims on and off depending on how many light bulbs are on. I've attached a very simple jpeg of the basic layout. Should I be including any protective measures or anything else?

    Secondly, on the software side.

    I've been running a snippet of code from the microcontroller handbook to test the bulbs
    for x=1 to 30 'send 30 bits to 164'
    toggle 0 'change the bit each time'
    high 1 'clock the bit into the 164'
    pause 100
    next

    I've been trying to figure out the best way to send a string of data to the shift registers so i can tell each bulb to be on or off by using an array or something. Ultimately , I would like to do something like this:

    data = 0,0,0,1,1,0,0,1,1,1,1,1,1,0,0,1,0 etc, now shift and clock this into the circuit.

    Could someone point me to the right command(s), shiftout? or something else?

    Thanks!

    John
    800 x 663 - 154K
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-01-28 18:46
    John -

    SHIFTOUT is indeed the command you want to use. By using an extended set of data fields (more than 8 bits) so long as the shift registers are daisy chained, you can do it with one command. here is an example:

    /code

    {$PBASIC 2.5}

    'Constants

    'Pin Port Assignments (arbitrary)
    Clk_Pin PIN 0
    Data_Pin PIN 1

    'Sample Data ONLY (below)

    pattern1 con $FF 'The hex constant can contain any
    pattern2 con $0F 'bit configuration(s) you might choose
    pattern3 con $F0 'to send out to the shift register

    Shift_Mode con 0

    SHIFTOUT Data_pin, Clk_pin, Shift_Mode, (pattern1, pattern2, pattern3)

    code/

    Regards,

    Bruce Bates
  • johnbotjohnbot Posts: 18
    edited 2006-04-13 02:23
    Thanks for the explanation of SHIFTOUT. Everyone, Does the circuit attached make sense or is there a better way to implement this circuit idea? Any alternate ideas/analysis of potential problems would be greatly appreciated!

    John



    yeah.gif

    Post Edited (johnbot) : 4/13/2006 2:27:13 AM GMT
    800 x 663 - 154K
Sign In or Register to comment.