[0:01] A random mess of LEDs
[0:04] No structure
[0:06] No order
[0:08] Complete chaos
[0:28] Order has emerged.
[0:30] We have a discernible geometric pattern on our leds.
[0:36] How does this work?
[0:38] Let’s have a look under the hood.
[0:42] We’re using an ESB 32 camera board
[0:46] With some simple image processing
[0:49] and a string of WS2811 addressable RGB LEDs.
[0:56] Wiring up the addressable LEDs is pretty straightforward
[1:00] they just require a power supply and data connection.
[1:05] Data is sent to the first LED on its data pin
[1:09] it keeps the bits that are meant for it and sends the remaining data on to the next LED.
[1:16] This happens down the chain of LEDs and until of a none left.
[1:24] To program the ESP 32 we need a USB to UART board.
[1:29] Once we’ve downloaded the initial sketch
[1:32] we can switch over to over-the-air updates which makes things quite a bit more convenient.
[1:38] To talk to the addressable LEDs we also need a level shifter
[1:43] the ESP board can only output 3.3 volts and the addressable LEDs
[1:48] require 5 volts to work reliably.
[1:53] There are many ways to do level shifting
[1:55] Adafruit have several boards that you can use and I’ve got a mosfet driver
[2:00] left over from another project that I’m going to use.
[2:04] Let’s quickly run through the circuit for driving the LEDs.
[2:08] I’ve decided to have two separate power supplies
[2:13] One for the LEDs and one for the ESP 32.
[2:17] The LEDs require a fair amount of power
[2:22] and the ESP cam is quite sensitive to voltage drops and seems to brown out very easily.
[2:29] I’ve also added a couple of large capacitors across each power supply.
[2:35] We need to make sure there is a common ground between both power supplies
[2:40] so we connect the two ground pins.
[2:44] For the level shifting I’m using my FET driver and I’m also adding a small
[2:49] decoupling capacitor to this chip.
[2:52] Finally we can add the cables for the ESP32 and for the LEDs.
[2:59] Connecting the power ground and data lines
[3:03] That’s our circuit complete let’s talk about the software.
[3:08] To make the whole thing work we need to know where each LED is.
[3:13] To do this we apply some simple image processing.
[3:17] For each LED in the string we capture a frame with all the LEDs off.
[3:23] We then light one individual LED and capture another frame.
[3:29] These two frames are compared
[3:33] and the location of the LED is determined by finding the part of the
[3:37] image with the largest difference.
[3:40] Repeating this lets us work out the
[3:42] approximate positions for each LED in the string.
[3:47] To display an image on the LEDs we create a frame buffer
[3:52] and draw out required image into that frame buffer.
[3:56] we then run through each LED and take the color that the LED should be
[4:01] given its position on the image.
[4:05] To provide user interface to the board
[4:07] I’ve built a very simple web interface that is served from the ESP 32 cam device.
[4:13] We can capture a frame from the sensor
[4:17] We can tell the system to recalibrate the LEDs
[4:23] and we can also pause and resume the animation sequence.
[4:29] All the code for the project is on GitHub.
[4:33] Let me know if you have any comments or suggestions.
[4:36] and please do hit the subscribe button
[4:39] It’s the only way I have of knowing if you like these videos and want more.
[4:44] Thanks for watching and I’ll see you in the next video!
read
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Related Content
Transcript
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter