0

Where to place a file that is to be Imported?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Where to place a file that is to be Imported?

by Crossette on Fri Feb 09, 2018 8:00 pm

I am attempting to run a Trinket M0 example file to read the data from the BME680 sensor breakout card.
It is stopping at the line IMPORT Adafruit_BME680. I do find a couple of files with .H and .CPP extensions
with this name in your GitHub directory. Is it one of these?
I am totally new to Python so please tell me what file to use and where to place it.
Thanks.

Crossette
 
Posts: 44
Joined: Wed Dec 13, 2017 8:50 pm

Re: Where to place a file that is to be Imported?

by Crossette on Sat Feb 10, 2018 7:21 pm

I just checked the CIRCUITPY drive on the Trinket M0 board. There is only 17.5 kb. of space left (as I received it from Adafruit).
Is there even enough room to add the BME680 driver?
Please detail how to load the correct module.

Crossette
 
Posts: 44
Joined: Wed Dec 13, 2017 8:50 pm

Re: Where to place a file that is to be Imported?

by Crossette on Mon Feb 12, 2018 7:16 pm

Crossette wrote:I am attempting to run a Trinket M0 example file to read the data from the BME680 sensor breakout card.
It is stopping at the line IMPORT Adafruit_BME680. I do find a couple of files with .H and .CPP extensions
with this name in your GitHub directory. Is it one of these?
I am totally new to Python so please tell me what file to use and where to place it.
Thanks.


@Adafruit Please help me to locate and load the correct file. Apparently the driver for this sensor is not part of my installed CIRCUITPY directory
in my Trinket M0.

Crossette
 
Posts: 44
Joined: Wed Dec 13, 2017 8:50 pm

Re: Where to place a file that is to be Imported?

by jerryn on Mon Feb 12, 2018 10:30 pm

The .h and .cpp files are for likely from the Arduino Libraries , not circuit python. Those will be .py or .mpy files. Have you looked at https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino?view=all#circuitpython for general information on using circuitpython on the Trinket M0. The bme680 library is part of the “bundle”. The trinket M0 does require careful management of the file system but the guide above should help you with that. If not, keep asking.
Good luck!

jerryn
 
Posts: 820
Joined: Sat Sep 14, 2013 9:05 am

Re: Where to place a file that is to be Imported?

by jerryn on Tue Feb 13, 2018 7:37 am

There is more information about installing the proper library at: https://learn.adafruit.com/adafruit-bme680-humidity-temperature-barometic-pressure-voc-gas?view=all#circuitpython-wiring-test

You can find the latest library bundle at:
https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/tag/20180213
Download the file (or a newer version if available)
adafruit-circuitpython-bundle-2.2.1-mpy-20180213.zip
Extract the zip file on your computer.

On your Trinket, you may have to delete some of the exiting files to make room. Make sure you still have a /lib folder on the Trinket M0. If not, create one.
From the "Bundle" repostory you should transfer the folder lib/adafruit_bus_device to /lib/adafruit_bus_device on you trinket.
You s hould also transfer lib/adafruit_bme680.mpy to /lib/adafruit_bme680.mpy


You should now be able to execute the test code from the guide.
Last edited by jerryn on Wed Feb 14, 2018 4:43 pm, edited 2 times in total.

jerryn
 
Posts: 820
Joined: Sat Sep 14, 2013 9:05 am

Re: Where to place a file that is to be Imported?

by Crossette on Wed Feb 14, 2018 3:22 pm

@jerryn Thanks for all the info! All I had to do was get the Adafruit_BME680.mpy file from the master library directory and place it in the lib folder on the Trinket!
But now I get an error that says line 344 in __init__
Import error: No module named Adafruit_bus_device.

Do I need to find a .mpy file for this and put that in the lib folder too? There are 3 files in the Adafruit_bus_device folder!

Crossette
 
Posts: 44
Joined: Wed Dec 13, 2017 8:50 pm

Re: Where to place a file that is to be Imported?

by jerryn on Wed Feb 14, 2018 4:35 pm

You should copy the whole adafruit_bus_device folder to the lib folder on your trinket.

jerryn
 
Posts: 820
Joined: Sat Sep 14, 2013 9:05 am

Re: Where to place a file that is to be Imported?

by jerryn on Wed Feb 14, 2018 4:40 pm

There were some typos in my earlier post, now fixed, sorry if they caused confusion

jerryn
 
Posts: 820
Joined: Sat Sep 14, 2013 9:05 am

Re: Where to place a file that is to be Imported?

by Crossette on Wed Feb 14, 2018 5:53 pm

I didn't find any typos but the solution was quite simple as you can see. Probably gave me way more info than needed.
As for the missing Adafruit_bus_device I placed the entire folder into the lib folder on the Trinket and that worked!
The Bosch BME680 sensor is now spitting out accurate readings about every 1/3 of a second. Humidity, temp, pressure and VOC.
All it took to make the demo file function was the addition of the Adafruit_BME680.mpy and the above mentioned folder
into the lib folder on the Trinket.
Perhaps you could put a comment in the Demo file to note that those 2 things are required to make it function.
Thank you, jerryn.

Crossette
 
Posts: 44
Joined: Wed Dec 13, 2017 8:50 pm

Re: Where to place a file that is to be Imported?

by jerryn on Wed Feb 14, 2018 10:20 pm

Glad it is working for you!

jerryn
 
Posts: 820
Joined: Sat Sep 14, 2013 9:05 am

Please be positive and constructive with your questions and comments.