A
A
Alexey Bazhenov2014-12-08 19:52:30
Arduino
Alexey Bazhenov, 2014-12-08 19:52:30

Why is the analog sensor lying?

I will describe a little.
There is a container that needs to be filled with water. There is a soil moisture sensor, 2 wires are soldered to the electrodes, which are lowered into the tank and, upon contact with water, give a signal about the desired water level in the tank.
In order to exclude the oxidation of wires (electrodes), it was decided to turn on the sensor immediately before testing the water level. That is, they turned on the sensor, looked that the container was empty, turned it off, and filled it for a while. And again, turn on the circle and look, if the water level is desired or slightly higher, then we skip the step with filling the container.
Turning on the soil moisture sensor (water level) is implemented by supplying 5 volts in this way analogWrite(5, 255);
BUT the sensor turns on everything is fine, the program waits for a second, and the readings do not change regardless of whether there is a water level or not, although the LED on the soil moisture sensor lights up or goes out depending on whether the sensor electrodes are closed or not.
Tell me why the readings from the analog port are always the same? When the sensor is connected directly everything works correctly.
I am not very experienced in this, and I think there is something very simple here that is clear and understandable to an experienced person at the subconscious level ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Peretyatko, 2014-12-09
@viperet

try controlling the power with digitalWrite(5, HIGH) and digitalWrite(5, LOW)
try taking readings from DO, and connecting accordingly to the digital input.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question