Mazda MX-6 Forum banner

21 - 31 of 31 Posts

·
Registered
Joined
·
90 Posts
Much appreciated and how brite are we talking. Do tinted windows help because mine are pretty dark all around. Also, were you able to dim the screen for night driving? Might be a factor in finding a replacement screen too.
 

·
Registered
Joined
·
235 Posts
Discussion Starter #22 (Edited)
Part of the visibility issue is the reflections. I put a non-reflective cellphone screen cover over it, but the side effect was making the screen look dimmer. Good eyes would probably have no problems, it is readable usually and I just shadow it with a hand if I need to.
The screen I used has an led power pin, if there is no power the screen does dim a little, but not a lot. I used a solid state relay that breake the LED power circuit when I turn on the lights. There is a better one available from Adafruit that has PWM on the LED pin so can have a controlled brightness, but the freight to NZ was really expensive, so I didn't bother. Just got a couple of screens out of China with free freight.
 

·
Registered
Joined
·
90 Posts
Did you post that parts info and code and I just missed it or are you still recovering from the holidays , etc. Just making sure I didn't miss something obvious. :wink2:
 

·
Registered
Joined
·
235 Posts
Discussion Starter #24
No, I haven't posted the info yet, although I have been looking at the code and commenting.
I have also done some work around logging and made a circuit to be able to read the RPM from the tach feed, although I have not yet connected it up yet.
 

·
Registered
Joined
·
90 Posts
No worries, sounds like your adding some cool functionality and well commented code = usable code. Like I said I was making sure I didn't miss something, really want to build one as it fits the bill perfectly .
 

·
Registered
Joined
·
90 Posts
No, I haven't posted the info yet, although I have been looking at the code and commenting.
I have also done some work around logging and made a circuit to be able to read the RPM from the tach feed, although I have not yet connected it up yet.
Not to bug you but I'm bugging you; Any progress? Would really like to build this, your idea and look is exactly what I had envisioned. If you get the chance post up the parts list and code I would be very grateful, definitely save me a lot of leg work.

Ok, done bugging....for now! :wink2:
 

·
Registered
Joined
·
235 Posts
Discussion Starter #27
No worries, you were right to push.
A list of the parts that I used.
Adafruit 5V metro mini, a mini version of the Arduino UNO R3, I used this as the UNO seems to be the only board supported by the software for using hardware SPI acceleration.
Freescale MPX4250AP MAP sensor for vacuum and boost reading. This is a 250 kPa sensor so reads up to 150 kPa boost, about 20 psi.
A BMP810 barometric and temperature sensor. I use this for barometric compensation, so the gauge should give accurate manifold pressure at any elevation.
A 1.44" 128x128 colour LED screen. Adafruit do a nice one but shipping cost is really expensive so I got some from Ebay, cheap with free shipping. Be carefull to get a 5V comaptible one, otherwise you will need to use ligic level converters. This is the one I enede up getting: 1.44 inch Full Color 128x128 SPI TFT LCD Display Module replace LED for Arduino | eBay
I used the Spartan 2 wideband controller and sensor from 14point7.com. This is good to use because it sends two set readings during the warm up phase so that you can see if you are showing accurate readings. My code has calibration adjustments in it that should be removed or altered. Any wideband input will do, they all use 0-5V to output the O2 values.
Here is the current code, it outputs the manifold pressure in bar, you can just use conversion to change to psi or inches mercury. I do have some code from the earlier OLED verion I did if you want to see how I did it.

#include <Adafruit_GFX.h>
#include <gfxfont.h>
#include <Adafruit_ST7735.h> //LCD display library
#include <Fonts/FreeSans24pt7b.h> //Fonts
#include <Adafruit_BMP085.h> //barometric temp sensor
#include <Wire.h> //for the I2C connection
#include <SPI.h> //for the SPI connection

int mapsen = 0; // Set MAP sensor input on Analog port 0
int o2sen = 1; //set O2 sensor input on Analog port 1
float boost = 0; // Set boost value to 0
float mapval = 0; // Set raw map value to 0
float atm = 0; //initial air pressure compensation
float Vs = 5.10; //the inferred supply voltage to MAP sensor. Set this to your value. I used this to calibrate the initial 0 reading
float o2val = 0; //set the raw o2 value to 0
volatile float peakboost = 0; // Set peak memory to 0. We don't save this to flash so resets on start up

Adafruit_BMP085 bmp; //alias for the baraomteric sensor

// For the ST7735 LCD 1.44" 128x128 screen
#define TFT_CS 10
#define TFT_RST 9
#define TFT_DC 8

// Option 1 (recommended): must use the hardware SPI pins
// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
// an output. This is much faster
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,TFT_DC, TFT_RST);


void setup() {
Serial.begin(9600); // sets up the serial output.
if (!bmp.begin()) { // starts the barometric library to use for the atmospheric pressure compensation.
Serial.println("Could not find a valid BMP085 sensor, check wiring!"); // prints the start message to the serial port, seems to need this.
while (1) {}
}

//set SPI spped
SPI.setClockDivider(SPI_CLOCK_DIV16);

// The 1.44" TFT LCD
// Use this initializer (uncomment) if you're using a 1.44" TFT
tft.initR(INITR_144GREENTAB); // initialize a ST7735S chip, black tab
tft.fillScreen(ST7735_BLACK);
tft.setTextSize(4);

}

void loop() {
//o2val = (float)(analogRead(o2sen)*0.0098+10)*0.9658+0.4056; //Reads the O2 sensor raw value on analog port 1
o2val = (float)(analogRead(o2sen)*0.0098+10)*0.9658+0.4056; //Reads the O2 sensor raw value on analog port 1 and uses a calculated correction as per the 14.7 msquirt spreadsheet
atm = (float)(bmp.readPressure()); // gets the value from the barometric sensor as the atm variable in mBar
mapval= analogRead(mapsen); // Reads the MAP sensor raw value on analog port 0
boost = (((mapval*(0.00489)/Vs)+0.04)/0.004)/100 -((atm)/100000);
if (boost > peakboost){ // If current boost is higher than peak, store in peak memory
peakboost = boost; }// Store current boost in peak memory

// tft.fillScreen(ST7735_BLACK);
//tft.setRotation(3);
//tft.setFont(&FreeSans24pt7b);
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
//tft.fillRect(4, 69, 127, 24, ST7735_BLACK);
tft.setTextSize(4);
tft.setCursor(5,30);
if (o2val > 15.5) {
tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);
tft.print(o2val);
}
else if (o2val < 12) {
tft.setTextColor(ST7735_BLUE, ST7735_BLACK);
tft.print(o2val);
}
else {
tft.print(o2val);
}

//this will print the boost value in Bar. I also allow for the - sign so that the display doesn't jump right when present.
// tft.fillRect(0, 119, 127, 24, ST7735_BLACK);
if (boost >= 0 && boost <= 1) {
tft.fillRect(4, 107, 20, 4, ST7735_BLACK);
tft.setCursor(28, 95);
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.print(boost);
}
//change text to red if boost > 1
else if (boost > 1) {
tft.fillRect(4, 107, 20, 4, ST7735_BLACK);
tft.setCursor(28, 95);
tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);
tft.print(boost);
}
// different start position to accomodate the - symbol and make the text green
else {
tft.setCursor(4, 95);
tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
tft.print(boost);
}
//print AFR, BOOST, peak boost
tft.setTextSize(2);
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.setCursor( 9,5);
tft.print("AFR");
tft.setCursor(9,70);
tft.print("BOOST");
tft.setCursor(75,70);
tft.print(peakboost);

delay (100);
}

Be careful of any line wrapping that this page may do to the code. Feel free to ask any questions about this. I will add a photo of what my set up looks like, I am about to take the dash out and put the centre part of a '96 GV wagon into it to get better controls and cup holders(!!!)
 

·
Registered
Joined
·
235 Posts
Discussion Starter #28
No worries, you were right to push.
A list of the parts that I used.
Adafruit 5V metro mini, a mini version of the Arduino UNO R3, I used this as the UNO seems to be the only board supported by the software for using hardware SPI acceleration.
Freescale MPX4250AP MAP sensor for vacuum and boost reading. This is a 250 kPa sensor so reads up to 150 kPa boost, about 20 psi. There is a peice of code all over the internet to read this sensor, but the maths makes no sense to meafter I read the spec sheet, so I used my own calculations worked out from the sheet.
A BMP810 barometric and temperature sensor. I use this for barometric compensation, so the gauge should give accurate manifold pressure at any elevation.
A 1.44" 128x128 colour LED screen. Adafruit do a nice one but shipping cost is really expensive so I got some from Ebay, cheap with free shipping. Be carefull to get a 5V comaptible one, otherwise you will need to use logic level converters. This is the one I enede up getting: 1.44 inch Full Color 128x128 SPI TFT LCD Display Module replace LED for Arduino | eBay
I used the Spartan 2 wideband controller and sensor from 14point7.com. This is good to use because it sends two set readings during the warm up phase so that you can see if you are showing accurate readings. My code has calibration adjustments in it that should be removed or altered. Any wideband input will do, they all use 0-5V to output the O2 values.
Here is the current code, it outputs the manifold pressure in bar, you can just use conversion to change to psi or inches mercury. I do have some code from the earlier OLED verion I did if you want to see how I did it.

#include <Adafruit_GFX.h>
#include <gfxfont.h>
#include <Adafruit_ST7735.h> //LCD display library
#include <Fonts/FreeSans24pt7b.h> //Fonts
#include <Adafruit_BMP085.h> //barometric temp sensor
#include <Wire.h> //for the I2C connection
#include <SPI.h> //for the SPI connection

int mapsen = 0; // Set MAP sensor input on Analog port 0
int o2sen = 1; //set O2 sensor input on Analog port 1
float boost = 0; // Set boost value to 0
float mapval = 0; // Set raw map value to 0
float atm = 0; //initial air pressure compensation
float Vs = 5.10; //the inferred supply voltage to MAP sensor. Set this to your value. I used this to calibrate the initial 0 reading
float o2val = 0; //set the raw o2 value to 0
volatile float peakboost = 0; // Set peak memory to 0. We don't save this to flash so resets on start up

Adafruit_BMP085 bmp; //alias for the baraomteric sensor

// For the ST7735 LCD 1.44" 128x128 screen
#define TFT_CS 10
#define TFT_RST 9
#define TFT_DC 8

// Option 1 (recommended): must use the hardware SPI pins
// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
// an output. This is much faster
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,TFT_DC, TFT_RST);


void setup() {
Serial.begin(9600); // sets up the serial output.
if (!bmp.begin()) { // starts the barometric library to use for the atmospheric pressure compensation.
Serial.println("Could not find a valid BMP085 sensor, check wiring!"); // prints the start message to the serial port, seems to need this.
while (1) {}
}

//set SPI spped
SPI.setClockDivider(SPI_CLOCK_DIV16);

// The 1.44" TFT LCD
// Use this initializer (uncomment) if you're using a 1.44" TFT
tft.initR(INITR_144GREENTAB); // initialize a ST7735S chip, black tab
tft.fillScreen(ST7735_BLACK);
tft.setTextSize(4);

}

void loop() {
//o2val = (float)(analogRead(o2sen)*0.0098+10)*0.9658+0.4056; //Reads the O2 sensor raw value on analog port 1
o2val = (float)(analogRead(o2sen)*0.0098+10)*0.9658+0.4056; //Reads the O2 sensor raw value on analog port 1 and uses a calculated correction as per the 14.7 msquirt spreadsheet
atm = (float)(bmp.readPressure()); // gets the value from the barometric sensor as the atm variable in mBar
mapval= analogRead(mapsen); // Reads the MAP sensor raw value on analog port 0
boost = (((mapval*(0.00489)/Vs)+0.04)/0.004)/100 -((atm)/100000);
if (boost > peakboost){ // If current boost is higher than peak, store in peak memory
peakboost = boost; }// Store current boost in peak memory

// tft.fillScreen(ST7735_BLACK);
//tft.setRotation(3);
//tft.setFont(&FreeSans24pt7b);
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
//tft.fillRect(4, 69, 127, 24, ST7735_BLACK);
tft.setTextSize(4);
tft.setCursor(5,30);
if (o2val > 15.5) {
tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);
tft.print(o2val);
}
else if (o2val < 12) {
tft.setTextColor(ST7735_BLUE, ST7735_BLACK);
tft.print(o2val);
}
else {
tft.print(o2val);
}

//this will print the boost value in Bar. I also allow for the - sign so that the display doesn't jump right when present.
// tft.fillRect(0, 119, 127, 24, ST7735_BLACK);
if (boost >= 0 && boost <= 1) {
tft.fillRect(4, 107, 20, 4, ST7735_BLACK);
tft.setCursor(28, 95);
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.print(boost);
}
//change text to red if boost > 1
else if (boost > 1) {
tft.fillRect(4, 107, 20, 4, ST7735_BLACK);
tft.setCursor(28, 95);
tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);
tft.print(boost);
}
// different start position to accomodate the - symbol and make the text green
else {
tft.setCursor(4, 95);
tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
tft.print(boost);
}
//print AFR, BOOST, peak boost
tft.setTextSize(2);
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.setCursor( 9,5);
tft.print("AFR");
tft.setCursor(9,70);
tft.print("BOOST");
tft.setCursor(75,70);
tft.print(peakboost);

delay (100);
}

Be careful of any line wrapping that this page may do to the code. Feel free to ask any questions about this. I will add a photo of what my set up looks like, I am about to take the dash out and put the centre part of a '96 GV wagon into it to get better controls and cup holders(!!!)
 

·
Registered
Joined
·
90 Posts
Awesome! I do thank you and what a wealth of info indeed. I know you have countless hours into this, it is very much appreciated and I have no doubt I'll be asking you for advice here and there.
 

·
Registered
Joined
·
90 Posts
Oh, do post up those pics too!
 

·
Registered
Joined
·
1 Posts
No worries, you were right to push.
A list of the parts that I used.
Adafruit 5V metro mini, a mini version of the Arduino UNO R3, I used this as the UNO seems to be the only board supported by the software for using hardware SPI acceleration.
Freescale MPX4250AP MAP sensor for vacuum and boost reading. This is a 250 kPa sensor so reads up to 150 kPa boost, about 20 psi. There is a peice of code all over the internet to read this sensor, but the maths makes no sense to meafter I read the spec sheet, so I used my own calculations worked out from the sheet.
A BMP810 barometric and temperature sensor. I use this for barometric compensation, so the gauge should give accurate manifold pressure at any elevation.
A 1.44" 128x128 colour LED screen. Adafruit do a nice one but shipping cost is really expensive so I got some from Ebay, cheap with free shipping. Be carefull to get a 5V comaptible one, otherwise you will need to use logic level converters. This is the one I enede up getting: 1.44 inch Full Color 128x128 SPI TFT LCD Display Module replace LED for Arduino | eBay
I used the Spartan 2 wideband controller and sensor from 14point7.com. This is good to use because it sends two set readings during the warm up phase so that you can see if you are showing accurate readings. My code has calibration adjustments in it that should be removed or altered. Any wideband input will do, they all use 0-5V to output the O2 values.
Here is the current code, it outputs the manifold pressure in bar, you can just use conversion to change to psi or inches mercury. I do have some code from the earlier OLED verion I did if you want to see how I did it.

#include <Adafruit_GFX.h>
#include <gfxfont.h>
#include <Adafruit_ST7735.h> //LCD display library
#include <Fonts/FreeSans24pt7b.h> //Fonts
#include <Adafruit_BMP085.h> //barometric temp sensor
#include <Wire.h> //for the I2C connection
#include <SPI.h> //for the SPI connection

int mapsen = 0; // Set MAP sensor input on Analog port 0
int o2sen = 1; //set O2 sensor input on Analog port 1
float boost = 0; // Set boost value to 0
float mapval = 0; // Set raw map value to 0
float atm = 0; //initial air pressure compensation
float Vs = 5.10; //the inferred supply voltage to MAP sensor. Set this to your value. I used this to calibrate the initial 0 reading
float o2val = 0; //set the raw o2 value to 0
volatile float peakboost = 0; // Set peak memory to 0. We don't save this to flash so resets on start up

Adafruit_BMP085 bmp; //alias for the baraomteric sensor

// For the ST7735 LCD 1.44" 128x128 screen
#define TFT_CS 10
#define TFT_RST 9
#define TFT_DC 8

// Option 1 (recommended): must use the hardware SPI pins
// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
// an output. This is much faster
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,TFT_DC, TFT_RST);


void setup() {
Serial.begin(9600); // sets up the serial output.
if (!bmp.begin()) { // starts the barometric library to use for the atmospheric pressure compensation.
Serial.println("Could not find a valid BMP085 sensor, check wiring!"); // prints the start message to the serial port, seems to need this.
while (1) {}
}

//set SPI spped
SPI.setClockDivider(SPI_CLOCK_DIV16);

// The 1.44" TFT LCD
// Use this initializer (uncomment) if you're using a 1.44" TFT
tft.initR(INITR_144GREENTAB); // initialize a ST7735S chip, black tab
tft.fillScreen(ST7735_BLACK);
tft.setTextSize(4);

}

void loop() {
//o2val = (float)(analogRead(o2sen)*0.0098+10)*0.9658+0.4056; //Reads the O2 sensor raw value on analog port 1
o2val = (float)(analogRead(o2sen)*0.0098+10)*0.9658+0.4056; //Reads the O2 sensor raw value on analog port 1 and uses a calculated correction as per the 14.7 msquirt spreadsheet
atm = (float)(bmp.readPressure()); // gets the value from the barometric sensor as the atm variable in mBar
mapval= analogRead(mapsen); // Reads the MAP sensor raw value on analog port 0
boost = (((mapval*(0.00489)/Vs)+0.04)/0.004)/100 -((atm)/100000);
if (boost > peakboost){ // If current boost is higher than peak, store in peak memory
peakboost = boost; }// Store current boost in peak memory

// tft.fillScreen(ST7735_BLACK);
//tft.setRotation(3);
//tft.setFont(&FreeSans24pt7b);
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
//tft.fillRect(4, 69, 127, 24, ST7735_BLACK);
tft.setTextSize(4);
tft.setCursor(5,30);
if (o2val > 15.5) {
tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);
tft.print(o2val);
}
else if (o2val < 12) {
tft.setTextColor(ST7735_BLUE, ST7735_BLACK);
tft.print(o2val);
}
else {
tft.print(o2val);
}

//this will print the boost value in Bar. I also allow for the - sign so that the display doesn't jump right when present.
// tft.fillRect(0, 119, 127, 24, ST7735_BLACK);
if (boost >= 0 && boost <= 1) {
tft.fillRect(4, 107, 20, 4, ST7735_BLACK);
tft.setCursor(28, 95);
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.print(boost);
}
//change text to red if boost > 1
else if (boost > 1) {
tft.fillRect(4, 107, 20, 4, ST7735_BLACK);
tft.setCursor(28, 95);
tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);
tft.print(boost);
}
// different start position to accomodate the - symbol and make the text green
else {
tft.setCursor(4, 95);
tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
tft.print(boost);
}
//print AFR, BOOST, peak boost
tft.setTextSize(2);
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.setCursor( 9,5);
tft.print("AFR");
tft.setCursor(9,70);
tft.print("BOOST");
tft.setCursor(75,70);
tft.print(peakboost);

delay (100);
}

Be careful of any line wrapping that this page may do to the code. Feel free to ask any questions about this. I will add a photo of what my set up looks like, I am about to take the dash out and put the centre part of a '96 GV wagon into it to get better controls and cup holders(!!!)
Hi,

Really nice post.
Did you have a schem of this boost gauge, please ?
 
21 - 31 of 31 Posts
Top