It is amazing the processing power available these days at such low prices, I would think a Raspberry pie could actually land a space mission on the moon. With the two Arduino's functioning its definitely what could be described as a smart bike and can now maintain a cadence with amazing accuracy.
![[Image: iP5t9y.jpg]](http://imageshack.com/a/img923/3325/iP5t9y.jpg)
The two Arduino's have most of their pins connected together although most aren't used but it adds extra support. I left pins D10 - D13 unconnected as they can be used for serial communication with the data logger. The data logger is not as important since I found an amazing app called Bluetooth Terminal/ Graphics. It not only logs data but also draws graphs live on my phone. Very useful to be able to see what's going on whilst riding the bike. On the topic of apps I've also found ArduinoDroid - Arduino IDE to be very useful for making quick modifications to the code, can't really believe it works on a smartphone. As my phone has reverse charging capability it can easily power the Arduino as well.
![[Image: bN7Upq.jpg]](http://imageshack.com/a/img921/5784/bN7Upq.jpg)
At the moment I have a simple I2C communication going between the two Arduino's. The additional Arduino is currently only measuring cadence and sending the value to the master when requested. An offset is calculated from the difference between the desired cadence and the actual cadence. This is then feed into the main equation.
Here's the first data I recorded with and without cadence correction. I did the same 7 mile length of road first section hilly the rest flat. Feels amazingly accurate when riding, a few rpms difference is undetectable. Makes a big difference not having a drop in cadence as the bike slows on a hill.
![[Image: VJsFeB.jpg]](http://imageshack.com/a/img922/9818/VJsFeB.jpg)
![[Image: jukXKG.jpg]](http://imageshack.com/a/img923/6084/jukXKG.jpg)
![[Image: Hq0OYO.jpg]](http://imageshack.com/a/img921/5369/Hq0OYO.jpg)
I forgot I was still in the small chainring for the first couple of miles which is why cadence goes so high.
![[Image: YiEpM1.jpg]](http://imageshack.com/a/img922/442/YiEpM1.jpg)
The resulting frequency graph appears to be 1rpm out, need to update the value in the servo position equation.
Whilst this simple offset proportional to difference in cadence works well under the right conditions it all goes wrong if there is to big a change in cadence. An oscillation is setup during acceleration or when I start pedaling again. Will be a nice little challenge to work out how to dampen this whilst not reducing the responsiveness. The other option is to write some code to disable the cadence correction until a period after I start pedaling.
![[Image: iP5t9y.jpg]](http://imageshack.com/a/img923/3325/iP5t9y.jpg)
The two Arduino's have most of their pins connected together although most aren't used but it adds extra support. I left pins D10 - D13 unconnected as they can be used for serial communication with the data logger. The data logger is not as important since I found an amazing app called Bluetooth Terminal/ Graphics. It not only logs data but also draws graphs live on my phone. Very useful to be able to see what's going on whilst riding the bike. On the topic of apps I've also found ArduinoDroid - Arduino IDE to be very useful for making quick modifications to the code, can't really believe it works on a smartphone. As my phone has reverse charging capability it can easily power the Arduino as well.
![[Image: bN7Upq.jpg]](http://imageshack.com/a/img921/5784/bN7Upq.jpg)
At the moment I have a simple I2C communication going between the two Arduino's. The additional Arduino is currently only measuring cadence and sending the value to the master when requested. An offset is calculated from the difference between the desired cadence and the actual cadence. This is then feed into the main equation.
Here's the first data I recorded with and without cadence correction. I did the same 7 mile length of road first section hilly the rest flat. Feels amazingly accurate when riding, a few rpms difference is undetectable. Makes a big difference not having a drop in cadence as the bike slows on a hill.
![[Image: VJsFeB.jpg]](http://imageshack.com/a/img922/9818/VJsFeB.jpg)
![[Image: jukXKG.jpg]](http://imageshack.com/a/img923/6084/jukXKG.jpg)
![[Image: Hq0OYO.jpg]](http://imageshack.com/a/img921/5369/Hq0OYO.jpg)
I forgot I was still in the small chainring for the first couple of miles which is why cadence goes so high.
![[Image: YiEpM1.jpg]](http://imageshack.com/a/img922/442/YiEpM1.jpg)
The resulting frequency graph appears to be 1rpm out, need to update the value in the servo position equation.
Whilst this simple offset proportional to difference in cadence works well under the right conditions it all goes wrong if there is to big a change in cadence. An oscillation is setup during acceleration or when I start pedaling again. Will be a nice little challenge to work out how to dampen this whilst not reducing the responsiveness. The other option is to write some code to disable the cadence correction until a period after I start pedaling.
- Oran

