The hardware is pretty straight forward:
- 18650 battery
- a TP4056 battery-charger unit;
- a DC-DC boost convert to 5V.
- a ESP8266 D1 mini board.
c. display and user interaction:
- a regular 1602 LCD (HD44780 controlled);
- a I2C adapter.
- UPLOAD button;
- SELECT button - to select between displaying mode: either TIME, CALORIES, DISTANCE, RPM or ALL (this is not yet implemented). Currently ALL are displayed at once;
- UP and DOWN buttons - to increase/decrease number of minutes for workout - it is not yet implemented.
I have improvised a shield for D1 mini: all signals from buttons and LCD come to the shield via 10-pin flat ribbon cable. This way I can detach the parts of the console and open it quite easily. Also on the shield I have two connectors: one for the sensor and one for the POWER switch.
Routing the wires inside the console enclosure and fitting everything inside proved to be a more challenging than I originally thought. I see how easily (and more elegant) it would have been to 3D print an enclosure especially for this.
As far as software is concerned:
- the bike can measure the time for workout, distance traveled, RPM, average speed for the whole workout (meters/seconds);
- all the data is uploaded to Thingspeak once the UPLOAD button is pressed;
- since the ESP8266 is located in a place that is not easily accesible, OTA (Over The Air) updating is included in the software.
What needs to be added:
- calories measurement;
- use a bigger font to display one of the metrics;
- different predefined workouts (selectable).
Pictures of the console (this is the back side of the console, the side that is not visible to the user): the ribbon coming from inside the console, the sensor wires and the power switch wires.
For charging the battery:
Data on Thingspeak: