Pi Solid State Relays

MCP23008 8-Bit I/O Expander with I²C Interface

Board version: Pi 3 B+ Rev 1.3
Memory: 1 GB
RPi OS version: Lite 32-bit
Use: Switch 230V AC sources (In the Netherlands (Holland) the standard voltage is 230V AC)



Basic installation OS

  • Interface options
    • I²C & SPI on


Check I²C & SPI

You can run the following command to verify: $ ls /dev/i2c* /dev/spi* This should be the result (I have Pi 3B+): $ /dev/i2c-1 /dev/i2c-2 /dev/spidev0.0 /dev/spidev0.1


Python will come pre-installed on your Raspberry Pi OS Lite.

$ python3 --version


Install Python3 pip

If you are using RPi OS Lite, the Python package manager, pip, does not come pre-installed. $ sudo apt-get install python3-pip -y Reboot


Install Adafruit Blinka and Dependencies

( https://pypi.org/project/adafruit-blinka/)

Blinka needs a few dependencies installed: $ sudo apt-get install -y i2c-tools libgpiod-dev python3-libgpiod $ pip3 install --upgrade RPi.GPIO

Adafruit Blinka: $ pip3 install --upgrade adafruit-blinka Reboot


Testing Blinka

Nano texteditor: $ nano blinkatest.py Add: import board import digitalio import busio # 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 en run: $ python3 blinkatest.py This should be the result: $ python3 blinkatest.py Digital IO ok! I2C ok! SPI ok! done!


Python Installation of MCP230xx Library

Type into the command line: $ sudo pip3 install adafruit-circuitpython-mcp230xx