There 2 ADC input ports on the 40-pin header.

Pin #37 Pin #40
ODROID-C2 ADC.AIN1 ADC.AIN0
ODROID-C4 ADC.AIN3 ADC.AIN2
ODROID-N2 ADC.AIN2 ADC.AIN0

You can access the ADC inputs via sysfs nodes.

Pin #37 Pin #40
ODROID-C2 /sys/class/saradc/ch1 /sys/class/saradc/ch0
ODROID-C4 /sys/bus/platform/drivers/meson-saradc/ff809000.saradc/iio:device0/in_voltage3_input /sys/bus/platform/drivers/meson-saradc/ff809000.saradc/iio:device0/in_voltage2_input
ODROID-N2 /sys/bus/platform/drivers/meson-saradc/ff809000.saradc/iio:device0/in_voltage2_input /sys/bus/platform/drivers/meson-saradc/ff809000.saradc/iio:device0/in_voltage0_input

ADC's maximum sample rate is 50kSPS with 10bit resolution (0~1023).
But the actual sample rate is 8kSPS if you access it via sysfs due to the limited file IO speed.

The ADC inputs are limited to 1.8Volt. If the input voltage is higher than 1.8Volt, you will fry your ODROID board.

This WiringPi example code shows how to access the ADC for C/C++ programming.
Introduction C Tinkering Kit on Ubuntu

Library Source code WiringPi port for ODROID-C0/C1/C2/XU3/XU4

2020/03/30 14:35 · luke.go