How to read analog data from GPIO, Android-things

2k views Asked by At

Tried to read analog data from gpio, but only see a way which returns signal strength as LOW or HIGH (boolean). Couldn't find any solution in the documentation and in code references. Is it even possible for now?

3

There are 3 answers

3
diazdeteran On

For Raspberry Pi you will need to use an analog-to-digital converter such as the ADS1115.

0
Jan Slominski On

Raspberry Pi 3 doesn't have analog-to-digital converter so you can only get boolean values (high/low) from its GPIO. So in order to get analog data you need to use external ADC module in your project.

EDIT: I found this interesting blogpost showing how to measure analog input on Android Things.

2
Paul Ruiz On

If you're still looking, I wrote a class and sample for the Adafruit MCP3008 ADC

https://github.com/PaulTR/AndroidThingsMCP3008ADC