Over the last few months I’ve been working on a LED light project. I’ve already blogged about hooking up the LED matrices and the accelerometer. I also blogged about my frustrations with product defects and setbacks. But I never really wrote about the actual goal of the project. Until now!
The goal of the project is to build a portable square matrix of LED lights that can be affixed to our backpack at music festivals. The lights will be passive - that is, there won't be any buttons, knobs, or any other required interaction. However, the lights will be supported by some sensors (such as the accelerometer), which will allow it to react to its surroundings. The LED matrix will display colorful moving images that will hopefully be at home at music festivals...you know, the fun rave-y kinds.
I didn’t want to declare this goal too early because I was afraid the project wouldn’t be feasible. I didn’t want my fourth blog post to be an apologetic explanation about how my project idea was fundamentally flawed! I decided to build a proof-of-concept first, and then blog the specifics second.
I'm excited to share more details about the project. It has come a long way over the past few weeks. But first, I'd like to talk about three potential “show-stoppers” that had me worried when this project was in it's early stage.
An accelerometer will be a fundamental input source for the device; but, unfortunately, both the lights and the accelerometer use the same connector on the Raspberry Pi. To get this to work, I would need to stack the LED controller on top of the accelerometer connector so they can “share” the same GPIO connection. I thought this wasn’t going to work at all. Surprisingly, it worked just fine. For those following along at home, I used the Adafruit RGB Matrix Hat and the 3-Axis ADXL342 i2c accelerometer (connected via this i2c shield).
To make good use of the acceleration readings from the accelerometer, I’d need to run a physics simulation in the background while the lights are running. Then, I could render physical objects on the screen that respond realistically to movement. I considered this to be a major challenge because the light display, physics simulation, and acceleromter would all need to run fast enough to maintain at least 30 frames per second - below that frame rate, things will start to look choppy.
The only way to prove that this could work was to build a prototype and test it out. It was a happy night when I finally got everything running. Yes, the Raspberry Pi (model 3B) is indeed fast enough to run the physics simulation (in pybox2d) and the lights (using this package by hzeller) at the same time. However, it can only simulate a small number of physics objects at once. Performance drops dramatically when there are over 100 physics objects at once.
This was the grandaddy of all potential show-stoppers for this project. The LED matrix runs at 5V, but it takes a lot of current. The Raspberry Pi itself probably doesn’t take much juice, but requires a stable and uninterrupted power source. I started off looking at drone and remote car batteries, thinking I’d need something beefy like that. Eventually, I remember that I already own this fairly powerful battery for charging my Nintendo Switch. I had to buy this cable off of Amazon to connect the battery to the LED hat. After that cable arrived in the mail, I stalled on testing the battery for about a week. I was afraid of finding that it wouldn’t work and that the project was over. Fortunately, that wasn’t the case. In my testing so far, the battery worked for 90 minutes and, according battery status, is still somewhere between 75% and 100% charged.
This isn’t a total victory yet. I want to test that battery all the way to 0% so I know exactly how much time it can run when we are “off the grid”.
They might not. I won’t really know for sure until I try. Music festivals often allow totems, which are border-line spears. Festivals also allow LED hulahoops. So, I feel like I have a good shot at getting my project into a festival. That said, I will need to try hard to make my device look safe not scary.
© 2017. All rights reserved.