Introduction: 500 LEDs Wall With ESP32

Hi everyone! By the end of this tutorial you will know how to create your own LED wall.

This tutorial is based on a summer program offered at Sacred Heart University.

Have fun!

Supplies

Supplies listed below.

Step 1: Supplies

Let's start by gathering everything we need to complete our Led Wall:

(Links were created on 7/10/2019)

Arduino IDE Software

ESP32 Micro Controller

LED Pixel Light

Power Supply

Power Cord

Wire Stripping Tool

Breadboard Jumper Cables

Electrical wire

Step 2: Determining the Right Power Supply for Your LedWall

There is a simple mathematical way to find out which power supply is the best for you usage.

We are using Ohm's power law: P = IxV (Power = Intensity x Voltage)

Voltage is determined by our leds: in this case 5V.

Intensity depends on the hardware, a single Led consumes 30mA.

Each strip of 50 Leds therefore consume 50 x 30mA = 1250mA = 1.25A.

Our 500 Led wall therefore consumes 10 times that (10 strips): 12.5A.

Power usage is then 5V x 12.5A = 62.5W for the Leds.


Of course, on top of the Leds you need to account for the ESP and every other item of your circuit.

We have a 60A power supply, we have plenty more than we need.

Step 3: The Power Cord

Our power supply comes with wire connectors. We need to adapt a power cord to connect it to a 110V plug.

- Cut the female connector off the power cord. We will keep the male part, otherwise know as NEMA 5-15P.

- Strip the cable to have about 3mm of copper visible on all wires.

Here is a quick video tutorial on how to strip wires:

Step 4: Wiring Up the Power Supply

Now we are ready to wire up our power supply!

Always unplug the power supply when ever working on it.


Wiring

  • The black wire (Phase) connects to the power supply's 'L' pin
  • The white wire (Neutral) connects to the power supply's 'N' pin
  • The green wire connects to the power supply's 'Ground' pin

(If your power cord's interior wires are not the same colours as ours be safe and look up the schematics online.)

Testing

Plug in the computer power cord into any powered outlet. The green LED on the power supply should turn on.

Step 5: Powering to the ESP32S

Looking at your ESP there should be labels next to all each pin.
if it is not labeled you can look up the 'pinout' of your individual ESP online.

Using a male to female breadboard jumper wire or an electrical wire, connect:

  • The '5V' ESP32S pin to the '+V' of the power supply (orange in the photo above)
  • The 'GND' ESP32S pin to the '-V' section of the power supply (black in the photo above)

(On some ESPs the '5V' pin is labeled as 'VCC' instead, they both mean the same thing.)

Please note that your ESP may have a different 'pinout' than the one that we are using.
As such you may be connecting your wires to different location than on the picture above.
As long as you are connecting to the correct pins (5V & GND), the physical location on the board does not matter.


Testing
Plug in your power supply again, and if your ESP has an LED indicator (most do),
it will light up to indicate power is being sent to the ESP. Congratulations!

Step 6: Powering the LED Light Strips

Using electrical wires:

- Connect the red wire of the LED Light Strip to V+ on the power supply.

- Connect the blue wire of the LED Light Strip to the V- on the power supply.

Step 7: Connecting the ESP32 to the LED Light Strips

Our ESP32 instructs the WS2811 driver connected to each led the color and brightness they need to be.
To do so, our ESP32 need a "data" cable to the strips.

The Leds strips come with a 3 wire connector:

- Red : Power
- Blue : Neutral
- White: Data

Let's connect the White Led strip cable to a digital pin on the ESP.
Please remember the PIN number selected as we will need to select it in the code later.

We plugged ours to the pin 13.

Step 8: Preparing the Computer: C2102 Driver

Now that our hardware is wired, we want to upload our first code to test it.

By default, Windows or MacOs can not communicate with our ESP32.
To do so, we need to download a "driver" for the ESP USB communication chip: the C2102.

This driver must be downloaded and installed:

- Windows 10: https://www.silabs.com/documents/public/software/C...
- Windows 7/8/8.1: https://www.silabs.com/documents/public/software/C...
- Mac: https://www.silabs.com/documents/public/software/M...

(Links as of 7/10/2019)

Step 9: Arduino Software - Adding ESP32 Support - Step 1

Before we can use our ESP32 with the Arduino software, we need to make sure that it is recognized.
By default, the Arduino software can not compile code for our ESP32, let's fix that:

Step 1: Adding boards to the manager

1 - Click in the Arduino the option File >> Preferences

2- In the "Additional Boards Manager URLs" field, copy the following link: https://dl.espressif.com/dl/package_esp32_index.json

Step 10: Arduino Software - Adding ESP32 Support - Step 2

Now that the Arduino software "knows" more boards, let's install our ESP32 support


Step 2:
Installing the ESP32 support

1 - In the top menu, select: Tools >> Board >> Boards Manager

2 - A window will appear. Use the search box, located in the upper right corner, to find "ESP32".

3 - Locate the one made by espressif. Install it. (See image)

Step 11: Arduino Software - Adding ESP32 Support - Step 3

Now that the Arduino software can communicate with our ESP32, let's plug it to the computer and verify that everything works.

1 - Let's make sure that we work on the ESP32 platform:

Click on Tools >> Board >> ESP32 Dev Module

1- Let's make sure that the Arduino software knows how to communicate to our ESP:

Click on Tools >> Port and select the one that pops up from plugging in this cable.

Important:

If you have any issue uploading the code to your ESP, check those two menus first.
If the port is not selected with a check mark, than the Arduino software will not communicate with it.

Step 12: Adding Libraries to the Arduino IDE

Now we are going to add a library that will allow us to test our Led Wall !

1- Click on Tools >> Manage Libraries.

2- In the upper right corner, search for NeoPixelBus.
Locate "NeoPixelBus by Makuna", install it (see image)

Potential other interesting Libraries:
(Not required for this tutorial)

- NeoMatrix

- FastLed

- Artnet

- GFX

Step 13: First Code: Strand Test

Our first code is an example from the Library.

You can either copy / paste the code below or click on :

File >> Examples >> Adafruit NeoPixelBus >> Strandtest

Please make sure to change your LED_PIN to the one you used to physically connect your leds.
We used 13 throughout this tutorial.

Also make sure to adapt the strand size with the LED_COUNT variable.

// A basic everyday LED Strip<br>test program.
<p>#include<br>#ifdef __AVR__
#include // Required for 16 MHz Adafruit Trinket
#endif
// Which pin on the Arduino is connected to the NeoPixels?
#define LED_PIN 13
// How many NeoPixels are attached to the Arduino?
#define LED_COUNT 500
// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
// setup() function -- runs once at startup --------------------------------
void setup() {
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// END of Trinket-specific code.
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
}
// loop() function -- runs repeatedly as long as board is on ---------------
void loop() {
// Fill along the length of the strip in various colors...
colorWipe(strip.Color(255, 0, 0), 50); // Red
colorWipe(strip.Color( 0, 255, 0), 50); // Green
colorWipe(strip.Color( 0, 0, 255), 50); // Blue
// Do a theater effect in various colors...
theaterChase(strip.Color(127, 127, 127), 50); // White, half brightness
theaterChase(strip.Color(127, 0, 0), 50); // Red, half brightness
theaterChase(strip.Color( 0, 0, 127), 50); // Blue, half brightness
rainbow(10); // Flowing rainbow cycle along the whole strip
theaterChaseRainbow(50); // Rainbow-enhanced theaterChase variant
}
// Some functions of our own for creating animated effects -----------------
// Fill strip pixels one after another with a color. Strip is NOT cleared
// first; anything there will be covered pixel by pixel. Pass in color
// (as a single 'packed' 32-bit value, which you can get by calling
// strip.Color(red, green, blue) as shown in the loop() function above),
// and a delay time (in milliseconds) between pixels.
void colorWipe(uint32_t color, int wait) {
for(int i=0; i
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait); // Pause for a moment
}
}
// Theater-marquee-style chasing lights. Pass in a color (32-bit value,
// a la strip.Color(r,g,b) as mentioned above), and a delay time (in ms)
// between frames.
void theaterChase(uint32_t color, int wait) {
for(int a=0; a<10; a++) { // Repeat 10 times...
for(int b=0; b<3; b++) { // 'b' counts from 0 to 2...
strip.clear(); // Set all pixels in RAM to 0 (off)
// 'c' counts up from 'b' to end of strip in steps of 3...
for(int c=b; c
strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
}
strip.show(); // Update strip with new contents
delay(wait); // Pause for a moment
}
}
}
// Rainbow cycle along whole strip. Pass delay time (in ms) between frames.
void rainbow(int wait) {
// Hue of first pixel runs 5 complete loops through the color wheel.
// Color wheel has a range of 65536 but it's OK if we roll over, so
// just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
// means we'll make 5*65536/256 = 1280 passes through this outer loop:
for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) {
for(int i=0; I
// Offset pixel hue by an amount to make one full revolution of the
// color wheel (range of 65536) along the length of the strip
// (strip.numPixels() steps):
int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
// strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
// optionally add saturation and value (brightness) (each 0 to 255).
// Here we're using just the single-argument hue variant. The result
// is passed through strip.gamma32() to provide 'truer' colors
// before assigning to each pixel:
strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
}
strip.show(); // Update strip with new contents
delay(wait); // Pause for a moment
}
}
// Rainbow-enhanced theater marquee. Pass delay time (in ms) between frames.
void theaterChaseRainbow(int wait) {
int firstPixelHue = 0; // First pixel starts at red (hue 0)
for(int a=0; a<30; a++) { // Repeat 30 times...
for(int b=0; b<3; b++) { // 'b' counts from 0 to 2...
strip.clear(); //Set all pixels in RAM to 0 (off)
// 'c' counts up from 'b' to end of strip in increments of 3...
for(int c=b; c
// hue of pixel 'c' is offset by an amount to make one full
// revolution of the color wheel (range 65536) along the length
// of the strip (strip.numPixels() steps):
int hue = firstPixelHue + c * 65536L / strip.numPixels();
uint32_t color = strip.gamma32(strip.ColorHSV(hue)); // hue -> RGB
strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
}
strip.show(); // Update strip with new contents
delay(wait); // Pause for a moment
firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
}
}
}</p>

Step 14: SHU Sample Code

Our code turns on all the Leds one by one to make sure they work:

// This example will cycle between showing 500 pixels as Red
<p>#include<br>const uint16_t PixelCount = 500; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t PixelPin = 13; // make sure to set this to the correct pin, ignored for Esp8266</p><p>#define colorSaturation 128<br>// three element pixels, in different order and speeds</p><p>NeoPixelBus strip(PixelCount, PixelPin);
//NeoPixelBus strip(PixelCount, PixelPin);
RgbColor red(0, colorSaturation, 0);
RgbColor green(colorSaturation, 0, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);
HslColor hslRed(red);
HslColor hslGreen(green);
HslColor hslBlue(blue);
HslColor hslWhite(white);
HslColor hslBlack(black);
void setup()
{
Serial.begin(115200)
while (!Serial); // wait for serial attach
Serial.println();
Serial.println("Initializing...");
Serial.flush();
// this resets all the neopixels to an off state
strip.Begin();
strip.Show();
Serial.println();
Serial.println("Running...");
}
void loop()
{
delay(100);
Serial.println("Colors R, G, B, W...");
for(int i = 0; i <=499;i++){
// set the colors,
// if they don't match in order, you need to use NeoGrbFeature feature
strip.SetPixelColor(i, red);strip.Show();
delay(100);
strip.SetPixelColor(i, hslRed);
strip.Show();
delay(100);
}}</p>

Step 15: Uploading Code to the ESP32

Important:

To be able to upload code to any micro controller, it needs to be in programming mode.
Most do this automatically and all you have to do is click upload in the software.

Our ESP32 requires you to hold the programming button while the code is being sent.
You also need to reset it after the code is uploaded by pressing once the reset button.

Our ESP32's programming button is located on the left, the reset button on the right.
Please refer to your manual if you have another micro-controller.

Step 16: Citations

This instructable was made with the help of the following tutorials:

https://randomnerdtutorials.com/installing-the-esp...

Used to install the ESP32 into Arduino IDE.

Authors:

Nathaniel Barone
Gabriel Castro

Editor:

Cedric Bleimling