After seeing some bike modification videos on Youtube, I wanted to modify my bike myself. I wanted to make a screen that would show my current speed and the current time. This way, I would easily know what time it is without having to pull out my phone while biking, which is dangerous, and I would know how fast I am biking quickly. In addition, I wanted some way to track the route I biked.
To do this, I used an Arduino Nano. I connected the Arduino with a NEO 6M GPS (getting data), a memory card module (storing data), and a couple of buttons and LEDs (showing when it is tracking). There is also a potentiometer for adjusting the units (m/s, kph, mph). Originally, I also wanted to include a Neopixel that would also show the speed using the LED lights, but I had to scrap that idea because of problems I ran into. All of this is powered by a power bank and a USB cable.
First, I wired all these on a breadboard instead of directly soldering because I did not want to deal with unsoldering if I did something wrong. This also made it easier to code. After coding, I soldered all the components onto a prototype board, then with the help of my parents, I mounted the prototype board onto the bike.
This project is not finished. I have not built a case for it yet because I don’t have the tools (such as 3D printers, etc). Additionally, I have not made anything that plots the route on a map.
How it worksEvery second, the GPS would get info and send the data through serial communication. The data includes the date, time, location, and speed. The Arduino then puts the speed and date/time onto the LCD display. Additionally, there are 2 buttons: one that controls when to start or stop route tracking, and one that controls when to pause tracking. When the bike is tracking your route, then the green LED turns on. If tracking is paused, it blinks, and if tracking is stopped, the LED turns off. There is also a red LED, which turns on if there is an error writing the location to a file or an error getting data from the GPS. The LCD would also show “No info” when the GPS is disconnected.
The tracking works by getting the location from the GPS and writing it to a file. Each time tracking starts, it writes the current date and time to a file so a reader can know when I started tracking. Then, every 5 seconds, it gets the coordinates rounded to 6 digits and writes it on a new line to the file. The reader would know when the tracking is stopped when it reaches another line that reads the date and time or another tracking session, or when it is the end of the file.
Problems I ran intoWriting the code took 2 days, much longer than I expected because I ran into many problems. The most important problem was memory issues. The Arduino has 32 kilobytes of flash memory, which is what stores the code, and only 2 KB of SRAM. After writing the code, the LCD started behaving really weirdly due to low memory. This was caused by many libraries I was including, many global variables, and inefficient code. I solved this by removing variables I didn’t need or changing the data types of the variables. For example, numbers in dates such as hour, minute, second are less than 255, so they can be stored in an unsigned char (byte) instead of an entire integer, which takes up 4 bytes. The memory issues also made me give up the idea of including the Neopixel showing the speed.
Soldering was also really hard and tedious. It also took me 2 days to solder all the components onto the board, even though I did not have that many. When soldering the headers, the heat would melt the plastic the headers were contained in. Also, whenever I wanted to solder two holes together, the solder would often build up through the holes instead of linking up. This was mostly because my soldering equipment was not good enough and I did not have much experience in soldering. This was probably the hardest part of the entire project.
Lastly, when I was testing it, I tried measuring the voltages of each wire to make sure everything was working, but I ended up shorting the 5V and GND wire of the Arduino, killing the power lines of the USB port. Luckily, the data lines were still alive, and the GPS also came with a USB port that worked whenever I plugged something into it.
Problems that still occurThe connection time of the GPS is very slow when powering the Arduino on. Even when outside, it can take 10 minutes for the GPS to be connected to the satellites. Also, when it is not connected, the LCD shows 16:00 instead of “No information, ” even though the time is invalid. Lastly, the LCD screen seems way too big, which may capture attention and might get my bike stolen.
Next stepsThe first thing to do is to fix these problems. To solve the low memory problem and to add more features to later versions, I might swap out my Arduino Nano with something with more memory, such as an Arduino Every. I would make my bike more inconspicuous by replacing the LCD screen with an LED strip telling me the speed and a little OLED screen telling me the time and other information. I only had an LCD on me at the time, so that was what I used. Lastly, I still need to look into the slow connection problem. I think it may have something to do with my code.
Secondly, I want to add more safety features to the bike, such as headlights, taillights, and brake lights. I also want to add a bell or a horn so people would know when I am coming. Lastly, I need to make an app or a website that plots the tracked routes on a map.
Comments