How to Use Seven Segment Displays on the Arduino - Ultimate Guide to the Arduino #28

Share

Summary

This video provides an ultimate guide to using seven-segment displays with the Arduino. It covers the basics of how these displays work, including common anode and common cathode configurations, and how to wire them up. The tutorial then delves into programming single-digit and multi-digit displays using the 'sseg' library, demonstrating how to display static numbers and dynamic sensor readings, such as temperature from a thermistor. The video also shows how to manage display flickering for analog sensor data.

Highlights

Introduction to Seven Segment Displays
0:01:16

Seven-segment displays are simple and effective for displaying numbers from an Arduino. Each segment is an LED, arranged to form numbers. Most displays include a decimal point, making it eight segments. Displays come in single, two, or four-digit versions and various LED colors and sizes.

How Seven Segment Displays Work
0:02:45

Seven-segment displays consist of LEDs arranged in the shape of the number eight. Turning on specific LEDs forms different numbers. There are two main types: common anode and common cathode. In common anode displays, LEDs are turned on by switching digital pins low. In common cathode displays, LEDs are turned on by switching digital pins high. Segments are typically labeled A through G for digits and DP for the decimal point.

Wiring a Single Digit Seven Segment Display
0:04:24

Using a common cathode, single-digit 5161AS display, connect both common pins to ground via a 1 kOhm current limiting resistor. Segment A connects to pin 6, B to pin 5, C to pin 2, D to pin 3, E to pin 4, F to pin 7, G to pin 8, and DP to pin 9.

Programming a Single Digit Seven Segment Display
0:05:43

To program a seven-segment display, use the 'sseg' library. Include the library, create an 'sseg' object, and initialize the display in the setup section. Define 'num_digits' (e.g., 1 for single digit), 'digit_pins' (empty for single digit), 'segment_pins' (connecting A-G and DP to Arduino pins), and set 'resistors_on_segments' to true. Set 'hardware_config' to 'COMMON_CATHODE' or 'COMMON_ANODE'. Use the 'begin' function to initialize and 'setBrightness' as needed. In the loop, use 'setNumber' to display a value, and 'refreshDisplay'.

Multi-Digit Seven Segment Displays
0:10:52

Multi-digit displays differ from single-digit ones as a single pin controls the same segment across all digits. They also have 'digit pins' (D1-D4) which are common terminals for each digit's LEDs. By switching power to these digit pins, individual digits can be turned on or off.

Building a Thermistor Circuit with a Four Digit Display
0:12:21

To build a circuit using a four-digit seven-segment display to show thermistor readings: connect one side of a 100 kOhm thermistor to 5V, the other side to a 100 kOhm resistor forming a voltage divider, and the resistor to ground. Connect the voltage divider's midpoint to analog pin A0. For a 5461AS display, each digit pin needs its own 1 kOhm current limiting resistor in series with the Arduino pin.

Programming a Four Digit Seven Segment Display with a Thermistor
0:13:25

Initialize the display in the setup section by setting 'num_digits' to 4 and defining the 'digit_pins' array with associated Arduino pins (D1-D4). Define 'segment_pins' for A-G segments and DP, set 'resistors_on_segments' to true, and 'hardware_config' to 'COMMON_CATHODE' or 'COMMON_ANODE'. Use the 'begin' function. In the loop, read the thermistor, convert it to Celsius, and store it in a variable (e.g., TC). Use 'setNumber(TC, 2)' to print the temperature with a decimal point two digits from the right. To avoid flickering, update the display every few hundred milliseconds using a 'millis()' based timer.

Recently Summarized Articles

Loading...