Project tutorial

Multiple LED Display Module © CC BY-NC-ND

I created the Multiple LED Display Module to make prototypes faster and more easily using different types of displays (digital/LED matrix).

  • 3,487 views
  • 6 comments
  • 18 respects

Components and supplies

Apps and online services

About this project

Hello everyone,

One of the things I love working with the Arduino is LED monitors. It does not matter if they are with 7 segments or array of points and I've done many different designs using them. They are very interesting because there is a kind of "magic" in how they work. What you see on monitors are optical illusions, only possible due to Persistence of Vision (POV)!

But the screens have a lot of pins to connect to the Arduino (or other microcontroller) and the best solution is to apply the techniques of data multiplexing to minimize the use of their ports. With this solution, each segment of LEDs will only be activated for a few moments (milliseconds), but this repetition in so many times per second (high frequency) creates the illusion of a complete image.

This is the same effect of the video screen you are using now to read this page. Personally, the most interesting thing to do is to develop the logic, the code to display the correct information according to your hardware. A single prototype using displays of LED requires a lot of time to mount all the components on one board and includes many wire connections.

To simplify the assembly process I have developed a Display LED Module for multiple purposes using simple and usual electronic components in the Arduino world.

I know there are many different kind of LED displays on the market running with I2C, for example, that greatly simplify the construction and code of a prototype, but in this case my option was to develop a complete personal module that works with standard components like 74HC595 (Multiplexer IC) and ULN2803 (drivers).

By using these components, I have more control over code development, I get more robustness and reliability with correct hardware components. With this module you can work with dot matrix with two color LEDs in two standard sizes (large and small) and also you can control a 7 segments x 4 digit display that are very common and easy to find in the market.

It also includes an additional feature for working with these cascading modules in a serial mode (different data on displays) or in parallel mode (same data on displays). So let's see how this module can work and help your developments!

Greetings,

Luís Antonio

Video #1
Video #2

1. Components

PCB (Printed Circuit Board)

  • 74HC595 (03 x)
  • ULN2803 (02 x)
  • Transistor PNP - BC327 (08 x)
  • Resistor 150 Ohms (16 x)
  • Resistor 470 Ohms (08 x)
  • Capacitor 100 nF (03 x)
  • IC Socket 16 pins (03 x)
  • IC Socket 18 pins (02 x)
  • Pin connector female - 6 pins (8 x)
  • Pin headers 90º (01 x)
  • Pin headers 180º (01 x)
  • Conector Borne KRE 02 pins (02 x)
  • PCB (01 x) - Manufactured

Others

  • Arduino Uno R3 / Nano / similar
  • LED Display 04 Digit x 7 Segments - (Common Anode)
  • LED Dot Matrix Dual Color (Green & Red) - (Common Anode)

Important notes:

I've put the datasheet of all the most important components I've just used for reference but you should check the datasheet for your own components before using them. This module is designed and tested to use only Common Anode displays.

2. First Prototypes

My first prototype was built into a breadboard to test the circuit. After that I made another prototype using a universal board as shown in the photos. This type of board is interesting to produce a quick prototype, but you realize that it still holds a lot of wires.

It is a functional but not so elegant solution compared to a manufactured end PCB (the blue board).

3. Printed Circuit Board (PCB)

I designed this PCB using a dedicated software (DipTrace - Free Version) to produce a dual layer board and I made several different versions before this latter. At first I had a version for each type of displays and after all I decided to combine them into just one version.

Project Targets:

  • Simple and useful for prototypes.
  • Easy and expandable installation.
  • Able to use 3 different types of displays.
  • Maximum width of PCB must be the same of LED matrix.
  • Maximum length at 100 mm to minimize PCB production costs.
  • Apply traditional components instead of SMD to avoid further difficulties during the manual welding process.
  • The board must be modular to be connected with other cascade boards.
  • Serial or parallel output to other boards.
  • Multiple boards should only be controlled by an Arduino.
  • Only 3 data wires for the Arduino connection.
  • 5V external power connection.
  • Ensure greater electrical robustness by applying transistors and drivers (ULN2803) to control the LEDs.

PCB manufacturing:

After finishing the project, I sent it to a PCB manufacturer in China (PCBWay) after much research with different local suppliers and in different countries. The main issue was related to the number of boards versus cost because I only need some of them. Finally I decided to place an order for only 10 PCBs.

After only 3 days the PCBs were manufactured and shipped to me crossing the world in just 4 days.

The results were excellent! Within a week after the purchase order the PCBs were in my hands and I was really impressed with the high quality of them and with the speed of the whole process!

4. Programming

For programming, you should keep in mind some important concepts about hardware design and the 74HC595 shift register. The main function of the 74HC595 is to turn 8-Bit Serial-In into 8 Parallel-Out Shift. All serial data enters the pin 14 and in each clock signal the bits go to the respective parallel output pins (Qa to Qh).

If you continue to send more data, the bits will be moved one by one to Pin # 9 (Qh ') as serial output again and because of this feature you can put other cascading chips together.

Important:

In this project, we have three ICs of 74HC595. The first two work to control the columns (with POSITIVE logic) and the last to control the lines (with logic NEGATIVE due to the operation of the PNP transistors).

Positive logic means that you must send a HIGH (+ 5V) level signal from Arduino and negative logic means that you must send a LOW (0V) level signal.

LED Matrix

  • The first is for the cathode outputs of red (8 x) LEDs >> RED COLUMN (1 to 8).
  • The second is for the output of the Green LED cathodes (8 x) >> GREEN COLUMN (1 to 8).
  • The last one is for the anode outputs of all the LEDs (08 x Red & Green) >> ROWS (1 to 8).

For example, if you want to connect only the green LEDs in column 1 and row 1, you must send the following serial data string:

1º) Rows ~10000000 (only the first line is set to on) - The symbol ~ is to invert all bits from 1 to 0 and vice-versa.

2º) Green Column 10000000 (only the first column of Green LED is on)

3º) Red Column 00000000 (all Red LEDs columns are off)

Arduino statements:

shiftOut(dataPin, clockPin, LSBFIRST, ~B10000000);  //Negative logic for the lines
shiftOut(dataPin, clockPin, LSBFIRST, B10000000); //Positive logic for the Green columns
shiftOut(dataPin, clockPin, LSBFIRST, B00000000); //Positive logic for the Red columns

Note:

You can also combine the two LEDs (Green & Red) to produce YELLOW color as follows:

shiftOut(dataPin, clockPin, LSBFIRST, ~B10000000);
shiftOut(dataPin, clockPin, LSBFIRST, B10000000); 
shiftOut(dataPin, clockPin, LSBFIRST, B10000000);

7 Segments display

For these type of display the sequence is the same. The only difference is that you do not need to use the Green LEDs.

1º) DIGIT (1 to 4 from left to right)

~10000000 (set digit #1)

~01000000 (set digit #2)

~00100000 (set digit #3)

~00010000 (set digit #4)

2º) NOT USED

00000000 (all bits set to zero)

3º) SEGMENTS (A to F and DP - check your display datasheet)

10000000 (set segment A)

01000000 (set segment B)

00100000 (set segment C)

00010000 (set segment D)

00001000 (set segment E)

00000100 (set segment F)

00000010 (set segment G)

00000001 (set DP)

Arduino example to set Display #2 with the number 3:

shiftOut(dataPin, clockPin, LSBFIRST, ~B01000000);   //Set DISPLAY 2 (Negative logic)
shiftOut(dataPin, clockPin, LSBFIRST, 0);  //Set data to zero (not used)
shiftOut(dataPin, clockPin, LSBFIRST, B11110010); //Set segments A,B,C,D,G)

Finally, applying this process you can control any LED of your display and also you can create any special characters you need.

5. Testing

Here are two programs as examples of functionality of the Display Module.

1) Countdown display (from 999.9 seconds to zero)

2) Dot Matrix (Digits 0 to 9 & Alphabet A to Z)

3) Digital Clock RTC in LED Display of 4 Digits and 7 Segments

Note: The latter is an update to my Digital Clock project already featured on Hackster.

6. Next Steps

This module will be useful for me in all future projects that require some LED display application. As next steps, I will put together some more boards to work with them in cascade mode and I am also developing a library to further simplify the programming.

I hope you have enjoyed this project. Please send me your comments because this is important to improve the project and information of this tutorial.

Schematics

BC327 - PNP Transistor
Transistor PNP of low power
ULN2803A - Darlington Transistor Array
SN74HC595 - 8 Shift Register with Output Latches (3 state)
LED Display - 04 Digits x 07 Segments (Common Anode)
LED Matrix 8x8 - Dual Color - Large
LED Matrix 8x8 - Dual Color - Small
PCB (front side) - Multiple LED Display Module
PCB (bottom side) - Multiple LED Display Module

Code

Multiple_LED_Display_Module_Display_4Dig_X_7Seg.inoArduino
Example for display 4 Dig x 7 Seg (countdown watch)
/*       Multiple LED Display Module - V1.0
         LED Display - 4 Digits x 7 Segments
             by LAGSILVA - 21.May.2016
*/

int clockPin = 8; // Pin 8 of Arduino connected in the pin 11 of 74HC595 (Clock)
int latchPin = 9; // Pin 9 of Arduino connected in the pin 12 of 74HC595 (Latch)
int dataPin = 10; // Pin 10 of Arduino connected in the pin 14 of 74HC595 (Data)

int PWMPin = 11;  // Pin 11 of Arduino connecte do pin PWM to control the Brightness of Display

int k, milhar, centena, dezena, unidade;
unsigned long ti;

//Digits Matrix - 0 a 9

byte num[] = {

  B11111100,  //Zero
  B01100000,  //One
  B11011010,  //Two
  B11110010,  //Three
  B01100110,  //Four
  B10110110,  //Five
  B10111110,  //Six
  B11100000,  //Seven
  B11111110,  //Eight
  B11110110,  //Nine

};


void setup() {

  pinMode(latchPin, OUTPUT); // Define the 3 digital pins as output
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(PWMPin, OUTPUT);

}


void loop() {

  for (k = 9999; k >= 0; k--) {

    milhar = k / 1000;
    centena = (k - milhar * 1000) / 100;
    dezena = (k - milhar * 1000 - centena * 100) / 10;
    unidade = k % 10;

    ti = millis(); // Initial time for the Timer of Hour/Time

    while ((millis() - ti) < 100) {

      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, LSBFIRST, ~B10000000);     //Set DISPLAY 1
      shiftOut(dataPin, clockPin, LSBFIRST, 0);
      shiftOut(dataPin, clockPin, LSBFIRST, num[milhar]);
      digitalWrite(latchPin, HIGH);

      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, LSBFIRST, ~B01000000);     //Set DISPLAY 2
      shiftOut(dataPin, clockPin, LSBFIRST, 0);
      shiftOut(dataPin, clockPin, LSBFIRST, num[centena]);
      digitalWrite(latchPin, HIGH);

      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, LSBFIRST, ~B00100000);     //Set DISPLAY 3
      shiftOut(dataPin, clockPin, LSBFIRST, 0);
      shiftOut(dataPin, clockPin, LSBFIRST, num[dezena]);
      digitalWrite(latchPin, HIGH);

      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, LSBFIRST, ~B00010000);     //Set DISPLAY 4
      shiftOut(dataPin, clockPin, LSBFIRST, 0);
      shiftOut(dataPin, clockPin, LSBFIRST, num[unidade]);
      digitalWrite(latchPin, HIGH);

      digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, LSBFIRST, ~B00100000);     //Set DISPLAY 3
      shiftOut(dataPin, clockPin, LSBFIRST, 0);
      shiftOut(dataPin, clockPin, LSBFIRST, B00000001); //Set LEDs of single dot
      digitalWrite(latchPin, HIGH);

    }

  }

}
Multiple_LED_Display_Module_Dot_Matrix.inoArduino
Example for LED Matrix 8x8 (Large or Small size)
/*         Multiple LED Display Module - V1.0
          8x8 LED Matrix Bicolor (Large & Small)
               by LAGSILVA - 21.May.2016
*/

int clockPin = 8; // Pin 8  of Arduino connected at pin 11 of 74HC595 (Clock)
int latchPin = 9; // Pin 9  of Arduino connected at pin 12 of 74HC595 (Latch)
int dataPin = 10; // Pin 10 of Arduino connected at pin 14 of 74HC595 (Data)

int PWMPin = 11;  // Pin 11 of Arduino connected at pin PWM to control the Brightness of Display

int num, lin, x;
unsigned long ti;

//Digits Matrix - 0 to 9 and A to Z

byte car[] = {


  16, 48, 80, 16, 16, 16, 124, 0,         //1
  56, 68, 8, 16, 32, 64, 124, 0,          //2
  56, 68, 4, 24, 4, 68, 56, 0,            //3
  8, 72, 72, 124, 8, 8, 8, 0,             //4
  124, 64, 88, 36, 4, 68, 56, 0,          //5
  56, 64, 64, 56, 68, 68, 56, 0,          //6
  124, 4, 8, 16, 16, 16, 16, 0,           //7
  56, 68, 68, 56, 68, 68, 56, 0,          //8
  56, 68, 68, 56, 4, 4, 56, 0,            //9
  56, 76, 84, 84, 84, 100, 56, 0,         //0

  56, 68, 68, 124, 68, 68, 68, 0,         //A
  120, 36, 36, 60, 36, 36, 120, 0,        //B
  56, 68, 64, 64, 64, 68, 56, 0,          //C
  120, 36, 36, 36, 36, 36, 120, 0,        //D
  124, 64, 64, 120, 64, 64, 124, 0,       //E
  124, 64, 64, 120, 64, 64, 64, 0,        //F
  56, 68, 64, 92, 68, 68, 56, 0,          //G
  68, 68, 68, 124, 68, 68, 68, 0,         //H
  56, 16, 16, 16, 16, 16, 56, 0,          //I
  60, 8, 8, 8, 72, 72, 56, 0,             //J
  68, 72, 80, 96, 80, 72, 68, 0,          //K
  64, 64, 64, 64, 64, 64, 124, 0,         //L
  68, 108, 84, 84, 68, 68, 68, 0,         //M
  68, 68, 100, 84, 76, 68, 68, 0,         //N
  56, 68, 68, 68, 68, 68, 56, 0,          //O
  120, 36, 36, 56, 32, 32, 32, 0,         //P
  56, 68, 68, 68, 84, 72, 52, 0,          //Q
  120, 36, 36, 56, 48, 40, 36, 0,         //R
  56, 68, 64, 56, 4, 68, 56, 0,           //S
  124, 16, 16, 16, 16, 16, 16, 0,         //T
  68, 68, 68, 68, 68, 68, 56, 0,          //U
  68, 68, 68, 68, 68, 40, 16, 0,          //V
  68, 68, 68, 84, 84, 108, 68, 0,         //W
  68, 68, 40, 16, 40, 68, 68, 0,          //X
  68, 68, 40, 16, 16, 16, 16, 0,          //Y
  124, 4, 8, 16, 32, 64, 124, 0,          //Z

};


void setup() {

  // Define the 4 digital pins as output
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(PWMPin, OUTPUT);

}


void loop() {

  for (num = 0; num <= 35; num++) {

    ti = millis();                                                                   // Initial time for the Timer of Hour/Time

    while ((millis() - ti) < 800) {

      //analogWrite(PWMPin, 10);                                                     //Set the bright of display via PWM(0 a 255 = 100% a 0% de brilho)

      //Color RED
      if (num % 3 == 1) {
        for (lin = 0; lin <= 7; lin ++) {
          x = 0;
          digitalWrite(latchPin, LOW);
          shiftOut(dataPin, clockPin, MSBFIRST, ~bitSet(x, lin));                    //Set Line (top view from left to right)
          shiftOut(dataPin, clockPin, LSBFIRST, 0);                                  //Set Column Green
          shiftOut(dataPin, clockPin, LSBFIRST, car[num * 8 + lin]);                 //Set Column Red
          digitalWrite(latchPin, HIGH);
        }
      }

      //Color GREEN
      if (num % 3 == 2) {
        for (lin = 0; lin <= 7; lin ++) {
          x = 0;
          digitalWrite(latchPin, LOW);
          shiftOut(dataPin, clockPin, MSBFIRST, ~bitSet(x, lin));                    //Set Line (top view from left to right)
          shiftOut(dataPin, clockPin, LSBFIRST, car[num * 8 + lin]);                 //Set Column Green
          shiftOut(dataPin, clockPin, LSBFIRST, 0);                                  //Set Column Red
          digitalWrite(latchPin, HIGH);
        }
      }

      //Color YELLOW (Green & Red)
      if (num % 3 == 0) {
        for (lin = 0; lin <= 7; lin ++) {
          x = 0;
          digitalWrite(latchPin, LOW);
          shiftOut(dataPin, clockPin, MSBFIRST, ~bitSet(x, lin));                    //Set Line (top view from left to right)
          shiftOut(dataPin, clockPin, LSBFIRST, car[num * 8 + lin]);                 //Set Column Green
          shiftOut(dataPin, clockPin, LSBFIRST, car[num * 8 + lin]);                 //Set Column Red
          digitalWrite(latchPin, HIGH);
        }
      }

    }
  }
}
Digital_Clock_V1_English_Display_Module_Version.inoArduino
Example of Digital Clock using the LED Display Module
/*      Digital Clock (with Multiple LED Display Module)
     Digital Clock with LED Display - 4 Digits x 7 Segments
        Display Time, Temperature and Relative Humidity
                     V1.2 - 22.May.2016

 *** Notes of revision V1.1 ***
     - Translated the remarks/comments into English
     - Added optional statements to show the Temperature in Fahrenheit Degrees (F)

*/

#include <Time.h>        //Time Library
#include <DS1307RTC.h>   //Real Time Clock Library
#include <Wire.h>        //Auxiliary Library for DS1307RTC (Real-Time Clock) - Pins to Arduino UNO: A4 (SDA), A5 (SCL)
#include <dht11.h>       //Temperature and Humidity Library
dht11 DHT;               //Define the name DHT for the sensor of Temperature and Humidity
#define DHT11_PIN 11     //Sensor DHT11 conected to the pin 11 on Arduino

int clockPin = 8; // Pin 8 of Arduino connected in the pin 11 of 74HC595 (Clock)
int latchPin = 9; // Pin 9 of Arduino connected in the pin 12 of 74HC595 (Latch)
int dataPin = 10; // Pin 10 of Arduino connected in the pin 14 of 74HC595 (Data)

int hora, minuto, temp, umid;
int unidadeHora, unidadeMinuto, dezenaHora, dezenaMinuto;
int unidadeTemp, dezenaTemp, unidadeUmid, dezenaUmid;
unsigned long ti;
int chk; //Variable to read the sensor DHT11

//Digits Matrix - 0 a 9
byte num[] = {

  B11111100,  //Zero
  B01100000,  //One
  B11011010,  //Twon
  B11110010,  //Three
  B01100110,  //Four
  B10110110,  //Five
  B10111110,  //Six
  B11100000,  //Seven
  B11111110,  //Eight
  B11110110,  //Nine

};


void setup() {

  pinMode(latchPin, OUTPUT); // Define the 3 digital pins as output
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);

  setSyncProvider(RTC.get);   // Update the time with data of RTC (Real Time Clock)

  //setTime(11, 45, 00, 17, 06, 2016);

}


void loop() {

  ti = millis(); // Initial time for the Timer of Hour/Time

  while ((millis() - ti) < 3000) { //Timer of 3 seconds to show the Hour

    hora = hour();
    minuto = minute();
    unidadeHora = hora % 10;
    dezenaHora = hora / 10;
    unidadeMinuto = minuto % 10;
    dezenaMinuto = minuto / 10;

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B10000000);                  //Set DISPLAY 1 (top view from left to right)
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaHora]);             //Set the Hour (ten)
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B01000000);                  //Set DISPLAY 2
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, num[unidadeHora]);            //Set the Hour (unit)
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B00100000);                  //Set DISPLAY 3
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaMinuto]);           //Set the Minute (ten)
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B00010000);                  //Set DISPLAY 4
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, num[unidadeMinuto]);          //Set the Minute (unit)
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B01000000);                  //Set LED of dots
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, B00000001);                   //Set LEDs of double dots
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B00000000);                  //Set Display 4
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, 0);                           //Reset the DISPLAY 4 (to avoid some flicking)
    digitalWrite(latchPin, HIGH);

  }
  delay(500);  //Wait for half second before go ahead to show the next feature


  chk = DHT.read(DHT11_PIN);  //Read data of sensor DHT11

  ti = millis(); //Initial time for the Timer of Temperature
  temp = DHT.temperature; //Reading the Temperature in Celsius degree (C)

  //Optional calculation of Temperature in Fahrenheit degrees (F). Remove the comments ("//") of following statement to use it.
  //temp = (temp*18+5)/10+32;

  while ((millis() - ti) < 3000) { //Timer of 3 seconds for the Temperature

    unidadeTemp = temp % 10;
    dezenaTemp = temp / 10;

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B10000000);                  //Set DISPLAY 1 (top view from left to right)
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaTemp]);            //Set the Temperature (ten)
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B01000000);                  //Set DISPLAY 2
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, num[unidadeTemp]);           //Set the Temperature (unit)
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B00100000);                  //Set DISPLAY 3
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, B11000110);                   //Set the degree symbol []
    digitalWrite(latchPin, HIGH);

    //Show the Temperature in Celsius degrees (C)
    //Set the following statements as comments with "//" to show the Temperature in Fahrenheit (F)
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B00010000);                  //Set DISPLAY 4
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, B10011100);                   //Set the symbol of Celsius [C]
    digitalWrite(latchPin, HIGH);

    //Show the Temperature in Fahrenheit degrees (F)
    //Remove the indication of comments "//" on following statements to show the Temperature in Fahrenheit (F)
    /*digitalWrite(latchPin, LOW);
      shiftOut(dataPin, clockPin, LSBFIRST, ~B00010000);                //Set DISPLAY 4
      shiftOut(dataPin, clockPin, LSBFIRST, 0);
      shiftOut(dataPin, clockPin, LSBFIRST, ~B10001110);                //Set the symbol of Fahrenheit [F]
      digitalWrite(latchPin, HIGH);*/

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B00000000);                  //Set Display 4
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, 0);                           //Reset the DISPLAY 4 (to avoid some flicking)
    digitalWrite(latchPin, HIGH);

  }
  delay(500);  //Wait for half second before go ahead to show the next feature

  ti = millis(); //Initial time for the Timer of Humidity
  umid = DHT.humidity; //Reading the Humidity

  while ((millis() - ti) < 3000) { //Timer of 3 seconds for the Humidity

    unidadeUmid = umid % 10;
    dezenaUmid = umid / 10;

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B10000000);                  //Set DISPLAY 1
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaUmid]);             //Set the Humidity (ten)
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B01000000);                  //Set DISPLAY 2
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, num[unidadeUmid]);            //Set the Humidity (unit)
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B00100000);                  //Set DISPLAY 3
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, B11000110);                   //Set the upper symbol of percentage [%] of Humidity
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B00010000);                  //Set DISPLAY 4
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, B00111010);                   //Set the lower symbol of percentage [%] of Humidity
    digitalWrite(latchPin, HIGH);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, LSBFIRST, ~B00000000);                  //Set Display 4
    shiftOut(dataPin, clockPin, LSBFIRST, 0);
    shiftOut(dataPin, clockPin, LSBFIRST, 0);                         //Reset the DISPLAY 4 (to avoid some flicking)
    digitalWrite(latchPin, HIGH);
  }
  delay(500);  //Wait for half second before to restart*/

}

Comments

Similar projects you might like

Sigfox Forest Fire Detector

Project tutorial by Louis Moreau

  • 2,242 views
  • 2 comments
  • 14 respects

Magic VR Hat

Project showcase by Ron Dagdag and Johnathan Hottell

  • 616 views
  • 3 comments
  • 8 respects

TV Tee Shirt

Project showcase by Maddy

  • 3,844 views
  • 1 comment
  • 12 respects

Race Car Dashboard (Online Connectivity)

Project showcase by Team Jatayu

  • 1,976 views
  • 4 comments
  • 7 respects
Add projectSign up / Login