Reading Car signals

Hello guys,

I would need some help from the Arduino experts ! !

I have a project bulilt in PIC and PicBasic Pro, which works very well. But, I would like to migrate to Arduino World.

My project is a simple Car computer without OBDII. I built it some years ago when I used to drive a small Opel Corsa here in Brazil.

The project is simple : The PIC 16F877A has 3 timers and 2 CCP modules, and Pic Basic Pro has a special interrupts library written by Darrel Taylor which makes interrupts really simple and easy to handle.

I have a timer working as a base time. This timer (TMR2), ticks every 0.5 s.
During this 0.5 period, I read the TMR0, which will give me the number of pulses from the VSS sensor. So, I can calculate the distance and the speed.
I can read also the TMR1, configured as a CCP module. This TMR1 give me the amount time the Fuel Injector was on High. And, with a special formula, I can calculate the instant consumption.

Please, check the picture attached for more details.

Some time ago (some months) some guys told me that this is not possible with an Arduino 328.

In your opinion, is this possible ? If yes, how can I do the same thing with Arduino ? Can someone help to write the Program´s Skeleton ?

Thank you very Much !

Regards,

Sérgio Pinheiro

The only hard part is going to be accumulating the injector open time. Clearly you need to connect the injector signal to a digital input via a suitable circuit to present it as a TTL level signal. You could simply poll it, but depending what else your sketch needs to do you may not be able to poll it frequently enough to get an accurate measurement. A more accurate approach would be to use a pin change interrupt to detect the start and end of each pulse and at the end of each pulse add the pulse duration to an accumulator.

Reading the accumulated values at regular intervals and doing some arithmetic on them is very easy to implement and doesn't involve using interrupts.

I suspect this doesn't actually need to be particularly accurate since you only have enough information to make the crudest guess at fuel flow, so any in little accuracies here or there probably aren't going to matter.

Some time ago (some months) some guys told me that this is not possible with an Arduino 328. In your opinion, is this possible ?

Yes, it is possible , I am sure! I have one on my Astra. It uses ATmega168P which is same as ATmega328P except of less of the resources, but I think they both have more power than PIC 16F877A.

If yes, how can I do the same thing with Arduino ?

Same way as you are decsribing. Depending on the type of your car, engine type, board display type and so on solution may vary. My board comp use input from valve injector on the first cylinder via optocoupler to ATmega's input. Then it have also inputs from the stearing panel: speed, rpm, fuel state. As an output it use in-build LCD (called TID).

From what you have described I would use the two hardware interrupts of the Arduino. One using CHANGE mode that marks the time difference between interrupt edges. The other interrupt using either RISING or FALLING mode that just increments a counter. The main part of your program will read/reset these values at desired interval and display on your output LCD.

How would one know how much fuel is passing through the injector per a time interval? - Scotty

This is empirical value, I am afraid. Based on pulses is known only relative consumption. System has to be tuned up.

Budvar10: This is empirical value, I am afraid. Based on pulses is known only relative consumption. System has to be tuned up.

... and you'll have to ignore the effects of fuel pressure, fuel temperature and injector voltage. As long as you calibrate it under typical conditions it should be possible to get consistent results under those conditions - but the further you go away from these conditions the less accurate it will be.

Hi Guys !

What a nice forum.

I just post my doubt yesterday afternoon and when I came back from work today I have already 6 answers !

Very good !

Well, let me explain some things :

My actual car is an Brazilian version of the Opel Meriva made by Chevrolet. It has an 1.4 liter engine which uses ethanol and/or gasoline.

I have connected the circuit made with the PIC to my car and I made a long trip (1200 Km) monitoring the data. After 2 tanks of gasoline, I calculated an error of 4%. Not bad.

All sensors are connected to the circuit is also using optocuplers to isolate my circuit from the car's circuitry.

IT is nice to rear that the ATMega 328 can do the job. I am planning to use an GLCD to improve the final result.

do you have some start point to suggest me ? Like an Arduina sample etc ?

Thank you very much !

my best regards,

Sérgio