I have an Arduino-related problem with a 3-wire water pressure transducer that outputs 0–5 V through its yellow wire; the sensor takes 24 V DC from an external power supply that I have bought ad hoc (GACUN-2410, output 24 V 1.0 A). The sensor is QDY30A (https://www.aliexpress.com/item/1005004607235726.html), and its technical specs and schematics are below:
Now, I tried that the sensor works with a multimeter (the made-up figures in the figure below are in volts). I always thought that the sensor output loop's end has to be connected to ground, but to my surprise it actually needs to be connected to the 24 V power supply's negative wire or it just gives 0.00 V as the reading, regardless of the pressure.
I also tried to connect it to my Arduino Uno's A1 port, but all I got was the reading going from 1023 to 0 and then -> 1023 -> 0 -> 1023 -> 0 in a very rapid, endless cycle on my LCD shield's display.
The code should not pose a problem here, but I can share how I got those numbers. The code is heavily simplified (LCD shield's button-related things and SD data logger shield-related stuff removed) so there may be small errors.
//Sample using LiquidCrystal library
#include <LiquidCrystal.h>
// select the pins used on the LCD panel
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int sensorOutput = 0;
char s[17];
void setup()
{
sensorOutput=analogRead(A1);
lcd.begin(16, 2); // start the library
Serial.begin(9600);
}
void loop()
{
char s[17];
lcd.setCursor(0,0);
sensorOutput=analogRead(A1);
lcd.setCursor(0,0);
lcd.print("Sensor output");
lcd.setCursor(0,1);
sprintf(s,"%d",sensorOutput);
lcd.print(s);
delay(200);
}
Now I'm puzzled about what to do: how to wire the sensor correctly to Arduino and make a working loop here so that I get a reading through an analog input port? As stated, the system works perfectly with a multimeter connected to the output wire and to the negative wire of the DC power supply, now I only need to transform this to work with Arduino.
The main objective here is to make a water level sensor for my well, with a constant reading on the LCD display (+ you can cycle through water volume and fill % with the LCD shield's buttons), and also log all values in the SD data logging module. I've researched this and found a similar project, but the post didn't address this specific question.