Table of Contents
Wiring Pi for Pure Data
Controlling the GPIO pins and an analog digital converter (MCP3008) in Pure Data on a Raspberry Pi.
Pure Data (Pd) is a visual programming language developed by Miller Puckette.
Wiring for the Raspberry Pi was written by Gordon Henderson.
WiringPi for Pure Data was written by Miller Puckette, 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.deb
http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/
Install the WiringPi for PD
Download: pd-wiringpi.zip
$ wget www.dernulleffekt.de/programme/pd-wiringpi.zip $ unzip pd-wiringpi.zip $ cd pd-wiringpi/ $ cp -R wiringPi_gpio/ /home/pi/Pd/externals/ $ cp -R wiringPi_mcp3008/ /home/pi/Pd/externals/
Unzip and copy the wiringPi_gpio and the wiringPi_mcp3008 folder in the PD external folder.
/home/pi/Pd/externals
One has to run Wiring PD with administration rights:
$ sudo pd
In Pure Data → Preferences → Path set the path to the two external folders. You might have to set the path for the PD folder, too. It should look like that.
Or install pdwiringPi
An other wiringPi external is that one https://github.com/garthz/pdwiringPi by Garth Zeglin. It also support PWM over GPIO for the pins: 12, 13, 18, 19.
$ wget https://github.com/garthz/pdwiringPi/archive/master.zip $ unzip master.zip $ cd pdwiringPi-master $ make
There should be a new folder called “pdwiringPi”. Add that one the Pure Data → Preferences → Path.
Pin Configuration
The Wiring library has its own pin labeling:
Wiring Pins.pdf
On Sparkfun one found a good pin labeling, too:
https://learn.sparkfun.com/tutorials/raspberry-gpio/all
For example:
pin 0 is GPIO 17
pin 1 is GPIO 18
Run WiringPi GPIO
The GPIO access needs administration rights, so one has to start Pure Data with these rights from the terminal:
$ sudo pd
Open the wiringPi_gpio-help.pd file and have fun with the GPIOs!
WiringPi and the MCP 3008
For the hardware wiring of the 10 bit analog to digital converter MCP 3008 connect the pins of the MCP3008 like that:
MCP3008 Raspberry Pi VDD 3.3V VREF 3.3V AGND GND DGND GND CLK SCLK DOUT MISO DIN MOSI CS/SHDN CE0
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.
Links
Wiring:
http://wiringpi.com/
https://github.com/WiringPi/WiringPi
https://github.com/jeremiahrose/pd-wiringpi
http://pi.bek.no/pd_wiringPi_GPIO/
MCP3008:
https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters/mcp3008
GPIO:
https://www.raspberrypi.org/documentation/usage/gpio/
License
This manual is made by Wolfgang Spahn 2020.
It is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.