Search

Four digit BCD 7 segments display and atmega328

As we showed in the previous example the 7 segments display is very easy to manage and is perfect for some aplications which are not many data to display( like temperatures, voltage, currents) sometimes we can combine and display  data consecutive.

For that we use the model from previous example ELF-511SYGWA/S530-E2.

 

4 digit bcd datasheet

 

We can see that all the anodes are common for all 4 digits(A, B, C, D, E, F, G,DP ).  So if we make HIGH all pins associated with number “4”  and all cathodes (pins 6, 8, 9, 12 of display) put them to the ground, then all 4 digits will show number “4”.  But we don’t want that we want to show something different on each digit so we will make a small trick- the human eyes see a continuous image at least 75Hz (here). We choose a 100Hz frequency for a 10 ms period. So if we have 4 digits it means each digit have 2.5 ms displaying.

Consecutive displaying is done by connecting each cathode at one moment  to the ground.

We will do that with four transistors to reach the necessary  frequency .

If we want to display number 1234, then we will power on, the pins for number 1 and with a transistor we will connect to the ground the cathode associated digit 1(pin 12 of display) for a 2.5 ms, after that we will block the transistor and we will power on the pins for number 2 and with the transistor associated digit 2 we will connect to the ground the cathode associated digit 2(pin 9 of display) for a 2.5 ms and same with digit 3 and digit 4.

Next we have to know how to connect the transistors to the display and how we will polarize them from arduino but not to exceed the maximum current supported by the pin and same for the transistor because throught collector pass the current sum off all LEDs which are on.

A page where is very good explain how to use a transistor as a a switch is here.

In the image below is the connection mode of the transistors at display:

transistor bcd

 

In the image below we have calculated the values of resistors(1k ohm)  from the base of transistors  and how we connected them to the atmega 328. The calculation of resistors between atmega 328 and LED are shown in the example with one digit. Because throught a LED pass a 20mA current and we have 8 LED(and dot) the total current throught the collector will be 160mA. So we have choose a 2222a bipolar transistor. From his datasheet(here) we see that the maximum collector current  is 600mA, so we can use this in the project.



Of course all this project can be made with arduino, instead of atmega 328 and all his peripherals(7805, 10k resistor, oscillator, 22pF capacitors, push button), we can mount an arduino.

The resistors, for LEDs and for transistors must be mounted, otherwise you can burn your arduino.

 

schematic 4 digits bcd 7 segmensts

Next we have uploaded two small programs:

First is for whole positive numbers (0 to 9999) and whole negative numbers(0 to -999) and can be downloaded from here.

 

bcd 7seg 4765

 

Second is for rational positive numbers(0 to 999.9) and for rational negative numbers(0 to -99.9) and can be downloaded from here.

 

bcd 7seg -24.3 bcd 7seg 28.2 bcd 7seg 594bcd 7seg 123.4

 

Please let us in the comment zone any suggestions that you think will improve the article!

If you like the article click the follow button from social media to stay in touch with us!

Facebooktwitterpinterest

Related posts

Leave a Comment

Show Buttons
Hide Buttons