Tachometer + motor temperature on Arduino for MiniMoto

I bought my son his first motorcycle last season. Joy knew no bounds.



We rode, everything is fine, but because minibikes don't have a speedometer, no tachometer, nothing, the idea came to fix it. Of course, there are ready-made options on sale , but the whole interest is in trying to do something yourself, but you can always buy. What came out of this, read below.







To fix the engine speed, I use the Hall sensor NJK-5002C, when a permanent magnet appears in the zone of operation, the sensor sends a signal to the output. Magnetic stripes are present on the engine flywheel; you do not need to glue / tighten magnets.







To determine the engine temperature, I use a waterproof DS18B20 temperature sensor, which is inserted into a special washer under the spark plug.







In my implementation of the device, the button cycles through the modes: when turned on, the revolutions are displayed, pressed the button - the revolutions changed to temperature, pressed again - the temperature changed to revolutions, etc. round.



Required details:

Arduino UNO / Nano

Hall sensor NJK-5002C Temperature

sensor DS18B20

7-segment display on TM1637 chip Momentary

button

Resistor 100 Ohm

Development board

Wires



Connection diagram




Let me explain one point in the sketch for what I use a timer: so, we can only get temperature data from the sensor (sensor.getTemp ()) by sending a request (sensor.requestTemp ();) and waiting (delay (1000);). As always, delay spoils everything, and if you poll the button in the loop without a timer, then switching the mode once to display the temperature (delay will work) - we will not be able to change the mode, because the microcontroller waits and pressing the button will not process. To avoid this, I also poll the button on a timer.





The video shows how it all works, for installation on a motorcycle I misunderstood a little with the diameter of the NJK-5002C sensor, which will be installed in the body of the inertial starter and so that everything is smooth, the diameter needs to be smaller, I plan to use the LJ8A3 or LJ6A3 sensor. By the next motorcycle season I will try to arrange everything in some kind of case and install it on MiniMoto, respectively, when ready, I will supplement the article with photos and videos.



Link to sketch and libraries.



For those who are interested in riding MiniMoto, a link to my son's YouTube channel.



All Articles