Arduino LilyPad Cyclocomputer
R Java C++ C Objective-C
Latest commit fcb1c70 Dec 10, 2012 @markfickett Merge pull request #1 from NetRat/patch-1
Update MomentaryButton.h for Arduino IDE versions >= 1.0, conditionally using Arduino.h instead of WProgram.h.
Failed to load latest commit information.
Histogram.cpp Format Histogram output for R when printing. Jan 20, 2011
MomentaryButton.cpp Reinstate the histogram (as yet without EEPROM save/restore). Jan 19, 2011
MomentaryButton.h Update MomentaryButton.h Dec 9, 2012
README.html Add a markdown symlink to the HTML README for github. Jan 21, 2011
cyclocomputer.pde Rename project to cyclocomputer. Feb 21, 2011
exampleData.R Add an R script to generate a histogram from the data recorded and pr… Jan 20, 2011
makeGraph.R Output kilometers when graphing (as well as for trip meters). Jan 23, 2011

<!-- .prosign { text-decoration: overline; } [title] { cursor: help; border-bottom: 1px dotted black; } img, a img { border: none; } #license { float: left; margin-right: 1ex; } -->

Bicycle Computer for Arduino LilyPad

This is a bicycle computer, designed to count wheel revolutions using a cyclocomputer wheel sensor. It stores two trip meters and a speed histogram; the trip meters are reported in Morse code via a speaker, and the histogram can be saved to EEPROM and later printed over the serial connection.

(Mouse over text like this for elucidatory tooltips.)

See photos and a video along with discussion concerning the hardware construction (sewing) and use.

Authorship and License

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License; it is written by Mark Fickett. (Do let me know if you find it interesting or useful! Or, should you find bugs, a report or a pull request would be welcome.)


The interface was designed for the LilyPad Arduino ATmega328 (Leah Buechley, All peripheral hardware has one lead connected to the specified pin, the other to ground.

  • PIN_REV_SENSOR (12) — connected to a commercial cyclocomputer's sensor (chosen only because it was already on the bike)
  • PIN_SPEAKER (3) — a buzzer, originally the ringer on a cordless touch-tone phone
  • PIN_BUTTON_REPORT (2) — a momentary switch, easily triggered without looking (similar on sparkfun), originally from a VCR's circuit board
  • PIN_BUTTON_A and PIN_BUTTON_B (11 and 12) — LilyPad Button Boards, difficult to trigger accidentally
  • and PIN_STATUS (13) — the built-in status LED

Controls and Outputs

The status light blinks K (dah-dit-dah, -.-) when setup completes, then a short blink each time the wheel sensor is triggered. The trip meters are named (in Morse output) dit or dit-dit. Button inputs are either a tap (quick press and release), or a hold:

  • Tap PIN_BUTTON_REPORT to hear the trip meters' values in Morse on PIN_SPEAKER.
  • Tap PIN_BUTTON_A or PIN_BUTTON_B to reset the associated trip meter; the name of the trip meter and SK are sent as confirmation.
  • Hold PIN_BUTTON_REPORT to write the histogram values to serial output, formatted for R (see makeGraph.R).
  • Hold PIN_BUTTON_A to save the histogram to EEPROM. Before writing S is sent; then the status LED is lit during writing, and finally a dit is sent after writing is complete. The histogram is always read from EEPROM on startup.
  • Hold PIN_BUTTON_B to clear the histogram. (This does not write the cleared histogram to EEPROM.) An X is sent as confirmation.

Dependency: Morse Library

The Morse code output uses a Morse library for Arduino, the key feature of which is to allow monitoring an input (PIN_REV_SENSOR) while sending Morse.