I have a work project that should be simple: read the signal from a sensor that outputs 0-5VDC. My multimeter shows a steady 76 mV signal from the sensor to the arduino, but the arduino is giving variable readings that are equivalent to 0-391mV. Please help!
Diagram is not complete. Is 12V (-) side connected to Arduino GND? Signal shown makes me think not, even if you believe it is, so please check it carefully.
Yes, it is grounded on arduino. I double and triple checked with multimeter.
Excitation voltage 28 VDC?
The sensor input can be from 9-30V. Omega says anything in that range gives correct signal. It is getting 12V now, and producing a steady 76mV signal.
Ok, but please remember, we know only what you tell us.
Suggest you try A1, in case A0 has been compromised; no other questions come to mind right now.
You may be picking up noise with your wiring but the meter is averaging it out.
Try this code
void setup()
{
Serial.begin(115200);
}
void loop()
{
int sensorValue = 0;
for (int i = 0; i < 16; i++)
{
sensorValue = sensorValue + analogRead(A0);
delay(25);
}
float voltage = (sensorValue / 16) * (5.0 / 1023.0);
Serial.println(voltage);
delay(200);
}
thanks. I'll try it
I tried it on another arduino and got the same thing...
Ok. Draw your complete circuit. Either the wiring is wrong, the sensor is damaged, or there is missing info. Results from post#9?
What values did my code print?
Are you sure you are connected to A0?
I am connected to A0. This new sensor provides correct data every millesecond, so I don't think averaging is hiding a bad sensor reading. I am working to calculate the average of the arduino data to confirm this
So you have two sensors and one works and the other does not?
Then obviously one of them is damaged.
No, I tried 2 different arduino boards on the same sensor. Both give crazy incorrect readings.
Therefore, it is NOT the Arduino, but it could still be the sensor, so swap sensors. If no difference, then it is either wiring or code.
I do not think it is a defective arduino board or a defective sensor. After that I have no idea
Again I ask what values did my code print out?




