Beaglebone AI - read analog input with python

Hello, i have a Beaglebone AI, i need read analog input with python code, example:

`

import Adafruit_BBIO.ADC as ADC
from time import sleep

ADC.setup()

analogPin = “P9_33”

while(1):
potVal = ADC.read(analogPin)
potVolt = potVal*1.8
print (“The Potentiometer Voltage is: {}”.format(potVolt))
sleep(0.5)

`

but, this code generated error:

debian@beaglebone:~$ sudo python3 test_bbai_ai.py
Traceback (most recent call last):
File “test_bbai_ai.py”, line 4, in
ADC.setup()
RuntimeError: Unable to setup ADC system. Possible causes are:

  • A cape with a conflicting pin mapping is loaded
  • A device tree object is loaded that uses the same name for a fragment: helper

Please, help me, thank you.

PD. BeagleBoard.org Debian Buster IoT TIDL Image 2020-04-06

Hello, i have a Beaglebone AI, i need read analog input with python code,
example:

import Adafruit_BBIO.ADC as ADC

  The first thing to realize is that the BB AI does not support runtime
pin-mux changes. There is no config-pin tool available. The second is that,
due to some changes in Px_y assignments to chip "balls", Adafruit_BBIO may
not be compatible.

   ADC.setup()
RuntimeError: Unable to setup ADC system. Possible causes are:
- A cape with a conflicting pin mapping is loaded
- A device tree object is loaded that uses the same name for a fragment:

  As stated -- the loaded device tree does not have pins configured for
ADC mode (hopefully it doesn't require all potential ADCs to be set, and
can find those that are active)

Please, help me, thank you.

  You are going to have to edit the device tree source to define the
desired pin as analog input, compile it, and set up uEnv.txt to load this
device tree in place of the one that is already in place.

NOTE: I don't know if it is possible to provide just an overlay device tree
without modifying the primary device tree. Maybe start with
https://www.element14.com/community/community/project14/visionthing/blog/2019/11/16/beagleboard-ai-brick-recovery-procedure#jive_content_id_PINMUXING
or

which is a replacement for Adafruit_BBIO (no ADC.setup() in the example

as it is set up in device tree). Looking at the main file, it performs
everything through sysfs access.

  Note that

indicates the Adafruit_BBIO is not yet compatible with the BB AI.

Hello Daveru

Please tell The professor Or H1B boot camp instructor he’s given you an assignment thats not possible.
If he doesn’t know that how’s he going to coach you after you add BBAI on your resume. Besides there’s no travel right now.
We understand tracking down Runtime errors is a tremendous task hopefully someone is available 24/7 in the future when you get another runtime error
Where are you going to school?

I am aware that this post clearly asks for reading analog inputs with python, however I am pasting a solution in C which I believe can very easily be written in python as it’s very basic file I/O: