Build a Simple Bicycle Turn Signal
by mbagrianski in Circuits > LEDs
3699 Views, 40 Favorites, 0 Comments
Build a Simple Bicycle Turn Signal
With the advent of fall, it's sometimes hard to realize that the days have become shorter, although the temperature may be the same. It's happened to everyone- you go on an afternoon bike trip, but before you're halfway back, it's dark and you're thrown into a game of hide-and-seek with every other vehicle on the road. Why not let the world know which way you're going turn at the next intersection by building a simple and low-cost turn signal?
This project is for people who need a safer way to bike at night. It's easy to make, works great, and is the perfect way to learn about basic woodworking, electronics, and programming.
So, if you'd like to get started, read on!
Supplies
Tools:
- Hacksaw or any other saw
- Drill, with 3/16" and 1/16" drill bits
- Screwdriver(s)
- (Optional) Countersink drill bits
- Single-use superglue (or similar)
- Soldering iron, solder, solder stand
- (Good to have) Tabletop clamp. This is something you should invest in if you have space, it makes drilling and cutting a whole lot easier.
- Sandpaper
- Ruler, pencil
Electronics:
- Arduino Nano, preferably with a breakout board
- Stranded wire, a decent amount (You'll need 3 wires that are around 2m long)
- 13x LEDs (orange or yellow, although the colour is up to you). Note that it's a good idea to get extras in case you burn out a few. Also important to keep in mind- mixing colours means your LEDs will light up at different brightnesses. This is because the internal resistance of an LED is unique to its colour. It's best to use 13 identical LEDs.
- 13x 220-ohm resistors, generic. Both these and LEDs are easily found on amazon.
- An SPDT toggle switch, ON-OFF-ON. For example, these ones
Other Materials:
- Wood panel, around 4"x2" or larger, and at most 1/2" thick. Plywood is a good source.
- (Optional) Acrylic plastic, 1/16" or thinner
- Zip ties
- Screws, relatively small, such as these
- Electrical tape
- Old rear/front bike reflector, such as this one. What we're interested in using is the mounting bracket. If you have a mounting bracket from a bell, speedometer, etc. that can also be used.
- Some sort of malleable foam. The stuff you wash your dishes with is probably good.
Starting Out
How is this going to work, and how should you start out?
There is a general procedure you should follow when building this project; however, sometimes you need to do things in a slightly different order to make sure that everything comes together nicely. For example, you should do most of the cutting and drilling in the beginning, but you'll need to do some additional drilling and fine-tuning after installing the electronics.
The concept of the project is simple- when making a turn, you hit an SPDT toggle switch on your handlebar, and a panel on the back lights up to indicate the direction of the turn. The microcontroller is used to animate the turn signal, which increases its conspicuousness. I wouldn't recommend using this on a sleek road bike because it is a little bulky, but it would look great on your average bike.
Take a look at the image and copy it down onto your wood panel. It's a general template, so if you want, you can modify the sizes and shape to suit your wish.
Cutting and Drilling
It's usually better to drill your holes before you make any cuts- larger pieces are easier to control. So, start by drilling 1/16" holes into the markings for the LEDs. After you've drilled all the holes, follow up by drilling 3/16" holes overtop. The reason for this is that it's much easier to control the placement of a 1/16" bit rather than a 3/16" bit, so your LEDs will be more in line. The first hole acts as a guide for the second, larger drill bit.
If you have a countersink bit, it's a good idea to make use of it here. You don't need to go very deep on the front side, just enough to deburr the surface. How deep you go on the back depends on how far you want your LEDs to stick out, so do as you see fit.
Now is also a good moment to drill 4 holes at the corners with the 1/16" bit if you plan on mounting an acrylic plate at the back.
Cut along your markings to remove any excess material from the plate until you are satisfied with the shape, and sand it down.
Setting the LEDs
For me, this part is always fun. Set up the LEDs in the holes, with polarity set up as shown in the colored diagram above. You'll see why they're arranged this way in the next step. A dab of glue over the backside of each LED should be enough to lock it in place. If you have trouble identifying LED polarity, take a look at this article.
Be sure that you push the LEDs all the way in until the back tab is flush with the rest of the surface.
Quick note: Always make sure your LEDs work before you glue them in place! I can't tell you how many times I've assumed an LED to be working, and had to rip apart a nearly-complete project because it wasn't. It should be a habit to check every component you have to install permanently beforehand.
Soldering
The very first image is a wiring diagram that you should follow. Make connections by bending the long LED legs- you shouldn't have to use any additional wire if you are careful. Make sure you heat the joint well before applying solder and keep it stable while the solder cools. A good solder joint should be able to resist an effort on your part to rip the connection apart (by the way, I don't recommend doing this on every joint that you solder, for obvious reasons).
Try to keep it clean. The neater your connections, the easier it will be to troubleshoot if the need arises. For bridging over another wire, it is enough to have 2-3mm between bare surfaces- typically LED legs are quite rigid and will not sag easily.
You can also solder on two of your 220-ohm resistors as seen above. Make sure you are making the connections as short as possible; also, be sure your resistors are glued down in some way. Joints will break when too much stress is applied nonlinearly, as happens when you tug on a shortish piece of wire. You'll end up ripping out the resistor, so be aware of that.
Some More Hardware
Here are two things that could technically be done at almost any point in the assembly, but I recommend you do now, for various reasons.
The first is using your old reflector bracket. You don't need the reflector itself, just the clamp by which it is attached to the handlebars or rear. Depending on the type, you could also use a headlight mount or something similar; you could even 3-d print a mounting bracket. Drill two holes in the base and mount as shown. Make sure the side that bends open, allowing you to slip the whole thing onto the bar, has enough space to do so without damaging your electronics. I suggest you do this now, rather than earlier or later, because it's easy to see where your main, immoveable connections are.
The second thing you may want to do is install an acrylic panel at the back (for both aesthetic purposes and to protect the surface from splashes). Cut a rectangle with the same dimensions as your turn indicator (in this case, about 2"x4"). Using your predrilled holes as a guide, drill through the plastic with the 1/16" bit and screw the panel on. You can see the result in the final picture.
You may also want to erase any markings you made on the block prior to this step (oops).
Finishing the Soldering
Now that we've mounted a few extra things to the turn indicator, you can finish off the last 3 or so resistors, following the same method (gluing down the components, keeping wire lengths minimal).
Once again, double-check to make sure your connections are functional. You can do so by applying a 5V or less voltage directly from your Arduino or power source across the segment. Individual LEDs that don't light up could be reversed- if so, simply cut the connection, push the LED out with a screwdriver from the other side, and glue it back in the right way.
Once your assembly is functional, you can move on!
Enter the Arduino!
Time to add a microcontroller! It should be relatively clear now why I've suggested you use a breakout board similar to the one shown- mounting electronics securely is a finicky job and this thing makes it much, much easier.
You'll notice that there are two pieces of foam used to create some space between the PCB and the wooden block. This a) ensures that there are no short circuits, as both sides have bare surfaces, and b) cushions the Arduino module.
What I've done here is poked holes in the foam first, and cut out the square after. Using the same screws with which you mounted the acrylic cover plate, mount the Arduino, taking care to ensure that there is enough space between the Arduino and board. You should reference the photos above to get an idea as to how it should be done.
Hook up your pins. Here's another benefit to this module- no soldering is required! You can always remove the Arduino to reuse in another project if you so wish, later on. Here are the connections you want to make if you wish to use example code without any modifications:
A2- left
A5- middle
A4- left arrow
A3- right arrow
A1- right
Additionally, connect the 9V battery connector to +Vcc and GND.
Basic Code and Troubleshooting
Now that most of the hardware is complete, take a moment to reverify your connections are correct. If you're fairly certain, plug in your Arduino into any available USB port.
I'm hoping you have had some basic experience in Arduino coding. If not, you can always get a quick review at sites such as this one. The project stems from the most basic thing you can do in Arduino- the "blink" code.
Download the attached code and run it. Make sure you've selected "Arduino Nano" as your board type and selected the right COM port. Once the upload is complete, you should see your turn signal flashing the same way as in the above video. If so, keep on moving!
Downloads
Finalizing the Hardware
You're ready to finish things up. Take 3 lengths of wire about 2m long, or as much as you need to reach from your handlebars to the rear of your bike where you will mount the signal. Solder each of these 3 wires to a terminal of your SPDT toggle switch.
Cut out a longish (did I say longish? Yes, it's up to your judgment) piece of acrylic plastic, about the width of your toggle switch. Using your soldering iron, heat up the plastic at a location so that you can bend it, like a bracket. Bend it to shape as in the photos above. A dap of superglue on the toggle switch should keep it in place.
Connections to be made are: the center terminal of your toggle switch goes to GND, while the other two go to D2 and D3. Hook everything up, and run the code attached below. You should find that you can now set the device to indicate which direction you'll turn! All that's left is to install it on your bike.
Downloads
Installation
Finally! We're almost done.
Start by mounting the main device on the shaft that holds the saddle. There's nothing extremely complicated about this, which is one of the advantages of such a design. Next, zip-tie the battery to the same shaft. Why zip-tie? It's cheap, easy to remove/replace, and secure.
Use a few zip ties along the entire length of the wire to make sure that it isn't free to get caught up in anything. Ensure that the wire has enough slack so that you can rotate the front wheel freely without ripping anything.
Attach the toggle switch to the handlebars as shown, with a zip tie on each side. Trim any long ends. And- you're done! You can power/unpower the system by disconnecting the battery connector.
Conclusion
Although I'm fairly satisfied with this version of the turn indicator, there's quite a bit to improve on. There's no protection from any external element, whether it's cold, mud or rain. I've found on a previous version (the second image on the introduction) that water is actually less of an issue than one might think; it's not really a problem until it seeps into the electrical connections and that takes quite a bit of water. In other words, this would be still fine in a light drizzle.
Other improvements could include a turn-operated switch rather than a manual one, a stop indicator that lights up at the application of your brakes, and maybe... flashing hazard lights? The goal is to give the standard bicycle features that make it as easy to distinguish at night as a car. This could go a long way towards reducing injuries and collisions on the road.
However, this is a good start! It's also a fun little project that can serve a good purpose. I hope you liked it!