The Chief Engineer of  ICStation R&D department Jack is using ICStation UNO R3 compatible with Arduino to successfully make the 74HC595 drive four digital LED display. We will share the schematic diagram, wiring diagram,making steps,download Diagram and  also the useful program code designed by ICStation.

When you develop a project, it often needs to make IO expansion.The 74HC595 shifting register is a good choice. Following will introduce you that use two pieces 74HC595 to realize the display system of four digital LED(of course, can also realize 8 digital LED display) .It only uses three IO (PIN2,3, 5) of Arduino.

Components list:
1. ICStation UNO development board  $12.69 ( Or Arduino UNO development board)
2.2PCS 74HC595
3.DuPont line: 30PCS
4.four digital LED display with the same anode
5. 20 PCS 20mm pin header
6.Bread board
7.USB Cable
8.4PCS 47Ω resistance

Step 1: Schematic Diagram

Step 2: The Wiring Diagram:

Step 3: To Build the Circuit According to the Schematic Diagram

Because we only do testing, maybe it is not practical.If you want it to have practical use, you should weld it manually which will make the circuit more stable. When you build the circuit by hand the pin header is needed which will help you to change the DuPont line to jumper wires immediately.

Step 4: Download Diagram

Step 5: Code for Your Reference

Designed by ICStation

#define   HC_DATA_H digitalWrite(data, HIGH)   // data line output high
#define   HC_DATA_L digitalWrite(data, LOW)   //date line output low
#define   HC_RCK_H digitalWrite(rck, HIGH)   // rck output high
#define   HC_RCK_L digitalWrite(rck, LOW)  // rck output low
#define   HC_SCK_H digitalWrite(sck, HIGH)   // sck output high
#define   HC_SCK_L digitalWrite(sck, LOW)  // sck output low

unsigned char LED_BCD[16] ={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e };  //common  anode digital tube BCD code
//Define the pin
int data =2;  
int rck =3;
int sck =5;
// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(data, OUTPUT);
  pinMode(rck, OUTPUT);
  pinMode(sck, OUTPUT);
  pinMode(sclr, OUTPUT);


// the loop routine runs over and over again forever:
void loop() {
  unsigned char dopp =0;
  for( unsigned char i=0; i < 4; ++i)
  if(i ==3) dopp =1;
else dopp =0;
  HC_data_analyze(i,i,dopp);  //Nixie Tube display


void HC_data_analyze(char LED_number,unsigned char LED_display,unsigned char LED_dp)
  // data analyse
  unsigned int HC_DISP = 0,HC_LEDCODE,HC_LEDCODE_temp=0;
  if(LED_display > 15) LED_display = 0;
  HC_LEDCODE = LED_BCD[LED_display] ;  //get BCD code
  for(unsigned char i=0; i < 8;++i)
     HC_LEDCODE_temp <<=1;
     if(HC_LEDCODE&0x01) HC_LEDCODE_temp |= 0x01;
     HC_LEDCODE >>=1;
    if(LED_dp)  HC_LEDCODE_temp &= 0xfe;
     case 0: HC_DISP |= 0x8000;break;
     case 1: HC_DISP |= 0x4000;break;
     case 2: HC_DISP |= 0x2000;break;
     case 3: HC_DISP |= 0x1000;break;
  write_74HC595(HC_DISP);  //74HC595 shifting register  data transfer

void write_74HC595( unsigned int data_a)  //communication with 74HC595
  char look =0;
  HC_RCK_L;  //latch open

  for (;look < 16; ++look)
    if(data_a&0x0001) {HC_DATA_H;}
    else {HC_DATA_L;}

    data_a >>= 1;

This file  is download from ICstation BBS
If you have any question, please visit our BBS:
<p>Hi Friend! the following error appears:<br>'sclr' was not declared in this scope<br>Thank you</p>
<p>I get the same error. If I comment it out, the code runs, but the LED just flashes instead of working.</p>
<p>I wrote arduino library for this display with two TM74HC595</p><p>https://github.com/kostarev/TM74HC595-4dig-display/archive/master.zip</p>
<p>Thank you, Valery. Your library works wonderfully with the module 4-digits.<br>Simple and comprehensible to use. I am a 5-minute solved his problem by using your library.<br>Reproduced in the article code - do not understand what. Back in the the code was a crutch for beginners! I looked for 2 hours, and did not understand how to derive other data in addition to the digits &quot;3210&quot;, despite the fact that I have the initial programming skills. This paper is copied on multiple resource, despite the fact that it is completely useless. The usefulness of this article only to find your library.</p>
<p>Last version of my library</p><p>https://sites.google.com/site/fajlydlablogakotavpalto/123/TM74HC595-4dig-display.zip?attredirects=0&amp;d=1</p>
<p>You've missed out one wire to connect one of the 595 pin 9 to pin 14 of another.</p>
<p>the code 'pinMode(sclr, OUTPUT); ' must be commented.</p><p>it is better to use 'ShitOut()' function.</p>
<p>Amusing spelling mistake :)</p>
<p>Thank you for your valuable advice!</p><p>The following is the code that has been changed.</p><p>-------------------------------------------------------------------------------------------------------</p><p>#define HC_DATA_H digitalWrite(data, HIGH) // data line output high<br>#define HC_DATA_L digitalWrite(data, LOW) //date line output low<br>#define HC_RCK_H digitalWrite(rck, HIGH) // rck output high<br>#define HC_RCK_L digitalWrite(rck, LOW) // rck output low<br>#define HC_SCK_H digitalWrite(sck, HIGH) // sck output high<br>#define HC_SCK_L digitalWrite(sck, LOW) // sck output low<br><br><br> <br>unsigned char LED_BCD[16] ={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e }; //common anode digital tube BCD code<br>//Define the pin<br>int data =2; <br>int rck =3;<br>int sck =5;<br>// the setup routine runs once when you press reset:<br>void setup() { <br> // initialize the digital pin as an output.<br> pinMode(data, OUTPUT); //initial data <br> pinMode(rck, OUTPUT); //initial rck<br> pinMode(sck, OUTPUT); //initial sck<br> pinMode(sclr, OUTPUT); //initial sclr<br><br> <br>}<br><br>// the loop routine runs over and over again forever:<br>void loop() {<br> <br> unsigned char dopp =0;<br> for( unsigned char i=0; i &lt; 4; ++i)<br> {<br> if(i ==3) dopp =1; <br> else dopp =0;<br> LED_display(i,i,dopp); //Nixie Tube display<br> }<br><br><br><br>}<br><br>void LED_display(char LED_number,unsigned char LED_display,unsigned char LED_dp)<br>{<br> // data analyse<br> unsigned int hc_disp = 0,hc_ledcode,hc_ledcode_temp=0;<br> <br> if(LED_display &gt; 15) LED_display = 0;<br> hc_ledcode = LED_BCD[LED_display] ; //get BCD code<br> for(unsigned char i=0; i &lt; 8;++i)<br> {<br> hc_ledcode_temp &lt;&lt;=1;<br> if(hc_ledcode&amp;0x01) hc_ledcode_temp |= 0x01;<br> hc_ledcode &gt;&gt;=1;<br> <br> }<br> if(LED_dp) hc_ledcode_temp &amp;= 0xfe; <br> hc_disp = hc_ledcode_temp;<br> <br> switch(LED_number)<br> {<br> case 0: hc_disp |= 0x8000;break;<br> case 1: hc_disp |= 0x4000;break;<br> case 2: hc_disp |= 0x2000;break;<br> case 3: hc_disp |= 0x1000;break;<br> }<br> <br> write_74HC595_ShiftOUTPUT(hc_disp); //74HC595 shifting register data transfer<br> <br> <br>}<br><br>//shift output to 74HC595<br>void write_74HC595_ShiftOUTPUT( unsigned int data_a) //communication with 74HC595<br>{<br> char look =0;<br> HC_RCK_L; //latch open<br> HC_SCK_L;<br><br><br> <br> for (;look &lt; 16; ++look)<br> {<br> if(data_a&amp;0x0001) {HC_DATA_H;}<br> else {HC_DATA_L;}<br> HC_SCK_H;<br><br> HC_SCK_L;<br> data_a &gt;&gt;= 1;<br> }<br> HC_RCK_H;<br>}</p><p>----------------------------------------------------------------------------------------------------------------</p>

About This Instructable




Bio: www.ICStation.com is a top store of electronic, which specializes in all kinds of IC products, such IC accessories, Module, Robots, Development Board, Transistor ... More »
More by ICStation:Hexapod4 Spider Robot Instruction Manual The NRF24L01 Wireless Motor Speed Control System with Arduino The Wireless Single Point Calling System with Arduino 
Add instructable to: