Make your bike smart with Raspberry Pi
Maker keanuDav was always forgetting to turn on his bike lights when riding out in the dark. He also never knew how fast he was going, or how long his rides were. So he created a shareable smart bike that automatically turns the lights on or off and keeps track of where you’ve ridden. The project uses a RFID scanner so somebody else can use the bike without messing with Keanu’s personal ride data.
Keanu’s creation sits neatly on the bike’s rear rack And features an LCD screen
Here in Cambridge, if you forget to take your clip-on lights off your bike when you lock it up, chances are they won’t be there when you go back. We reckon this Raspberry Pi-powered solution could work for us here in the UK’s leading cycling city too, since there’s nothing to easily unclip and walk away with.
Hardware
- Raspberry Pi 3
- GPS NEO 6M (to track speed and location)
- Portable power battery
- RFID RC522 (so guest data and Keanu’s data can be separated)
- LCD screen (so you can see the IP address and display when a user scans in or out)
- Elegoo Uno R3 Board
Keanu totted up the total price of the build, including wood and the light, at around €145.
How does it all fit together?
We’re not going to lie: the smart bike looks tricky to recreate. I mean, that is a lot of wires. And several bits of hardware. But it does perform multiple functions for the rider, so we can put up with a little fiddliness.

And don’t worry, Keanu is a hero and shared this Fritzing diagram on his instructable, which is handily set out in a twelve-step format so you can follow along easily.

How do you collect all the data?
Keanu explains:
“The RFID scanner is used with the arduino. I read out the data from the scanner with the arduino and send it to the Raspberry Pi with Serial USB.
The GPS module is also using serial communication. The data the GPS sends to the Raspberry Pi is not that well formatted, so I used a library to parse the data and make it a lot easier to use.
The analog values from the LDR are converted using the mcp3008 (an adc), then I transform the value to a percentage.”

Keanu stores the data in a relational database in mySQL. Then the database and a python script run together on the Raspberry Pi. Here’s everything you need on GitHub.
Take a ride
On top of the impressive coding and electrical skills, Keanu is a dab hand at woodwork. You could use a pre-made box in another material if that’s not your thing. It just needs a hole for the LCD screen to show through.

Make sure to check out maker Keanu’s step-by-step tutorial explaining how he made the smart bike.
8 comments
edmun
with no “flaming” around it but….
nowadays, a nice led lights for your bike can come with light sensor that will switch the light on when it is becoming dark. even simple Meteor Comet X Pro has it.
tracking your ride? a smartwatch usually will detect that you’re cycling and will sync info to your phone and phone can sync it to the cloud.
I get the point that it is nice to build something, develop something, go with something new, but sometimes it it also good to rethink if it is really necessary to reinvent the wheel. Even if your wheel will feel that it is better than the wheel from the shop, sometimes overdoing things is not good to thing to do
Pi6
If you want something for your use case that the market doesn’t offer (yet), you need to first build a basic working version, and then improve upon it. What you see in this article is a very basic DIY product, but it offers its creator lots of room for customizing it to their own need. Not much you can do with an off the shelf, closed-design product.
Monstrohundo
That’s certainly a path forward toward the same goal — but, to touch on that point that it is nice to build/develop something, building even pre-existing items can still help us to gain (further) experience with those components that make up the whole, so that we can (better) use those components in future projects. That might not be your own goal, but it certainly can be for other makers; this kind of self-practice would be similar to the reasons why we underwent manual mathematics practice in school instead of just using a calculator — or, why we recreate existing items in high school or higher education.
In addition, creating items or programming apps on our own allows us to sidestep, or at least reduce, exposure to marketer tracking that’s often found in software with no monetary cost to the user. Such tracking may otherwise be tricky to block.
Ken
I am sorry, but I disagree. The concept is a working gps for a bike, but that is a mute point. He has put together a solution with multiple pieces of hardware that work. Others will be able to take his project and customize it for their own use. IMO, well done.
zack
Thanks, raspberrypi for always giving us a new idea I will try this on my bicycle, and also special thanks to Ashley Whittaker
Andrew Taylor
If he can do it so can my 9 year old grandson and if he starts on this type of project now where will he be when he is 16?
Where will it take him with the flights of fancy children have and a garage full of bits to put together.
How were the first pc’s and Macs built?
It is a concept, a springboard for other possibilities. Maybe link it up with the PI Hat with gyroscope and accelerometers to make a black box for the car to record how it is being driven. Add a noble phone sim to upload to the cloud the data and location to have a vehicle tracking app. Add a camera to picture the driver when the vehicle exceeds parameters and send the photo with the “offences” to mum and dad.
And all from a bike ride around Cambridge
Martin
That’s a cool project. Would that work with a regular dynamo as an energy source too ?
Yusu
Raspberry Pi always gives us a new idea. I will try this soon. Thank you keanuDav.
Comments are closed