Where to get help with Adafruit Circuit Python on BBB

230 views
Skip to first unread message

Steve Lentz

unread,
Dec 10, 2020, 3:38:53 PM12/10/20
to Beagle Board
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
#//////////////////////////////////////
#
# BMO055 Test
#
#//////////////////////////////////////

import time
import board
import busio
import adafruit_bno055
i2c = busio.I2C(board.SCL,board.SDA)
mybno055=adafruit_bno055.BNO055_I2C(i2c)

while True:
    mybno055.gravity
    time.sleep(1.5)

Here is the error:
    
Traceback (most recent call last):
  File "/var/lib/cloud9/PocketBeagle/bno055.py", line 11, in <module>
    import adafruit_bno055
  File "/home/debian/.local/lib/python3.7/site-packages/adafruit_bno055.py", line 37, in <module>
    from adafruit_bus_device.i2c_device import I2CDevice
ModuleNotFoundError: No module named 'adafruit_bus_device.i2c_device'

Process exited with code: 1

I have checked that all the files appear to be in the cache at /home/debian/.local/.  Python version is set to Python3.  The Python path in Cloud9 points to /usr/local/lib/python3.7/dist-packages.  The included Python examples (blinkLED.py) do work.  

Clearly everything that should be needed is installed, because it works from the command line.  Why does this Python program fail?

Any advice appreciated.  

Thanks,
-Steve


jonnymo

unread,
Dec 10, 2020, 4:05:01 PM12/10/20
to Beagle Board

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/F6DC30FF-B89E-405E-84C0-1548AC86FEA2%40gmail.com.

Steve Lentz

unread,
Dec 10, 2020, 8:03:03 PM12/10/20
to Beagle Board
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.

Darren Freed

unread,
Dec 10, 2020, 11:29:30 PM12/10/20
to beagl...@googlegroups.com
AFAIK CircuitPython is Adafuit's port of micropython, meant for embedded devices. What you are looking for is the Adafruit_BBIO library.

jonnymo

unread,
Dec 10, 2020, 11:48:36 PM12/10/20
to Beagle Board
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.



Jon

david...@gmail.com

unread,
Dec 11, 2020, 12:57:11 AM12/11/20
to BeagleBoard
the Adafruit discord channel 
  https://discord.gg/adafruit
#help-with-circuitpython
  channel is where you can get advice from their side

david...@gmail.com

unread,
Dec 11, 2020, 1:03:16 AM12/11/20
to BeagleBoard
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

jonnymo

unread,
Dec 11, 2020, 2:10:57 AM12/11/20
to Beagle Board
If you look in the board.py file you can see what boards are supported already.  This does appear to include the BB Black.

Jon

Steve Lentz

unread,
Dec 11, 2020, 8:31:49 AM12/11/20
to Beagle Board
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


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

Dennis Lee Bieber

unread,
Dec 11, 2020, 1:29:40 PM12/11/20
to Beagleboard
On Thu, 10 Dec 2020 21:28:55 -0700, in gmane.comp.hardware.beagleboard.user
Darren Freed <darrenfreed-Re5JQ...@public.gmane.org> wrote:

>AFAIK CircuitPython is Adafuit's port of micropython
><http://micropython.org>, meant for embedded devices. What you are looking
>for is the Adafruit_BBIO <https://pypi.org/project/Adafruit-BBIO/> library.
>
>AFAIK CircuitPython is Adafuit's port of micropython
><http://micropython.org>, meant for embedded devices. What you are looking
>for is the Adafruit_BBIO <https://pypi.org/project/Adafruit-BBIO/> library.
>

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

=======================================================================================

This is a CircuitPython driver for the Bosch BNO055 nine degree of
freedom
inertial measurement unit module with sensor fusion.

* Author(s): Radomir Dopieralski

CLASSES
builtins.object
BNO055
BNO055_I2C
BNO055_UART


NOTE: no error on the import of adafruit_bno055 (and yes, I did ensure
I'd uninstalled the non-circuitpython adafruit_bno055 before installing the
circuitpython version) -- though I also have to admit that I installed
using "sudo pip3..." to make it a systemwide install, not user specific.

If it fails from the direct login, try installing the
circuitpython/blinka libraries using sudo -- to make them systemwide.


--
Dennis L Bieber

Darren Freed

unread,
Dec 11, 2020, 2:00:41 PM12/11/20
to beagl...@googlegroups.com
Cool!  Good to know



--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

set_

unread,
Dec 22, 2020, 8:51:42 PM12/22/20
to BeagleBoard
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
Reply all
Reply to author
Forward
0 new messages