Reading the analog inputs (ADC)

There are 7 analog inputs on the BeagleBone.

ADC properties:
 - 12 bits (Output values in the range 0-4095)
 - 125ns sample time
 - 0-1.8V range (do not exceed!)
 - 2 uA current flows into the ADC pin in this range
 - If using a voltage divider, the lower leg (the one connected to ground) should be <= 1k Ohm
 - Since we are measuring millivolts, resistors with 0.1% error tolerance should be used in a voltage divider.
 - There is a 1.8V reference voltage VDD_ADC at Port 9 Pin 32.
 - There is a GNDA_ADC that should be grounded on Port9 Pin 34.
NamePin # Pin # Name
  32 VDD_ADC
AIN635 36 AIN5 
AIN2 37 38 AIN3 
AIN0 39 40 AIN1 
 The ADC values can be read very easily:


Original BeagleBone, later builds:

    beaglebone:~# cat /sys/devices/platform/omap/tsc/ain1


Original BeagleBone, older builds: 

    beaglebone:~# cat /sys/devices/platform/tsc/ain1


(Note that the path "ain1" maps to the pin "AIN0", the path "ain2" maps to the pin "AIN1", etc.)

BeagleBone black:
FIrst enable the ADC ports, then find out where they are and finall read them:

    sh-4.2# echo cape-bone-iio > /sys/devices/bone_capemgr.*/slots

    sh-4.2# find /sys/ -name '*AIN*'









    sh-4.2# cat /sys/devices/ocp.2/helper.14/AIN1                         


(Note that the path AIN0 maps directly to the pin AIN0)