0
\$\begingroup\$

I'm developing a timer based on this project: Digital Stop Watch with ATmega8 by Avinash Gupta (I cant put the link, because my reputation is too low)

Original schematic: enter image description here

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 transistor (emitter 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.

After this, I see that 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. Then, I assembly this circuit: enter image description here, but this circuit doesnt works. I dont have idea whats happen. Just seems like if the display segments turn on almost all time and turn off when they want.

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

\$\endgroup\$
1
\$\begingroup\$

So what you need is a level shifter. PD1 through PD7 need to swing from low (0 volts) to hi (+12V)

One way might be to use an inverting transistor (PD1 out to 10K resistor to base, emitter to GND, collector to R11) AND in the code, to invert all your logic outputs, that is assuming you can reprogram it.

If you can't fix the code, then you need 2 inverters.

Another method might be to add a 5V zener in series between the microcontroller output and the current limiting resistors (R5 thru R11) so that when the output goes hi, there is only 2 volts to drive the led. Or even simpler add Just one zener in series with your 12V supply before the BC558 transistors. Your display might be a little dimmer, but will cut off more effectively. You can bring the brightness back up by lowering the value of R5 thru R11.

\$\endgroup\$
0
\$\begingroup\$

Your assumption is correct. The 5V base voltage is too low to turn the PNP off, with a collector at 12V.

In that case, a simple npn transistor, in common collector setup can be used to turn the pnp on and off at 12V.

schematic

simulate this circuit – Schematic created using CircuitLab

Resistor values should be adjusted for your transistors hfe value. The npn can be any common small signal transistor. Logic is inverted, so change your code accordingly.

\$\endgroup\$
0
\$\begingroup\$

MCU have protection diodes on every pin, so it sinks current if the voltage is higher than MCU voltage. I understood your MCU works on 5V, so when you switched voltage for display to 12V, your BC558 transistors always have base current (because pin voltage cannot go higher than 5V). This causes current emitter-collector which goes trough display...

\$\endgroup\$
  • \$\begingroup\$ yes, I know, for these reason I put a level shifter in the Port C and Port D. But still doesnt woks \$\endgroup\$ – Orlando Feb 22 '16 at 21:23
  • \$\begingroup\$ Please try to connect display directly to the 12V (just one segment). Are you sure that new display is with common anode? \$\endgroup\$ – Darko Feb 22 '16 at 22:46
  • \$\begingroup\$ yes, I am sure. Was the first test that I do with this displays \$\endgroup\$ – Orlando Feb 22 '16 at 22:48
  • \$\begingroup\$ Could you then check output of mcu. Maybe ports D and C are failed during first test? \$\endgroup\$ – Darko Feb 22 '16 at 22:50
  • \$\begingroup\$ Ok, I replace this big displays by the littles and works fine. In fact, I'm putting just one big display for the seconds units and three little displays for the tens units seconds and for the minutes \$\endgroup\$ – Orlando Feb 22 '16 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.