Air Filter Halo Animated with ATMega 328P

I recntly decided that I wanted to get into AVR programming and was looking for a good starter project. I decided that controlling the LEDs in my Halo would be a good, simple project to learn the ropes on. My main goal was to have the LEDs spin around, but I also wanted to have a few different modes. In additon to spinning, I wanted a sort of knight rider pattern and a flashing/alternating pattern. Also, it needed to turn on in a solid on mode. When I had just plain LED lights on my halos, no LEOs had said anything about it, but I’m sure spinning LEDs would not be appreciated.

I started out with just making the LEDs spin by hooking them up directly to the ATMega’s I/O pins. It was a good way for me to start figuring out what was going on and how to program the AVR.AVR - First LED attempt



After I got the AVR running and was a little more comfortable programming it, I used 4 TPIC6B595 shift registers to control 32 LEDs (16 on each side). This isn’t really going to be much of a tutorial, especially for how to use shift registers, but there are lots of very good tutorials out there. Trust me, I had to use them. As far as why the high powered shift registers for the LEDs, I had orginally thought to use some super bright LEDs to give the rotating part some extra width while on, but  in the end, I decided to use normal LEDs and just to have 3 on at a time while spinning.

After bread boarding the entire circuit to make sure it worked, it was time to put it on a PCB. I decided to send it out to a fab shop to make sure that it got done right and I was wating on the cable that would connect the two halves, so I wasn’t in much hurry. Here are the boards once I got them back from the fab shop.PCBs unpopulated



On the last halo, I used a 1/4″ think piece of lexan, and it made it very difficult to get the 5mm LEDs in without drilling through the outside, so this time, I ordered a sheet of 3/8″ thick for the actual LED ring and 1/4″ sheets for the outside cover. Also, my first one was very crude, so this time I made sure to make a ring on the inside that would hold the filter in place. I got the plexi from which was the cheapest place I could find the 3/8″.

Old/New plexi



At this point, I had all the pieces to populate the PCBs. This is a picture of the main board populated. The red and black wires will go to a 12v to 5v step down. The yellow wires are the leads for the button to change modes. The group of 5 wires will go to the daughter board. At this point I just downloaded a simple project to the controller to power up the LEDs and make sure they all worked. Looking great so far!LEDs populated



Since it’s an open air filter, I wanted to make it as water resistant as possible. I did this by casting the PCBs in epoxy. You can kind of see the power jack from the step down regulator on the right side of the main halo.Halos, epoxy setting



Now it was time to install it on the bike! I still had the all on program in the controller, so I wired it up and just held it in place to make sure I was happy with how it was looking so far.Halo test fit



Here is when I met my first big problem… Not thinking, I soldered the LEDs clockwise on both halos. Works great when lying flat on the bench, but they spin opposite of each other when placed on the bike…. Luckily, I was able to fix it in the programming that the one set would spin opposite of normal. Pain in the butt, but was able to get it working.

And finally, the video of the finished product!


Very happy with how it turned out!



Here is the code I used:

Here are the PCB’s if you decide to order them.

Main board:

Daughter board:

Be Sociable, Share!

Leave a Reply