Skip to content

Computer Engineering II. A 3 digits seven segment display project. We used Arduino as a CPU for a temperature sensor with 3 digits display in C°

Notifications You must be signed in to change notification settings

RezzaMir/3-digit-temperature-display

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

3-Digit Temperature Display

Purpose: The purpose of this project is to use the Arduino as a CPU for a temperature sensor with a 3-digit display in C°.

  1. A 3 digit seven segment display will be used
  2. Shift register will be used
  3. We will use a temp sensor which goes from -40 to 125°C, the same is in TinkerCAD
  4. We will add 13 transistors and 3 displays to control the digits of the display to the circuit breadboard

A flow chart is given to help you realize the way it must flow but this is just an eagle’s eye view. To get all digits to appear on at the same time we are multiplexing them very fast and utilizing the optical persistence of our eyes to make it ‘look’ like they are all on at the same time when they are going on and off. The flow chart that I am giving you is a starter to do to make that happen. If you notice, there is a delay for how long the display is on. We are starting at 5 ms for that but we will also experiment with that value to see its effect. We want to make the display of the temperature as clear and as stable as possible and that will involve the stability of your readings as well.

Picture4

All connections to the shift register are the same as before.

Add two new 7 segment displays to the layout and connect all the like segments together. Each digit will now be switched on and off using the PNP transistors driven by the Arduino. Only one Display is on at one time – they are multiplexed. Our input will be a temp sensor. Since it only goes up to 1.75V max we will set the Aref input to 2V. Make sure that you put in the program that you are using the external reference with the instruction: analogRefrence(EXTERNAL); To calculate the voltage from the ADC remember that 1023 equals 2V (not 5V). 1.75V should equal 895. The temp sensor operates like this. Temp in C° = (Vout – 0.5)*100 (Remember to make this variable a FLOAT type or you will not get any decimals flowchart this is shown as CENTS).
Note that the output enable is now controlled too to prevent ghosting. This really turns the segments off.

Software graphic and flow chart

This is a graphic of the timing for the loading of segments, and the timing of the transistors which must be coordinated in the code. Note how only one digit is on at a time but all are off when the shift register is loaded to prevent ghosting which is when more than 2 numbers are trying to show at the same time with one of them much dimmer. To avoid this, you have to turn all the digits off before loading the next digit.

Picture5

The temperature is shown as the CENTS in the flow chart and the formula is also shown above. The flow chart shows where the ADC is read and the values are converted. Ignore the bit about a running average.

It is assumed that Digit 1, 2 and 3 values are stored as variables. The rest of the code is just loading turning-on and turning-off each of the three digits and then going to the top and starting all over again reading etc.
Once you have a value for CENTS, it needs to be converted to 3 numbers for each digit. Start by dividing it by 100 and using that value for Digit1. Then execute a modulo instruction (Remainder= CENTS%100) to find the remainder and divide that by 10 to get Digit2. Digit3 is then the remainder from digit2 found by using the modulo again (e.g., Digit3 = Remainder%10). You will notice that there is a negative number if the temp goes low enough, and it also goes above 100 C°. The 3 digits will be used to go above 100 but when the temperature goes negative the left digit must show a negative sign.

Picture6

Troubleshooting

Once you have written your program use the Serial.print and Serial.println instructions to help visualize your data. In other words if you are wondering what the ADC value is, use the Serial.println(adc) to send that value to the serial monitor where you can determine if it is correct or not. You can do this for other variables as well. This is probably the most valuable tool for debugging Arduino programs. Once you figure things out you may have to comment out the serial commands as they do tend to slow things down.

Appendix

Functional Diagram

Picture1

7 Segment Displays

Picture2

Seven Segment Pinout

Picture3

Circuit and Display 'OFF/ON'

Display is 'On' with 3 digits

M 1

Display is 'Off'

M 2

About

Computer Engineering II. A 3 digits seven segment display project. We used Arduino as a CPU for a temperature sensor with 3 digits display in C°

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages