member
Basics: Project 018h 4 digit 7 segment display modules 5641AH or 3461BS, 74HC595, DHT 11 21 22 - Tem
of Acoptex.com in UNO
Basics: Project 018h
Project name: 4-digit 7-segment display modules 5641AH or 3461BS, 74HC595, DHT 11 21 22 - Temperature display.
Tags: Arduino, Arduino Uno, DHT11 21 22, Humidity and temperature module, 4-digit, 7-segment, 5641AH, 3461BS, 74HC595, temperature display module
Attachments: sketch1 (common anode), sketch2 (common cathode), library1, library2
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 9 pcs ( 8 pcs 220 Ohm or 330 Ohm, 1 pc 10 KOhm)
5. Breadboard
6. 4-digit 7-segment display module 5641AH or 3461BS 1 pc
7. Chip 74HC595 (shif register) 1 pc
8. DHT 11 21 22 module 1 pc
General
In this project we will learn how to connect a 4-digit 7-segment display modules 5641AH or 3461BS and 74HC595 and DHT 11 21 22 module to Arduino board and make a temperature display.
Understanding DHT humidity and temperature sensor
You can read about it 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.
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.
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 3461BS common anode, 3 pin DHT 11 21 22 sensor module
2. 4-digit 7-segment display module 3461BS common anode, 4 pin DHT 11 21 22 sensor module
3. 4-digit 7-segment display module 5641AH common cathode, 3 pin DHT 11 21 22 sensor module
4. 4-digit 7-segment display module 5641AH common cathode, 4 pin DHT 11 21 22 sensor module
Step by Step instruction
- Plug your Adruino Uno board into your PC and select the correct board and com port
- Open up serial monitor and set your baud to 9600 baud
- Modify sketch for your sensor (DHT11 or DHT21 or DHT 22)
- Verify and upload the the sketch to your Adruino Uno board
- You can see the temperature displayed on 4 digit 7 segment display module
- If it will be problem with compilation - remove 2 files from the library - DHT_U.cpp and DHT_U.h
Summary
We have learnt how to connect 4 digit 7 segment display module 5641AH or 3461BS, 74HC595, DHT 11 21 22 module to Arduino board
Library:
-
You will need to unzip and add the DHT-sensor-library-master library to libraries in your PC, for example C:\Users\toshiba\Documents\Arduino\libraries ORYou can install it in Arduino IDE too: select Sketch-> Include library->Manage your libraries->type DHT in Filter your search line and you will see DHT sensor library by Adafruit->More info->select version->installIf it will be problem with compilation - remove 2 files from the library - DHT_U.cpp and DHT_U.h.See attachments on the begining of this project description
- Adafruit_Sensor library included.Download, unzip and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC.
- DHT-sensor library included. You will need to unzip and add the DHT-sensor-library-master library to libraries in your PC, for example C:\Users\toshiba\Documents\Arduino\libraries ORYou can install it in Arduino IDE too: select Sketch-> Include library->Manage your libraries->type DHT in Filter your search line and you will see DHT sensor library by Adafruit->More info->select version->install
- If it will be problem with compilation - remove 2 files from the library - DHT_U.cpp and DHT_U.h.
Sketch:
- See attachments on the begining of this project description.
Other projects of Acoptex.com










Viewed: 5125 times