Go Down

Topic: Motorcycle Dashboard - Rpm, Speed and Fuel Gauge (Read 4837 times) previous topic - next topic

menticol

Jan 05, 2015, 10:27 pm Last Edit: Jan 05, 2015, 10:42 pm by menticol
Hello guys!

Since I'm new in the forum let me introduce myself: My name is Felipe, and I'm writing from Bogotá Colombia. I have some experience with electronics and programming languages, but Arduino is my first approach to the world of micro controllers.

If I can help you with something, I'll be glad!

Regarding my question, my project is a custom dashboard for my motorcycle. The plan is capturing speed, RPMs, fuel quantity and engine temperature, and then using that data to make a more complete and visually-appealing dashboard (hopefully that will come later).

On the hardware side, I've intercepted the wiring loom going to the OEM dashboard. The RPMs signal comes from the ignition circuitry, and are fed to Arduino's Analog input # 5.

The speedometer is installed on the front wheel, and sends eight +5V pulses for each wheel rotation. Naturally the pulse frequency is directly proportional to the wheel's rotation speed.

Fuel measurement is done with a potentiometer inside the fuel tank. The sensor is shorted to ground, and a full tank means almost zero resistance to ground.  Fuel sensing is done with Arduino's #1 analog input, and it goes in series with the OEM fuel sensor.

On Arduino's analog Pin 0 there's a connection from an Dfrobot LCD + keypad module.

Temperature has not been implemented yet, I'm planning to do it using a LM35 sensor.

Now, the software side. The code is powered by the "elapsedMillis" library by John Ploche, and it works as follows: The RPM and Speedometer pulses are collected. Everytime the counter reaches 500 ms the rpm calculation is made from these pulses, and counter resets to zero (getting ready for a new stream of pulses). The speedometer, works the same way, but every 1000 ms.

Other functions are an odometer, an elapsed duration of travel indicator, and the fuel indicator showing % and litres available.

I was very happy with the code, it was even more accurate than the OEM dashboard. But then I made a dumb change and I spoiled it! It looks like this:

REAL RPM         INDICATED RPM
1200                 2100
2000                 3000 - 3200
3000                 4200 - 5000

and so on...

My suspicion is that some new instruction is stealing precious processor time, but after hours and hours trying I couldn't figure what was the change and why it doesn't work.

Please, if you can give me some light about the problem, I'll be extremely grateful. Attached is the code and some pics of the project.

Best regards

menticol

Hello again! A little update

Tried a desperate measure and removed all the code except by the RPM and Km/h speed calculations. It works again. But well, all the Arduino expense just for duplicating a perfectly good dashboard? is dumb.

I can't believe that the power of Arduino is not enough to make such simple calculations (enlapsed time, odo, fuel percent, etc.)

Paulcet

I am no expert....  But it is a $3 uC....

I do find it curious that you are using the analog inputs for pulse counting.  You might want to use the digital inputs for all but the fuel level signal.  I have read some things about noise on the analog inputs, and having invalid data when changing from output mode to input mode (not your case I suppose).

wildbill

Certainly the use of analogRead is unusual - digitalRead is more likely the right thing. You're still polling though. Alternatively, people often use interrupts when reading RPM or speed in this kind of situation.

menticol

Hello Paulcet and Wildbill! Thank you by your answers

I am no expert....  But it is a $3 uC....

I do find it curious that you are using the analog inputs for pulse counting.  You might want to use the digital inputs for all but the fuel level signal.  I have read some things about noise on the analog inputs, and having invalid data when changing from output mode to input mode (not your case I suppose).
Don't underestimate the power of $3 uC! with that computer power we reached the moon :P My doubts are more centred on my programming skills!

Certainly the use of analogRead is unusual - digitalRead is more likely the right thing. You're still polling though. Alternatively, people often use interrupts when reading RPM or speed in this kind of situation.
I'll fix the wiring to use the digital inputs instead. Also I'll check some examples of Interrupts, as both of you suggest. I'll keep you updated of any progress!

menticol

Well guys, here's an update:

I tried using the following directions, linked from Arduino Playground.

http://elimelecsarduinoprojects.blogspot.com/2013/06/measure-rpms-arduino.html

On Digital Pin #2 I've connected my signal coming from the ignition. The problem, as you see on the attached image, persists.

The engine was running stable at 1000 rpm during the test.

I'm running out of ideas...

Paulcet

Let's have a look at your code and schematic

alaminxp

Have you able to complete the project? I am also thinking for same Project.
I also have Apache RTR 180.

I want to make a motorcycle dashboard as like your.

Go Up