Bike handles equipped with a turn signal button and two LED rings on the left and right handles for the corresponding turn signal.
This project is a turn signal for my E-bike that I take to and from school every day. There is a spring-loaded rocker switch with a left and a right arrow, which trigger the corresponding signals to start blinking. After a turn is made, it automatically shuts off the turn signal.
The turn signal box sitting at the back of the bike is attached using heavy-duty Velcro so that readjustments can be done as needed.
The two signals at the front of the bike are housed in a custom-made resin shield that helps diffuse the LEDs. They are also covered in heat-shrink for durability and water resistance.
The turn signal can be powered either via a rechargeable battery pack or a 9V battery. All of the components are modular and can be taken out, altered, or replaced with ease. An Arduino Pro Micro is situated on a red breadboard with connections to a 3-axis magnometer, 8 LED NeoPixel sticks, and power/data connections going to the front of the bike.
The front switch and signals box is also attached via heavy duty Velcro. The cable plugged into the side of the box is a custom data and power cable that connects the signals at the back of the bike to the switch and signals at the front of the bike. The screw-on cable is water resistant, as is every aspect of the turn signal system (for documentation purposes, the acrylic boxes are not sealed so that wiring could be displayed).
In this video, I demonstrate the operation of the turn signals from hitting the desired directional arrow on the rocker switch to the signal shutting off automatically after the turn is made.
2. Process images and review
Your process section should have at least 4 photos each of which is captioned, and ~100–300 words describing any aspect(s) of your process you'd like your readers to know about. Did something surprise you with how well or how terribly it went? Did something take much longer than expected? Did you get lucky and something worked out unexpectedly? Tell us about it.
Add captions and alt text to your images so your reader understands their relevance and meaning.
This video is of my first prototype to understand 1) what kind of button or switch I would want to trigger my turn signal, and 2) how the NeoPixel LEDs function. In the video, I have a latching push button, and when pressed, the lights blink.
Next, I prototyped how the chevrons at the back of the bike would sit and connect to each other.
After getting the basic code down, I moved to designing the box to house my finished device. I used translucent acrylic to help diffuse the light, and inset my red chevrons into it.
I also started prototyping the casing to hold the NeoPixel rings that sit at the front of the bike. This took many iterations in both PLA plastic and resin because it needed to be able to hold two rings back-to-back, including the wiring in-between. It also needed to be translucent, hence printing the final version in clear resin.
Next, I started building the cable that would connect the signals at the back of the bike to the signals at the front of the bike. To the left is an image showing my first iteration of the pin-out of my cable. In the end, pins 6 and 7 were also used to carry data for the rocker switch. Below is how the final connections looked.
Once my main building blocks were complete and able to be tested, I then had to tweak my code. I worked with Zach to create a logic map to help understand what my code needed to do, and how best to do it!
This video is my first fully working demonstration. What's been added to the device is a 3-axis magnetometer that works like a compass. This way, when the compass detects a difference in my direction, it triggers the turn signal to shut off. This video was taken the night before the final crit. Sadly, after filming this and encasing the NeoPixel rings in their housing, I created a short in my circuit that made it not function the next day. After getting feedback, I rebuilt the entire design, making it modular for easy repairs/additions, and including more insulation like heat-shrink so that my connections stayed secure.
Not only did I want to rebuild the circuitry to be more robust, I also wanted to increase modular-opportunity and reduce the overall size. The image to the right is the final iteration on a solderless breadboard before it became what it is today! It also includes an Arduino Pro Micro instead of the Uno, for space.
During the in-class crit, I received two comments in particular that stuck with me and inspired me to go back and overhaul my original design that I brought to the crit that day. First, Garth made a very, very good point: more. heat. shrink. There was a short happening somewhere in my circuit, and it was inevitable because I had two connections touching that shouldn't have been touching in the first place. It was just too messy! Adding heat shrink over all of my exposed soldered connections helped make my project what it is now: functional. Before, it was just too messy to be sure it would work-- I could do something as simple as hit a small pot hole, and it could cause two of my connections to touch. Now, this isn't a worry! Plus, I also have to worry less about wire-to-wire connections coming undone because of the heat shrink's added durability to the connections. The second comment came from Zach himself. This was also integral to the future of my device: creating "j" shaped connections between every single wire, then soldering them together. Similar to the issue of the lack of heat shrink, I was having a lot of my wire-to-wire or wire-to-pin connections keep coming off! I have never had this happen to me before with my soldering, but this was also my first time making a lot of connections with solid wire to solid wire. Using the technique of creating a "j" hook between the two wires and then adding the solder made all of my connections stronger, and at least until this point, unbreakable! Again, adding in the heat shrink only helped!
As of right now, although I am proud of how far this project has come, I am still a tad unsatisfied, and therefore, it's a work in progress. Even though it can be powered with a battery pack, and this is my preferred method, I am confused as to why a 9V battery only works 70% of the time. The other 30% of the time, it will have the side of LEDs that were triggered get stuck on solid red and not shut off. I learned about a voltage regulator from Zach and implemented one, but it still has issues! To be fair to myself, though, I am very proud of this system I've created. When running on a battery pack, it's very robust. As demonstrated in the video, it works very well and exactly as intended. I am especially proud of the auto-turn-off's robustness. I really got the sensitivity to the perfect amount (which happened to be + or - 20 degrees), so even if I'm not making a full 90-degree turn, it senses that I've made a change in direction. Although in the beginning I was hoping to make the auto-turn-off be purely mechanical for longevity's sake (i.e., turning my handles would hit a switch), I think that the digital compass ended up being a better solution to my problem and ultimately will be better in the long run because of how easily it can be adjusted if needed. I also really impressed myself with the cable that I made. It was really cool to take the knowledge I gained from working on the Plush Neuron over the summer, and the 200+ hours of soldering and fabrication that I put into it, and transfer that to my own application. Without having that prior experience, I wouldn't have known how to make my own custom cable/connections in the way that I did, and I think that really made this project special for me. It showed me that I really did grow this summer, and even more by applying that knowledge to another context. Overall, I hope to keep tweaking this turn signal so that I can use it daily on my bike rides to and from school/work. In fact, it's completely usable how it is right now! I just want to tweak some aspects, like the power supply issues, before permanently installing it on my bike.
/*Zarmond D. Goodman (zdgoodma)
60-223 - Intro to Physical Computing
Fall 2025
Project 2: Bike Auto-Turn Signal
A turn signal for my bike that automatically detects turns and shuts off once completed.
Pin mapping:
Arduino pin | role | description
-------------------------------------
2 input compass SDA
3 input compass SCL
15 output left LED data
14 output right LED data
8 input left DPDT signal
9 input right DPDT signal
*/
#include <Adafruit_NeoPixel.h> // LED library
#include <QMC5883LCompass.h> //compass library
QMC5883LCompass compass; // create object for compass
#define LEFT_LED_PIN 15 // Which pin on the Arduino is connected to the NeoPixels?
#define RIGHT_LED_PIN 14
#define LED_COUNT 48 // How many NeoPixels are attached to the Arduino?
//variables for the pins connected to the DPDT switch
const int LEFTBUTTON = 8;
const int RIGHTBUTTON = 9;
bool hasTurned = false; //var that stores if turn has been made
// Declare NeoPixel strip objects:
Adafruit_NeoPixel leftPixels(LED_COUNT, LEFT_LED_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel rightPixels(LED_COUNT, RIGHT_LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(LEFTBUTTON, INPUT_PULLUP);
pinMode(RIGHTBUTTON, INPUT_PULLUP);
leftPixels.begin(); // initialize NeoPixel strip objects
rightPixels.begin();
Serial.begin(9600); // initialize for compass data and debugging (compass needs to write to serial)
compass.init(); // initialize compass
}
void loop() {
int leftState = digitalRead(LEFTBUTTON); //var storing left button presses
int rightState = digitalRead(RIGHTBUTTON); //var storing right button presses
// Read compass values
compass.read();
// Return Azimuth reading and store it in a var
int azimuthVal = compass.getAzimuth();
//Serial.println(azimuthVal);
delay(250);
//When wanting to turn left:
if (leftState == LOW) { //if left signal is pressed
int startTurnPos = azimuthVal; //record current azimuth directional value
while (hasTurned == false) { //until I turn, keep blinking the LEDs
compass.read(); //read current compass values
int currentPos = compass.getAzimuth(); //record my current position when the turn signal is initiated
//Serial.println(currentPos);
if (abs(startTurnPos - currentPos) > 20) { //if my azimuth changes by 20 in either direction then:
delay(5000);
hasTurned = true; //I have turned
}
//This for loop is what makes the LEDs continuously blink
for (int i = 0; i < LED_COUNT; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
leftPixels.setPixelColor(i, leftPixels.Color(255, 0, 0));
leftPixels.show(); // Send the updated pixel colors to the hardware.
}
delay(500);
leftPixels.clear(); //this turns off the LEDs creating the blink effect
leftPixels.show();
delay(500);
}
}
//When wanting to turn right:
if (rightState == LOW) { //if right signal is pressed
int startTurnPos = azimuthVal; //record current azimuth directional value
while (hasTurned == false) { //until I turn, keep blinking the LEDs
compass.read(); //read current compass values
int currentPos = compass.getAzimuth(); //record my current position when the turn signal is initiated
//Serial.println(currentPos);
if (abs(startTurnPos - currentPos) > 20) { //if my azimuth changes by 20 in either direction then:
delay(5000);
hasTurned = true; //I have turned
}
//This for loop is what makes the LEDs continuously blink
for (int i = 0; i < LED_COUNT; i++) { // For each pixel...
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
rightPixels.setPixelColor(i, rightPixels.Color(255, 0, 0));
rightPixels.show(); // Send the updated pixel colors to the hardware.
}
delay(500);
rightPixels.clear(); //this turns off the LEDs creating the blink effect
rightPixels.show();
delay(500);
}
} else { //if nothing is pressed, then the signals stay off
// Serial.println("off");
rightPixels.clear();
rightPixels.show();
leftPixels.clear();
leftPixels.show();
}
}
/*References:
https://forum.arduino.cc/t/qmc5883l-calibration/686843 for calibration help
https://kunkune.co.uk/soldering/how-to-interface-the-gy-271qmc5883l-compass-magnetometer-with-arduino/ intital compass setup help
*/