Arduino Based Tachometer for Gym Cycles
Introduction: Arduino Based Tachometer for Gym Cycles
My grandfather tries to exercise regularly on the gym cycle he has, however, the display for the cycle is broken. Therefore he is unable to see the distance travelled by him after exercising for a certain period of time.
The LCD used on the gym cycle to display the data was custom made and could not be replicated. He was unwilling to exercise without an indication of the distance travelled.
Therefore, I came up with this solution where my grandfather could still measure the number of cycle revolutions over a certain period of time and calculate the distance travelled.
This project won't apply for regular cycles, but for exercise bikes, it is a perfect option if the LCD display is old or damaged.
The design of the circuit is very similar to one of my previous projects: Distance sensor (for white cane). Please check it out if you would like to. https://www.instructables.com/Distance-Sensor-for-...
Supplies
1) 1 x 16x2 LCD screen (link)
2) 40 x Male to Male and Male to female jumper wires (link). You need an assortment of male to male and male to female wire (link)
3) 1 x HC-SR04 Ultrasonic sensor (link)
4) 1 x Arduino Uno or Arduino Nano with its connecting cable (link)
5) 1 x 170 point-small-breadboard (link)
6) 1 x Potentiometer or trim pot for controlling the LCD's contrast (link)
Step 1: How the HC-SR04 Ultrasonic Sensor Works With the Arduino
The HC-SR04 ultrasonic sensor works on the principle of sound wave reflection. One side of the sensor sends an ultrasonic wave and the other side of the sensor detects it.
These two sides are used in conjunction, the trig pin of the HC-SR04 is activated, which causes the sensor to shoot an ultrasonic sound wave.
The echopin then comes into play. 939
The sensor gives out a high value on the echo pin when it detects that the sound wave has reflected and come back.
The Arduino and its code are used to measure the time difference between the ultrasonic sensor's trig pin being activated and the echo pin turning high.
This time difference is essentially the time taken for sound to traveltwo times the distance (because it is being reflected) between the sensor and the object it is being pointed at.
Knowing the speed of sound, about 340 m/s, and the time difference makes it very easy to calculate the distance.
2 * distance = speed of sound x time dif.
Actual distance = 0.5 x 340 x time dif.
Here is a link that might explain the circuit a little better. https://howtomechatronics.com/tutorials/arduino/ul...
The other two pins on the sensor, Vcc and GND, are connected to the +5V supply and ground pins on the Arduino respectively. They are there just to power the sensor.
Step 2: How the Device Works
The entire device sits right underneaththepedal so that when the pedal with the ultrasonic sensorpointingup on to the underside of the pedal.
The device is constantlymeasuring the distance between the sensor and the pedal. Since the person is cycling, this value would be changing constantly similar to a sinecurve.
When the pedal is on its lowestpoint the distance measured by the sensor and recorded by the Arduino is less than the set thresholdvalue in the code.
This causes a counter value on the Arduino to increase by 1 indicating that one revolution has been completed. This then can be translated to actualdistance using the diameter of the gym cycle wheel.
The devicestarts immediately recording the number of revolutions once it's USB cable has been plugged into a power source. This power source can be a laptop, power bank, or an adapter from the wall.
Step 3: Wiring the LCD
Pins D2, D3, D4, D5, D11, and D12of the Arduino is connected to pins 14, 13, 12, 11, 6, and 4 of the LCD, respectively.
The pins will be numbered directly on the Arduino. For the LCD you can count the pins from left to right if they aren't already numbered.
These are roughly the data pins which transmit information from the Arduino to the LCD about what to display on the screen.
Pins1, 5, and 16 of the LCD are connected to ground.
Pins2 and 15 of the LCD are connected to +5V.
Pin 3 of the LCD is connected to the middle terminal of the Potentiometer or trim pot. One of the other two terminals of the Potentiometer or trim pot should be connected to ground and the other to +5V. 939