How to read analog input data from soil moisture sensor using AML-S905X-CC ADC PINS

I have AML-S905X-CC le potato with ubuntu, I want to read data from soil moisture sensor using the analog data to be more accurate. I found that it have the pins 1 and 2 on the header 2J3 (Chip ADC2 Line ADC1 for example).
I want to write a process using python to read it and set other GPIOS pins values as a result of it.
but got an errors and I didn’t found any example how to use this pins using python.
(It’s clear the chip and line values are different than the GPIOs pins that is numbers and the example you have in the guide expected for numbers at least for the line value)


The SARADC is 10-bit and can read voltages between 0 and 1.8V.

Please use the search function:

I found it, but didn’t understand how can I use it with python to read the data regulary. Also sorry for the noob question, but how can I know the sensor voltage range?

It is a virtual file. Just read it. Put 1.8V and measure the reading. Then put 0V and measure the reading. You have to tune it for variations.

Thanks a lot. I think my sensor works with 3.3V~5V so I guess I couldn’t use it for this. but you helped me a lot to understand how to work with it.

You need to use a resistor divider circuit to scale down the voltage for the ADC.

Cool. I used it now with two resitors of 220 OHM to get 1.65V from 3.3V Vin can you explain me the numbers I’m getting from the ADC pin? I didn’t find it’s specification… is it 10bits? what is the minimum and maximum I can get…?
Now the values is about 3700 when the sensor dry and 2400 when it totally wet (covered by water). Is it make sense? I want to be ensure I won’t damage my libre le potato and sensor…

Measure the voltage with a multimeter and see how it scales.