Getting Started with PI-SPI Libraries

The PI-SPI series of modules were designed to allow the user a simple way to create real world applications using the Raspberry Pi. Applications can have a mix of analog inputs, analog outputs, digital inputs and relay outputs. Most of the modules use the SPI bus (Serial Peripheral Interface) and some use the I2C bus (Inter-integrated Circuit).

One limitation of the Raspberry Pi SPI is the number of chip selects available - CE0 and CE1, until now!

Widgetlords Electronics (VP Process Inc.) has released a new library on GitHub that allows for more than 2 chip selects and makes writing software for the PI-SPI series as easy as using "write" and "read" commands. The new "libwidgetlords" library allows all modules to be used simultaneously without the user having to write any code for chip select manipulation.

Let's get started!

Here are the steps required to setup the Widgetlords Libraries:
(One assumption - the user is starting with a properly set up SD card and has the latest RPi operating system - all libraries have been tested with Stretch)

1. Open a terminal window and run

sudo raspi-config

2. Select "5 Interfacing Options".

3. Select "P6 Serial".

4. Answer no for a serial-accessible login shell.

5. Answer yes for enabling serial hardware.

6. Select "Finish".

7. Download the latest library release (v1.0.2) from the GitHub releases page:

https://github.com/widgetlords/libwidgetlords/releases

or directly from

https://github.com/widgetlords/libwidgetlords/releases/download/v1.0.2/libwidgetlords_1.0.2_armhf.deb

8. Install by double-clicking or running

sudo dpkg -i libwidgetlords_1.0.2_armhf.deb

NOTE: If you have previously installed the library you must remove it first using

sudo apt remove libwidgetlords

9. Set the appropriate overlay in /boot/config.txt by adding the appropriate dtoverlay to the end of the file.

Open the config file with

sudo nano /boot/config.txt

Scroll to the bottom of the file.

For the PI-SPI series add the following line:

dtoverlay=pi-spi

For the PI-SPI-DIN series add the following line:

dtoverlay=vpe-2701c

10. (OPTIONAL for the PI-SPI-DIN series), run

sudo apt remove fake-hwclock

in order to make use of the battery-backed RTC.

11. Reboot your raspberry pi with

sudo reboot

The libraries are now installed and you are good to go with programming your PI-SPI's.