True Story Follows
So I’m talking with Larry Fleming, The Remote Control Blimp Guy, and he’s all, “So I’m on tour with R. Kelly and these LED screens are blowing up, figuratively.” Larry had constructed a matrix of LED strands to create a super light weight, low resolution TV screen that could be mounted on one of his blimps. Video with none other than R. Kelly and a blimp is below:
The problem though is that the initial setup involved pre-loading the blimp with video files which severely limits the number of applicable use cases. So I worked with Larry to create a setup in which the said jumbotron could interpret composite video input. In this way, the system is decoupled from the video source, and now live video could be transmitted to the blimp.
Now the number of use cases is limitless. For example:
- Fly a blimp outside your office window with The Big Lebowski playing on loop
- Display a live video from on onboard camera, useful for the lazy operator that would rather watch an absurdly bright and large TV from a mile away instead of transmitting video wirelessly
- If pulled over by a police officer, you can now film the interaction and transmit it live to a 35 ft blimp flying overhead to keep everyone accountable
- Change the color of the screen depending on your surroundings, giving your blimp a chameleon-like effect just like in the movie “Predator” starring Arnold Schwarzenegger and Sonny Landham
- Create an intricate system to help cheating on a school test that you take outdoors…have your friends discretely fly by with the answers written on a 10 foot wide screen and then go into Predator-Chameleon mode when your teacher no longer has his/her back turned.
You can see a small demo below, but this demonstration is a bit lacking. The lighting was bad (sun roof immediately overhead), and the video used was mostly black and white, not giving a good idea of the full spectrum of color available. I can also hear the trolls coming for me, and in fact one such troll, Steven “Brozart” Kim, complained about the low resolution of the screen. The demo video below is only 75 by 30 pixels, which limits us to a corresponding screen resolution of the same. The bottleneck here is actually just the number of LED’s used; 1 microcontroller can support 4,000 LED’s, and one raspberry pi can support 4 microcontrollers. Hence, with 1 system, we could have a screen that’s about 8 times larger than the demo shown here. For anything larger, we could set up multiple systems and split a composite video signal across multiple devices. But that would be a ridiculously large screen.
Some of the lessons I learned from the project are listed below.
Microcontrollers are quite simple
Working with microcontrollers is something I’ve historically deferred on for side projects because of the simple mental hurdle that these are typically associated with hardware projects. Moreover, my ignorant perception of these projects was that you had to go and learn “Arduino code” and understand “Arduino sketches” and so forth. I didn’t realize that arduino sketches are actually just C++ programs with a few embedded libraries specifically for arduino controllers.
It turns out that the only real practical limitation is that you don’t have an abundance of RAM like you might typically be used to for server-side software. Otherwise, you spend a few minutes installing some software on your computer, you compile a program, press a button on the device to load the software, and that program now runs on startup.
LED’s at a high level
For a typical setup, at the time of this writing the predominant LED’s to buy for projects are WS2812b’s and APA-102c. WS2812’s are more ubiquitous and are synonymous with Adafruit’s Neopixel LED’s. They’re fairly cheap, but the downside is that the signal requires precise timing. As such, you MUST use a microcontroller as opposed to, say, a raspberry pi where the operating system will not guarantee the timing of the output.
The timing problem does not exist for APA-102’s because an additional clock signal is used. However, the drawback is that now an extra wire is used across all of your LED strips, adding a little bit of size and weight. For our use case, we wanted to minimize weight as much as possible. Additionally, APA-102’s are more expensive and harder to come by than the WS2812’s.
Raspberry Pi’s can Easily Turn into Embedded Devices
When I start playing around with a raspberry pi, it generally involves connecting keyboard, mouse, and monitor or setting up a wired network connection and remoting into the machine after a network scan. It’s easy enough to add a startup script to a raspberry pi so that the device can just be turned on and immediately run the desired program (You can find out how here). However, you quickly run into the concern of how to do a graceful shutdown and avoid the possibility of hard drive corruption.
There are options and tutorial for adding a graceful shutdown switch on the Pi, but these are either marginally costly or require enough manual labor to make it an ineffective solution to scale for creating the embedded device multiple times over.
I instead opted to make the hard drive read-only so that it would always be safe to pull the plug on the Pi. This gives the added bonus of knowing that once the Pi’s hard drive is in a desired state, every time the device is powered on it will create deterministic results. There are a few different tutorial on the internets on how to set this up, but I only found one tutorial that successfully worked here.
Writing a Program in C Changed My Worldview Forever
After crafting an incredibly elegant video parser on the microcontroller, once I actually started testing the video screen I found that I needed to limit the video size or frame rate in order for the video to play at regular speed. I had seen sample videos of comparable projects on the internets that didn’t have this problem with larger demo videos, so clearly I was doing something wrong. I played around with various buffering mechanisms and trying to isolate slow parts of the C code, but nothing in particular stood out. After a little while, I went ahead and experimented with inlining function calls, kind of a last resort, and found that I was getting better speeds. So I inlined all of my beautifully crafted isolated functions with single responsibilities into one larger function, and I ended up with a 2.5-3x performance increase.
This bummed me out, because I’m usually the guy that’s always arguing in favor of increasingly small functions on code reviews. And now I’m wrong, from a performance standpoint.
My whole programming life was built on a lie.