Skip to content
mxmxmx edited this page Aug 15, 2019 · 109 revisions

inputs/outputs:

note: the tactile switches + gate inputs need the internal pull-ups on the GPIO to work.

  • the pd external (tedium_input) is taking care of that, so when using those, you don't have to worry about it.

  • when not using the external, the pull-up resistors need to be activated by some other means; take a look at the OSC client (for C); alternatively, one might run a simple python script such as pullup.py during start-up. note this will look slightly different for the pcm5102a vs wm8731 version. for details, see below (*).

gpio externals:

  • note: the installation procedure below refers to manual installation. simply running install.sh will do the same.

    • first, get the pd externals for gate inputs, gate outputs, and the switches: [tedium_input] and [tedium_output].

    • you can either compile them yourself (details here) or use the pre-compiled externals (the stuff ending in .pd_linux); they're also available for osx (see the dummies folder).

    • once compiled, move tedium_input.pd_linux and tedium_output.pd_linux to your externals folder: ../extra (the exact path will depend on how/where you've installed pd); for example:

sudo mv tedium_input.pd_linux /usr/lib/pd/extra/

  • or

sudo mv tedium_input.pd_linux /home/pi/pd-0.46-7/extra/

  • or simply:

sudo mv *.pd_linux /usr/lib/pd/extra/

gpio test:

  • now, run the test-patch called D_io_test. there's two different versions, they only differ as regards the GPIO numbers being used:

sudo puredata -nogui -rt D_io_test_wm8731.pd

  • respectively

sudo puredata -noadc -nogui -rt D_io_test_pcm5102a.pd

  • note the sudo (needed for the externals to work). -noadc because the pcm5102a is just a DAC.

  • this is the test patch in question (pcm5102a) (it'll look similar for wm8731):

  • ... this just toggles the two gate outputs/LEDs. GPIO_num = 4, 17, 2, and 3 are the gate inputs; GPIO_num 23, 24, and 25 would be the tact switches. [tedium_output 16] and [tedium_output 26] are the corresponding output externals. as noted, the pin numbers differ somewhat for the wm8731 version.

  • the patch isn't doing anything interesting: any clock signal applied to gate inputs 1-4 should result in a gate output (on both outputs) + the two leds should light up. ditto for the three tact switches. pressing them should switch the leds on and off.

  • if this doesn't work: make sure pd can find the externals (to get more info from pd, use the -verbose flag); if it still doesn't work, check your soldering around the NPN transistors.

  • in practice, you'd probably go about the outputs differently; for instance, setting the pulse-width of the second/lower gate output (= right inlet) to 50ms might look somewhat like this:

  • alternatively, use adc2FUDI.c for the inputs -- see the note (†) at the bottom of the page


notes:

not using the pd-externals.

  • (†) alternatively, the inputs (in pd) can be handled by adc2FUDI.c. just uncomment everything relating to the GPIO, and recompile; in this case, usage is analogous to the ADC / as follows:

  • back on your raspberry, run pullup.py first; then do sudo ./adc2FUDI [IP-address] 54321 10 & (make sure no instance of adc2FUDI is still running). patching a clock into the trigger inputs should result in corresponding 'bangs'; ditto when pushing the buttons. (if using wifi, they're might be some latency. so don't worry). the mapping is (from left to right: 8: clock 1 (top left), 9: clock 2 (top right), 10: clock 3 (bottom left), 11: clock 4 (bottom right), 12: top button, 13: middle button, 14: bottom button).

  • note that you could alternatively send the output of ./adc2FUDI to any IP-address in your network, e.g. your laptop.


(*)

  • for the pcm5102a version, pullup.py will look like this:
#!/usr/bin/env python

# pull up GPIO23-25 (tact switches)

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)

GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(25, GPIO.IN, pull_up_down = GPIO.PUD_UP)
  • the wm8731 version will look like this:
#!/usr/bin/env python

# pull up GPIO23-25 (tact switches)

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)

GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(25, GPIO.IN, pull_up_down = GPIO.PUD_UP)

# and pull up GPIO 4, 14, 17, and 27 (gate inputs)

GPIO.setup( 4, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(14, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(17, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(27, GPIO.IN, pull_up_down = GPIO.PUD_UP)