1

lets assume i'm having a circut like this: Example

and (assuming Board mode)

  • Pin 2 would give me the 5V
  • Pin 6 = GND
  • Pin 3 = A0

how can i detect the input (Pin 3)? With python and RPi.GPIO i found only a solution for HIGH/LOW. But i would need an exact 'power' (my lack of English, sorry).

I am trying to build a soil moisture mesurement tool.

And the language doesn't matter, but python would be preffered.

5

The raspberry pi does not support analog inputs like what you are describing without an expansion module. I don't have any experience with these, but it shouldn't be too tough. Depending on what you are doing with the Pi, an Arduino may be a better choice as it has analog inputs built into the board.

  • hmm... thats not what i was expecting/hoping. – Le_Morri Jun 11 '13 at 14:56
  • 2
    You could build your own ADC, by adding a capacitor. Have an other pin first ground the capacitor, so it's empty. Then turn of this pin. Next measure how long it takes for the capacitor to charge, and the pin A0 to read high. This however, will take a lot of time to calibrate, and might not be all that accurate. Better to just add some ADC chip (e.g. hobbytronics.co.uk/adc-i2c-slave), or abelectronics.co.uk/products/3/Raspberry-Pi/17/… if you don't want to solder. – Gerben Jun 12 '13 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.