I have made this awesome 410 RGB LEDs matrix. It’s fun and serves the educational purposes for now. Soon enough, the ESP32 & 410 LEDs matrix will be transformed into something even more fun. I thought I will take you on this journey with me while I’m trying to figure out how everything works. If you are new to LEDs, this read if for you. I hope you will learn as much as me!
ESP32 & 410 LEDs
First of all, I’d like to thank Banggood.com for sponsoring this. They were kind enough to let me play with some LEDs. Here are the items I use in my matrix
410 LEDs is quite a alot! This thing will need a good power supply. I will test things out first and see how I can wire things up. I used the existing adhesive to glue the strips to the piece of wood. This should be good enough for the testing. I will see how comfortable I am with writing a code for this, then decide what would be my final project.
To build this matrix I cut the strips to 41 LEDs per line. The 41 isn’t a magical number, it’s the upper limit of the longest wooden board I could find in my garage. I have the total of 10 lines. Each new line has an opposite direction. To drive the WS2812B correctly, you have to check what direction the strip should be facing. Basically, I have created one very long snake. To learn how to drive WS2812B read this.
5V power supply
To power it all up I needed a power supply. I picked a 5V 30A switching power supply. My napkin math tells me this is more than plenty to get each individual LED powered up. This thing looks beefy!
Initially, I connected the power supply at the beginning of the strip to figure out how many LEDs I could power before the voltage collapses. The answer is 40 (depending on brightness). Increasing the voltage could work, but remember, these are individually addressable LEDs, therefore, you are risking a damage to it, if you drive bigger than 5V voltage, but turn on only a few LEDs.
As you can see, up to about 50 LEDs we have no issues at all. Past that, you can notice small flickering. Turning on more LEDs reveals an even bigger problem. The entire matrix turns yellow, then orange and then almost all red.
I used 2 channels of my power supply connecting it from both ends. I also interlinked each line to reduce the voltage drop even further. I have more than enough current to drive all the junctions. Remember that each time a junction is created, the current splits in half.
Lastly, I changed the brightness to 253 (max) to see if I have enough juice to power the entire matrix. I’m pleased to say, it’s bright as hell. I’m still half blind while I type these words.
The FastLED library comes with a calibration script. My strips had to be calibrated before I could write colours using names. Upload the script and follow the instructions. You will be asked to change the order (if needed) of RGB values. This change is declared in the void setup().
Coding ESP32 & 410 LEDs using Arduino IDE
I wrote a very simple code in Arduino IDE to map the pot’s input to the LEDs. The ADC (Analog to Digital Converter) has 12-bit value. I have to take this into consideration when translating the analogue voltage from pin 2 to a digital output (PWM) sent via pin 5.
As the voltage on the power rail can drop due to power draw, connect the potentiometer to the 5V pin of the ESP32 so the mapping script would read the values without any interference.
Here is the code:
As you can see, ESP32 & 410 LEDs matrix works great. The next step is to decide how to drive the LEDs. There is more than one option. We can use LED channels for each line, or try to leave it as it is. This is something I will explore in part 2.