Hi,
After a lot of searching, I have found some similar threads but not the solution for my problem. I have two 2.3" common anode displays and I want to multiplex them and I made some circuit but it don't work. The problem is that displays are blinking, refresh rate is 60 Hz measured few times. P-channel mosfet for high side switching is BS250 and NPN transistor is 2n3904. Sorry for my bad English and I am hoping that someone can read my schematic that is attached on post.
Thank you for help.
P.S. Microcontroller is used to drive all elements.
Here is my code. This project is thermometer that read temperature from LM35 analog pin using ADC. Code for reading temperature is good and working as need to. My only problem is displaying this temperature. I am trying but I can not find what is wrong.
One more question, should I leave COM on ULN2003a connected to 12V or this pin must be unconnected?
After some time I found that there is no problem with my code. I have disconnect my mcu from circuit to see what is the problem. When I connect A,B,C and D input of CD4511 IC to ground and bases of NPN tranistors to +5V on segment displays should be number 0 but there is 8 and it blinks. When I touch with my finger resistor between gate and source of p-channel mosfet sometimes display show number 6. I realy dont know what is problem in this schematic it behaves so weird.
I have make new better schematic and I am hoping that someone will help me.
There are several things which may be wrong with your circuit:
1. You're trying to push around 40mA through each LED segment. The power supply is 12V, the LED segment drops about 1.2V, and the resistance is 270 plus 14 for the MOSFET...that's (12-1.2)/(270+14)=38mA. That is way too much. You should only need about 10mA. And with only 10mA you would not need the MOSFET.
2. According to the datasheet for the MOSFET it has a max gate-source threshold of -3.5V. But yours is more like -12V. The 2N3904 is pulling the MOSFET gate down to almost 0V, but the source pin of the MOSFET is at around 12V.
3. I would eliminate the both transistors and just use a 2N3906 PNP.
4. If your power supply can't provide much current you might have problems trying to give each LED 40mA.
But what you should do first is remove the CD4511 and ULN2003, and tie the 270 ohm resistors to high or ground to achieve the "0" to make sure that works. Then add the ULN2003 and tie its inputs to achieve the "0". Then add the CD4511.
Your post make me to think. This LED display is 2,3" and I have measured voltage drop per segment and it is 7,5V (4 diodes in series), current through segment is 13 mA.
I checked displeys, ULN2003 and CD4511 like you said and they are fine. Instead of 2N3906 I put BC557, but to turn off that transistor I need at least -0,5V between base and emiter so I am using BC547 to pull PNP base to 0 the sam way I do with mosfet.
Everything is fine when I connect CD4511 inputs to +5V or 0V, npn base over 1K resistor to +5V and corresponding number shows, even when mcu drive npn transistors and cd4511 inputs are fixed to e.g DCBA (0v,0v,5v,5v) numer 3 shows up.
Things go crazy when I connect mcu to ABCD input of cd4511, displays are blinking again.
Video below shows blinking.
Oh, okay. Because in post #4 you said that even without the MCU it displays an "8" instead of "0" and it blinks. I was a little confused. I also didn't realize you were using large 7-segment displays.
So does it work fine without the MCU?
If yes, then try putting a 10K (or larger) resistor from the MCU pin to ground. That's if you're using an NPN. If you're using a PNP, then tie the resistor high.
I tried some things and found that if I leave unconnected inputs of cd4511, display blinks an if I connect them to ground, display show 0 and don't blink. Whole time mcu is connected to NPN transistors and switching them (switching displays by pulling PNP base low).
Now I know that there is something with inputs of CD4511, maybe in some moment they are floating and because of high impedace on input CD4511 behaves so wierd. I will try to find TTL IC replacement for this CMOS CD4511, maybe this resolve my problem.
Voltage levels on BCD pins are 4,8V for '1' and 0,01 for '0', enough to drive CD4511. CD4511 is powered by 5V same as MCU. One more wierd thing that I found is when I bring closer my hand to CD4511 inputs, other segments on display starts to blink.
For now I will leave this project in desk drawer.
If I found a solution for this, I will post it here.