One of the essential hardware interfaces needed for any good IoT platform is an analog input. Many sensors output a low level voltage proportional to the measured signal. For example, a temperature sensor may output a voltage of 0 to 3 volts for temperature values from 0 to 80 degrees Celsius. A nice feature of the AM335x processor used on the BeagleBone is that it already incorporates an 8 channel 12bit Analog to Digital Converter (ADC) on chip. The ADC is mainly used for the touch screen interface for LCD displays but the extra channels can also be used as general purpose analog inputs. The open source Windows Embedded Compact BSP is available on Codeplex at Beaglebone BSP.

The standard driver used the ADC exclusively for touch screen so I had to make several modifications to allow for general purpose use. This involved pulling out all the ADC setup and scanning to a dedicated ADC driver. The touch samples were then shared with the touch driver, which runs on a different thread, through a message queue. There are 8 ADC channels available on the BeagleBone, AN7 is hardwired on the PCB to measure the 3.3V supply. AN0-AN6 are brought out to expansion connector. AN0-AN3 are reserved for LCD touch screen (4-wire resistive) which are typically implemented on a LCD cape, but can be used as general purpose if the LCD is not used. I also use AN6 to measure battery voltage (see Power managment on BBB) which leaves AN4 and AN5 available for other analog inputs.

I also wrote a managed C# test program which I can use exercise each channel.

ADCtest 

Remember when interfacing sensors the input to the ADC must be scaled properly. The ADC input can only take 0-1.8VDC so a resistor divider may be necessary. To output the actual units, for example degrees Celsius, use the input scaling factor, the ADC reading and work backwards.

While the ADC implementation has a lot of nice features, like sample averaging. I would not try to use it for fast moving signals, like audio input or something like that. It is really meant for measuring fairly static signals …like battery voltage or transducers etc.