TDM-Duino project is on its way !
It all started as an Arduino project to replace the gear position display on my bike.
I also wanted to display some more data as the original Diag Mode will not work when the engine is running.
I also wanted some fuel consumption data and a trip computer.
Finally why not include a performance monitor ?
This project uses an Arduino (Uno for testing, Nano on the final setup as it has less power consumption and a much lower footprint), an LCD 16x2 display and some extra electronics for input/output/power.
There are no extra modules like rtc or sd card reader. All timing and memory is done with the Arduino.
The coding :
The first thing I did was the gear position display : it uses some custom characters on the LCD screen to display big digit as an 8 segment display, using two lines.
Then I added some extra screens to display more info and give it a more onboard computer look to display fuel consumption, trip info, performance data and disgnostic data (the Diag Mode on the bike does not work when the engine is running.
The project uses the original bike sensors.
The gear sensor uses a resistor scale to give an analog value which is read on an analog input. It could as well use a diode matrix and be read on three digital inputs, just a matter of choice.
The fuel sensor should give me some headache : I'm pretty sure it don't have a great accuracy, I still have to check it and make calibration.
Other sensors are not too difficult to read : the pressure sensors are standard models, datasheet is available. The temperature sensors needed some more important internet research to gather usable infos.
The TPS is just a potentiometer
So far there are five different screens showing all the available infos. The gear position is always displayed.
Power-on screen
Screen 1 : Main
- Engine rpm
- Engine coolant temperature
- Speed
- Battery voltage
Screen 2 : Fuel Consumption
- Instant Fuel Consumption
- Fuel remain
- Average Fuel Consumption
- Expected mileage (up to 999km)
Screen 3 : Trip data
- Trip distance (up tu 9999km - xx.x bellow 99km, xxxx above)
- Trip time (up to 99h59m - mm:ss bellow 1hour, hhHmm above)
- Average speed
- Max speed
Screen 4 : Diag mode
- TPS : throttle position sensor
- MAP : manifold air pressure
- IAT : intake air temperature
- BAP : barometric air pressure
Screen 5 : Performance
- Time : 0-100kph
- Time : 0-160kph
- Time : 0-400m
- Time : 0-1km
Two push buttons are used mainly to navigate between the screens but they also have a different usage on a long push :
- button 0 : screen up (short push) / lcd backlight on/off toggle (long push)
- button 1 : screen down (short push) / current screen data reset (long push)
Digital in/out :
- injector signal on int0, gives rpm data and injection timing / fuel consumption.
- speed sensor on int1, gives speed & distance data.
- button 0 input
- button 1 input
- power-off sense
- analog inputs select
The speed calculation constants may be changed according to the final gear ratio.
All displays are metric and fuel consumption given in L/100km but they are easy to change to imperial.
Analog inputs :
- Gearbox Position Sensor
- Fuel Level Sensor
- Manifold Air Pressure
- Barometric Air Pressure
- Engine Coolant Temperature / Intake Air Temperature
- Battery Voltage Sensor / Throttle Position Sensor
I use a four wires LCD display so only 6 of the 8 analog inputs are usable.
4 inputs go directly to the ATmega and 2+2 are selected by a CD4093.
All input are bufferized except the gear position sensor and the fuel level sensor.
Some data need to be stored permanently (fuel & trip data), even when the power is off.
This may be done live by using an external memory (SD card module), not really useable (big memory usage, too much transfert time), or by using the ATmega built-in eeprom but in this case it shouldn't be during working due to the limited write cycle on the ATmega eeprom but also due to the time it takes to white data into the eeprom. I finally decided to use the ATmega eeprom solution and use a power-off code and electronics which allow enough time at power-off to store all the data in eeprom. All data stored is of course recovered at power-on.
Several options may be added :
- unlock the bike (using a relay on the alarm connector) with long push (10s) on one of the buttons or with another (hidden) button or a reed switch.
- automatic headlight on when engine is running & bike moves.
- radiator fan on/off at different temperatures.
- shift light.
- ambiant air temperature with ice alarm.
This is a long project, Arduino coding is almost finished and seems to work ok on the workbench using some simulation data.
Fuel level sensor needs calibrating. This shouldn't be easy as I suspect the sensor to be very imprecise.
There is also the final casing and the lcd display location, and also the buttons location - should go on the lhs handle.
Project will probably change while I proceed on some sensors experiments !
Any appreciations / suggestions / cakes are welcome.