ADC Differential Pi with ADXL335 Accelerometer

In this tutorial we will use the ADC Differential Pi or DeltaSigma Pi with a ADXL335 from Analog Devices on a SparkFun Triple Axis Accelerometer Breakout to make a digital accelerometer. For this you will need your Raspberry Pi, an ADC Differential Pi or DeltaSigma Pi, and a SparkFun Triple Axis Accelerometer Breakout.

We will use the AB Electronics python library to talk to the ADC Differential Pi, to download the library visit our Python Library and Demos knowledge base article.

Parts Used:

Connecting the Sensor to the ADC Differential Pi Plus

If you haven’t done so install your ADC Differential Pi Plus onto the Raspberry Pi by connecting it onto the GPIO header. Make sure your Raspberry Pi is turned off when you do this to minimise the risk of damaging the Raspberry Pi or the ADC Differential Pi Plus.

Connect the VCC pin on the ADXL335 board to 3.3V on the GPIO header.

Connect the GND on the ADXL335 to GND on the GPIO header.

On the ADC Differential Pi connect the negative inputs on channels 1, 2 and 3 to GND, this sets the ADC chips into single ended mode to measure between 0 and 2.048 volts.

Now we need to connect the output from the ADXL335 board to the ADC inputs, as the output from the ADXL335 is up to 3.3 volts we need to add a voltage divider between the ADXL335 output and the ADC Differential Pi positive inputs on each channel.

Connect the X pin on the ADXL335 to a 18K resistor, connect the other side of the resistor to input 1 on the ADC Differential Pi and also connect the 27K resistor between pin 1 on the ADC Differential Pi and GND.

Connect the Y pin on the ADXL335 to a 18K resistor, connect the other side of the resistor to input 2 on the ADC Differential Pi and also connect the 27K resistor between pin 2on the ADC Differential Pi and GND.

Connect the Z pin on the ADXL335 to a 18K resistor, connect the other side of the resistor to input 3 on the ADC Differential Pi and also connect the 27K resistor between pin 3 on the ADC Differential Pi and GND.

For this tutorial we will start by creating a new python program file called demo-adxl335.py. You can use your favourite text editor for writing the program. You can find a complete example of demo-adxl335.py in the ABElectronics_Python_Libraries/ADCDifferentialPi/ folder.

At the top of your program you will need to import the ADCDifferentialPi library and time library. We also add variables to hold the values related to the sensor data conversion.

The ADCDifferentialPi library is used for all communication with your ADC Differential Pi Plus, it gives you control over almost everything that can be done with the MCP3424 controller.

Next we need to create an instance of the ADCDifferentialPi class and call it adc.

adc = ADCDifferentialPi(0x68, 0x69, 12)

0x68 and 0x69 are the I2C address for the ADC chips, if you have changed the address selection jumpers on your ADC Differential Pi Plus then you will need to change these numbers to match the new addresses.