Q:
How do I connect the ADIS16364 to my Arduino processor system?
---------------------------------------------------------------------------------------------
A:
This software package is an example of how to interface an ADIS16364 iSensor with an Arduino, and plot the data with a simple python program. This project can be used as a whole package, or you can use it to pick and choose code for things such as SPI communication, two's complement conversion, memory map for ADIS16364, python plotting, python serial communication, and much more.
The code project can be found on git hub:
https://github.com/agleason6/ADIS16364_example.git
From there you can download a .zip file, or clone the repository, or you can download the stable version from this FAQ page. Note that if you download the .zip file from github, you will have to change the name of the directory to just "ADIS16364_example"; github adds extra text to the directory name.
What you'll need
- Arduino Uno or Arduino Mega 2560
- ADIS16364 with breakout board
- Jumper wires
- Arduino IDE
- Python with modules below, I tested this on Python 2.7
- pySerial python module, see http://pyserial.sourceforge.net/
- NumPy python module, see http://numpy.scipy.org/
- SciPy python module, see http://www.scipy.org/
- matplotlib python module, see http://matplotlib.sourceforge.net/
Connections
Using jumper wires, make connections from the ADIS16364 breakout board to the Arduino
as shown below:
Arduino Uno Connections:
CS (J1-3) - to digital pin 10 (SS)
SCLK (J1-2) - to digital pin 13 (SCK)
DOUT (J1-4) - to digital pin 12 (MISO)
DIN (J1-6) - to digital pin 11 (MOSI)
VCC (J1-12) - to 5V
GND (J1-9) - to GND
Arduino Mega 2560 Connections:
CS (J1-3) - to digital pin 53 (SS)
SCLK (J1-2) - to digital pin 52 (SCK)
DOUT (J1-4) - to digital pin 50 (MISO)
DIN (J1-6) - to digital pin 51 (MOSI)
VCC (J1-12) - to 5V
GND (J1-9) - to GND
See ADIS16364 datasheet Rev D, Figure 18, pg 17 for illustration of J1 and J2 connectors
https://www.analog.com/static/imported-files/data_sheets/ADIS16364.pdf
How to use
Once you've installed everything above, and made all the proper connections, it's time to
program the Arduino. First open up the ADIS164364.ino file with the Arduino IDE.
Press verify, and upload (after which you have properly setup the IDE with serial port, and device).
Now close the IDE, because you may have issues with the python plotting if you have both
programs trying to access the same serial port.
Plotting data with Python
usage: plot_data.py [-h] -p PORT -r RATE [-b] [-n NUM] [-s]
optional arguments:
-h, --help show this help message and exit
-p PORT, --port PORT Serial port, ie /dev/ttyACMX on Linux, or COMX on Windows
-r RATE, --rate RATE Baud rate
-b, --bar Show Bargraphs Instead of line plots
-n NUM, --num NUM Window width, default is 100 points
-s, --smooth Make lines look smoother
To run on Windows (COMX being the COM port that your Arduino is connected to):
python plot_data.py -p COMX -r 9600
To run on Linux:
python plot_data.py -p /dev/ttyACMX -r 9600
if you don't have udev setup for your Arduino, and you get permission issues, try running it as root:
sudo python plot_data.py -p /dev/ttyACMX -r 9600
Note: plot_data.py samples data as fast as python can plot, so it will run significantly slower than what the part is capable of. Please do not use this script to gauge the performance of the part. If you want to analyze performance, please checkout ADISUSB.
https://www.analog.com/en/mems-sensors/mems-inertial-sensors/adis16364/products/ADISUSB/eb.html
Enjoy,
agleason