Go Down

Topic: Vehicle fuel corrector with an arduino (Read 365 times) previous topic - next topic

allanhurst

Crudely...

as I understand it, you want a single output which is a function of several inputs - ie

output  = Fn(input1, input2 etc)..........

find an algorithm or a mapping which takes all your input signals and generates the wanted output voltage as a function of all those values. ie fill in the above.

 This is the hard bit - and I can't help there

If the inputs are in the range 0..5V the a/d in the arduino will produce a number 0..1023 for each of these.
.

Perhaps a mathematical algorithm as outlined will do the job

 eg output = A * input1 + B * log (B' * input2) + C * sin(C' * input3)  etc.

where  A,B,C etc are constants.   You can implement this simply in 'C'.
 
If a mapping ( ie too hard to do as above) you'll probably need a several look-up tables stored in codespace or in  EEPROM. You'll probably need to use the map(.....) function to interpolate between your known data points.

You might need a mixture of these approaches. ..

your calculations should be scaled to a value 0..255 which will produce to 0..5V at the output.

Send that to an output using the arduino writePWM (..) function and a low-pass filter . If you need a 0..12V range you would then need an amplifier to scale the output

as I said , the coding part isn't very hard - it's knowing how the output you want depends on all the inputs.  Once you've discovered that, the coding is straightforward.

regards

Allan.


juntekind

Let see if i understand,Yes i need to  run the car on the dyno and every time the car has a bad mixture of air fuel i had to indicare in the code the exact tps portion and exact rpm and start to play with the ouput correction % and keep doin again and again until i correct the mixture. The only constant i will know will the tps voltage and the rpms the % will eventualy modified, the base will be o% to start on all.

Need to have  0 to 10000rpm in 500rpm increments
Need to have 5 tps referece example 0-5% ,6-25%,26-50%,51-75%,76-100%
Then to specify :
Tps             500rpm  1000rpm 1500rpm 2000rpm ........... 10,000rpm
     0-5%     -10%          -15%            -9%           +3%                     +25%
   6-25%       ??%           ??%             ??%          ??%                       ??%
 26-50%       ??%           ??%             ??%          ??%                       ??%
 51-75%       ??%           ??%             ??%          ??%                       ??%
76-100%       ??%           ??%             ??%          ??


So first i have to see is the tps voltage on hi to low if low is 2v and hi is 5v then i have  to divide by 5, 5% of 3v will be .15 that is 0 to 5% voltage of tps  then .7125 for the rest
So will be
0-5% =2v to 2.15v
5-25% = 2.16v to 2.87v
26-50%=2.88v to 3.59v and so

juntekind

Crudely...

as I understand it, you want a single output which is a function of several inputs - ie

output  = Fn(input1, input2 etc)..........

find an algorithm or a mapping which takes all your input signals and generates the wanted output voltage as a function of all those values. ie fill in the above.

 This is the hard bit - and I can't help there

If the inputs are in the range 0..5V the a/d in the arduino will produce a number 0..1023 for each of these.
.

Perhaps a mathematical algorithm as outlined will do the job

 eg output = A * input1 + B * log (B' * input2) + C * sin(C' * input3)  etc.

where  A,B,C etc are constants.   You can implement this simply in 'C'.
 
If a mapping ( ie too hard to do as above) you'll probably need a several look-up tables stored in codespace or in  EEPROM. You'll probably need to use the map(.....) function to interpolate between your known data points.

You might need a mixture of these approaches. ..

your calculations should be scaled to a value 0..255 which will produce to 0..5V at the output.

Send that to an output using the arduino writePWM (..) function and a low-pass filter . If you need a 0..12V range you would then need an amplifier to scale the output

as I said , the coding part isn't very hard - it's knowing how the output you want depends on all the inputs.  Once you've discovered that, the coding is straightforward.

regards

Allan.


Output will be 0v to 5v
So 0 is 0 and 5v is 255
50% will be 127

I will nedd to state
If(the part i have trouble?
output =( input *from -127 to +127) but no more than 255

How can make a map for this?
Correction % = cor
Map(cor,0,255,0,100?

If(the part i have trouble
output =( input *from -50%to +50%) but no more than 255?
This is something to start?

juntekind

Crudely...

as I understand it, you want a single output which is a function of several inputs - ie

output  = Fn(input1, input2 etc)..........

find an algorithm or a mapping which takes all your input signals and generates the wanted output voltage as a function of all those values. ie fill in the above.

 This is the hard bit - and I can't help there

If the inputs are in the range 0..5V the a/d in the arduino will produce a number 0..1023 for each of these.
.

Perhaps a mathematical algorithm as outlined will do the job

 eg output = A * input1 + B * log (B' * input2) + C * sin(C' * input3)  etc.

where  A,B,C etc are constants.   You can implement this simply in 'C'.
 
If a mapping ( ie too hard to do as above) you'll probably need a several look-up tables stored in codespace or in  EEPROM. You'll probably need to use the map(.....) function to interpolate between your known data points.

You might need a mixture of these approaches. ..

your calculations should be scaled to a value 0..255 which will produce to 0..5V at the output.

Send that to an output using the arduino writePWM (..) function and a low-pass filter . If you need a 0..12V range you would then need an amplifier to scale the output

as I said , the coding part isn't very hard - it's knowing how the output you want depends on all the inputs.  Once you've discovered that, the coding is straightforward.

regards

Allan.


Please explain me this from gere im lerning

eg output = A * input1 + B * log (B' * input2) + C * sin(C' * input3)
What is A? The value of input1?
What is log and sin?

TomGeorge

#34
Today at 10:08 am Last Edit: Today at 10:10 am by TomGeorge
Hi,
Please look at this excellent youtube.

https://www.youtube.com/watch?v=3Vi4M2qJueQ

https://www.youtube.com/watch?v=f7bvv4LaNrc

There are no magic equations, you have to use what is called mapping which involves quite a bit of memory.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

juntekind

Hi,
Please look at this excellent youtube.

https://www.youtube.com/watch?v=3Vi4M2qJueQ

https://www.youtube.com/watch?v=f7bvv4LaNrc

There are no magic equations, you have to use what is called mapping which involves quite a bit of memory.

Tom... :)
Thanks tom
I allready have a full programable ecu on my drift car a haltech like the one on the last video and a mega squirt ecu on my track car so i know what is a map i just does not know how to do the coding

This project will be for my friend cars that doesnt want to spend $ and keep damaging engines

MorganS

Then stay away from a homemade Arduino ECU. It would be normal and expected to damage several engines while experimenting.
GoForSmoke: "What GShield? You never mentioned a shield."

OldSteve

Then stay away from a homemade Arduino ECU. It would be normal and expected to damage several engines while experimenting.
Ha, I was just going to say the exact same thing - I hope he has a few spare engines sitting around. :)
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

juntekind

Ha, I was just going to say the exact same thing - I hope he has a few spare engines sitting around. :)
[/quote
Ha, I was just going to say the exact same thing - I hope he has a few spare engines sitting around. :)
I do have spare engine
But i will experiment on  non modified engines so it will not brake anything.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy