I am creating a self watering indoor garden with a Raspberry Pi 3 B+, but for the way I'm building it, I need an accurate level detection. The water will be fed into this container, and then this pump will pump the water.
For different reasons, which I won't explain not to make this post long, I need to accurately detect when the water reaches two different levels. I tried this sensor connected to the MCP3008:
But it always returns different readings, so it's never accurate. I tried different codes, using the SPI and the normal GPIO, but it still returns a crazy reading. The ultrasonic sensor wouldn't work for me because this container will be closed and the water would touch it.
I read about using 2 wires, like on this trhead Detect water level and I think it would be ideal for this project, but how can I build that? I couldn't understand from he way he explained. Or is that sensor I'm using supposed to be accurate and I'm doing something wrong? I used these two ways of wiring and code:
I appreciate any help.