How is the correct value for psi from MPX4250 sensor?

I am experiment and learn.
Is making a major task with your help and the beach there and áhvað to go there to learn more and test me.
I am also practicing for Blynk app lcd :slight_smile:
It functions all I see value in Blynk app but need the correct value for psi.

using this code.

/*************************************************************
  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Social networks:            http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  Output any data on LCD widget!

  App project setup:
    LCD widget, switch to ADVANCED mode, select pin V1
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

#define W5100_CS  10
#define SDCARD_CS 4

//int sensorPin = A5;    // select the input pin for the potentiometer
//int ledPin = V9;      // select the pin for the LED
//int sensorValue = 0;  // variable to store the value coming from the sensor

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "3295d2122335428a8a8877a04a64367b";

WidgetLED led1(V7);

int Pressure = A5;
int val = 0;
int val1 = 0;
int val2 = 0;

WidgetLCD lcd(V1);

void setup()
{
  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

  Serial.begin(9600);
   Blynk.begin(auth, IPAddress(192,168,10,3)); // For more options, see Boards_Ethernet/Arduino_Ethernet_Manual example
  // declare the ledPin as an OUTPUT:
  pinMode(Pressure, INPUT);      // sets the analogue pin 1 as input
  
  //lcd.clear(); //Use it to clear the LCD Widget
  lcd.print(4, 0, sensorPin); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
  lcd.print(4, 1, val);
  // Please use timed events when LCD printintg in void loop to avoid sending too many commands
  // It will cause a FLOOD Error, and connection will be dropped
   
    
    
}

BLYNK_READ(V6)//pressure reading
{
  int val = analogRead(5);
  val = map(val, 0, 1080, 0, 35);
  Blynk.virtualWrite(6, val); 

//GREEN LED
 if (val > 30){//If val = greater than 100, LED turns green
    Blynk.setProperty(V6, "color", "#ff0033");    
    led1.on();//LED On
  } else {//If val = less than 30 LED turns off
    Blynk.setProperty(V6, "color", "#33cc33");
    led1.on();//LED On

  }
}
void loop()
{
  Serial.print(A5);
  Blynk.run();
}

I do not understand the question @Eyberg. A correct value from sensor? You mean translation of ADC readings into real psi readings?

@marvin7
Hehehe ok :slight_smile:
Yes

I know who the right unit of psi from this sensor (1 bit = 0.038425 psi)
Have not found a solution to put it into the code :slight_smile:

Oh, see… he, he, you need to do some math here then! Basically pdf datasheet states it has sensitivity of 20mV/kPa and as 1kPa = 0,145PSI, then 1PSI = ~140mV of sensor output. And now the rest depends on ADC resolution and reference voltage. IF it would be typical ATMEGA, then it would be 10bit and typically 5V (or 1.1V internal) reference. Then it is 4.883 mV/ LSB for 5V Vref. (I prefer using 1,1V though)
So psi = ADC / 28, correct me, if wrong.
But i do not know the Arduino 101 board, which is not ATMEGA based.

1 Like