Skip to content
mxmxmx edited this page Nov 2, 2015 · 61 revisions

ADC doing ok?

  • get the ADC-to-FUDI 'converter' thingie here (*): adc2FUDI.c, and move it onto your rpi/odroid (scp or use wget). it doesn't matter where it goes, choose/make a folder you like. ('FUDI' is the serial protocol used by pd: http://en.wikipedia.org/wiki/FUDI).

  • cd into that folder and compile it: in the terminal, run
    gcc adc2FUDI.c -lwiringPi -std=c99 -Wall -O3 -o adc2FUDI

  • the next steps assume both your rpi and notebook/computer are on the same network (wifi) or connected with an ethernet cable: on your (proper) computer, open up puredata and create a simple [netreceive] patch like the one below (example is using port 54321). the 8 ADC channels are prefixed with # 0-7 (that's what adc2FUDI.c is doing), so we tap them with [route 0 1 2 3 4 5 6 7]

  • now run the little program above. ie: on your rpi/odroid, in the respective directory, run sudo ./adc2FUDI [IP-address] 54321 10 &, where [IP-address] the IP-address of your notebook (most likely something like 192.168.0.xx), '10' a variable relating to the ADC update rate. (if you have a monitor connected to your raspberry, you could do the same with: sudo ./adc2FUDI 127.0.0.1 54321 10 &. in this case, you'd have to run the pd patch on your rpi, obviously)

  • terminal tedium / the ADC should now transmit to your computer. turning the knobs, you should see values from 0-4095 coming in (mapping is: top/bottom from left to right == 1-2/3-4/5-6). outputs 6 and 7 should be steady at around 2048. those are the two CV inputs without manual offset. patch a lfo or the like into the CV jacks, to check they behave ok, too.

  • the values you see should be steady, ie not flipping around a great deal. if not, check your soldering or whether you didn't forget to solder something (caps, jacks, pots?). ditto if you don't get meaningful results.

  • if turning the knobs fully CCW doesn't get you down to zero, that'll be due to variations in the resistors. if you're annoyed by this, you could either: change the line #define RESOLUTION 4095 in the C program (the - inverted - ADC reading is subtracted from it. make sure you take care of cases when the difference is < 0); or change the resistors. (to be on the save side, using 47k rather then 49k9 would be an option). generally speaking though, it doesn't matter much.

  • (*) alternatively, you might want to try a/the spi external: [terminal_tedium_adc]. (##NB: this is broken it seems on recent versions of linux; still have to figure this out##).. in my experience anyways, the C app above works better, for whatever reason. at any rate, there's also a set of corresponding dummy-externals for osx, ie to make development of patches easier. Note the [metro] object -- it needs a bang to read the ADC; the message [open /dev/spidev0.1( opens the device:

Clone this wiki locally