Hello guys hope you can help me get data from this absolute pressure sensor im using the following sensor
http://uk.farnell.com/honeywell/nbplann150paunv/sensor-pressure-abs-150-psi-smt/dp/2146007
and this is my gauge project i have tweaked someone else code etc but its not reading right can’t get my head around the scale and the Vout+ and Vout- and yes i have searched all over place i may be chasing my tail with the scale from my issues with the input ?
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH1106.h>
#include <SPI.h>
#define sensorPin 0
#define OLED_MOSI 11
#define OLED_CLK 13
#define OLED_DC 12
#define OLED_CS 10
#define OLED_RESET 2
Adafruit_SH1106 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
// bar graph
float rawval = 0; // Setup raw sensor value
float barboost = 0; // Setup value for boost bar
// peak
int boostPeakReset = 6000; // time in milis to reset peak value
float boostPeak = 0.00;
float boostMax = 0.00;
unsigned long boostPeakTimer = 0;
// log
byte count;
byte sensorArray[128];
byte drawHeight;
boolean filled = 0; //decide either filled, or dot-display. 0==dot display.
void setup()
{
display.begin(SH1106_SWITCHCAPVCC); // 3.3V power supply
display.clearDisplay(); // Clear the display and ram
for (count = 0; count <= 128; count++) //zero all elements
{
sensorArray[count] = 0;
}
}
void loop() // Start loop
{
int boostmbar = map(analogRead(sensorPin), 1023, 167.77, 5, 0.82);
rawval = analogRead(0); // Read MAP sensor raw value on analog port 0
barboost = (((rawval * 0.19) - 69.45) + 10); // Calculate boost value for the bargraph
if (boostPeak < boostmbar && boostmbar > 0.50) {
boostPeak = boostmbar;
boostPeakTimer = millis();
if (boostMax < boostPeak) {
boostMax = boostPeak;
}
}
else if (boostPeak > boostmbar && (millis() - boostPeakTimer) > boostPeakReset) {
boostPeak = 0.00;
}
// log
drawHeight = map(analogRead(A0), 0, 1023, 0, 25 );
sensorArray[0] = drawHeight;
for (count = 55; count <= 128; count++ )
{
if (filled == false)
{
display.drawPixel(count, 71 - sensorArray[count - 55], WHITE);
}
else
display.drawLine(count, 1, count, 71 - sensorArray[count - 55], WHITE);
}
for (count = 80; count >= 2; count--) // count down from 160 to 2
{
sensorArray[count - 1] = sensorArray[count - 2];
}
//display.drawLine(55, 43, 55, 64, WHITE);
display.setTextColor(WHITE);
display.setTextSize(3);
display.setCursor(0, 0);
display.println((boostmbar * 0.001) - 0.97); // 0.97 = 970mbar atmospheric pressure correction
display.drawRect(0, 24, 128, 12, WHITE); // Border of the bar chart
display.fillRect(0, 24, barboost, 12, WHITE); // Draws the bar depending on the sensor value
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(97, 0);
display.println("BAR");
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 40);
display.println("PEEK");
display.setTextSize(2);
display.setCursor(0, 50);
display.println((boostPeak * 0.001) - 0.97); // 0.97 = 970mbar atmospheric pressure correction
if (970 < boostmbar ) {
display.setTextSize(1);
display.setCursor(97, 14);
display.println("BOOST");
}
else if (970 > boostmbar ) {
display.setTextSize(1);
display.setCursor(97, 14);
display.println("VAC");
}
delay(1);
display.display();
display.clearDisplay();
}
i have used the simple voltage serial output to measure voltage coming from the sensor but its at 2 ish volts i expected more like 0.82v ?