Increase voltage from 5 to 12V to deactivate a display

Discussion in 'Embedded Systems and Microcontrollers' started by orlandoperalta23, Feb 19, 2016.

  1. orlandoperalta23

    Thread Starter New Member

    Oct 22, 2015
    12
    2
    Hi everyone.

    I´m developing a timer based on this project: http://extremeelectronics.co.in/avr-projects/avr-project-digital-stop-watch-with-atmega8/

    At first, I made the same schematic (as in the image) with 13mm x19mm and 5V displays and it works fine. The displays work perfectly. Then I change the displays by larger 12V display (something like 5cm x 10 cm). Now, I have a problem: the segments of the display dont turn off at all.

    I supply the display with 12V throught BC558 transistor and when I want to show a number: 1, for example, the others segments of the display dont turn off, them only dim a little bit. Later I tried many ideas about the origin of the problem we saw that the problem is this (or we think so): the digital signal from the microcontroller is 0V (to turn on the segment) or 5V (to turn off the segment). The low voltage works fine to turn on the segment because the voltage throught the led is 12V (bigger than threshold voltage), but the high voltage dont woks to turn off because the voltage trought the led is 7 (12V from the transistor - 5V from the micro) and this voltage can turn on the segment (a little dim). So we try to increase the voltage from the pin of the micro using a common emitter transitor (emmiter to 10k resistor to ground, base to the micro pin and collector to 12V) and a lot of other configurations, even with an op amp in compare mode. All this in order to increase the voltage of the digital signal to 12V. But all this doesnt works.

    Excuse me for the large explanation. Now, can someone help me to know how can I solve this problem.

    Thanks in advance.

    Bye
     
  2. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,006
    3,762
    Your displays are staying on because the PNP base resistor (currently 5V from your Microcontroller) has to be the same voltage as the PNP emitter (12 V in your new design) to prevent current from flowing into the base and turning on flow.
     
  3. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    Please post a schematic of the LED drive circuitry.
     
  4. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,006
    3,762

    You need an NPN to turn on the PNP like this...

    NOTE, you logic will be inverted (output high to turn LED on. Low (0) to turn off.



    image.jpg
     
    Last edited: Feb 20, 2016
  5. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,523
    1,247
    Or, for a non-inverting interface that doesn't require changing the microcontroller software. use the same NPN transistor in a common-base configuration. Collector to the PNP driver as shown, Base to +5V, Emitter to the uC port through something smaller, like 2.2K to 4.7K. Same number of parts, no firmware change.

    ak
     
    JohnInTX and GopherT like this.
  6. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,006
    3,762
    Per AK's suggestion, here is what it would look like...

    image.jpg
     
    JohnInTX likes this.
  7. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    This is what I understand the OP's problem to be:
    upload_2016-2-21_7-51-59.png
    They tried to level shift the outputs of the uC, but details are unclear and a schematic hasn't been provided...
     
  8. orlandoperalta23

    Thread Starter New Member

    Oct 22, 2015
    12
    2
    Hi, thanks for your answer.

    I´ll try this and I will comment what happens.

    Thanks again
     
    GopherT likes this.
  9. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,006
    3,762
    Note that Post 7 is an attempt to understand what you have that is NOT working. Posts 4, 5 and 6 are suggestions to solve your problem.
     
  10. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    The solutions offered don't address the problem. When the common anode of the display is enabled, the segments that should be off have their cathodes at about 5V and only dim a little. The solution will require level shifting the uC outputs to 12V. It seems that the OP tried, but didn't do it correctly.
     
  11. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,006
    3,762
    The schematics in posts 4 and 6 work fine as level shifters. The OP's original link in Post 1 was modified to 12 v and, therefore does indeed suffer from lack of turn off because the PNP base cannot be raised to 12 V for complete turn off with the 5 volt pins from the Microcontroller. The options in posts 4 and 6 work perfectly to completely shut off the PNP when the base of the NPN (post 4) or NPN emitter (post 6) is switched from the 5v pins of a Microcontroller.
     
  12. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    Agree, but that wasn't the stated problem. I fully expected that after the slightly dimmed but not off segment issue was resolved, ghosting would have been the next problem.
     
  13. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,006
    3,762
    That seems like he is saying the display doesn't turn off when he changed from 5V supply to 12v supply.

    What question do you think he is asking?
     
  14. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    He's talking about individual segments not turning off, not an entire display. You solved the problem he isn't able to see yet.
     
  15. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    What's the point of using a 12V supply? If each segment had multiple LEDs in series, you might need to use a higher voltage, but a little display like that isn't likely to need it. It's a "stop watch", not a "tower clock"! If you want a brighter display, reduce the 330 ohm resistors so you get more current.
     
  16. dannyf

    Well-Known Member

    Sep 13, 2015
    1,779
    360
    Because the mcu's high output of 5v on the output pin / base of the transistor cannot turn the transistor off, with the transistor's emitter at 12v.

    The easiest solution is to go back to a 5v power supply;

    If you have to stay with the 12v power supply, you will need to add a npn to drive the pnp and to reverse the logic of your program.
     
  17. orlandoperalta23

    Thread Starter New Member

    Oct 22, 2015
    12
    2
    Hi.
    First at all: thanks for your answers.

    After read all your answer, I understood better my problem. Yes, the problem is that when I put a number in the display... some parts of this should be turn off, but it only dim.

    I need this type of display because the stop watch will be located in the middle of a high school square. So the display should be big.

    I think that exist two reason for this problem:

    1) The 5V from the Port C in the base of the PNP transistor is too low to turn off at all this transistor, when I want deactive the display. So I need increase the voltage in the base of this transistor to 12V in order to turn completly off the transistor. When I have 0V from the Port C all works fine with this transistor, because turn on perfectly.

    2) Similarly, in the Port D, when I have 0V all works fine, because the voltage throught the display is 12V, enough to turn completly on this. But when I have 5V in the Port D, the voltage throught the display is near to 7V and is not low enough to turn off the display.

    Thats the reason why when I tried to level shifting only in the Port D of the micro doesnt works. I need to do both two level shifting in Port C and Port D

    Now, I plan to do the assembly as in the attached file or something similar, even if this implies a change in the code logic.Captura de pantalla 2016-02-21 22.02.48.png

    Other importan detail is I'm using common anode displays

    Thanks again and I'll tell you how it goes
     
  18. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    If you use the circuit provided by AK, you don't need to change the polarity of the Port C signal to enable digits.

    You need to insert current limit resistors for the Port D signals. As you have it now, the transistor could burn out the segments.
     
  19. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,006
    3,762
    R37 does nothing - it should be removed.

    You need to add a current limiting resistor between the LED and Q15. 330 ohm is a reasonable number but I don't know about your display yet.
     
  20. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    Yes, definitely remove R37. And I think R36 is too large--I'd put 2.2K there, at most. You want a good solid turn-on of the NPN transistors.
     
Loading...