Hello, I'm trying to build an odometer for my electric scooter using the code and wiring from alan_dewindt's odometer setup. At low speeds the arduino seems to be picking up the digital pulses from the hall effect sensor module, but at higher speeds the arduino seems to be skipping readings from the sensor and outputting a slower speed on the LCD. Even at full speed the light on the sensor appears to be blinking in time with the revolutions of the wheel so I don't think the sensor is the problem. I've tried two different setups with the same wiring - one uses a Nano and the other uses an Uno. I'm pretty sure they are fakes since I got them for cheap on ebay, but I've never had any problems with either of them. I created a sketch that displays the digital output of the hall effect sensor which shows the arduino skipping readings.
I would really like to keep the functionality of his code since I am not particularly very experienced at arduino programming. I have modified his code but only to change the wheel circumference to 0.495m. Hopefully this is a simple fix. I really want to be able to know how fast my scooter goes!
alan_dewindt's odometer setup: https://create.arduino.cc/projecthub/alan_dewindt/bicycle-odometer-and-speedometer-with-99-lap-period-recorder-331d2b
My hall effect sensor:https://www.ebay.com/itm/2PCS-3144E-Hall-Effect-Sensor-Switch-Speed-Counting-Sensor-Magnetic-Detector-RF/323790631863?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649&autorefresh=true
My troubleshooting sketch which displays the output of the hall sensor in the serial plotter:
int sensorPin = 13; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
// begin the serial monitor @ 9600 baud
Serial.begin(9600);
}
void loop() {
// read the value from the sensor:
sensorValue = digitalRead(sensorPin);
Serial.println(sensorValue);
Serial.print(" ");
delay(20);
}
I have attached an image of the serial plotter with the gaps in the sensor reading as well as a picture of my arduino uno setup which I used to plot the hall sensor output.
![20200406_215203[1].jpg](https://europe1.discourse-cdn.com/arduino/original/3X/c/a/cac5eac75360331fcc371ad3028576b60a03eac8.jpg)