Medium Basics: Project 018i 4 digit 7 segment display modules 5641AH or 3461BS, 74HC595, LM 35 sensor - Tem

of Acoptex.com in UNO

Basics: Project 018i

Project name: 4-digit 7-segment display modules 5641AH or 3461BS, 74HC595, LM35 sensor - Temperature display.

Attachments: sketch1 (common cathode), sketch2 (common anode)

In this project, you needed these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.Arduino IDE ( you can download it from here  )

3.Jumper cables

4. Resistor 8 pcs (220 Ohm or 330 Ohm)

5. Breadboard

6. 4-digit 7-segment display module 5641AH or 3461BS 1 pc

7. Chip 74HC595 (shif register) 1 pc

8. LM35 sensor 1 pc


In this project we will learn how to connect a 4-digit 7-segment display modules  5641AH or 3461BS and 74HC595 and  LM35 sensor to Arduino board and make a temperature display. 

Understanding the LM35 sensor

LM35 is a precision IC temperature sensor with its output proportional to the temperature (in oC). The sensor circuitry is sealed and therefore it is not subjected to oxidation and other processes. With LM35, temperature can be measured more accurately than with a thermistor. It also possess low self heating and does not cause more than 0.1 oC temperature rise in still air.   

The operating temperature range is from -55°C to 150°C. The output voltage varies by 10mV in response to every oC rise/fall in ambient temperature, i.e., its scale factor is 0.01V/ oC.

You can find the datasheet here.

Understanding the 4-digit 7-segment display module

The obvious downside to using these relatively inexpensive 4 digit, 7 segment displays is that for full functionality, each pin must be connected to a controlling I/O pin. If you are using an Arduino Uno compatible micro-controller, one of these four digit displays will use from 12 to 16 of your 20 or so available I/O pins.There is a line of 4 digit, 7 segment displays with some additional circuitry that only requires one to three I/O pins to control one or more 4 digit displays. It is a little bit expensive but you pay for the convenience of not having to use almost all of your micro-controller I/O pins to drive a single 4 digit display and from having to manage every LED segment in the display.

The display module has 12 pins, six near the bottom and six on top. The pins are numbered counter-clockwise, starting with pin 1 on the lower left. Each digit consists of 7 segments, labeled A-G in green with a decimal point connected to pin 3. Because the display module 3461BS is a common anode display, to light any combination of segments on any digit, the desired combination of segment I/O pins must be set HIGH, then the corresponding digit select pin, labeled D1-D4, is set LOW. If two or more digit select pins (shown in orange above) are LOW at the same time, they will display identically, which is usually not desired. The same segment on every digit shares an I/O pin. The idea is to only light one digit at a time by setting the appropriate segment pins HIGH then bringing that digit's select pin LOW and then quickly turning the digit off by setting its select pin HIGH again after a few milliseconds before going on to the next digit. This happens so fast that our persistence of vision tricks us into believing all the digits are lit continuously and flicker free. In fact, this four digit refresh can happen faster than the shutter speed of most cameras. Because the segments are only lit briefly, many makers do not use current limiting resistors that can help prevent the LEDs from failing prematurely. 

However, it is better to be a little more conservative and protect each LED segment, including the decimal point with a resistor in the range of 220 to 330 ohms, depending on what’s close at hand.

The basic 4-digit 7-segment display is white in color. It has a common anode. The display features one decimal point per digit, and individually controllable apostrophe and colon points. The LEDs have a forward voltage of approx 3 VDC and a max forward current of 20 mA. The hardware interface is 12 (two rows of 6) through-hole pins. The same display is available in green, blue and red color.

You can find the datasheet of 4-digit 7-segment display module 5641AH here.

You can find the datasheet of 4-digit 7-segment display module 3461BS here.

Understanding the 74HC595

The 74HC595 consists of an 8−bit shift register and a storage register with three - state parallel outputs. It converts serial input into parallel output so you can save IO ports of an MCU.When MR (pin10) is high level and OE (pin13) is low level, data is input in the rising edge of SHcp and goes to the memory register through the rising edge of SHcp. If the two clocks are connected together, the shift register is always one pulse earlier than the memory register. There is a serial shift input pin (Ds), a serial output pin (Q) and an asynchronous reset button (low level) in the memory register. The memory register outputs a Bus with a parallel 8-bit and in three states. When OE is enabled (low level), the data in memory register is output to the bus. 

Signals and connections of the 74HC595

Pins of 74HC595 and their functions:

Q0-Q7: 8-bit parallel data output pins, able to control 8 LEDs or 8 pins of 7-segment display directly.

Q7’: Series output pin, connected to DS of another 74HC595 to connect multiple 74HC595s in series

MR: Reset pin, active at low level; here it is directly connected to 5V.

SHcp: Time sequence input of shift register. On the rising edge, the data in shift register moves successively one bit, i.e. data in Q1 moves to Q2, and so forth. While on the falling edge, the data in shift register remain unchanged.

STcp: Time sequence input of storage register. On the rising edge, data in the shift register moves into memory register.

OE: Output enable pin, active at low level. Here connected to GND.

DS: Serial data input pin

VCC: Positive supply voltage

GND: Ground

You can check the specification of chip 74HC595 here.

Signals and connections of LM35 sensor
Signals and connections of 4-digit 7-segment display modules 5641AH (common cathode) and 3461BS (common anode)

Build the circuit

When a 7-segment display is used, if it is a common anode display, connect the anode pin to power source; if it is a common cathode one, connect the cathode pin to GND. When a 4-digit 7-segment display is used, the common anode or common cathode pin is to control the digit displayed. There is only one digit working. However, based on the principle of Persistence of Vision, we can see four 7-segment displays all displaying numbers. This is because the electronic scanning speed is too fast for us to notice interval.

The following picture shows the needed connections with the Arduino Uno 

1. 4-digit 7-segment display module 5641AH common cathode

2. 4-digit 7-segment display module 3461BS common anode

Step by Step instruction

  1. Plug your Adruino Uno board into your PC and select the correct board and com port
  2. Open up serial monitor and set your baud to 9600 baud
  3. Verify and upload the the sketch to your Adruino Uno board
  4. You can see the temperature displayed on 4 digit 7 segment display module


We have learnt how to connect 4 digit 7 segment display module 5641AH or 3461BS, 74HC595, LM35 sensor to Arduino board


  • No library required for this project


  • See attachments on the begining of this project description. 

Other projects of Acoptex.com
Medium Basics: Project 083w Sipeed Maixduino board - Using PlatformIO IDE of Acoptex.com in Sipeed Maixduino 08-08-2019
Medium Basics: Project 083e Sipeed Maixduino board - Uploading MaixPy of Acoptex.com in Sipeed Maixduino 04-08-2019
Medium Basics: Project 083f Sipeed Maixduino board - Using MycroPython of Acoptex.com in Sipeed Maixduino 04-08-2019

Published at 19-08-2017
Viewed: 5955 times