ESP8266 NodeMCU – Usinging 74HC595N Shift Register

In this tutorial, we will learn how to control a 74HC595N Shift Register. Understanding the basic working principles of the 74HC595 and its usefulness, we can now begin to apply it in our projects.

Parts Required

To build the global setup you must have the following parts:

Note: You do not need to have a NodeMCU board nor an ESP8266 to follow this tutorial. I am using this board because it is very famous and also because, I will post future tutorials using wifi communications. In order to use other boards, you just have to change the pin number.

Shift Register 74HC595N

Figure 1

A shift register is a circuit you can use to control many outputs (8 here) at the same time while only using a few pins (3 here) of your board. It works on Serial IN Parallel OUT protocol. It receives data serially from the microcontroller and then sends out this data through parallel pins.

Thankfully Arduino provide a helper function specifically for shift registers called shiftOut(), which allows to simply shift the bits in one call. The shiftOut() function takes four parameters; the first two are the pins to use for Data and Clock respectively. The third parameter specifies which end of the data you want to start at. We are going to start with the right most bit, which is referred to as the ‘Least Significant Bit’ (LSB).
The last parameter is the actual data to be shifted into the shift register, which in this case is a byte variable that you will fill with the respective leds you to turn on or off.

Figure 2

As you can see in figure 2, pins marked as Q0-Q7 (15 and 1-7) are the output pins. Pin16 is connected to (VCC) 3.3V, whereas pins 8 and 13 are connected to ground and pin 10 to (VCC) 3.3V. Finally pins 14, 12 and 11 are data, latch and clock pins and are the ones used by NodeMCU to pass data to the shift register.

For further understanding about the logic and function tables of this circuit, you can visit the datasheet.


Figure 3

We will start by placing the shift register in our breadboard, ensuring that each of its sides are placed on a separate side of the breadboard.

Then, we will connect pins 16 (VCC) to the 3.3V pin on the NodeMCU and connect pins 8 (GND) to its Gnd pin. This should keep the shift register into the normal working mode.

Next, we have to connect the three pins needed to control the shift register, which, in this case, are the following:

  • Pin 11 (SRCLK) of the shift register to pin D5 on the NodeMCU;
  • Pin 12 (RCLK) of the shift register to pin D8 on the NodeMCU;
  • Pin 14 (SER) of the shift register to pin D7 on the NodeMCU.

Finally, we just have to connect all the output pins (QA-QH) to each one of our LEDs, ensuring that a 220Ω resistor is placed between the output pin and the LEDs, in order to limit the current flowing through them, and that the cathodes of the LEDs are connected to ground.

The result of the previously described wiring process should be similar to the illustration shown figure 4.



To see a video of the setup working, you can visit our youtube channel and watch the video.

2 thoughts on “ESP8266 NodeMCU – Usinging 74HC595N Shift Register

  1. I am looking for help for a DIY clock based on an ESP32 Devkit C with a 74HC595N. There are lots of examples using strips. I have 300 individual 3mm white LEDs. It’s easy enough to solder a bunch together to make up 4 x 7 segments. It is difficult to find information on power and resistors requirements. Some say to use 220 ohm on each LED and some say on each segment. Some say ESP32 5.5v will power it, some say it will need 12v. I hope ESP32 will power the 96 required LEDs.

Leave a Reply

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