Ok, It seems like I found a way.
First, make sure the spi module is enabled.
In the file /etc/modprobe.d/raspi-blacklist.conf
comment out the line:
#blacklist spi-bcm2708
There is a project called webiopi. The project has a python lib that supports a couple ADCs. The supported ADCs are listed in this page and include the MCP3204.
To install just the python library I used:
wget https://webiopi.googlecode.com/files/WebIOPi-0.6.0.tar.gz
tar xzvf WebIOPi-0.6.0.tar.gz
cd WebIOPi-0.6.0/python
sudo python setup.py install
(though I used a virtualenv).
Then I could pull data from the PI using this script, run as SUDO:
from webiopi.devices.analog import MCP3004, MCP3008, MCP3204, MCP3208
# Setup a MCP3204 on SPI CE0
mcp0 = MCP3204()
print mcp0.analogReadAllVolt()
The wiring is as follows (from ADC to Pi):
- Vcc and Vref to +3.3
- Analog Ground to Ground
- SCLK to SP10 SCLK
- CS/SHDN to SP10 CE0 N
- CH0 to some resistor (or what you want to measure)
- Digital ground to ground
- Din to SPI MOSI
- Dout to SPI MISO
Here is a diagram showing a similar connection I made once to an an AVR to show the pinout of the MCP3204:
Would love to hear your comments.