Raspberry Pi Wiring & Test

The Raspberry Pi also has an I2C interface that can be used to communicate with this seesaw

Install Python Software

Once your Pi is all set up, and you have internet access set up, lets install the software we will need. First make sure your Pi package manager is up to date

sudo apt-get update

Next, we will install the Raspberry Pi library and Adafruit_GPIO which is our hardware interfacing layer

sudo apt-get install -y build-essential python-pip python-dev python-smbus git
git clone https://github.com/adafruit/Adafruit_Python_GPIO.git
cd Adafruit_Python_GPIO
sudo python setup.py install

Next install the adafruit seesaw python library.

sudo pip install Adafruit-seesaw

Enable I2C

We need to enable the I2C bus so we can communicate with the seesaw.

sudo raspi-config

select Advanced options, enable I2C, and then finish.

With the Pi powered off, we can wire up the sensor to the Pi Cobbler like this:

  • Connect Vin to the 3V or 5V power supply (either is fine)
  • Connect GND to the ground pin on the Cobbler
  • Connect SDA (22)  to SDA on the Cobbler
  • Connect SCL (23) to SCL on the Cobbler
  • Connect the positive (long lead) of an LED to pin 15 on the samd09 breakout and the other lead to GND through a 1k ohm resistor.

You can also use direct wires, we happen to have a Cobbler ready. remember you can plug the cobbler into the bottom of the PiTFT to get access to all the pins!

Now you should be able to verify that the sensor is wired up correctly by asking the Pi to detect what addresses it can see on the I2C bus:

sudo i2cdetect -y 1

It should show up under it's default address (0x49). If you don't see 49, check your wiring, did you install I2C support, etc?

Run example code

At long last, we are finally ready to run our example code

cd ~/
git clone https://github.com/adafruit/Adafruit_Python_seesaw.git
cd Adafruit_Python_seesaw/examples
sudo python blink.py

If everything is set up correctly, the LED attached to pin 15 on the SAMD09 breakout should blink on and off repeatedly. Press CTRL + C to stop the program running once you are satisfied with the blinking.

Documentation

See here for documentation of the seesaw python API.

Last updated on 2017-11-03 at 12.38.33 PM Published on 2017-11-01 at 05.26.25 PM