Using an Arduino to Control or Test an SPI electronic device by techshopdude
Featured
Scope A Trace Labels.jpg
DSC_4438.JPG
DSC_4462.JPG
Scope A Trace Ohm meter.jpg
Scope B Trace.jpg
AD7376 Pin Out.JPG
AD7376 Timing Diagram.JPG
There are many electronic devices that use the SPI  bus, or Serial Peripheral Interface bus, for communications (e.g. various sensors, LCD displays, digital potentiometers, D/A and A/D converters, wireless transmitters and receivers, audio volume controls).  The devices receive data serially from a microcontroller using a 3-wire set-up that includes a chip select signal (usually titled CS - when this signal is at logic 0, a chip recognizes it will be receiving or sending data), a clock signal for clocking the serial data into the device, and the serial data stream itself.

Many hobbyists use microcontrollers such as the Arduino to control and use SPI devices.  Oftentimes, you just want to test the electronic device to make sure it and its associated circuitry is working properly.  This Instructables will show you how to set up and program a simple proto board circuit using the Arduino Uno to drive SPI data to a peripheral circuit which, in this case, is an Analog Devices AD7376 digital potentiometer.  It could be any 8-bit SPI device using this circuit.

For this Instructables, I used an Arduino Uno board, a proto-board, some DIP (Dual Inline Package) switches (they are optional), a variety of jumper wires, a DC power supply, an ohm meter, a few capacitors for DC power supply smoothing, and a few pull-up resistors for the digital potentiometer.   The AD7376 digital potentiometer is a surface mount device so I soldered it onto a surface-mount proto-PCB so it could be plugged into the proto-board.  I used an oscilloscope to display the signals for this Instructables.
 
Remove these adsRemove these ads by Signing Up

Step 1:

DSC_4438.JPG
Assemble the Circuit: Place the Arduino board on the proto board in a convenient location.  Next insert the DIP switches with all the pins on one side connected to ground (these DIP switches will provide the 8 bits of data that will be read by the Arduino and then sent serially to the AD7376).  Wire digital pins 2 through 9 of the Arduino to the other side of the DIP switch, one wire per switch element.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!