Expanding the ESP-01's Capabilities to Build an LED Matrix

Even though the ESP-01 only has four GPIO pins, it can still be capable of some amazing stuff, such as this WiFi-connected LED display.

The ESP8266 ESP-01

Espressif is well known in the maker community for their line of IoT SoC chips, including the ESP8266 and ESP32. The ESP8266 has a processor with 160KiB of RAM and an integrated WiFi modem, clocked at 80MHz. While the processor can support up to 16MiB of external flash, most modules contain around 512KiB to 4MiB. It also has a total of 16 GPIO pins, with support for SPI, I2C, I2S, and UART protocols, making it a very capable chip. While other boards break out all or most of these pins, such as SparkFun's Thing lineup or a NodeMCU module, the ESP-01 variant only has four GPIO pins exposed to minimize its footprint.

LED Matrix Theory

An LED matrix consists of a grid of LEDs that can normally be controlled on an individual level. For an N*M size matrix, there are N pins for each row and M pins for each column. LEDs have two leads: anode and cathode. The anode pin must be given a logic HIGH signal to be active, whereas the cathode must be set to logic LOW. If both of these conditions are met, then the LED is on. In this matrix, all anodes are connected to row pins, and all cathodes are connected to column pins.

To begin, each row is scanned, which means that a row is given power if a given LED in it needs to be lit. Columns are scanned after, which removes power from a column if there's an LED in it that needs to be turned on.

Construction and Wiring

Instructables user tuenhidiy decided to take the concept of an LED matrix and build one with an ESP8266 ESP-01 as the controller.

But in order for it to work, there had to be some way to expand the ESP-01's limited GPIO pin count. He chose to create a grid of 13x15 LEDs, but that would require 28 pins. However, they don't have to be driven directly. That's where shift registers come into play. The 74HC595 and TPIC6B595N shift register ICs can each output eight signals while being controlled via the SPI protocol, letting the four combined control up to a 16x16 matrix. Below is a schematic showing how each component is connected:

Soldering took a while, as he had to individually attach each LED to a piece of protoboard, as well as corresponding male pin headers. This allows for the top board to plug into a bottom board like a shield. The control module has sockets for four shift registers, a voltage regulator, an ESP-01, and power.

Displaying Weather and Time

The matrix on its own can't do much, so it's necessary to add some logic to display the weather and time. For getting the time, the ESP8266 WiFi library is needed, as well as NTPClient, WiFiUdp, and time. When a number is to be displayed, it is first converted into a 13x15 bitmap and then each row/column is pushed via SPI- one byte at a time from a buffer. In a similar manner, weather data is retrieved from openweathermap using the ESP8266HTTPClient and ArduinoJSON libraries. After it gets parsed, temperature, humidity, pressure, wind speed, and wind degree are all scrolled across the matrix.

Evan Rust
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles