Introduction: Magnetic Rainbow Tail-light for Bike Helmet
I have Giant Compel bike helmet. It has a mysterious plastic piece on the back which I pried off to reveal this slot with a metal surface in it. After some research, I discovered it's for Giant's Numen+ light, which attaches magnetically to the helmet. But I had 3D modeling skill, access to a 3D printer, and some spare components lying around! I'm gonna build my own helmet light in a sleek case that has more colors: 16,581,374 more colors to be exact. Plus it'll have infinity more patterns than their measly one-light system. Here's how I did it and how you can too.
- The final product has a toggle-button that turns the light on or off.
- Since the light is behind my head, I chose to use a button that sticks out when it's on, and is in when it's off, so I can reach back and feel whether the light is shining or not while wearing the helmet.
- It's powered by a ~400mAh LiPo battery and recharges with micro-USB.
- A circle of eight very bright RGB LEDs can display patterns and colors. I've programmed mine to be a pretty rainbow that rotates around rapidly.
- The light attaches with a snap-fit and a magnet to the back of my bike helmet and points backwards while I'm riding to make me more visible at night!
I've tried my best to provide the 3D models I designed for this project in their most original format, in the hopes that if you have different parts or a different helmet, you can adapt the project to your needs.
Step 1: Parts, Materials, and Tools
Parts:
- Freenove 8 RGB LED Module - Our pretty lights
- I don't know where to buy these except as part of kits like these. If you can find a place to buy them individually, let me know and I'll update this.
- 3.7v 400mAh Li-Po battery - To power everything and be rechargeable
- The one I used was 36x24 mm. I think this battery from Adafruit will be the right size, and it's got a few extra mAhs.
- Arduino Pro Micro- The brains of the operation, controlling the lights' colors and patterns
- Push toggle button - To turn the light on and off
- I used one just like these buttons on eBay.
- More options, which might be different sizes:
- SparkFun LiPo Charger Basic - Micro USB- To accept a USB cable and control the battery charging
Materials:
- Wire (thin and flexible if possible)
- Solder (thinner is better for this project)
- Magnet 10mm wide, 3mm tall bar magnet (optional)
- Hot glue
- Superglue or J-B Weld
- PLA filament
- Some kind of clear plastic—1.5mm or 3mm acrylic, sheet protector, plastic bag, etc.
Tools
- 3D printer
- Soldering Iron with fine tip
- Flush cutters
- Wire stripper
- Hot glue gun
- Hacksaw or jeweler's saw for cutting a PCB
- Sandpaper (rough grit)
- Safety glasses
- Clamp
Step 2: 3D Print
The light is housed in a 3D-printed case that's made up of three parts: top, middle, and bottom.
The STLs and Fusion360 files for the case are attached. You can use Fusion360 to modify the design if you need to. Fusion 360 is a free download for hobbyist use. It's not super simple to learn but very powerful.
3D print the parts. They should print well in the orientation shown above. Only the middle piece needs support, and that's only a little on the main overhang.
Because your printer will be different than mine, you might have to do a test print and then change the tolerances in different areas of the parts. The bottom piece should snap together with the middle piece because of the alignment pegs and holes on one side. The top piece and the middle piece should fit together because of the alignment chamfer. The bottom piece should fit into the helmet, sliding in from the top and faintly clicking into place. Also, all the components should fit snugly into their spots inside the parts.
Here's a list of tolerance-sensitive areas to look out for in the design:
- Alignment pegs (middle and bottom)
- Alignment chamfer (top and middle)
- Charger board slot (bottom)
- Arduino (bottom)
- LED Module hole (top)
- Micro-USB hole (bottom)
- Button slot (bottom)
- Button hole (bottom)
- Magnet hole (bottom)
- Snap-fit grooves (bottom)
Tweak stuff until these things fit properly.
I printed these parts on an Ultimaker S5 and sliced the STLs in Cura 4.8. I've included the .3mf file with the models and my slicing settings.
Step 3: Upload Code
Download the Arduino code from my GitHub repo, then upload it to your Arduino Pro Micro.
The code is just a slight modification to Adafruit's NeoPixel test. Modify it if you want!
Attachments
Step 4: Prepare PCBs
Desolder the pin headers from the back of the Freenove LED module. They're just taking up extra space. We'll solder our wires directly on to the surface-mount pads on the PCB later. Save the pin headers! You can re-use two of the pins in a few steps.
Remove the female JST connector from the SparkFun LiPo Charger Basic. I found it was easiest to do this by cutting the four metal connections with flush cutters, removing the plastic piece, and then desoldering the little leftover metal nubs after the plastic was out of the way. You can save the plastic connector and use it in another project!
Step 5: Cut PCBs
Two PCBs need to be cut to fit in the enclosure.
First, we need to round one side of the Freenove LED Module. Two corners need to be rounded off to match the curve formed by the LEDs. Take note of where the traces lie under the surface of the board (front and back) and make sure not to cut or sand into them!
- Etch a guiding line for your sanding later with a knife or an etching tool. See the picture above.
- Break away both of the PCB's corners with a strong cutting tool. I broke my flush cutters doing this, so you'll probably need something more heavy-duty.
- Switch to sandpaper once you get close to your etched line—don't worry, PCB material is pretty soft. This will help you get a more precise and smooth edge. You can use a rotary sander if you're impatient, but watch out that you don't sand off too much material.
- Wash off the board with a slightly damp cloth.
Next, we need to cut the red SparkFun LiPo Charger board so it will fit in the case. Note the length of the board's place in the 3D printed part and measure this onto the board to find where to cut. As you can see in the pictures, I cut the board without measuring, ended up with a board that was too short, and had to glue it back together to get the right length. Having the board fit properly is important because when we plug in a USB cable, we want the pushing force to go through the PCB and push up against the case on the other side instead of threatening to push the plug and charger board further inside the case to be lost forever.
- Measure how long to cut your board. Use the space in the 3D printed part as a guide.
- Cut the boardat a right angle using a jeweler's saw or a hacksaw. Make sure not to cut through any traces on either side of the board (you should have plenty of space).
We're cutting off the place where the JST connector used to be on the charger board. The two through-holes labeled "+" and "-" are all we'll be using for this project. The JST connector's pins and these through-holes are connected to the same places in the PCB.
Step 6: Prep Button
The button has six long leads that stick up way too high to fit in this enclosure.
- Cut off all leads but two, making sure they're ones that are connected when the button is in the "sticking out" position.
- Bend them over so they don't take up too much vertical space
The leads across from each other are connected to the button the same way as far as I can tell, so it's ok that they're almost touching.
Step 7: Solder Arduino, Button, and Charger Board
First, add leads to the through-holes in the charging board. You can use pieces from the pin header you desoldered in Step 4. We need to extend these contacts upwards so that we can solder two wires on each lead later. Solder them in sticking up. Then cut them to size. They should be the maximum height that will still fit under the top edge of the bottom piece of the case.
A note on wiring: aim to connect things in this project with just a bit more wire than is needed. There's not tons of space for extra wiring inside the enclosure, but we want a bit of wiggle room. See pictures for a method to deal with extra wire length.
Now we can connect the Arduino, button, and charger board together!
- Solder one lead of the button to the "+" pin of the charger board. Make sure that you're leaving room for another wire on the lead later.
- Solder the other button lead to the "RAW" pin of the Arduino. Thread the wire under the charger board if you can.
- Solder the "-" pin of the charger board to a GND pin on the Arduino.
Now power will flow from the battery (once we attach it) through the button, to the microcontroller, and then later on to the lights).
A full wiring diagram for the completed assembly is included above. Note: black wires in the diagram are brown in my build. This is because I ran out of black wire.
Step 8: Test Connection
Test the connection by plugging a micro-USB cable into the charger board. The Arduino's lights should turn on only when the button is in the open position. If this doesn't happen, check over your solder joints, make sure you connected the right pins, and investigate with a multimeter.
Step 9: Solder Battery Wires
- Cut the battery's leads to length. It will end up folded back and on top of the components we've soldered so far. Mock it up to see how long you need the wires to be. Make them just a bit longer than you'll need, you can deal with the extra as shown in the pictures.
- Solder the red wire to the "+" pin of the charger board.
- Solder the black wire to the "-" pin of the charger board.
- Check your connections from the last step. Since you're soldering to the same leads, something could have come undone.
- Test that it works (again). If your battery is charged, opening the button should turn on the Arduino! You should also be able to charge the battery with micro-USB.
Note: Never solder directly to battery terminals. Here, we're soldering to wires coming from the battery so it's safe as long as things don't get too hot.
Step 10: Solder LED Module
- Tin the input ("IN") pads of the LED Module. This will make soldering to them easier.
- Solder wires onto the pads. There's no hole to put the wire through, so take your time and hold the wire steady until the solder has cooled. I used a green wire for "S" (Signal), and red and brown for "V" and "G", (Voltage) and (Ground).
- Solder the red wire to "VCC" on the Arduino.
- Solder the green wire to pin "2" on the Arduino.
- Solder the brown wire to a "GND" pin on the Arduino.
All the components are now connected! Make sure everything folds up nicely.
Step 11: Test Lights!
Push the button into its "On" position and see the lights working!
Something wrong?
- Make sure the Arduino is on (lights on)
- Make sure the battery is charged (use a cable if not, or charge it)
- Check your solder connections
- Do they look sturdy? Did solder "flow" onto both the wire and the pin?
- Are they connecting the right things together? Did you get the right Arduino pin?
- Check that you've uploaded the correct code onto the Arduino
Step 12: Test Assembly
Lightly put everything together to make sure your wiring fits, your wires are long enough, and that everything still turns on when it's assembled. Be really gentle moving the whole spider-y ball of components around—we don't want our solder joints flexing too much. If things stop working intermittently when you move it around, it's probably a bad solder connection.
Step 13: Glue in Components
- Glue in the Arduino into the bottom piece of the case with a tiny dab of hot glue.
- Glue the button in using a small amount of superglue on the back and side of the button. Don't glue the bottom of the button. If you do, the glue may get into the workings of the button and freeze it up.
- The battery charger board might not need to be glued because it's such a tight fit. If you want, add a drop of glue to the end where it pushes against the case. The USB-end will be clamped in between the bottom and middle pieces of the case.
- Thread the LED Module through the middle piece. It won't fit after we glue it into the top piece.
- Glue the LED Module into its spot in the top piece with a few drops of superglue.
The battery is still loose. We'll hot-glue it in later, once the case is half-assembled.
Step 14: Glue Case Together
First, we need to glue the bottom piece to the middle piece.
- Mix up your J-B Weld according to its instructions. You could also use superglue for this step, or maybe hot glue if you're very quick and sure of yourself.
- Spread glue all the way around the top edge of the bottom piece of the case. Creating an unbroken line of glue will make the final light more waterproof. Skip where the Micro-USB charger is, though. If you need to, you can seal that once the case is complete.
- Press the bottom and middle pieces together, using the alignment pegs on the groove-side of the case to align it perfectly. They should make the pieces snap together. Make sure the battery is in the proper place and no wires are in the way.
- Wipe off any extra glue.
Now that the bottom and middle pieces of the case are secure, we'll glue the battery in. Use hot glue to secure the battery on either side as shown in the photo.
Next, we'll glue the top piece to the middle piece.
- Once again, spread glue all the way around the edge to make a seal
- Press the pieces together. They should fit only one way because of the small ridge on the top piece, and the bezel on the middle piece.
- Wipe off extra glue.
Gently test that the electronics still work one last time before the glue dries.
Now clamp the entire assembly gently. More glue may squish out; wipe it off. Wait for it to cure!
Don't skip the next step.
Step 15: Wash Hands
J-B Weld is toxic. Wash your hands after you've finished gluing and cleaned up.
Step 16: Add Magnet (optional)
- Break your magnet to size. I used a vice grip to lightly grip the magnet at the point I wanted to break it. Then I grabbed the protruding bit with pliers and bent it. Neodymium magnets are very brittle. WEAR EYE PROTECTION! The magnet kinda explodes when broken. You could also cut it with a hack-saw maybe. Or just buy a better sized magnet and modify the case design so it fits in properly!
- Superglue or J-B Weld the magnet into its hole in the bottom piece of the case. I had to push mine in with the handle of some pliers and a lot of J-B Weld squelched out, so I wiped that off. Wash your hands after if you used J-B Weld.
A magnet will help the light stick on to the helmet. But because the case is designed to slide and snap on, it shouldn't be necessary. I'm using one just in case, and because it's cool.
Step 17: Add Clear Light Cover
For a final touch, we'll add a clear cover over the lights. This piece will keep water out but let light escape from our beautiful LEDs.
I was going to use a 60W lasercutter to cut a clear 3mm-thick acrylic cover, but the lasercutter was out of service. Attached is a DXF file I exported from the Fusion design of the case. You can use it if you want to lasercut this piece.
Instead, I used a manual lasercutter—which most people call a "saw".
- I traced the top piece's shape on some 1.5mm clear plastic with a hobby knife.
- I used a jeweler's saw with a fine blade to cut around my line. I cut it a tiny bit big on purpose so I could sand it down to exactly the right size.
- I hot-glued the clear cover on to the top piece of the case. Once again I made sure to use a continuous bead of glue to keep water out.
Hot glue probably wasn't a good choice for this because it fell off later. Use J-B weld instead! You'll have more time to work before it dries, and it'll make a stronger bond.
While gluing the cover down, I was careful to keep the plastic clean. Any dust or fingerprints on the underside will be trapped there forever!
You can improvise a bit for this step: Use whatever piece of clear plastic you have around. Cut it with a lasercutter, or with a saw, or with scissors. Use the glue that you're most comfortable with and meets your needs best. Maybe you live in a dry place and want to skip this step altogether! Or maybe you want to diffuse your lights by using a translucent plastic piece. Go for it!
Attachments
Step 18: Done!
After all your glue has cured or dried, you're done! Charge up that battery, attach the light to your helmet, and start biking!