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)
NOTE: All of the libraries and sample code use Python 3
1. Open a terminal window and run
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 (v2.1.1) from the GitHub releases page:
8. Install by double-clicking or running
sudo dpkg -i libwidgetlords_2.1.1_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:
For the PI-SPI-DIN series add the following line:
For the PI-SPI-DIN-2x4MIO series add the following line:
For the PI-SPI-DIN-RTC-RS485-4AI-4KO-8DI series add the following line:
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
The libraries are now installed and you are good to go with programming your PI-SPI's.
NOTE: If the libwidgetlords library has already been installed and you are upgrading to a newer version, you must un-install the current library before installing the newer version.