Go Down

Topic: arduino nano bc547 4 digit 7seg display (Read 437 times) previous topic - next topic

cristian10001



I want to use this schematic for a project, I added those transistors and I want to know if it's ok. The display model is
BQ-M362RD-A-001, common anode.

I will use DS3231 and DHT11 powered by 5V from the arduino. The entire circuit is powered by a 9V battery. Will the circuit work properly for a longer period of time?

groundFungus

I don't know about the transistors, but would like to offer a couple bits of advice.

The DHT11 is a cheap temperature and humidity sensor.  That is about all that it has going for it.  If you want accurate temperature and humidity a BME280 temperature, humidity and barometric pressure sensor is a much better choice.  Make sure that it is BME, not BMP.  

9V transistor batteries (small rectangular PP3) are pretty low capacity batteries.  One will not run that circuit for very long if at all.  To choose a battery you need to know how much current the circuit requires and how long the circuit must run between battery charges or changes.  Then you can calculate the required battery capacity.

PaulRB

#2
Sep 23, 2019, 07:48 am Last Edit: Sep 23, 2019, 07:59 am by PaulRB


Hi, this circuit will not work. It is for a common cathode display.

To correct it, connect the transistor collectors to 5V and the emitters to the common anodes. The resistors on the bases will not be needed (because you will be using the transistors as "emitter-followers").

6v6gt

Unless you are using a rather odd multiplexing model (maximum of three segements per digit simulataneously lit) you may have a problem with BC547 transistors. These are specified for Ic (collector current) of 100 mA.
Your display segments appear to have a forward current of 30mA and you can drive them even harder if you want (with a reduced duty cycle).

PaulRB

BC547 transistors..are specified for Ic (collector current) of 100 mA.
Good spot @6v6gt!

@cristian10001 use BC337 instead. Or better, use BC327, which is PNP and you will need those base resistors after all.

cristian10001

Good spot @6v6gt!

@cristian10001 use BC337 instead. Or better, use BC327, which is PNP and you will need those base resistors after all.
I will replace those 547 with 337, but if I connect the collector directly to 5V and the emitter to the corresponding digit, how can I still control the display?

What if I removed the transistors from the circuit? At the moment I haven't connected any transistor, and everything seems fine.

PaulRB

#6
Sep 23, 2019, 07:44 pm Last Edit: Sep 23, 2019, 08:12 pm by PaulRB
Without the transistors, you will be damaging the Arduino. Suppose you want to display the digit "8". To do that, 7 segments will need to be lit. The current flowing through each segment will be (5V-2.1V)/120R=24mA. That's ok for the segments (max 30mA) and the Arduino pins connected to them (max 40mA). But the Arduino pins connected to the digit common anodes must source 7x24=170mA. Thats more than 4 times higher than they are rated for. They won't self-limit the current. They will be damaged and eventually fail.

cristian10001

Without the transistors, you will be damaging the Arduino. Suppose you want to display the digit "8". To do that, 7 segments will need to be lit. The current flowing through each segment will be (5V-2.1V)/120R=24mA. That's ok for the segments (max 30mA) and the Arduino pins connected to them (max 40mA). But the Arduino pins connected to the digit common anodes must source 7x24=170mA. Thats more than 4 times higher than they are rated for. They won't self-limit the current. They will be damaged and eventually fail.
What about first question, about losing the control of digits? I will still use the original circuit? Now I am a little bit confused about how to control the segments.

6v6gt

#8
Sep 24, 2019, 01:12 pm Last Edit: Sep 24, 2019, 01:15 pm by 6v6gt
Here is a schematic for a common anode display:

http://embedded-lab.com/blog/lab-11-multiplexing-seven-segment-led-displays/

Notice how the 4 driving transistors are connected.

You have understood the principle of multiplexing for a common anode display ?
To display say a '1' as the first digit in the display, you have to set segments B and C to LOW and the remaining segments HIGH. Then you have to switch on the transistor connected to the anode of the first digit position. You do this by bringing the base LOW (because it is a PNP transistor). To display something in all 4 digit positions, you have to repeat that cycle quickly enough so it does not appear to flicker since at any one time, only one digit will be displayed.

Does that help answer the question "about losing the control of digits? "

Paul__B

Do it properly and use a MAX7219.  :smiley-eek:

In fact, get the whole ready-built display.  It's just not worth the fuss otherwise!

TomGeorge

Hi,
I agree with @Paul__B.
If you go ahead with the Nano doing the multiplexing job, you will find that at times the display will flicker due to the code having to do other things as well as drive the display.

Using a MAX7129 driven display, you will not have the flicker problems.
Also you will need less wiring to connect the display.
The double display @Paul__B has shown , will let you  display two variables at once.
There are also displays designed for clock display with  :   added.

You will also need a pullup resistor for the DHT11 signal line.

Tom.. :)

Everything runs on smoke, let the smoke out, it stops running....

PaulRB

What about first question, about losing the control of digits? I will still use the original circuit? Now I am a little bit confused about how to control the segments.
It depends which type of transistors you use.

If you use bc337 (NPN) as emitter followers, your code can switch on a digit by setting the pin connected to the transistor base to HIGH and LOW to switch it off, the same as for a common cathode display. However, to light a segment, you must set the segment pin to LOW, and HIGH to switch the segment off, the opposite to what you would do with a common cathode display.

But if you use bc327 (PNP), then you must set the Arduino pin connected to the base to LOW to switch on the digit and HIGH to switch the digit off. For the segments LOW for on and HIGH for off. So this is completely the reverse of how you control a common cathode display.

If you are considering max7219 as suggested, the circuit will be simpler and the display brighter and flicker-free. However, the code will be more difficult, because max7219 was designed with common cathode displays in mind. But we can help with the more difficult code.

6v6gt

. . .
I agree with @Paul__B.
. . .
From the point of view of learning about electronics, micro controllers, multiplexing and such like, the OP has, IMHO, found an excellent starting point.

Of course, it would be much easier to buy a ready made Chinese clock from Walmart, Aldi or any big name store or use ready made parts which solve some of the problems, but is that the point ?

I recommend the OP carries on with his project, with the chosen parts and sees how far he gets.

Paul__B

Quote from BTTF:

"It's a scientific experiment!"  :smiley-lol:

ShermanP

If your display is efficient enough that you can reasonably power a maximum of four segments at a time from one I/O port, then you can do this without any transistors, and with only one resistor on each CA line.  You can do this by multiplexing by segment instead of by digit.  You drive a common segment line that feeds all four digits, but the ones that light up are those whose CA lines are turned on.  There are no resistors on the segment lines, and only a single resistor on each CA line (because for each digit, only one segment can be on at any time).  But you would have to refresh twice as often as the traditional multiplexing by digit because one segment can be on only 1/8 of the time.

The limitation is that your port pin would have to supply as many as four segments at a time.  You would just need to try it and see how bright the display is when sinking a total of, say, 30mA for four segments.

https://www.youtube.com/watch?v=8w09Zy8MQrc

https://github.com/gbhug5a/7-Segment-Displays-Multiplex-by-Segment

The Github repo contains a demonstration sketch that can be used with various resistor values to see if it will work for you.  It's written for two digits, but you can modify it to work with four.


Go Up