This is an old revision of the document!
Wiring Pi for Pure Data
Controlling the GPIO pins and an analog digital converter (MCP3008) in Pure Data on a Raspberry Pi.
Wiring for the Raspberry Pi was written by Gordon Henderson.
WiringPi for Pure Data was written by Miller Puckettte, Jaime Oliver La Rosa and Jeremiah Rose.
This is a workaround for installing the WiringPi object and using the analog digital converter MCP3008 for analog inputs in Pure Data on a Raspberry Pi 4 with
Raspbian Buster.
Pure Data and Wiring Pi
Install Pure Data
In the terminal:
$ sudo apt update $ sudo apt install puredata
Install Wiring
In the terminal:
$ sudo apt-get install wiringpi
For the Raspberry Pi 4 one needs to update the WiringPi to version 2.52:
$ cd /tmp $ wget https://project-downloads.drogon.net/wiringpi-latest.deb $ sudo dpkg -i wiringpi-latest.
http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/
Install the WiringPi for PD
Download: pd-wiringpi.zip
Unzip and copy the wiringPi_gpio and the wiringPi_mcp3008 folder in the PD external folder.
/home/pi/Documents/PD/externals
In Pure Data → Preferences → Path set the path to these two folders.
Pin Configuration
The Wiring library has its own pin labeling:
Wiring Pins.pdf
On Sparkfun one found a good pin labeling, too:
}}\\
Open the wiringPi_gpio-help.pd file and have fun with the GPIOs!\\
=== WiringPi and the MCP 3008 ===
{{:puredata:raspberrypi_mcp3008.jpg?600|}}\\
For the hardware wiring of the 10 bit analog to digital converter MCP 3008 connect the pins of the MCP3008 like that:\\
{{:puredata:sensors_raspberry_pi_mcp3008pin.gif?200|}}\\
MCP3008 Raspberry Pi
VDD 3.3V
VREF 3.3V
AGND GND
DGND GND
CLK SCLK
DOUT MISO
DIN MOSI
CS/SHDN CE0
{{:puredata:gpio-pinout-diagram-2.png?400|}}\\
Before using the Wiring object enable the SPI interface in:
$ sudo raspi-config
Open PD as administrator (sudo pd) and then open the wiring_mcp3008-help.pd file. After clicking on setup_wiringPi the analog inputs should work.\\
{{:puredata:pd_wiringpi_mcp3008-help_jan2020.png?|}}\\
----
==== Links ====
[[https://puredata.info/
http://wiringpi.com/
https://github.com/jeremiahrose/pd-wiringpi
http://pi.bek.no/pd_wiringPi_GPIO/
https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters/mcp3008
https://www.raspberrypi.org/documentation/usage/gpio/