A 74HC595 shift register gives a NodeMCU eight extra outputs from three pins — and on the ESP8266, where boot pins and USB serial take most of the header, that matters more than on any other board.
The chip runs from 3V3, with data on D7, clock on D5 and latch on D6 — three pins with no boot role. OE goes to GND and MR to 3V3. After an LED self-test, the sketch scans for Wi-Fi networks and shows the strongest signal as a bar of 0–8 LEDs.
Wiring
| NodeMCU ESP8266 | 74HC595 8-bit shift register (DIP-16) | Wire | Notes |
|---|---|---|---|
| — | Q0 | — | To LED 1 via 220 Ω to GND (not drawn) |
| — | Q1 | — | To LED 2 via 220 Ω (not drawn) |
| — | Q2 | — | To LED 3 via 220 Ω (not drawn) |
| — | Q3 | — | To LED 4 via 220 Ω (not drawn) |
| — | Q4 | — | To LED 5 via 220 Ω (not drawn) |
| — | Q5 | — | To LED 6 via 220 Ω (not drawn) |
| — | Q6 | — | To LED 7 via 220 Ω (not drawn) |
| — | Q7 | — | To LED 8 via 220 Ω (not drawn) |
| 3V3 | VCC | red | Pin 16. 100 nF capacitor from VCC to GND at the chip. |
| GND | GND | black | Pin 8. |
| D7 | DS | green | Pin 14, serial data (GPIO13). |
| D5 | SH_CP | blue | Pin 11, shift clock (GPIO14). |
| D6 | ST_CP | yellow | Pin 12, latch (GPIO12). |
| GND | OE | black | Pin 13, active-LOW output enable — always on. |
| 3V3 | MR | red | Pin 10, active-LOW reset — keep HIGH. |
2–6 V part, 3.3 V board. Power it from the same voltage as your board: 3.3 V on ESP32 and Pico, 5 V on Uno. At 5 V the 74HC595 needs about 3.15 V for a HIGH, so a 3.3 V board driving a 5 V-powered chip is marginal — use a 74HCT595 at 5 V for that.
Board quirks
- The NodeMCU has few truly free GPIOs: D3, D4 and D8 decide the boot mode, D0 has no PWM or interrupts, RX/TX carry USB serial, and D1/D2 are best kept for I2C. A 74HC595 on D5, D6 and D7 turns three safe pins into eight outputs.
- Run the chip from 3V3 so its inputs match the ESP8266’s 3.3 V logic. A 74HC595 on 5 V needs about 3.5 V for a HIGH, which the NodeMCU can’t give reliably — use a 74HCT595 if you need 5 V outputs.
- At 3.3 V the outputs are weaker, so 220 Ω resistors give about 5 mA per red LED. All eight on stays well under the chip’s 70 mA limit.
shiftOut()is plenty fast for LEDs. For long chains, D5/D7 are also the HSPI clock and MOSI pins, so you can switch to hardware SPI without rewiring.- The sketch scans for networks (passively — it never connects) and lights one LED per ~6 dB of the strongest signal: handy for finding the best spot for a router, repeater or outdoor NodeMCU.
Code
// 74HC595 shift register on a NodeMCU (ESP8266) — 8-LED Wi-Fi signal bar from 3 pins.
// VCC → 3V3, GND → GND, DS → D7 (GPIO13), SH_CP → D5 (GPIO14), ST_CP (latch) → D6 (GPIO12),
// OE → GND, MR → 3V3. Q0–Q7 → LED + 220 Ω each → GND.
// Shows the strongest nearby network's signal (passive scan — it never connects).
#include <ESP8266WiFi.h>
constexpr uint8_t DATA_PIN = D7, CLOCK_PIN = D5, LATCH_PIN = D6;
void writeByte(uint8_t value) {
digitalWrite(LATCH_PIN, LOW);
shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, value); // Q7 gets the first bit sent
digitalWrite(LATCH_PIN, HIGH); // outputs change together on this edge
}
void setup() {
pinMode(DATA_PIN, OUTPUT);
pinMode(CLOCK_PIN, OUTPUT);
pinMode(LATCH_PIN, OUTPUT);
writeByte(0);
Serial.begin(115200);
Serial.println();
WiFi.mode(WIFI_STA);
WiFi.disconnect();
for (uint8_t i = 0; i < 8; i++) { // self-test: each LED in turn
writeByte(1 << i);
delay(100);
}
writeByte(0);
Serial.println("74HC595 Wi-Fi bar: scanning every 3 s");
}
void loop() {
int n = WiFi.scanNetworks();
int best = -100;
String name = "-";
for (int i = 0; i < n; i++)
if (WiFi.RSSI(i) > best) {
best = WiFi.RSSI(i);
name = WiFi.SSID(i);
}
// -90 dBm (barely there) → 0 LEDs, -40 dBm (next to the router) → 8 LEDs.
int leds = n ? constrain((best + 90) * 8 / 50, 0, 8) : 0;
writeByte(leds ? (uint8_t)(0xFF >> (8 - leds)) : 0); // fill Q0 upwards
Serial.printf("%d networks, strongest %s at %d dBm -> %d LEDs\n", n, name.c_str(), best, leds);
WiFi.scanDelete();
delay(3000);
}// 74HC595 shift register on a NodeMCU (ESP8266) — 8-LED Wi-Fi signal bar from 3 pins.
// VCC → 3V3, GND → GND, DS → D7 (GPIO13), SH_CP → D5 (GPIO14), ST_CP (latch) → D6 (GPIO12),
// OE → GND, MR → 3V3. Q0–Q7 → LED + 220 Ω each → GND.
// Shows the strongest nearby network's signal (passive scan — it never connects).
#include <ESP8266WiFi.h>
constexpr uint8_t DATA_PIN = D7, CLOCK_PIN = D5, LATCH_PIN = D6;
void writeByte(uint8_t value) {
digitalWrite(LATCH_PIN, LOW);
shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, value); // Q7 gets the first bit sent
digitalWrite(LATCH_PIN, HIGH); // outputs change together on this edge
}
void setup() {
pinMode(DATA_PIN, OUTPUT);
pinMode(CLOCK_PIN, OUTPUT);
pinMode(LATCH_PIN, OUTPUT);
writeByte(0);
Serial.begin(115200);
Serial.println();
WiFi.mode(WIFI_STA);
WiFi.disconnect();
for (uint8_t i = 0; i < 8; i++) { // self-test: each LED in turn
writeByte(1 << i);
delay(100);
}
writeByte(0);
Serial.println("74HC595 Wi-Fi bar: scanning every 3 s");
}
void loop() {
int n = WiFi.scanNetworks();
int best = -100;
String name = "-";
for (int i = 0; i < n; i++)
if (WiFi.RSSI(i) > best) {
best = WiFi.RSSI(i);
name = WiFi.SSID(i);
}
// -90 dBm (barely there) → 0 LEDs, -40 dBm (next to the router) → 8 LEDs.
int leds = n ? constrain((best + 90) * 8 / 50, 0, 8) : 0;
writeByte(leds ? (uint8_t)(0xFF >> (8 - leds)) : 0); // fill Q0 upwards
Serial.printf("%d networks, strongest %s at %d dBm -> %d LEDs\n", n, name.c_str(), best, leds);
WiFi.scanDelete();
delay(3000);
}Expected serial output
74HC595 Wi-Fi bar: scanning every 3 s
9 networks, strongest JioFiber-4G at -48 dBm -> 6 LEDs
9 networks, strongest JioFiber-4G at -63 dBm -> 4 LEDs74HC595 Wi-Fi bar: scanning every 3 s 9 networks, strongest JioFiber-4G at -48 dBm -> 6 LEDs 9 networks, strongest JioFiber-4G at -63 dBm -> 4 LEDs
Common errors
Board won’t boot after wiring the 74HC595
A wire landed on D3, D4 or D8. Check that DS, SH_CP and ST_CP are on D7, D5 and D6.
LEDs show a random pattern that never changes
The latch on D6 isn’t connected. Without a rising edge on ST_CP the outputs never update.
Nothing lights
MR is LOW or floating (tie it to 3V3) or OE is HIGH (tie it to GND).