Pages: [1]   Go Down
Author Topic: CAR BOOST GAUGE  (Read 1231 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

God afternoon,

I have set about building a project to read the boost levels from my car so i can display the value on an LCD screen within the car, i am having the car tuned and think this will prove invaluable to me during this process. so far i have written the below code winch should read my existing map sensor and display it as a pressure value in PSI.

Unfortunately i am not near my home computer to be able to upload the sketch but it is something fairly similar to what i have previously done so i am confident it will work.

I have one problem, i am aware that i can get the display to show me a value based on a 0-5v input  and display this as a percentage from 0% - 100% as i am able to do this with a pot, my question is how do i introduce an offset into the code?

My Existing map sensors full pressure range is 0-2.5 bar so in my calculations this is 0-36.26 PSI however at zero pressure the signal from the transducer being fed to my Arduino will be 0.25v and at the full 36.26PSI will be 4.75v (Total Range of 4.5v) i have worked out that 1024/36.26 is 28.24 which should give me a PSI value on the screen if my input was 0-5v but my question is how do i get this to work if my input is 0.25-4.75v as above? also i would appreciate if someone could please check my working out. below is my code so far:

* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
*Pressure transducer Powered by 5v from Arduino
* Pressure transducer signal attached to analog input 0
* at 0 pressure my pressure transducer reads 0.25v
* at 2.5 BAR (36.26PSI) my pressure transducer reads 4.75v
*28.24 value below is 1024/28.24 as i thought this would convert the input to PSI?

#include <LiquidCrystal.h> // include the LCD library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);//Set the pin asignment for the LCD

int mappin = A0; //Pressure Transducer input pin
int mapValue1 = 0; //Input signal from pressure transducer
int mapValue2 = 0; // final display variable
void setup() {
    lcd.begin(16, 2); // lcd rows and columns
    lcd.print("Boost Pressure"); // title of sorts

void loop() {
    mapValue1 = analogRead(mappin); // read the input (max 1024? is that correct?)
    mapValue2 = mapValue1 / 28.24 ;// divide by 28.24 to get PSI Value
    lcd.setCursor(0, 1);// set cursor to second row, first column
    lcd.print(mapValue2);//display Value In PSI
    lcd.print("PSI"); //print PSI at the end
    delay(100); //wait 0.1 seconds
    lcd.print(" ");//wipe the extra characters

As soon as i am home tonight i plan on uploading this to my Arduino and would appreciate any help anyone could give me on getting this set up correctly.

Thanks in advance and if there is any additional information needed please let me know.

Hope you all have a good weekend.

Thanks and best regards,


Global Moderator
Offline Offline
Brattain Member
Karma: 240
Posts: 24449
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

but my question is how do i get this to work if my input is 0.25-4.75v
Don't you just subtract 0.25?
Have I missed something?

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Shannon Member
Karma: 184
Posts: 11197
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The map() function would be an obvious way to apply the offset and scale.

I only provide help via the forum - please do not contact me for private consultancy.

Pages: [1]   Go Up
Jump to: