Serial seven segment LED display shield

Seven segment LED displays are brighter, more attractive, and provide a far viewing distance as well as a wider viewing angle compared to LCD displays. This project describes a serial seven segment LED display shield for Arduino Uno or compatible boards. The shield consists of eight 0.56″ seven segment displays that are driven by one MAX7219 chip. The shield also features a light dependent resistor (LDR) to implement adaptive brightness control to the LED displays. The LDR output can be fed to A0 or A1 analog input channel of Arduino to read the surrounding illumination level. Arduino can then use that information to adjust the brightness of the LED displays. A demo code and Eagle CAD files are also provided in the latter part of the article.

Serial seven segment LED display shield

Serial seven segment LED display shield

MAXIM’s MAX7219 display driver chip provides a 3-wire serial (SPI) interface to drive up to eight seven-segment LED displays (common-cathode type). Included on the chip are a BCD decoder, multiplex scan circuitry, segment and digit drivers, and an 8×8 static RAM to store the digit values. The maximum segment current for all LEDs is set through an external resistor. However, the device is also capable of providing a 16-level brightness control of the LED segments via software. For more details on the internal block diagram and operation of MAX7219, read my earlier project Serial 4-digit LED display as well as Maxim’s datasheet.

Display Shield Features

  • Consists of eight seven segment LED displays (0.56″height) arranged in two rows of four digits.
  • Header pins (1) with shunt jumpers for connecting the DIN, CLK, and LOAD pins of MAX7219 to Arduino pins. With jumpers, you can connect DIN to pin 8 or 2, CLK to pin 9 or 3, and LOAD to pin 10 or 4.
  • An LDR circuit for detecting ambient light level. The LDR output can be connected to A0 or A1 pins via jumper J2.

These features are highlighted in the pictures below.

SPI

Serial 7-segment LED display shield features

Jumpers1

Jumpers to select Arduino I/O pins for DIN, CLK, and LOAD pins of MAX7219

Adaptive brightness control

An automatic brightness adjustment is basically a closed loop system that has the capability to assess ambient light and adjust the brightness of the display accordingly. In this shield, a general purpose LDR and a fixed value resistor (10K) are connected in series between the power supply and ground pins to create a voltage dividing network. The resistance of a typical LDR is less than 1 KΩ under bright lighting condition. Its resistance could go up to several hundred KΩ under extremely dark condition. Therefore, the voltage across the 10K resistor increases proportionally with the surrounding illumination. For the given setup, the voltage across the 10K resistor can vary from 0.1V (under dark condition) to over 4.0V (under very bright illumination). Arduino can be programmed to read this analog voltage through its analog input channel (A0 or A1) and then sends out appropriate signals to the MAX7219 driver to adjust the brightness of the seven segment LED displays. I have explained this topic in more detail in one of my previous articles.

Test code

This code detects the ambient light condition by reading the LDR output through A0 channel and adjust the brightness of the LED display. The displays just shows numbers from 0-7. You will need to install the LedControl library.

/* Testing SPI 7-Segment LED display shield
 * Uses LedControl library
 * Demonstrates the use of LDR for auto brightness adjustment.
 */


#include "LedControl.h"

// Arduino Pin 8 to DIN, 9 to Clk, 10 to LOAD, no.of devices is 1
LedControl lc=LedControl(8,9,10,1);
int adc_value, brightness;
void setup()
{
 // Initialize the MAX7219 device
 lc.shutdown(0,false); // Enable display
 lc.setIntensity(0,8); // Set brightness level (0 is min, 15 is max)
 lc.clearDisplay(0); // Clear display register
}
void loop()
{
 
 adc_value = analogRead(A0);
 brightness = adc_value/65; // Divide by 65 to get Maximum Brightness 15.
 lc.setIntensity(0,brightness);
 // Display 1 through 8
 for(int i=0; i<8; i++){
 lc.setDigit(0,i,i,false);
 }// End i
 delay(500);
 
}

 

Making a temperature/humidity meter display with auto brightness adjustment

You can simply insert a DHT22 sensor on the Arduino shield headers (pins GND, 13, 12, 11) to make a temperature/humidiy meter as shown below. The DHT22 pins GND, Data, and VCC connect to the GND, D12, and D11 pins of Arduino. You can then power the DHT22 sensor by simply writing ‘logic 1’ to D11 pin.

Shield2op

Making a simple DHT22 based temperature/humidity meter with adaptive brightness control

op1

For testing, you can insert the DHT22 directly on to the Arduino headers and power the sensor with I/O pins.

 

Eagle CAD files

You can download the Eagle CAD files for this shield from the following link.

Download Eagle CAD files

Related Posts

2 comments

Leave a Reply

Your email address will not be published. Required fields are marked *