- Enable SPI on Raspberry PI
- Enable SPI for use in Python
Enable SPI on Rasperry PI
From the command line type:
sudo nano /etc/modprobe.d/raspi-blacklist.confComment out the blacklist spi-bcm2708 by prefixing it with #
Press and hold 'CTRL' and press 'O', then press 'ENTER', then close nano with 'CTRL' + 'X'
You will need to reboot the type:
sudo rebootWhen it has restarted you can test if it is working by typing 'lsmod', this display kernel modules loaded, you can wee from the image below the spi_bcm2708 module is now loaded,
SPI is now enabled on the Raspberry PI
Enable SPI for use in Python
To enable SPI to be used in python you need to install the python module for interfacing with SPI.
You will need internet access so you can download the code from github.
git clone https://github.com/doceme/py-spidevOnce you have cloned the py-spidev you will need to change to the directory and use python to install the module.
cd py-spidev
sudo python setup.py installIt is now possible to use import spidev more information can be found here http://tightdev.net/SpiDev_Doc.pdf
import spidev



