We're constantly building/updating/improving our libraries, so we don't ship all the CircuitPython libraries with your board.
You'll want to grab a copy of the CircuitPython Library Bundle - a .zip file containing a bunch of useful CircuitPython libraries. The TinyLoRa library is separate repository, but it's easier to install everything at once using the bundle.
Grab the latest version of the library bundle by clicking this button and make sure you download the version that matches your CircuitPython library version:
Unzip the library. You'll see a two folders:
examples. Double click the
lib folder to see a listing of all the CircuitPython libraries.
On Express boards (the board will say 'EXPRESS' on it), the
examples directories can be copied directly to the CIRCUITPY drive.
Just drag the entire
examples (optional) folders into the CIRCUITPY drive, and 'replace' any old files if your operating system prompts you.
The RFM9x Feather M0 (all-in-one) has less space available compared to express boards. To save space, we're only going to install the libraries required for this guide.
From the bundle folder, navigate to the
lib folder and find the required folders:
Copy these three folders/files over to the
Before continuing make sure your board's
lib folder has at the
adafruit_si7021 libraries copied.
If you find yourself running out of space on your non-express board and are a computer running MacOS - there's a chance that your mac is creating hidden files which are taking up space on the board.
Make sure you're running the latest version of CircuitPython for your board, and follow the guide here for information on how to prevent these files from being created.
For further space savings- remove the TTN configurations for any country other than your own (you'll only need
ttn_usa.mpy if you're in the United States).
If you're following along with a Raspberry Pi, Beaglebone or any other supported small Linux computer, we'll use a special library called adafruit_blinka (named after Blinka, the CircuitPython mascot) to provide the layer that translates the CircuitPython hardware API to whatever library the Linux board provides. It's CircuitPython, on Pi!
If you haven't set up Blinka and the Adafruit IO Python Library yet on your Raspberry Pi, follow our guide:
We use two pins on the Pi (SDA/SCL) to communicate over I2C with the Si7021. You only have to do this step once per Raspberry Pi, the I2C interface is disabled by default.
Once you're done with this and have rebooted, verify you have the I2C devices with the command:
sudo i2cdetect -y 1
The output from running this command should look like the following:
You'll also need to enable SPI to communicate over SPI with the RFM breakout. You only have to do this step once per Raspberry Pi, the SPI interface is disabled by default.
Once you're done enabling SPI and have rebooted, verify you have the SPI interface by typing the following command into the terminal:
ls -l /dev/spidev*
You should see the following output:
Next, you'll need to install libraries to communicate with the RFM9x breakout and the Si7021. Since we're using Adafruit Blinka (CircuitPython), we can install CircuitPython libraries straight to our Raspberry Pi, instead of installing from separate files.
Run the following command from your terminal to install the Adafruit_CircuitPython_Si7021 Library:
sudo pip3 install adafruit-circuitpython-si7021
Then, install the Adafruit_CircuitPython_TinyLoRa library
sudo pip3 install adafruit-circuitpython-tinylora