Sunday, 27 January 2013

Boost gauge display



As I said previously the boost gauge from the nsfabrication used a Standard 16x2 character LCD display. I don't have a serial LCD display only a parallel display so I had to rewrite the code from nsfabrication's blog to take account of this.

 #include <LiquidCrystal.h>  
 // initialize the library with the numbers of the interface pins  
 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);  
 int mapsen = 0; // Set MAP sensor input on Analogue port 0  
 int boost = 0; // Set boost value to 0  
 int mapval = 0; // Set raw map value to 0  
 volatile int peakboost = 0; // Set peak memory to 0  
 volatile int tim = 0;  
 void setup()  
 {  
 lcd.clear();  
 lcd.begin(16, 2);  
 lcd.setCursor(2, 0);  
 lcd.print("Designed by");  
 lcd.setCursor(4, 1);  
 lcd.print("MDM INC");  
 delay (1000); // Display splash screen for 2 seconds  
 lcd.clear();  
 lcd.print("Peak:");  
 lcd.setCursor(0, 1);  
 lcd.print("Map:");  
 lcd.setCursor(13, 0);  
 lcd.print("kPa");  
 lcd.setCursor(13, 1);  
 lcd.print("kPa");  
 }  
 void loop()  
 {  
 mapval= analogRead(mapsen); //Reads the MAP sensor raw value on analog port 0  
 boost = (((mapval/5)-0.04)/0.00369)*0.0049; //Converts raw MAP value to kPa  
 if (boost > peakboost) peakboost = boost;  
 tim = tim + 1;  
 if (tim > 2000) peakboost = 0 , tim = 0;  
 lcd.setCursor(7, 1);  
 lcd.print(boost);  
 lcd.setCursor(7, 0);  
 lcd.print(peakboost);  
 }  


Output of the MPX4250GP sensor
The loop of the program simply calculates the boost pressure from the analogue input. the calculation is derived from the transfer function of the sensor given from it's data sheet. the sensor I'm using a Freescale MPX4250GP, this sensor is not ideal in an engine as it measures gauge pressure and not absolute pressure. This means it can not read a vacuum, which a spark ignition (petrol) engine produces when it is off boost.

I'm not convinced the gauge is reading close to 100% accurate as I believe it to be reading slightly off, so I would like to calibrate it. one of the reason for this is the sensor is set for 5.2 volts were the Arduino is supplying 5 volts. but this can be fixed by changing the calculation the Arduino is processing.

While this display is simple to use one of my issues is that that they a a bit big, also there is limited information that it can display. I want to produce some very simple graphics on the display. So having a look on a number of electronic sites that sell Arduino stuff, I came across a little monochrome 128x32 OLED graphic display.


This little display is sold by Adafruit and comes with what appears a good Arduino library to utilize. using this display would allow graphics such as an analogue gauge to be drawn on the screen.

Arduino boost Gauge

My idea to start an Arduino boost gauge came from an eBay listing of a LCD Boost gauge sent by a friend, asking if he need one is Nissan 200sx. The boost meter in question was a made by a Japanese company called "Mines". This gauge displays the boost pressure in on an LCD display rather than the normal round mechanical display. 

Mines LCD boost meter
Now I'm a big fan of boost gauges and having owned a number of turbo cars, both petrol and diesel I had a boost gauges in almost most of them. 99% of the time they will tell you the same information, but it’s that 1% that will simplify any trouble shooting you have to do, like diagnosing a boost leak or boost controller fault.   

Currently I'm driving an Audi S4 B5, a 4 door saloon one with a 2.7L V6 twin turbo engine (produces 265PS) and I have always wanted to put a boost gauge in the S4, but I decide as it quite nice sitting inside it I didn't want to spoil it with a cheap mechanical gauge, or fit the common centre vent mod that allows you to neatly fit a gauge in the centre vent, these can be costly at around $200. So I left it at that.

That was until I got sent the link. I looked at the mines boost gauge and like the look of it. As I thought it could fit nice in the black interior of the Audi. Being a nice rectangle shape I thought it would be easy to make it discreet.

Now I've played a bit with an Arduino controller, having bought one a year or so ago, but I never really got round to properly using it. so knowing the capability of the Arduino I decided to have a quick Google to see what others had used.

I found a posting on a Seat Cupra forum and a link to the guys blog nsfabrication. He uses a Arduino control and the popular 16 x 2 LCD display to display the boost pressure from a Freescale MPX4250AP pressure sensor.
Muzza1742's finished Boost gauge