Sunday, December 8, 2013

Setting up software, I2C, Python

Setting up the software, I2C, Python

I had to completely re-image my RasPi because i messed up a config file. So, might as well document the installation process!

1) Installed Raspbian. Configured it to boot to command line, with minimal memory to graphics.
2) Installed TightVNC. Instructions from This setup is so that the RasPi has internet access, and I can access it from my laptop. For a setup where i connect directly to the RasPi with an ethernet cable but without internet access, the following instructions can be used:
3) Install PureData.
4) Install Python to interface with GPIO and I2C interfaces:
Python is the officially supported language and offers pretty good speed on the GPIO, according to the benchmarks at Maybe once i figure out what i'm doing i'll switch to wiringPi, but for now Python is a nice language to use with lots of sample code.

For I2C: I'm using Adafruit's own python demo code.
The P5 header on the raspberry pi is not enabled by default, and needs to be configured before it can be used. Somebody posted a quick python program to do that configuration at
It also does not have a built in pull-up resistor on the two data pins, which are necessary for a I2C interface (see The I2C interface sends data by pulling the two pins low, and without the pull-up, the device is not even visible to the I2C driver (giving me a good ESD scare). Therefore I built my own pull-up resistors onto the external IC of the LCD shield. I used two 56K resistors soldered directly from the data lines to the 3.3V line.

For GPIO: I'm using the python rpi.gpio library. Here is my membrane keyboard / pushbutton interface. This is by far the most delicate thing I've tried to solder so far, and it's probably the most fragile part of the entire endeavor, so if this breaks, i'll etch my own PCB. I've decided not to use the keys on the I2C interface after all because the GPIO is much faster and supports interrupts so I don't have to poll them in a loop.
Also pictured: extension plugs with screw mounts for the USB dongle's 3.5mm jacks. That way, the attachment is more sturdy. The red pushbutton gives a nice tactile click and will be used to trigger record/stop.

Next steps: Configuring the USB audio to work, putting it all together structurally, and actually coding the damn thing! I'll be accessing the RasPi through TightVNC on my laptop from now on!

No comments:

Post a Comment