Bicycle odometer with ESP-12

The idea is to make a Bicycle odometer with ESP-12, a chip that would allow us to create an app to verify the bicycle speed. I plan to measure the speed of the bicycle in km/h (kilometers per hour) using a reed switch sensor and a magnet on the wheel.

This is just like any other bicycle odometer works basically. The difference in my project will be the display (there will not be a proper display): I will show the speed in six LEDs in increments of 5km/h. So LED 1 is >5km/h, LED 2 is >10km/h and LED 6 is >30km/h. This means that I cannot measure precisely anything above 30km/h, which for a weekend leisure bicycle is ok in my opinion.

As previously stated I will be using an ESP8266 ESP-12 as the brains of the project, just because I have a bunch of them laying around. The connections of it for programming and reseting will be fairly similar to the ones found here.

State of the project

I just sent the PCBs to be manufactured in China @ PCBWAY. Have not started writing code yet, guess I will wait for the PCBs to arrive and then it will be prototype time!.

The schematic diagram and layout

Speakig of connections, here is the schematic diagram and printed circuit board layout of the project.

Schematic diagram of the ESP-12 bicycle odometer
Schematic diagram of the ESP-12 bicycle odometer
Layout of the ESP-12 bicycle odometer
Layout of the ESP-12 bicycle odometer
Front 3D view of the ESP-12 bicycle odometer
Front 3D view of the ESP-12 bicycle odometer
Back 3D view of the ESP-12 bicycle odometer
Back 3D view of the ESP-12 bicycle odometer

A couple of things to notice: the six LEDs will be charlieplexed, using only three pins of the ESP-12. There is a 2.54mm jumper for entering the ESP-12 programming mode. The reed switch input goes through a RC circuit for low pass filtering. There is a three-pin connector for the voltage regulator.

The voltage regulator

I initially considered using the AMS1117-3.3 LDO (low drop output) voltage regulator, but according to its datasheet it has a drop voltage of 1.1V. I want to use Lithium 3.7V batteries in this project so a 1.1V drop in 3.7V would be down to 2.6V, not enough for the ESP-12 to function.

There are other commonly available LDOs around, but all of the are 0.6V or higher of drop voltage. Not enough. I then considered using buck converters, putting the voltage down from 3.7V. That has problems too, since a low battery voltage (say 3.5V or lower) would make it not viable for the buck to generate the required 3.3V.

I ended ep settling for a buck-boost circuit (actually a charge pump) called HX4002 from Aliexpress, enough for what I need. It goes up to 150mA with voltages between 2.7V and 5.5V.

HX4002 charge pump circuit
HX4002 charge pump circuit

Project characteristics in bullet points

  • ESP-12 WiFi chip controller.
  • Reed switch speed sensor (same as any other bicycle odometer).
  • 3.3V Buck-boost (charge pump) regulator for 3.7V Lithium battery supply, with TP4056 for charging.
  • The “display” of speed will be six 5mm green LEDs.
  • There is a reset push button and a programming jumper for the ESP-12.
  • I plan to add WiFi capabilities in the future, maybe for an APP or webpage to be able to read speeds.