You must be registered for see images attach
I didn't really like the Banks gauge... so, ta daaaa! It's about $40 in parts, with the screen being half of that. The enclosure is up to your imagination. You can change it from *F to *C in the code, and can see the actual voltage from the pyro-amp output. Obviously it'd be really compact without the breadboard. Truck was off for a bit, so it's reading residual heat after a test run prior to the photo.
Wiring is pretty simple... I'll work up a diagram in the future. Right now it's powered by USB in it's prototype form, but it can easily take a key-on 12v source.
Basic Parts:
Adafruit Pro Trinket (5v)
128x64 OLED
For Pyro Readout:
K Type Thermocouple Amp
For Boost Readout:
MPX 4250DP (36 PSI boost max measurement capability)
EDIT: Code updated to display average of 10 samples
Arduino Sketch:
Code:
[SIZE=1]
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// If using software SPI (the default case):
#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
#define XPOS 0
#define YPOS 1
#define DELTAY 2
int convertTemp = 0;
float convertPSI = 0;
const int numReadingsPSI = 10;
int readingsPSI[numReadingsPSI]; // the readings from the analog input
int readIndexPSI = 0; // the index of the current reading
int totalPSI = 0; // the running total
int averagePSI = 0; // the average
const int numReadingsPYRO = 10;
int readingsPYRO[numReadingsPYRO]; // the readings from the analog input
int readIndexPYRO = 0; // the index of the current reading
int totalPYRO = 0; // the running total
int averagePYRO = 0; // the average
void setup() {
display.begin(SSD1306_SWITCHCAPVCC);
display.clearDisplay();
display.setTextSize(3);
display.setTextColor(WHITE);
display.setTextSize(4);
for (int thisReadingPSI = 0; thisReadingPSI < numReadingsPSI; thisReadingPSI++) {
readingsPSI[thisReadingPSI] = 0;
}
for (int thisReadingPYRO = 0; thisReadingPYRO < numReadingsPYRO; thisReadingPYRO++) {
readingsPYRO[thisReadingPYRO] = 0;
}
}
void loop() {
//AVERAGE PSI
// subtract the last reading:
totalPSI = totalPSI - readingsPSI[readIndexPSI];
// read from the sensor:
readingsPSI[readIndexPSI] = analogRead(A0);
// add the reading to the total:
totalPSI = totalPSI + readingsPSI[readIndexPSI];
// advance to the next position in the array:
readIndexPSI = readIndexPSI + 1;
// if we're at the end of the array...
if (readIndexPSI >= numReadingsPSI) {
// ...wrap around to the beginning:
readIndexPSI = 0;
averagePSI = totalPSI / numReadingsPSI;
}
//AVERAGE PYRO
// subtract the last reading:
totalPYRO = totalPYRO - readingsPYRO[readIndexPYRO];
// read from the sensor:
readingsPYRO[readIndexPYRO] = analogRead(A1);
// add the reading to the total:
totalPYRO = totalPYRO + readingsPYRO[readIndexPYRO];
// advance to the next position in the array:
readIndexPYRO = readIndexPYRO + 1;
// if we're at the end of the array...
if (readIndexPYRO >= numReadingsPYRO) {
// ...wrap around to the beginning:
readIndexPYRO = 0;
averagePYRO = totalPYRO / numReadingsPYRO;
}
//DISPLAY START
display.clearDisplay();
convertTemp = (((averagePYRO*(5.0/1023.0)-1.25)/.005)*9/5+32);
convertPSI = (((averagePSI*(5.0/1023)/.01845)-9)*0.14503773773020923);
display.setCursor(12,0);
display.println(convertTemp);
if (convertPSI<9.999)
{
display.setCursor(36,34);
}
else
{
display.setCursor(12,34);
}
display.println(abs(convertPSI),1);
display.display();
}
[/SIZE]
Attachments
Last edited: