I am new to Arduino community, i am new to Arduino and wouldl like some insight on this project I am working on for a pressure transducer.
Basically this is the pressure transducer i have, i have both a 100psi and 300 psi.
I connected everything accordingly, the transducer sends the signal to analog pin 0.
When I have nothing attached which means 0psi, the analogread returns about 530 and the voltage reads 2.2v to 2.4v. which is halfway between the full range.
I am really stuck and not really sure when to go from here. Both transducers behave the same way so I think i can rule that out at least.
#include <LiquidCrystal.h>
#include <Wire.h> //allows communication over i2c devices
const int pressureInput = A0; //select the analog input pin for the pressure transducer
const int pressureZero = 562; //analog reading of pressure transducer at 0psi
const int pressureMax = 921.6; //analog reading of pressure transducer at 100psi
const int pressuretransducermaxPSI = 100; //psi value of transducer being used
const int baudRate = 9600; //constant integer to set the baud rate for serial monitor
const int sensorreadDelay = 250; //constant integer to set the sensor read delay in milliseconds
float pressureValue = 0; //variable to store the value coming from the pressure transducer
float pressureValuePsi = 0;
int rs=7;
int en=8;
int d4=9;
int d5=10;
int d6=11;
int d7=12;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
String name;
int potVal;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16,2);
}
void loop() {
// put your main code here, to run repeatedly:
pressureValue = analogRead(pressureInput); //reads value from input pin and assigns to variable
pressureValuePsi = ((pressureValue-pressureZero)*pressuretransducermaxPSI)/(pressureMax-pressureZero); //conversion equation to convert analog reading to psi
Serial.print(pressureValue, 1); //prints value from previous line to serial
Serial.println("psi"); //prints label to serial
lcd.setCursor(0,0); //sets cursor to column 0, row 0
lcd.print("Pressure:"); //prints label
lcd.print(pressureValuePsi, 1); //prints pressure value to lcd screen, 1 digit on float
lcd.print("psi"); //prints label after value
lcd.print(" "); //to clear the display after large values or negatives
delay(sensorreadDelay); //delay in milliseconds between read values
}
You are suffering the frustration of buying from a sellor that does not support the product with technical information. Without a data sheet how do you know if it is good or bad. It probably has an offset which you are measuring but???
You can easily test your code without using the pressure sensor. Replace the sensor with a 10k potentiometer. Connect the wiper terminal to your Arduino A/D pin and adjust the potentiometer. Your readings should follow the rotation of the wiper.
The photo shows that you have a big jumble of wires, with other things connected to the Arduino.
Try the sensor out with just the Arduino, and the simplest possible program to measure and print (on the serial monitor) the ADC voltage produced by the sensor.
That is what i was thinking. In order to read positive and negative pressures the output is biased to 2.5V. Less than 2.5V for less than 0 PSIG, more than 2.5V for greater than 0 PSIG.
If you scroll down in the link you get a bunch of junk then more info, very sparse in data. Here is the response I gave on stack exchange.
"I would expect your pressure transducer has an initial offset voltage, typically 0.5V, it states Output: 0.5 - 4.5 V / 0 - 5 V. I would also expect the output to be about 4.5V at full pressure but this is only a SWAG as there is no data sheet available. It might have been a good price but was it worth all of the time it is taking you to determine if it is OK? Are the meter readings correct, I cannot determine that unless I know what type of output the transducer has. Is it actually analog, does it need a pull up resistor, output loading requirement, ???
If you cannot get the information from the vendor I think the only way you will really know is to connect several up and test them. There are several types of pressure transducers in this package, they are absolute (atmospheric pressure) and Gauge (PSIG) (Pounds Per Square Inch). The nice looking advertisement on your link does not give this or much other needed information such as what media is it compatible with other then a few."
I use many of this type of sensor. I have not had any problems with them. There are 3 wires , Common - Black, +5vdc - Red, Vout - Blue. Connect 5Vdc and common to a power supply measure from Vout and Common. You should read zero volts with no pressure. If that is the case then you either have something wrong in your code or wiring.
According to the minimal data on the web page, 0.5V with "no pressure". The range 0.5 to 4.5V from zero to full scale is typical of 5V analog pressure sensors.