Hey guys im pretty new with the whole arduino scene and havent been this excited about building things since i bought mine 3 days ago.
My truck has a map sensor on it that is 5v, i have my connections right, and the arduino displays the raw value correctly to my lcd, but when i try and take the sensor readings and convert them to a usable unit, something is off.
When I initially send power to the sensor (engine off) it gives me a value of roughly 220ish, which i capture and subtract so that i can "calabrate" the reading, but my value for my boost is way to low. Im assuming that my subtraction of the value is whats skewing my calculated preasure, but if i dont, i start with a value of 6 PSI. The system obviously has to start at 0. Im assuming the sensor doesn't read in a linear fashion. The Sensor is a "09373269 Pressure sensor" heres all I could find on it. http://www.daytona-sensors.com/download/Delphi_MAP_Sensors.pdf and http://www.daytona-sensors.com/tech_wego.html which seems to show reference specs, but i dont have the skillset to know waht to do with that data.
Also, im vampire tapped into the signal wire, and sharing the same ground, but not effecting the input voltage. If im not mistaken, this should be ok.
Be kind, its my first post.
(Vars setup at start)
int mapsen = 2; // Set MAP sensor input on Analog port 2
float boostcal = 0; //int for boostcal
int x = 0; //Dummy Var for boostcal calibration loop
int boostkPa = 0; // Set boost value to 0
int boostPSI = 0; // Set boost value to 0
float mapval = 0; // Set raw map value to 0
int peakboost = 0; //Peak Boost var
(My Void loop)
while(x < 1) //Run once and setup the cal value for the map sensor.
{
boostcal = analogRead(mapsen); // Calabration value for boost sensor.
x++;
}
mapval= analogRead(mapsen); //Reads the MAP sensor raw value on analog port
boostkPa = ((mapval-boostcal)*(.00488)/(.022));
boostPSI = (boostkPa*(.14503773773020923)); //Converts boostkPa to PSI
lcd.print("Bst:");
lcd.print(boostPSI);
When you sample the analog pin you are not reading a direct voltage out of the sensor you are reading a value between 0 and 1023, 0 being 0v and 1023 being 5v, you need to map this to suit your sensor (according to the data sheet min is 50kpa and max is 333kpa), you will also need to map the boostcal value the same way or it's value will be wrong too.
This will map the value so 0v (0) is 50kpa and 5v (1023) is 333, but you will need to play with the values to get them right as the below data sheet shows the sensor's min output voltage is 0.25 and max is 4.85
You should also move the boostcal value out of the loop into the setup and get rid of the while loop, it's not required.
I also wouldn't use the calibrate, I would just subtract atmospheric pressure from the sensor value, ie 14.69psi or 101kpa.
I also wouldn't use the calibrate, I would just subtract atmospheric pressure from the sensor value, ie 14.69psi or 101kpa.
No mountains where you live?
You definitely want to do the calibration. Especially if the vehicle is likely to be operated at altitudes well above sea level (like, say, my house, which is at about 4500 feet. And I'm down in the valley: I've seen trucks up on the mountainsides that were at least 2-3000 feet higher). Assuming a sea level ambient pressure could produce significant errors in boost readings.
It would also be a good idea to do a little experimenting to find out whether the output of the sensor needs time to stabilize after power-up: you don't want to calibrate against a bogus value.
I guess when you put it that way, I live in rural NSW in Australia, it's all pretty much the same altitude, besides say you start driving at a low altitude then find yourself higher up, unless you have recalibrated your numbers are going to be off!
I didn't really look at the formula, but I see now that it is wrong, try this:
You should probably pull out your map sensor and bench test it with an air compressor, this will make it much easier than trying to test it in the car.
bircoe - Thanks alot for the help, I just gave it a shot in truck, and my values are spot on now. Thanks alot for all your help, if you pm me your paypal addy, ill send ya a couple bones for a 6 pack.
I do have one last quesion though, as my goal here is to learn how to devlop theese tools on my own. Would you mind explaing to me how you determined what values to pass in the map function based on the spec sheet I linked earlyer in the post.
Well it was pretty easy, the spec sheet listed that the map sensor has a min value of 50kpa (@.25v) and max of 333kpa (@4.85v).
So therefore
0 needs to be mapped to 50
1023 needs to be mapped to 333
Altho you should probably tweak the numbers abit, i'm too lazy to work them out, they will be a little too high at 0v and a little too low at 5v, maybe something in the order of 45 and 340 might give some more accurate results.
And I'm a little curious to see your project, got any pics? I want to do something similar but currently have no boosted vehicles.
PS no payment is required, but if your in or near Vegas you can shout me a drink when I'm there later in the year!
Ill post pics later tonight when i get home from work. My last task is to read 1000c on 5v with an ad595, see my other post. THen my project should be close to done.
Its messy and for the time being, i only have place hold text for the EGT, im working it out right now. I plan to design a board to etch/get produced, and maybee possibly sell later to other diesel guys.
I plan to drill a hole down the center of the drain bolts (just big enough for 3 wires) then take my sensor and feed it through the top then fill the hole with a high temp epoxy. What im still toying with is weather or not i should solder a small cap on the end of the bolt to cover the sensor. Then use a 3 conductor automotive pigtail to connect it.
I still havent decided what im gonna do with the last line, bar graph of, possibly an o2 reading? Throttle Position?
Last line can be one of theese Oil pressure, Manifold air temp, intercooler temp, speed, rpm, Oil-temp, Coolant temp, voltage, speed, heading, date, time, duty-cycle on injectors, timing, lambda or a love message from the Arduino to yourself.. =)
Make sure what ever drain plug you choose isn't the only one! You may even find that the tranny already has a temp sensor, I know my Holden Commodore (Australian Sedan with a Buick 3.8lt V6 and 4L60E Auto) has temp sensors, the values can be read with a ODB Scantool.
If your transmission has an oil cooler you should probably tee into that.