This is probably not for this forum, but perhaps you can give me some direction.
I have a BME680 and BNO055 connected to my BBB via i2c. I2cdetect and i2cdump work as expected, so I think I’m good with wiring and low level stuff.
I want to access these sensors from a Python program. I have carefully followed all of Adafruit’s instructions regarding installation of libraries, copying of files, etc.
From the command line, I can communicate with the sensors as follows:
debian@beaglebone:/var/lib/cloud9$ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import board
>>> import busio
>>> import adafruit_bno055
>>> i2c = busio.I2C(board.SCL,board.SDA)
>>> mybno055=adafruit_bno055.BNO055_I2C(i2c)
>>> mybno055.gravity
(-0.11, 0.52, -0.01)
>>>
When I create the following program and try to run it, I get an error message.
#!/usr/bin/python3
#//////////////////////////////////////
Grrr, I installed it by copying files from their circuit python bundle, those instructions must be out of date. I see they’ve made a proper package now, I’ll give it a try.
AFAIK CircuitPython is Adafuit’s port of micropython, meant for embedded devices. What you are looking for is the Adafruit_BBIO library.
There has been work to port CircuitPython to at least the PocketBeagle, but I am not sure how it does for the BBB. It does appear to be working with the PB at least.
https://github.com/adafruit/Adafruit_Blinka/issues/100#issuecomment-504693820
Jon
the Adafruit discord channel
https://discord.gg/adafruit
#help-with-circuitpython
channel is where you can get advice from their side
Here’s a few other links that could help
https://circuitpython.org/blinka
( a link to the beaglebone black (as well as others) is on that page https://circuitpython.org/blinka/beaglebone_black/ )
https://pypi.org/project/Adafruit-Blinka/
You probably don’t need to do any porting - but insights can be gained here: https://learn.adafruit.com/adding-a-single-board-computer-to-blinka
If you look in the board.py file you can see what boards are supported already. This does appear to include the BB Black.
https://github.com/adafruit/Adafruit_Blinka/blob/master/src/board.py
Jon
Jon:
OK, you set me on the right track. After doing all of the following:
sudo pip3 install Adafruit_BBIO -U
sudo pip3 install adafruit_circuitpython-lis3dh
sudo pip3 install adafruit-circuitpython-busdevice
sudo pip3 install adafruit-circuitpython-register
Everything is working as expected. I had already done the first two, but I’m including them here in case anyone else comes across this.
The instructions here: https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries are outdated. It is not necessary (and in fact is detrimental) to copy the busdevice and register directories from the bundle linked on that page.
I am pretty sure it is not necessary to copy the device files from the bundle either, it is sufficient to do:
sudo pip3 install adafruit-circuitpython-ds3231
sudo pip3 install adafruit-circuitpython-bme680
sudo pip3 install adafruit-circuitpython-bno055
But I would want to test this on a clean installation to be 100% certain.
Thank you,
-Steve
Adafruit has developed an interface package -- blinka -- designed to
permit use of circuitpython libraries on multiple Linux-based boards: R-Pi,
BBBlack, PocketBeagle... cf:
https://github.com/adafruit/Adafruit_Blinka/tree/master/src/adafruit_blinka/board
The interface package uses the board specific libraries (adafruit-bbio,
equivalent on R-Pi) behind the scenes, allowing code to be written to the
common CircuitPython libraries.
Adafruit are slowly migrating their non-CircuitPython libraries (for
example: Adafruit_bno055) over to CircuitPython
(Adafruit_circuitpython_bno055)
My suggestion for the OP is to use an independent SSH client and to get
OUT of the cloud9 environment. Try writing the program and running it from
a direct login to the beagle.
debian@beaglebone:~$ cat bno055.py
#!/usr/bin/python3
import time
import board
import busio
import adafruit_bno055
help(adafruit_bno055)
debian@beaglebone:~$
debian@beaglebone:~$ python3 bno055.py
Help on module adafruit_bno055:
NAME
adafruit_bno055
DESCRIPTION
``adafruit_bno055`` - Adafruit 9-DOF Absolute Orientation IMU Fusion
Breakout - BNO055
Hello,
Did you ever figure out how to manage to get the ADC or any analog instance working for the BBB from this lib?
Seth