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.

No comments:

Post a Comment