Raspberry 3 Model B and SPI (For RFID RC522)

Shortly after finishing the work on our schokotron project I finally had some ideas for playing around with my raspberry pi 3. I think I am going to post the experiments and the code during the next weeks and months. The experiments will be using elixir and python depending on the sensor and available libraries.

Basic Raspberry setup

This setup is based on me using elixir and some SPI experiments. Just do what you need for your task.

  • Install Raspbien: https://www.raspberrypi.org/downloads/
  • Install Erlang, OTP and Elixir: https://www.erlang-solutions.com/blog/installing-elixir-on-a-raspberry-pi-the-easy-way.html

Enable SPI, for example via command line sudo raspi-config or via the desktop raspberry configuration.

SPI issue on Raspberry PI 3 (raspbien jessy)

The first thing I realized when getting started is that a very recent kernel is necessary for some of the SPI based setups. (This is due to some changes to drivers that are not an issue with older versions of the PI.) Thus I will summarize the setup / updates that should be done before using a Raspberry PI 3.

Kernel Update to fix SPI support

Due to some weird hardware workaround, the latest Jessie-image isn’t really working with the bcm2835-drivers and the rc522 RFID reader won’t read any cards without it (see this issue for more details). You can solve that problem by doing the following two things:

Update your Kernel to > 4.14 by running:

sudo apt update
sudo apt upgrade
sudo BRANCH=next rpi-update

Add the following line to your /boot/config.txt: