Prerequisite Pi Setup!
In this page we'll assume you've already gotten your Raspberry Pi up and running and can log into the command line
Here's the quick-start for people with some experience:
- Download the latest Raspberry Pi OS or Raspberry Pi OS Lite to your computer
- Burn the OS image to your MicroSD card using your computer
- Re-plug the SD card into your computer (don't use your Pi yet!) and set up your wifi connection by editing supplicant.conf
- Activate SSH support
- Plug the SD card into the Pi
- If you have an HDMI monitor we recommend connecting it so you can see that the Pi is booting OK
- Plug in power to the Pi - you will see the green LED flicker a little. The Pi will reboot while it sets up so wait a good 10 minutes
- If you are running Windows on your computer, install Bonjour support so you can use .local names, you'll need to reboot Windows after installation
- You can then ssh into raspberrypi.local
sudo apt-get update sudo apt-get upgrade sudo apt-get install python3-pip
and
sudo pip3 install --upgrade setuptools
We put together a script to easily make sure your Pi is correctly configured and install Blinka. It requires just a few commands to run. Most of it is installing the dependencies.
cd ~ sudo pip3 install --upgrade adafruit-python-shell wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/raspi-blinka.py sudo python3 raspi-blinka.py
If you are installing an older version of Raspberry Pi OS, your system default Python is likely Python 2. If so, it will ask to confirm that you want to proceed. Choose yes.
It may take a few minutes to run. When it finishes, it will ask you if you would like to reboot. Choose yes.
Check I2C and SPI
The script will automatically enable I2C and SPI. You can run the following command to verify:
ls /dev/i2c* /dev/spi*
You should see the response
/dev/i2c-1 /dev/spidev0.0 /dev/spidev0.1
Enabling Second SPI
If you are using the main SPI port for a display or something and need another hardware SPI port, you can enable it by adding the line
dtoverlay=spi1-3cs
to the bottom of /boot/config.txt and rebooting. You'll then see the addition of some /dev/spidev1.x devices:
Blinka Test
Create a new file called blinkatest.py with nano or your favorite text editor and put the following in:
import board import digitalio import busio print("Hello blinka!") # Try to great a Digital input pin = digitalio.DigitalInOut(board.D4) print("Digital IO ok!") # Try to create an I2C device i2c = busio.I2C(board.SCL, board.SDA) print("I2C ok!") # Try to create an SPI device spi = busio.SPI(board.SCLK, board.MOSI, board.MISO) print("SPI ok!") print("done!")
Save it and run at the command line with:
python3 blinkatest.py
You should see the following, indicating digital i/o, I2C and SPI all worked.