# Beaglebone Analog Inputs



## Phishfry (May 14, 2016)

I see from the web that the BeagleBone has an ADC chip for analog inputs accessible from the gpio pins.
FreeBSD supports this through ti_adc.c . I wonder if they show up through gpioctl.

I want to use ACS712 current monitor module on the analog input pins.
https://www.sparkfun.com/products/8882
Anybody using FreeBSD Beaglebone analog inputs??


----------



## tingo (May 14, 2016)

I have just recently gotten a BeagleBone Black, so I haven't tried it, but the ti_adc(4) man page suggest that they are accessed via sysctl, like so:

```
root@beaglebone:~ # sysctl dev.ti_adc
dev.ti_adc.0.ain.7.input: 0
dev.ti_adc.0.ain.7.samples_avg: 0
dev.ti_adc.0.ain.7.open_delay: 0
dev.ti_adc.0.ain.7.enable: 0
dev.ti_adc.0.ain.6.input: 0
dev.ti_adc.0.ain.6.samples_avg: 0
dev.ti_adc.0.ain.6.open_delay: 0
dev.ti_adc.0.ain.6.enable: 0
dev.ti_adc.0.ain.5.input: 0
dev.ti_adc.0.ain.5.samples_avg: 0
dev.ti_adc.0.ain.5.open_delay: 0
dev.ti_adc.0.ain.5.enable: 0
dev.ti_adc.0.ain.4.input: 0
dev.ti_adc.0.ain.4.samples_avg: 0
dev.ti_adc.0.ain.4.open_delay: 0
dev.ti_adc.0.ain.4.enable: 0
dev.ti_adc.0.ain.3.input: 0
dev.ti_adc.0.ain.3.samples_avg: 0
dev.ti_adc.0.ain.3.open_delay: 0
dev.ti_adc.0.ain.3.enable: 0
dev.ti_adc.0.ain.2.input: 0
dev.ti_adc.0.ain.2.samples_avg: 0
dev.ti_adc.0.ain.2.open_delay: 0
dev.ti_adc.0.ain.2.enable: 0
dev.ti_adc.0.ain.1.input: 0
dev.ti_adc.0.ain.1.samples_avg: 0
dev.ti_adc.0.ain.1.open_delay: 0
dev.ti_adc.0.ain.1.enable: 0
dev.ti_adc.0.ain.0.input: 0
dev.ti_adc.0.ain.0.samples_avg: 0
dev.ti_adc.0.ain.0.open_delay: 0
dev.ti_adc.0.ain.0.enable: 0
dev.ti_adc.0.clockdiv: 2400
dev.ti_adc.0.%parent: simplebus0
dev.ti_adc.0.%pnpinfo: name=adc@44E0D000 compat=ti,adc
dev.ti_adc.0.%location:
dev.ti_adc.0.%driver: ti_adc
dev.ti_adc.0.%desc: TI ADC controller
dev.ti_adc.%parent:
```
I haven't figured out how pins are mapped from physical pins to the various dev.ti_adc.0.ain.X.input yet.
This on

```
root@beaglebone:~ # uname -a
FreeBSD beaglebone 10.3-STABLE FreeBSD 10.3-STABLE #0 r298781: Fri Apr 29 22:54:51 UTC 2016     root@releng1.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/BEAGLEBONE  arm
```


----------



## tingo (May 14, 2016)

From the BeagleBoneBlack wiki page I see that AIN0 - AIN6 are available on P9.


----------



## tingo (May 14, 2016)

Phishfry said:


> I want to use ACS712 current monitor module on the analog input pins.
> https://www.sparkfun.com/products/8882


Please note that the max input voltage on the AIN pins on the BeagleBoneBlack is 1.8 V, not a good fit for that sensor.


----------



## Phishfry (May 14, 2016)

The power supply for the sensor is 5v but the sensor output is:
185 mV/A output sensitivity
Right? I am by no means an expert at this.. I have my eye on similar Allegro modules on ebay.

You ain't learning if you don't break something!


----------



## Phishfry (May 14, 2016)

Well thanks for saving me i read this.

This output voltage is centered at 2.5 V and changes by 185 mV per amp of input current,

https://solarbotics.com/product/23210/


----------



## tingo (May 15, 2016)

If you don't want to make a circuit to change the voltage output level of the sensor, perhaps the ADC cape is a better fit. It has analog inputs that can take up to 5 V.


----------



## wblock@ (May 15, 2016)

A resistor divider can be set up to scale the input voltage down to whatever you like: http://www.raltron.com/cust/tools/voltage_divider.asp.  Calibrating this analog stuff can be a pain, made easier with a good lab power supply.


----------



## Phishfry (May 16, 2016)

I think I am going to use a temperature sensor instead for testing. Less chance of damage.

That link above for the ti_adc(4) man page is dead link. I could not seem to find it.

So are the 5V analog inputs of the Ardundio pretty standard for sensor boards? I see the ADC Cape uses 5V as well.

There are many unique features on BBB when compared to other Arm offerings.


----------



## wblock@ (May 16, 2016)

The OneWire temperature sensors are really easy to use, and don't need to be calibrated.


----------

