I like to work with LED displays with 7 segments or with dot matrix and I already did many different projects with them.
Everytime they are interesting because there is some a kind of magic in how they can work because what you are seeing it is an optical illusion !
Displays have a lot of pins for connection with an Arduino (or another microcontroller) and the best solution is to apply the technics of data multiplexing to minimize the use of their ports.
When you do this, each segment or each LED will be turned on for a few instants (miliseconds or less), but the repetition of that in so many times per second creates the ilusion of the image that you want show.
For me the most interesting thing is to develop the logic, the program in order to find out how they can show the correct information according with your project.
In a single project using displays demands many time to assemble all components on a breadboard with many wires for connections.
I know there are many different displays on market running with I2C, with simplified ways (or not), to program them and I have used them too but I prefer to work with standard components like 74HC595 (multiplexer IC) and ULN2803 (drivers) because they give you more control in your program and also more robustness and reliability in your utilization.
To simplify the assembly process I have developed a LED Dipslay Module for multiple purposes using simple and common components in the Arduino's world.
With this module you can work with dot matrix with dual color LEDs in two standard sizes (bigger and smaller) and also you can control 7 Seg x 4 Digits display that are very common and easy to find them in the market.
And you also can work with these modules in cascade on a serial way (different data into displays) or on a paralell way (same data into displays).
So let's see how this module can work and help you in your developments !
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Components
- PCB (Printed Circuit Board)
- 74HC595 (03 x)
- ULN2803 (02 x)
- Transistor PNP - BC327 (08 x)
- Resistor 150 Ohms (16 x)
- Resistor 470 Ohms (08 x)
- Capacitor 100 nF (03 x)
- IC Socket 16 pins (03 x)
- IC Socket 18 pins (02 x)
- Pin connector female - 6 pins (8 x)
- Pin headers 90º (01 x)
- Pin headers 180º (01 x)
- Conector Borne KRE 02 pins (02 x)
- PCB (01 x) - Manufactured
- Arduino Uno R3 / Nano / similar
- LED Display 04 Digit x 7 Segments - (Common Anode)
- LED Dot Matrix Dual Color (Green & Red) - (Common Anode)
- Important Remarks:
- I put the datasheet of all most important components only as reference but you must check the datasheet of your own components before use them.
- This board was designed to use only displays of COMMON ANODE.
Step 2: First Prototypes
My first prototype was done on a breadboard to test the circuit.
After that I did another prototype using an universal board as you can see in the pictures.
This kind of board is interesting to produce a quick prototype but you realize that still keeps a lot of wires.
It is a functional solution but not so elegant comparing with a final manufactured PCB (the blue one).
I am not good with soldering because I do not have enough experience with this process but even this I got good results with both experiences and more important: I did not burn any component and neither my hands !
Probably the results on my next board will be better due the practice.
Due this I encourage you to try this kind of experience because it will be excellent for you.
Just keep in mind to take care with the hot iron and try to do not spend more than few seconds on a component to avoid burn it !!
And finally, on Youtube you can find many videos about soldering that you can learn before go to real world.
Step 3: PCB Design
I designed this PCB using a dedicated software to produce a dual layer board and it was developed several different versions before this last one.
At begining I had one version for each kind of displays and after all I decided to combine everything in just one version.
- Simple and useful for prototypes.
- Easy setup and expansible.
- Capable to use 3 different kind of displays.
- Maximum width of the large dot matrix of LED.
- Maximum lenght at 100 mm to minimize the costs of production of the board.
- Apply traditional components instead of SMD to avoid more difficulties during manual soldering process.
- The board must be modular to be connected with another boards in cascade.
- Serial or paralell output for another boards.
- Several boards must be controlled by an Arduino only.
- Only 3 wires of data for Arduino's connection.
- External 5V power connection.
- Increase the electrical robustness applying transistors and drivers (ULN2803) to control the LEDS.
Related to this last item I recomend you read my another Instructables about these components:
After finished the design, I sent it to a PCB manufacturer at China after many searches with different local suppliers and in different countries.
The main issue was related the amount of boards versus cost because I need just a few of them.
Finally I decided to put an regular order (not an express order due higher costs) of only 10 boards with a company at China.
After only 3 days the boards were manufactured and sent to me crossing the world in more 4 days.
The results were excellent !!
In one week after the purchase order the boards were in my hands and I was really impressed with the high quality of them and with the quick speed !
Step 4: Programming
For programming you must keep in mind some important concepts about the hardware design and about the shift register 74HC595.
The main function of 74HC595 is to transform 8-Bit Serial-In into 8 Parallel-Out Shift.
All serial data go into Pin #14 and at each clock signal the bits go to its corresponding parallel-out pins (Qa to Qh).
If you continuous to send more data, the bits will be moved one by one to Pin #9 (Qh') as serial output again and due to this functionality you can put another chips connected in cascade.
In this project we have three ICs of 74HC595. The first two work to control the columns (with POSITIVE logic) and the last one to control the lines (with NEGATIVE logic due the PNP transistors functioning).
Positive logic means that you must send a HIGH level signal (+5V) from Arduino and Negative logic means that you must sent a LOW level signal (0V).
- Dot matrix of LEDs
- The first is for the outputs of the cathodes of Red LEDs (8 x) >> COLUMN RED (1 to 8).
- The second is for the outputL of the cathodes of Green LEDs (8 x) >> COLUMN GREEN (1 to 8).
- The last one is for the output of anodes of all the LEDs (08 x Red & Green) >> LINES (1 to 8).
For example, if you want to turn on only the Green LED of column 1 and line 1 you must send the following sequence of serial data:
~10000000 (only the first line is set to on) - The symbol ~ is to invert all bits from 1 to 0 and vice-versa.
2º) COLUMN Green
10000000 (only the first column of Green LED is set to on)
3º) COLUMN RED
00000000 (all the columns of Red LEDs are off)
- Arduino statements:
shiftOut(dataPin, clockPin, LSBFIRST, ~B10000000); //Negative logic for the lines
shiftOut(dataPin, clockPin, LSBFIRST, B10000000); //Positive logic for the Green columns
shiftOut(dataPin, clockPin, LSBFIRST, B00000000); //Positive logic for the Red columns
You can also combine both LEDs (Green & Red) to produce the color YELLOW as following:
shiftOut(dataPin, clockPin, LSBFIRST, ~B10000000);
shiftOut(dataPin, clockPin, LSBFIRST, B10000000);
shiftOut(dataPin, clockPin, LSBFIRST, B10000000);
- 7 Segments display
For these kind of displays the sequence is the same. The only difference is that you do not need to use the Green LEDs.
1º) DIGIT (1 to 4 from left to right)
~10000000 (set digit #1)
~01000000 (set digit #2)
~00100000 (set digit #3)
~00010000 (set digit #4)
2º) NOT USED
00000000 (all bits set to zero)
3º) SEGMENTS (A to F and DP - check your display datasheet)
10000000 (set segment A)
01000000 (set segment B)
00100000 (set segment C)
00010000 (set segment D)
00001000 (set segment E)
00000100 (set segment F)
00000010 (set segment G)
00000001 (set DP)
- Arduino example to set Display #2 with number 3:
shiftOut(dataPin, clockPin, LSBFIRST, ~B01000000); //Set DISPLAY 2 (Negative logic)
shiftOut(dataPin, clockPin, LSBFIRST, 0); //Set data to zero (not used)
shiftOut(dataPin, clockPin, LSBFIRST, B11110010); //Set segments A,B,C,D,G)
Finally, applying this process you can control any LED of your display and also you can create any special characters you need.
Step 5: Testing
Here are two programs as example of functionality of the Display Module.
1) Countdown display (from 999.9 seconds to zero)
2) Dot Matrix (Digits 0 to 9 & Alphabet A to Z)
3) Digital Clock RTC in LED Display of 4 Digits and 7 Segments
This last one is an update of my first version of Digital Clock.
Step 6: Conclusion & Next Steps
This Module will be useful in all future projects that demands some LED display.
As next steps I will assemble more some boards to work with them in cascade mode and I will develop too a library to simplify even more the programming.
I hope you have enjoyed this project.
Please, send me your comments because this is important to improve the project and the information of this Instructable.
Participated in the
Automation Contest 2016