Hi there !
I have a problem with an Arduino Nano clone from Elegoo.
My project is a simple water level alarm that goes off when the level gets 10cm above or below the normal.
For that I simply use metal sticks that are wired that way :
- Voltage input, always in the water
- Voltage output for low level detection, supposed to be always in the water (current is supposed to pass)
- Voltage output for high level detection, supposed to not be in the water (current is not supposed to pass)
The problem is, the current can't be more than 0.5mV between the sticks (alive animals in the water...)
So I have to plug the outputs to the analog pins of my arduino.
The problem is, those plugs seem to be always receiving an information ! Even when nothing is plugged, the function analogRead() always read a value around 245 so ~ 1.25V.
Here is my code (in french, sorry...) :
const int SONDE_BAS = 0;
const int SONDE_HAUT = 1;
int alarme = 0;
int niveau_haut = 0;
int niveau_bas = 1;
void setup()
{
pinMode(SONDE_BAS, INPUT);
pinMode(SONDE_HAUT, INPUT);
Serial.begin(115200);
}
void loop()
{
niveau_haut = analogRead(SONDE_HAUT);
niveau_bas = analogRead(SONDE_BAS);
if(niveau_haut != 0)
{
alarme = 1;
}
if(niveau_bas == 0)
{
alarme = 1;
}
if(niveau_haut == 0 && niveau_bas != 0)
{
alarme = 0;
}
Serial.print(F("niveau_haut : "));
Serial.println(niveau_haut);
Serial.print(F("niveau_bas : "));
Serial.println(niveau_bas);
Serial.print(F("Alarme : "));
Serial.println(alarme);
Serial.println("-----------------------");
delay(150);
}
And the return from the serial :
-----------------------
niveau_haut : 248
niveau_bas : 245
Alarme : 1
-----------------------
Evan though nothing is plugged to the pins...
I tried all the pins and they give approximately the same result...
I don't get it !
Somebody have a solution ?
Thanks in advance !
Nico
(Sorry if I'm not always very clear, English is not my first language...)