The main reason to play with Circuit-Python was to use a FeatherWing from Pimoroni called Enviro+ to develop an environmental measure tool.
It is assumed that everything is installed on the development machine (see Circuit-Python article).
Shopping list
Ok, to play with this some boards are needed.
Initially my shopping list was :
- Pimoroni FeatherWing Enviro+
- Adafruit Feather M0 Adalogger
- DS3231 Precision RTC FeatherWing - RTC Add-on For Feather Boards
- PM2.5 Air Quality Sensor and Breadboard Adapter Kit - PMS5003
Preparing the hardware
The "new" Adafruit Feather nRF52840 Express needs to be flashed with the latest CircuitPython.
So from the download area for Circuit-Python look for the nRF52840 board and download the latest version (at the time, the 6.0.1).
To install it, the first time or after a cleanup (see the Troubleshooting section below) just press the reset key twice and then just copy the UF2 file on the board (seen by the system as USB flash named nRF52840).
After the upload, the board will reset and present itself to the system as a drive named CIRCUITPY.
So from the download area for Circuit-Python look for the nRF52840 board and download the latest version (at the time, the 6.0.1).
After the upload, the board will reset and present itself to the system as a drive named CIRCUITPY.
Troubleshooting
Sometime things just get screwed up and is necessary to restore the board as default.
To do so :
Sometime things just get screwed up and is necessary to restore the board as default.
To do so :
- reset the board (click once on the reset button)
- access the serial console
screen /dev/ttyACM0 - enter REPL
- >>> import storage
- >>> storage.erase_filesystem()
This will leave the board as just initialized with Circuit-Python.
Everything in it will be erased.Reinstall the basic CircuitPython libraries :- press the reset key twice
- copy the UF2 file on the board (seen by the system as USB flash named FTHR840BOOT)
After the upload, the board will reset and present itself to the system as a drive named CIRCUITPY.
- reset the board (click once on the reset button)
- access the serial console
screen /dev/ttyACM0 - enter REPL
- >>> import storage
- >>> storage.erase_filesystem()
Everything in it will be erased.
- press the reset key twice
- copy the UF2 file on the board (seen by the system as USB flash named FTHR840BOOT)
Preparing the code
Pimoroni provide a basic project on GitHub, so the first this to do is to clone it on the host machine.
- open a terminal
- clone the project somewehere
git clone git@github.com:pimoroni/EnviroPlus-FeatherWing.git - download the Circuit-Python libraries depending the version of Circuit-Python used.
Since we installed on the board the latest, will be the 6.x.x one - Copy these libraries in the CIRCUITPY drive, under the lib directory :
- adafruit_bus_device
- adafruit_bme280 (not adafruit_bmp280)
- adafruit_st7735r (not adafruit_st7735)
- adafruit_display_text
- Copy the libraries from the Pimoroni cloned project on the same area
- i2cdevice (not to be confused with Adafruit's i2c_device library)
- pimoroni_envirowing
- pimoroni_ltr559
- pimoroni_physical_feather_pins
- pimoroni_pms5003
- pimoroni_circuitpython_adapter
Connecting to the IDE
As start copy in it one of the examples provided by Pimoroni.
If Serial is activated, the code will restart.
Library problem
For example running a code that test all the libraries and connections :
code.py output:
Screen successfully set up!
I2C Initialised!
BME280 Tests Passed!
Gas Sensor Tests Passed!
Traceback (most recent call last):
File "code.py", line 80, in <module>
File "lib/pimoroni_ltr559/__init__.py", line 218, in __init__
File "lib/i2cdevice/__init__.py", line 230, in get
File "lib/i2cdevice/__init__.py", line 183, in read_register
File "lib/i2cdevice/__init__.py", line 288, in _i2c_read
File "lib/pimoroni_circuitpython_adapter/__init__.py", line 46, in read_i2c_block_data
File "lib/pimoroni_circuitpython_adapter/__init__.py", line 40, in read_i2c_block_data
TypeError: extra keyword arguments given
Press any key to enter the REPL. Use CTRL-D to reload.
No comments:
Post a Comment