sunnuntai 30. kesäkuuta 2013

IOIO Cyclocomputer - enhanced version


I had some issues with my first proto of cyclocomputer that I covered in previous post. Briefly, sensor signals and IOIO board electricity start failing when driving on rough road. That happened since I used very basic wire connectors without any locking mechanism. Now I have made some improvements to get hardware work better. I created so called shield that is attached over IOIO board and solder all wires directly to it. That solved connector issues since there is no separate connectors anymore. Shield is still removable and IOIO board can be easily removed if needed. I also improved Android user interface to have more professional look.

IOIO board and custom made shield where sensors are connected.

Shield attached to IOIO board.

Standard speedometer sensor to measure cadence. Magnet is attached to crank.

Standard speedometer sensor to measure speed.

Android user interface.

I try to hide wires and succeeded quite well.


sunnuntai 9. kesäkuuta 2013

IOIO cyclocomputer - mounted to bike


I got my cyclocomputer proto mounted to bike that I mentioned in previous post. Briefly, computer is running on Android phone and IOIO board is used to connect phone to sensors. Sensors are ordinary speedometer sensors that normal out of the stock bike speedometers are using. It means that there is no need to use GPS to measure speed since speed data is measured by physical sensors.

On my proto I'm using two separate sensors to measure wheel rotation and cadence speed. For clarification, cadence means how fast foot pedals are rolling around (rolls per minute). Using collected data I can calculate speed, travel distance, average speed, cadence, gear ration etc. Calculated values are displayed on Android phone that is mounted to bike handlebar.


Bike mounting

Android device can be connected to IOIO board by two ways: using USB cable or wireless bluetooth. Unfortunately my old phone (HTC Desire HD) is not capable to open bluetooth connection to IOIO so I'm forced to use not so fancy USB cable. Anyway, connection is working and that only matters. IOIO board itself including 9V battery is packed to saddle bag. I have faced some issues with sensor connectors on shaking bike because connectors are simple pins on board without any locking mechanism. I have to consider to purchase better connectors if I would like to have more permanent solution ... and maybe  something else than masking tape on wiring :)


Some words about application code

Controlling IOIO board from software code is relatively simple. Only challenge I faced was to figure out how to measure two separate sensors simultaneously. To measure very short signals such as rolling wheel I had to use IOIO method called input.waitForValue(bool). Problem is that waitForValue() freeces the program execution until desired value appears (magnet passes sensor) so it is impossible to measure two separate signals simultaneously. When program is waiting signal from rolling wheel it cannot capture signal from cadence sensor. I solved this issue by creating own thread for both sensors and got code running correctly. Rest of the application is mostly calculating values and displaying them on screen. Total count of lines containing comments is about 350.

Example of thread to measure sensor value:

Summary

Overall project was succesful and didn't take too much time to implement - thanks to IOIO board that is easy to develop. After few rides the biggest issue is loose connectors. When driving on rough road the sensor signals and board electricity start to fail. Connectors have to be build carefully to get hardware work without issues. Currently I'm using basic harvin connectors to connect wires to IOIO board and they are not tight enought to work on moving bike. In future I will make some improvements to get hardware to work better.