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?
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.
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").
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).
@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.
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.
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.
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.
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? "
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.
cristian10001:
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.
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.
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.
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.
Hi everyone, I would like to thank you for your support. I noticed that I didn't put the code used as inspiration for this project (maybe it is more helpful).
I am going to design the printed circuit board using bc337 or 2n3904 transistors, I will see if it goes with these npn.
cristian10001:
. . .
I am going to design the printed circuit board using bc337 or 2n3904 transistors, I will see if it goes with these npn.
A 2n3904 has a maximum rating of 200mA - not quite enough for 7 segments @30mA and a decimal point, if you use the display mentioned in your OP.
Remember also that the BC337 and 2n3904 have different pin outs.
I'm curious about how he measured the current e.g. :
//200 dim but readable (1.4mA)
He is controlling the brightness by switching a digit on and delaying a number of microseconds, in the case of the example above 200 microseconds. However, the current would not be dependent on length of time the digits were left on. I guess these readings are dependent on some integration his digital multimeter is making over the entire period.
The risk is not only to the display. It is to the arduino as well.