I have a pressure sensor "gems 3100" and I can't measure any correct value.
I connected the sensor through a resistor 250 Ohm when the voltage supply is directly connected to the sensor + and ground is connected through the resistor to the sensor.
I have already tried several programs and I can't in any case measure the correct value.
A. If anyone has an example for me for a program whether this controller or similar I would be happy.
B. If someone has an idea what to do I'll be happy.
C. Could it be that I need to add extra bord to arduino?
Thanks
What you DO need to do is post a link to the sensor, post a schematic showing how you connected it to the Arduino, AND post your code.
If you'd read the stickies at the top of the forum, the ones you were supposed to read BEFORE you blundered in here, you'd know that.
Sensor Link: http://www.gemssensors.com/~/media/files/resources/na_english/catalogpages/catalog-h_3100series-3200series.ashx
The code I run:
float inputVariable0 = 0;
float inputVariable1 = 0;
int i = 0;
void setup()
{ //Begin serial communication
Serial.begin(9600); //Alota sarjaliikenne tietokoneen kanssa
pinMode(A0, INPUT);
}
void loop()
/* *************************************************************
In this example A0 is read 10 times to virtually increase resolution
*/
{
for (int i=0; i < 10; i++){
analogRead(A0); // read twice with small delay to get accurate reading
delay(2);
inputVariable1 = analogRead(A0);
inputVariable0 = inputVariable0 + inputVariable1;
}
inputVariable0 = (inputVariable0 - 7296) / 818 ;
//
Serial.print("Pressure = "); // print Pressure
Serial.print(inputVariable0 ,1); // print variable with one decimal
Serial.print("0"); // print 0 after
Serial.println(" Bar"); // print Bar and jump to new line
if (inputVariable0 < -1.05) { // If pressure is less than -1Bar print an extra message.
Serial.println(" Sensor Loose or Broken ");
delay(100);
}
inputVariable0 = 0; // This value must be cleared before next 10 loop reading
i = 0; // clear the loop counter also
delay(1500); // wait 1.5 seconds and return to loop
}
That "link" (which is NOT a link. Can't you follow simple rules?) shows an awful lot of sensors in the 3100 series. Which ONE do you have?
pinMode(A0, INPUT);
Setting the digital nature of a pin you are using as an analog pin is WRONG!
A schematic is missing.
You FAILED to use code tags, too. Read the damned stickies BEFORE you post again.
sensore link :http://www.gemssensors.com/~/media/files/resources/na_english/catalogpages/catalog-h_3100series-3200series.ashx
code:
float inputVariable0 = 0;
float inputVariable1 = 0;
int i = 0;
void setup()
{ //Begin serial communication
Serial.begin(9600); //Alota sarjaliikenne tietokoneen kanssa
pinMode(A0, INPUT);
}
void loop()
/* *************************************************************
In this example A0 is read 10 times to virtually increase resolution
*/
{
for (int i=0; i < 10; i++){
analogRead(A0); // read twice with small delay to get accurate reading
delay(2);
inputVariable1 = analogRead(A0);
inputVariable0 = inputVariable0 + inputVariable1;
}
inputVariable0 = (inputVariable0 - 7296) / 818 ;
//
Serial.print("Pressure = "); // print Pressure
Serial.print(inputVariable0 ,1); // print variable with one decimal
Serial.print("0"); // print 0 after
Serial.println(" Bar"); // print Bar and jump to new line
if (inputVariable0 < -1.05) { // If pressure is less than -1Bar print an extra message.
Serial.println(" Sensor Loose or Broken ");
delay(100);
}
inputVariable0 = 0; // This value must be cleared before next 10 loop reading
i = 0; // clear the loop counter also
delay(1500); // wait 1.5 seconds and return to loop
}
I still don't know which specific sensor you are using, but it appears as though you are using it in a two wire configuration, which means that the sensor outputs current, not voltage, and you need to read that differently.
Google 4-20mA + Arduino.
