Skip to content

Instantly share code, notes, and snippets.

@battila
battila / gist:bb9b1a761a22ae8b9fcf05bd527489ae
Created September 2, 2016 23:41 — forked from ChickenProp/gist:3183960
Expanding the Raspberry Pi's GPIO capabilities with the MCP23017

Introduction

The MCP23017 is an I/O expander chip. It has 16 GPIO pins which you can control using an I2C interface using two pins from a Raspberry Pi, plus a power source and sink (which can also come from the Pi). It's not quite as simple as directly controlling the Pi's GPIO pins, but it's not complicated, either.

You need to install i2c-tools, which is probably in your distribution's package manager. You also need a kernel with I2C support; you might need to modprobe i2c-dev. It would presumably be possible to do without either of these things, and bitbang the I2C protocol over GPIO, but I don't understand the protocol well enough to try.

On pin numbering: if you like, you can refer to the datasheet for the MCP23017. There's a small dot in one corner of the chip, with a semi-circular cut-out at that end. The pin near

/*
This is for configuring the hc-06 bluetooth chip to work with Johnny-Five javascript robotics library.
Might also work with the hc-05.
Author: Glen Arrowsmith (@garrows)
*/
#define ROBOT_NAME "RandomBot"

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt