Arduino Bike: Call for ideas!

Hello!

I am planning on installing an Arduino in my bike and have it do some interesting stuff. Basically it's just a hobby thing, nothing essential, but just fun to tinker with (I love my bike).
And now, I would like to ask you, what cool ideas do you have for adding to an Arduino enabled bicycle?

So far I have come up with:

- Arduino + LiIon Battery (from old iPod)
Housed under the luggage carrier, in a waterproof case. Accessible for in-home recharging and software updates.
Connection to other components via Cat5 cable running within the bike frame.
- switchable head and rear lights
Battery powered to keep them on when stopped, at traffic lights, while waiting for someone,...
Blinking patterns and one-shots are possible.
- blinkers?
Have the bike make a turn signal. Mounted on the ends of the handlebars, and around the rear light.
- temperature sensor, maybe compass
Get some readings from the environment while riding.
- rpm counter for speed and distance calculation
This is already commercially available, but maybe new features could be incorporated.
- LCD and pushbuttons on the handlebars
For displaying speed, distance, time&date, sensor input; and switching modes, turning lights on/off.
- Attached to the bike's generator for pedal recharging
Also, here in Germany, it is a legal obligation to have battery-independent lighting on a bike!
- (in the future) addition of a GPS module?
and other fancy (and expensive) stuff. A GSM-eneabled, twittering, bicycle? ;D But seriously, that's future-talk.

So, what ideas have you got? Comments? Thoughts?
Im excited to read what you guys post here!

Also, I'm looking for some waterproof components here.

I would to a 3.3V system from the Li-ion battery. This can be done efficiently with
an LDO.

If you do Bluetooth to your phone then you could access the GPS and the other
embedded capabilities in the phone. While you are moving you get directional
readings using GPS deltas. You may still want a real compass.

Capacitive touch buttons would help with the waterproofing of the switches.

(* jcl *)

GPS + wifi Shield, so if it's ever goes past an open wifi hotspot, it uploads it's location online... In case it's stolen and the person goes past a place with free wifi?

a vertical row of 8 or so LEDs that write out a message 1 column at a time, refresh-rate depending on how fast you're going (so you get only see the message when you're moving)............. if that makes sense at all.

An Inclinometer if that is a real name that measures and displays the slope up or down in degrees or ratio and suggests a gear in relation to speed. Only a gimmick but a challenge I suppose.

Another might be to control a generator by feeding a variable amount of current to a constantly turning alternator fitted to the bike. A car alternator with the field winding controlled by an arduino to gradually engage at the most opportune times such as going downhill and braking.

I was going to do very a similar thing until my GPS broke (or rather I broke it...)

I will be watching this thread with interest. Capacitive touch buttons sound like a good idea.

There aren't many waterproof displays around so I would recommend going with a normal one and making a clear case/use a waterproof box.

The speed, distance etc can all be done with a reed switch from a bike computer. If you want an odometer then you would need to save data before power to eeprom before power loss (you are using a battery also so you could do it when power from the dynamo is lost)

Maybe you also (/instead of eeprom) want to log data to a microsd card.

With the light thing, you may not be able to get enough power from the dynamo to power front and rear light and the arduino,(gps),display,sensors etc. I would recommend a normal standby rear light for when you stop to make things simpler. The front light probably wants to turn off when you lose power from the dynamo...

As you can probably tell, I have many ideas for this and would be interested in sharing ideas.

PM me and I'll email you some other stuff that may help... :slight_smile:

Regards,

Mowcius

Oh yeah, by the way... Loving the paintjob...

This is a fantastic Idea! I'm actually trying to do something very similar with my Yamaha Zuma Scooter, I'm searching for suitable components now, so I'll give you a heads up with what I find.

I decided that it is slightly against the ethics of the forum to just discuss things via pm. So here is the info I exchanged...

How far did you get with your bike project? Any prototypes or something?

I did some prototypes on the interface but not any on the product. The lack of GPS then put me off... It is still on my list of stuff to do and I have done a bit on it recently.

My main concern right now is the "interface", especially since I want to really integrate it into the bike so it does not get stolen! I can't just place some sort of plexiglass case with an LCD in it and mount it on the handlebars, it would need to be a LOT more subtle!

I would recommend that you create some kind of mount so that, like a bike computer, you can remove the display etc from the mount so it cannot be stolen.

Small form factor displays with enough characters to show the stuff you want to show are not easy to find.

Maybe you want a display like:
http://www.crystalfontz.com/products/parametric.phtml?importancedisplay=50&displ...
Annoyingly the smallest sparkfun do is a 16x2. Also a serial display would probably be best because on a normal arduino you would start to run out of pins with a non serial one and all the other stuff you want...

Then you would need to make a clear case for it to make it waterproof. Laser cut?

For the buttons, I was thinking of some sort of small, thin lever mounted next to the brake lever, for easy operation while riding. But I just can't figure out the display. What's the most compact design to find?

I'm still liking the idea of capacitive touch buttons because they would be easy to implement into any size/shape, but as I presume you are wanting to keep the device on your bike in all weathers, I'm not sure how rain affects it/ if it sets them off...

So many questions...

That's ok, any more?

I decided that it is slightly against the ethics of the forum to just discuss things via pm. So here is the info I exchanged...

:slight_smile:

I have underlined concrete questions for those wishing to skip ahead.

So, here are some new thoughts:

Buttons:
Capacitive buttons, while neat, sound a bit complicated for my needs. I was thinking of using small pushbuttons and simply wrapping them in insulating tape and transparent plastic foil.
This way they would be waterproof, I would simply click through the tape layer. It would result in a very flat button (using SMD pushbuttons) and I could easily tape them to the handlebars that way.

Display
Instead of an LCD, I could also use 7 segment LED displays or a small 5x7 LED matrix. This is cheaper, more compact and easier to insulate than an LCD. The front is waterproof by nature, And I would just need to wrap the connectors on the back in tape to protect them.

Cabling
Since the Arduino will be riding on the back of the bike, I need a communication bus to the components on the front (head light, blinkers, display, buttons).
My idea is to run one Cat5 cable through the bike frame, this is elegant and hassle-free. Only downside: a maximum of 8 lines. My idea: I2C Protocol! :smiley:

1- Vcc
2- GND
3- I2C Clk
4- I2C Data
5- free
6- free
7- free
8- free

Can I2C run without problems over a distance of ~2m?
If so...
Is there a chip that would give me lots of outputs (for the LED matrix, about 16, for blinkers 2) and some inputs (for buttons) over an I2C interface?
I have read the pages on the MAX72xx chip, but this is SPI and output only. Also, since my temperature sensor uses I2C, it would be great to use the same protocol for the rest of the components.
Any hints for such a chip will be greatly appreciated!

Voltage
I have a 3.7V LiIon battery, and a generator delivering up to 5V (i think DC).
Should I use a 3.3V Arduino board, or use a booster circuit to run it on 5V? I like the second option better because my other Arduinos all run on 5V, so I already would have the right programmer. Any disatvantage to this setup?

Hoping for more answers!

Is there a chip that would ........... over an I2C interface?

MCP23016 gives you 16 I/O pins and it's half brother MCP23008 gives you 8 lines all over I2C.

Wow, that chip looks good!
However, would it be suitable for running a 5x7 LED matrix? I mean, because of the refresh rate. Or would it limit me to using a 7-segment display with permanently lit segments?

update: I found the MAX6953 IC that handles LED Matrices via I2C! Bingo! Then I could use one MCP23008 and use it for the pushbuttons and the blinker LEDs :slight_smile:

Ok, I have a few more ideas and answers in a random strange order :wink:

simply wrapping them in insulating tape and transparent plastic foil

Seeing the paintwork on your bike I would opt for a more elegant approach. Capacitive buttons aren't too difficult and only really require a wire, you can then just do a simple circuit and a bit of code to get the arduino to sense the touch... I am however looking for a waterproof pushbutton for you.

Another idea, do you really need a button or could you have the display cycling through whatever data you want to show every few seconds...

Can I2C run without problems over a distance of ~2m?

Yes, but it would be less than 2m on your bike...

My idea is to run one Cat5 cable through the bike frame, this is elegant and hassle-free. Only downside: a maximum of 8 lines.

Or you could use a scart cable (lots and lots of connectors) I used one to extend my portable DVD player screen about 2m with no issues and about 10 data lines etc...

I have a 3.7V LiIon battery, and a generator delivering up to 5V (i think DC).
Should I use a 3.3V Arduino board, or use a booster circuit to run it on 5V? I like the second option better because my other Arduinos all run on 5V, so I already would have the right programmer. Any disatvantage to this setup?

The dynamo is unlikely to be DC because they drive bulbs which accept AC. If you have an LED light then it will have a rectifier circuit in it...

I will email you some ideas I had on driving my arduino from hub dynamo and battery backup. I also have some pictures, tests, diagrams etc that I can send...

Is there a chip that would give me lots of outputs (for the LED matrix, about 16, for blinkers 2) and some inputs (for buttons) over an I2C interface?
I have read the pages on the MAX72xx chip, but this is SPI and output only. Also, since my temperature sensor uses I2C, it would be great to use the same protocol for the rest of the components.
Any hints for such a chip will be greatly appreciated!

Since the Arduino will be riding on the back of the bike

Does the arduino need to be on the back. You could use a small form factor arduino mini or other similar small arduino board and mount it under/near the display.

Should I use a 3.3V Arduino board, or use a booster circuit to run it on 5V?

3.3v arduino boards aren't so flexible on what things you can power from them. You then couldn't power a 5v lcd for example and they often cannot provide the current on the outputs that the 5v ones can. There are many simple booster circuits out there (mintyboost etc).

I could also use 7 segment LED displays or a small 5x7 LED matrix

You can't display as much on them and they are much harder to code for than a serial LCD (3 pins - gnd, v+ and RX instead of a lot (8 or 12 or 15 ish))

Hope this helps,

Mowcius

Capacitive buttons aren't too difficult and only really require a wire, you can then just do a simple circuit and a bit of code to get the arduino to sense the touch... I am however looking for a waterproof pushbutton for you.

Do you have a site describing how to build these buttons, fool proof? :slight_smile:

Another idea, do you really need a button or could you have the display cycling through whatever data you want to show every few seconds...

Well, I would also like to be able to turn the head/rear lights on and off, as well as the blinkers, independently. So, there's gotta be buttons.

I will email you some ideas I had on driving my arduino from hub dynamo and battery backup. I also have some pictures, tests, diagrams etc that I can send...

Please do! I will PM you my e-mail adress. Or you could just post them here in the forums! I'm looking forward to seeing them :wink:

Does the arduino need to be on the back.

Well, I figured it would be the best place to "hide" it from potential thieves while leaving it accessible for battery changes / firmware upgrades. I will think about a front-mounted version as well! The battery's size is my main concern, and the lower side of the luggage carrier just lends itself to clip the microcontroller there :slight_smile:
But then I would need some wires going to the back to power the rear light and blinkers.... No way around it.

You can't display as much on them and they are much harder to code for than a serial LCD (3 pins - gnd, v+ and RX instead of a lot (8 or 12 or 15 ish))

LCDs are pretty expensive (especially serial ones), plus not as easy to make waterproof, as I mentioned earlier. Using two small 5x7 matrices I could display data and make longer texts scroll. And with just a surface of about 3x2 cm, discretely under the shift lever! I'm not afraid of coding my on library for them.

thanks for all that inspiring info!

Do you have a site describing how to build these buttons, fool proof?

This should help:
http://www.arduino.cc/playground/Main/CapSense

Well, I would also like to be able to turn the head/rear lights on and off, as well as the blinkers, independently. So, there's gotta be buttons.

For the lights, you could have a light sensor to control them but you would need buttons for the blinkers...

Please do! I will PM you my e-mail adress. Or you could just post them here in the forums! I'm looking forward to seeing them

Ok, I'll try to sort that out tonight and then send it all tomorrow

Well, I figured it would be the best place to "hide" it from potential thieves while leaving it accessible for battery changes / firmware upgrades. I will think about a front-mounted version as well! The battery's size is my main concern, and the lower side of the luggage carrier just lends itself to clip the microcontroller there Smiley
But then I would need some wires going to the back to power the rear light and blinkers.... No way around it.

A front mounted one could be pretty small. The blinkers are going to be on the handlebars no? You would need wires for the rear light though.

LCDs are pretty expensive (especially serial ones), plus not as easy to make waterproof, as I mentioned earlier. Using two small 5x7 matrices I could display data and make longer texts scroll. And with just a surface of about 3x2 cm, discretely under the shift lever! I'm not afraid of coding my on library for them.

They are a bit expensive. You're a braver man than me if you want to code for scrolling on 2 matrices!

Mowcius

By the way, how big is your battery? I presume that it is a lipo 3.7v cell and is about 30x50x4mm ish.

What capacity is it? I have been looking at the 2000mah lipo cells and that was what I was considering as a backup in my project.

Mowcius

An Inclinometer if that is a real name that measures and displays the slope up or down in degrees or ratio and suggests a gear in relation to speed. Only a gimmick but a challenge I suppose.

There is not such thing but you could use the data from the gps on altitude and compare it to a previous reading from a short time ago to work out incline. For showing when you should change gear you can use a reed switch to tell you what your cadence is (speed at which you are pedalling) and then from the speed that you are travelling (reed switch on wheel or gps data) you can suggest whether you should change up or down. If you only have one sprocket on the front of your bike you can also then work out what gear you are in.

If you want to get mad about it then you could use a gyroscope and accelerometer to measure movement (just cos you can) and a magnometer to measure the direction of north and give you a heading (gps can also give you a heading and direction of north when you are moving but not when you are stationery)

Or you could use an inertial measurement unit...

An inertial measurement unit (IMU) combines information from two or more sensors, such as gyros, accelerometers, magnetometer, and/or GPS, to determine orientation and velocity vector relative to the earth. The computations are fairly complex, and special filtering is often required to eliminate the measurement noise these silicon devices are subject to, so a "low cost" off-the-shelf IMU with decent specs can easily cost $1000 to $5000 US.

:o
Shame I don't have that much spare cash :cry:

My idea of everything you could measure ;D:

Temperature
Heading
Wheel rpm
Speed
Average
Max
Trip Distance
Overall Distance
Trip Time
Current Time
Date
Cadence
Current Gear
Battery/dynamo voltage
etc etc...

Anyone got any interesting feasible other ideas? :sunglasses:

Mowcius

By the way, how big is your battery? I presume that it is a lipo 3.7v cell and is about 30x50x4mm ish.

it's a 3.7V Li-Ion measuring 50x35x4mm indeed. I dont't know the capacity, and I still need to figure out what those three wires coming out of it do.

you could use the data from the gps on altitude and compare it to a previous reading from a short time ago to work out incline

GPS doesn't do very well on altitude measurings, and a gear recommender is not something I'm really planning to implement right now.
I care about speed (rpm/kmh, current and averagef), distance (last trip and total) mostly.
temp, heading, time&date, would be nice. A low battery indicator would probably be smart.

Your project is very interesting!

For the LCD, have a look at those cheap 8x2 on eBay! (less than 5$ I think)
There is a post on the forum about I2C or register modified LiquidCrystal librairies.

I would say that a small form-factor Arduino or even a Standalone chip with the few components would the a good solution, because you don't want it to be stolen but the most expensive will be in the rear box ?
I would put everything in the front, except if you have lots of stuff...
Or take the to boxes away when you park your bike!

(Hm, seem like fun to make: small box to put in front of a public bike (Paris's Velib) when I ride... an accelerometer+GPS+LCD logger... but would it make sense, switching from my iPod touch to an iPhone would be cheaper and still fun coding the app?!)

it's a 3.7V Li-Ion measuring 50x35x4mm indeed. I don't know the capacity, and I still need to figure out what those three wires coming out of it do.

My size guess was damn good... I have one somewhere but have not measured it :smiley:

Is it a li-ion battery or a li-poly battery? It doesn't make massive amount of difference but it would be good to know...

I presume that you have scavenged the battery out of something then and have not bought it separately. You will need a specific charger for it. Annoyingly you cannot trickle charge li-ion or li-poly batteries so you can't charge it on journeys using the dynamo.

GPS doesn't do very well on altitude measurements, and a gear recommender is not something I'm really planning to implement right now.
I care about speed (rpm/kph, current and average), distance (last trip and total) mostly.
temp, heading, time&date, would be nice. A low battery indicator would probably be smart.

I agree that GPS isn't that great for altitude. You would get a very inaccurately incline measurement from it (but you would still get one). The sirfIII and newer GPS chipsets are more accurate but with an accuracy of up to about 2.5m you could still be a long way off what it says...

The gear indicator I also do not see a need for, I just mentioned it because someone has done it before...

Ok so:

Speed is easy (s=d/t) - every time the reed switch activates it is the circumference in distance/time since last sense...

Distance - amount of senses on reed switch * circumference of wheel...

Average - This really needs to be permanently being calculated to get it accurate but I'm not sure of the best way to do this. Anyone got any ideas?

Odometer - This is more difficult. You need to save data to EEPROM before power loss. Code ideas:
On startup, read distance data. Then add on trip distance to that during trip. At some point before power loss, this data then needs to be re-saved to EEPROM. I'm not sure how the best way to do this is. I'm probably missing something really simple...

Temperature - Easy - From temp sensor (may need a bit of calculation to get it to degrees)

Heading - Can be gained from a magnometer (or from GPS)

Time & Date - Easiest to get from GPS data. You could also get time and date from a real-time clock module (Sparkfun sell them: SparkFun Real Time Clock Module - BOB-12708 - SparkFun Electronics)

Mowcius

For the LCD, have a look at those cheap 8x2 on eBay! (less than 5$ I think)
There is a post on the forum about I2C or register modified LiquidCrystal librairies.

Unfortunately nobody has had a good idea of how to waterproof an LCD yet. If you make a sealed box then it will inevitably get some moisture in it and steam up inside and never dry out again...

There is quite a lot hanging round when you look for it :stuck_out_tongue: I am always amazed at what obscure bits of code are available with a bit of digging...

I would say that a small form-factor Arduino or even a Standalone chip with the few components would the a good solution, because you don't want it to be stolen but the most expensive will be in the rear box ?
I would put everything in the front, except if you have lots of stuff...
Or take the to boxes away when you park your bike!

That was an idea I had, make a connector to connect the dynamo and lights and just leave everything else in a box that you can remove from the bike...

(Hm, seem like fun to make: small box to put in front of a public bike (Paris's Velib) when I ride... an accelerometer+GPS+LCD logger... but would it make sense, switching from my iPod touch to an iPhone would be cheaper and still fun coding the app?!)

Huh? I don't quite understand the relevance of the ipod/iphone etc to this post...

Btw... Don't you want one of these!

That's gone down on my list of things to buy for my project!

Mowcius