LED Rails for Onewheel Pint

Inspiration

This project was inspired by a reddit post that showed an LED matrix someone had attached to their onewheel. This project looked super good, but there wasn't any information on how it was built. So I set out to build my own version that fit my constraints.

Constraints

My largest mechanical constraint was that my design needed to be removable. I didn't want to run LEDs all the time, and when riding aggressively I didn't want to risk breaking my design. So whatever I added to the rails needed to allow for quick assembly and disassembly.

Electrically I was constrained by space and power sources. The design had to fit on the onewheel and not impede my ability to ride it. I couldn't run the system from a wall socket, since the whole system had to be mobile, and running from the onewheel's internal battery would be complex and potentially dangerous. So I began looking for a battery system that could supply the power needed to run the 174 LEDs.

Electronics

For this project I used WS2812B LEDs, with a density of 60 LEDs per meter. I ordered the Ip67 variant, which came with a rectangular, rubbery outside casing for the LEDs to sit inside.

The long LED strip was cut into shorter sections, and wires were soldered between each row. Each rail has 87 total LEDs.

I already had an Arduino UNO on hand from previous projects, so it was fast to get some initial code up and running. I used a perf board to solder my own custom shield to the Arduino. This way, if I ever want to use my Arduino for something else I can simply remove the perf board shield, no de-soldering required. While the soldering may be ugly, it does the job and allows for a relatively compact electronics setup.

While not necessary, I added an LCD screen to the project for some fun visual flair. Specifically, I used this Adafruit I2C LCD shield since it only required 4 wires to get running, and came with a library to easily control it. The LCD screen did have buttons built in, but since the LCD screen was an afterthought, I had already added a button on some extended wires to my perf board that I ended up using instead.

For the battery, I ended up going with a modified 6 pack AA battery holder. 3 AA batteries in series achieves ~4.5V-5V, which is what the Arduino and LEDs need. The two sides of the battery pack are wired in parallel, so I can run either 3 batteries at 5V and 2500mAh or 6 batteries at 5V and 5000mAh. At maximum brightness on full white light, each LED can pull 60mA. This results in a maximum power draw of 10.44 Amps. Theoretically, this would give me about a half hour battery life with 6 batteries. However, I found that I rarely push LEDs to their maximum brightness, since it becomes uncomfortable to look at. Also, since I mainly run animations, many of the LEDs are not even turned on for every frame, so my actual power draw is much less than 10.44 Amps.

Mechanical

Originally I had planned to use a long piece of 1/4in aluminum flatbar as my rail where I would mount the LEDs on the outside. This seemed like a good idea since aluminum is pretty strong and lightweight. However, getting two pieces of aluminum the right thickness and length was going to cost quite a bit. I realized I had some 1/4in clear polycarbonate laying around that would work perfectly for this project. I could actually embed the LEDs inside the rail so they would be protected, and I could sand the outside of the polycarbonate to diffuse the lights.

I machined these rails on a CNC router with a 6mm endmill. The rails feature 3 slots on the backside where the casing on the LEDs presses into place. Luckily, this press fit seems to be enough to keep the LEDs from moving around or falling out. The rails were also drilled and tapped for M4 screws on top to allow mounting from above.

To attach the rails to the onewheel itself, I used a series of parts CNC machined out of 1/2in thick polycarbonate. The fender blocks use one M4 screw that replaces the original screw for mounting the fender. These blocks keep the fender held on tight no matter whether the rails are on or off. Each block has a hole and embedded nut for an M5 bolt. This bolt is tightened an loosened to attach or remove the rails.

Attached to the tapped holes on the top of the rails is a spacer and a tab. The tab has a slot on one end, which allows it to be mounted without fully removing the M5 screw on the fender blocks. One tab on each side has a slot for wires to pass underneath.

This mount system is fairly secure, and satisfies my goal of quick removal. Just loosen each of the M5 socket heads, and the rails come right off.

The battery and 3D printed Arduino case are mounted to the top of the fender with Dual Lock, which is similar to velcro but has much more holding force.

IMG_1164.MOV

Software

To run the LEDs I used the FastLED library, which was super simple and got all my LEDs running in no time. The LCD screen also had a library, which handled all the I2C communication.

Since data is passed through consecutive LEDs, the Arduino only thinks the LEDs are in one long strip, rather than a matrix/grid. To fix this, I wrote a little code to transfer the long strip into an x and y coordinate system, which made writing future mathematical patterns much easier.

I also developed a python program using OpenCV to take images or animations and generate the code that would enable the Arduino to display these images on the LEDs. This allowed me to create animations in photoshop that would be hard to mathematically generate. My python program would then scan each pixel in each frame of the animation and print out usable Arduino code that I could copy over to my Arduino sketch.

This method did work very well, however it was not very efficient in terms of memory due to the fact that it created a new line of code for every single pixel of every frame. An animation I created with 26 frames used over half of the available memory on the Arduino. Replicating the animation mathematically with loops resulted in the same animation but only used 10% of the total memory. So the python+photoshop method is reserved for only the most complex animations that would be nearly impossible to program by hand.

The current program has 9 animations and a timer setting that cycles through each. Each animation was coded using loops, which provided a fun challenge in breaking down visuals into mathematical models. I'm most proud of the fire animation, which projects a randomized flickering flame that can change colors onto the LEDs.