Connect with us

can't figure what the hell is wrong !

Discussion in 'General Electronics Discussion' started by Jouellet, Sep 15, 2016.

Scroll to continue with content
  1. Jouellet

    Jouellet

    86
    19
    Feb 2, 2015
    hi folks,

    working on something: it's a Seven Segment display, make with 10mm LEDs, driven by an Arduino.

    So far so good.

    The LEDs are in fact 3 x LED in serial, with a current limiting resistor, connected to ground. These are going to be powered from a 12 V source (no choice; LED are 3.2V x 3 = 9.6V), so I figure out that I would need to drive them from a transistor, even better a transistor array.

    main circuit.JPG

    I then made a PCB, ordered a bunch of them and then ...Crap ! I screwed up on the orientation of the LEDs and pinout vs the selected transistor array.

    No problem; I'll just make a small board, with transistor and reuse my main board - which I did

    custom board.JPG


    Problem is that when I install the custom board, all the LEDs are lit !!! Checked the output of the Arduino: 0V but the **** LEds are ON !

    I tested my board on a proto-board

    test setup.JPG


    When I apply 5v to the base, it works ! 0 volt, they turn OFF

    What am I missing ?!?!
     
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,418
    2,788
    Jan 21, 2010
    Change the logic of your program so that outputs are active low rather than active high.

    You've used PNP transistors. These are off when the bar is high and on when it's low.
     
  3. Jouellet

    Jouellet

    86
    19
    Feb 2, 2015
    hold on ...

    Why is it working of the protoboard ?

    When 5V is applied, the LED are ON, when brought to 0, the LED are OFF.
     
  4. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,418
    2,788
    Jan 21, 2010
    Are you using the transistors on the protoboard?

    In any case, you have shown PNP transistors which turn off with a positive voltage.
     
  5. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,418
    2,788
    Jan 21, 2010
    Aaah, on the protoboard you are actually pulling the base low when you press the button and are disconnecting it with the button released.

    If your output from the microcontroller acts as open collector, it will work exactly the opposite. You're lucky it can turn them off at all. I would not have been surprised if the input protection made it impossible.
     
  6. Jouellet

    Jouellet

    86
    19
    Feb 2, 2015
    Steve, When I press the button, I apply +5V to the base, via the 2.2K resistor.

    When I release it, no voltage is applied, therefore considered low.

    The current Arduino sketch (for testing) is going thru each output, putting them High for 1 second, then Low. If the theory about the High/Low vs PNP was valid, I would see some kind of blinking, but it's not the case . They are ON at all time !

    I'm completely puzzled by this one ...
     
  7. BobK

    BobK

    7,682
    1,686
    Jan 5, 2010
    Here is where you are wrong. Inputs are not low when no voltage is applied. They are floating, which puts them in an undefined state. With TTL, it is actually interpreted as high. With CMOS is could be anything. Since a CMOS input looks like a capacitor, it will often retain it's previous state, at least for a while. To make an input low, you must connect it to 0V. Inputs should never be left floating.

    Bob
     
    HellasTechn likes this.
  8. Jouellet

    Jouellet

    86
    19
    Feb 2, 2015
    Bob, I agree with you: when I make circuit that have inputs, I always use a 10K resistor to ground. Always.

    But in this case, the output of the Arduino was intended to go directly to the input of the ULN2003. Since I screwed up with that part and corrected it (!!) with a custom transistor array, doesn't the same kind of behavior apply ? The output of the Arduino would be connected to the resistor driving the base at all time.

    And again, what puzzle me, is that when I connect my custom transistor array on a proto-board (with LED connected on the output side), they are OFF until I physically apply +5V on the Resistor that connects to the base. That behavior is what I'm expecting.

    And if I take measurement at the output of the Arduino (with or without the custom module in place), the reading is 0V, switching to +5V for about 1 second every 7-8 seconds, as the per the sketch.

    I will try tonight to add a 10K resistor (connected to ground) between the Arduino's output and the Resistor driving the base of the transistor.
     
  9. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,418
    2,788
    Jan 21, 2010
    The answer is that when you apply 5v to the base of a transistor that has 12v on the emitter via a switch you are effectively placing 12-5v, or 7V on the base (ok, that voltage is across the BE junction and the base resistor)*

    . Current flows from the 12v rail through the base resistor and the switch into the 5v supply. You are effectively pulling the base low.

    With the switch open, there is no base current so the input floats high.

    In contrast, the microcontroller when low pulls the base down, and you are fortunate that when it is high it allows the output to float higher than the supply rail of the microcontroller.

    The additional resistor will possibly force a more "correct" behavior resulting in the transistor not turning off at all.

    A better result would be obtained by using your original ULN2003 to pull the bases of the PNP transistors low (via a resistor) and adding another resistor from the uln2003 to 12v to help ensure the PNP transistor turns off quickly. This will also give you the expected high output = led on that your code expects.

    * More correctly you are applying -7V because the base is more negative than the reference terminal which is the emitter
     
  10. AnalogKid

    AnalogKid

    2,415
    686
    Jun 10, 2015
    In the first schematic in post #1, where does the trace on IC2 pin 9 go? If it goes to GND, that turns on all outputs all the time forever and ever until the end of eternity.

    ak
     
  11. Jouellet

    Jouellet

    86
    19
    Feb 2, 2015
    Steve: it goes...was going to +12V...(boards ended up in the garbage tonight...)

    That's how things got messed up: I've connected all my LED strings to ground, instead of VCC , And I did not find a replacement that would be a perfect pin-to-pin fit for the ULN2003

    I'll redo the boards, with LEDs flipped, and connected them to VCC. The ULN2003 will switch them to ground.
     
    (*steve*) likes this.
  12. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,418
    2,788
    Jan 21, 2010
    A pain, but it's probably the best solution
     
  13. Jouellet

    Jouellet

    86
    19
    Feb 2, 2015
    Steve: Went thru the note and examples that I've used when "trying" to design the fix..

    in the example that I've used, the guy shows the circuit that I did:
    upload_2016-9-16_9-45-49.png
    He mentioned that R2 was not essential, so I did to put it. But NOWHERE did he mentioned that switching it OFF was done by applying close to 12v to the base. I assumed that 5V was OK, as with a typical NPN switching...

    After more reading (and your explanations), I finally understand what the issue is.I still don't get it why, my protoboard test was working: week-end investigation.

    I have another question: Could I use a NPN transistor to do my switching, but instead, placing the load between the collector and the ground ? My guess is no, as it is probably "the nature of the beast" for a NPN transistor, but I want to make sure....

    Took the board out of the garbage, and though I could use this circuit:

    upload_2016-9-16_9-56-9.png

    With the newly (re-)acquired switching notion, this seem to make sense. What do you think ?

    Also, I noticed while searching for PNP switching examples, that some circuits are showing Vcc connected to the Emitter, with the load between the collector and ground, but some other were showing the collector to Vcc, with the load between the Emitter and ground. I'm assuming the second ones are wrongly drawn. Any comments ?

    TIA
     
  14. AnalogKid

    AnalogKid

    2,415
    686
    Jun 10, 2015
    Your idea of "typical NPN switching" is actually a narrow case of a much wider range of circuits. Pulling the base of PNP (not NPN) transistor up to 5 V will turn it off only if the emitter is connected to 5 V. Typical for many logic circuits, not for medical, industrial control, etc. circuits that run on 12 V or 24 V. The rule of thumb for turning off a simple transistor switch as in figure 1 in post #13 is that the base must be pulled up to the emitter, whatever that voltage is. If the base drive is coming from a totem pole output that can do that, then R2 is not necessary. If the drive is coming from an open collector transistor as in a ULN200x or ULN280x, then R2 is needed.
    Correct, nature of the beast.
    That is basically where you started, with R1 and Q1 inside the ULN2003.
    You are confusing PNP and NPN transistor types. Sticking with the NPN, you can make a saturated switch (with the lowest possible voltage drop across the collector-emitter) with the emitter at GND and the load between the collector and Vcc. However, another arrangement is called an emitter follower. In this case, the collector is at Vcc and the load is between the emitter and GND. The logic polarity is non-inverting - when the base goes high, the emitter goes up. BUT, the transistor does not saturate. The emitter voltage always is about 0.7 V less than the base voltage, so if the driving circuit can make only 4 V at its output, and there is some voltage drop across the base current limiting resistor, the emitter (the voltage across the load) will be close to 3 V.

    ak
     
    Last edited: Sep 16, 2016
    (*steve*) and Jouellet like this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-