Jetson/Tutorials/Communicate To Arduino

< Jetson
Revision as of 18:19, 23 September 2014 by Shervin.emami (talk | contribs) (Added intro title)
Jump to: navigation, search


There are multiple ways an Arduino or any microcontroller can communicate with a Jetson TK1. The easiest & recommended method is to use serial UART communication. It is also possible to use I2C (faster than serial), SPI (faster than I2C), or direct GPIO, but these are slightly more tricky than serial UART communication.

Serial UART communication

User applications that need two-way communication between the Jetson & Arduino can implement it using serial UART. UART on Arduino typically runs at aroud 100kHz (115,200 Hz) but it can actually run at upto 1MHz.

On the Arduino side, communication is implemented with the Serial API.

On the Jetson side, the user would open() /dev/ttyUSB0 and perform read/write calls on the returned descriptor, using termios.h for configuring options like baud rate, etc.

TODO example serial code

I2C communication

To use I2C on Jetson TK1, be aware that the I2C connections on Jetson TK1 are either 1.8V or 3.3V, while some Arduino's & microcontrollers need 5V signals. There is some info about bidirectional voltage tanslation for this on the GPIO Electrical Connections page. There is also an I2C page for Jetson TK1. I2C normally runs at 100kHz, but it can run at 400kHz with a code change. I2C allows the master device to send data to a slave device, or to request data from a slave device (see more info).

SPI communication

SPI is often running at 100kHz, but it can run at 4MHz (or even 8MHz if you use a 16MHz Arduino, since it will be at half the CPU clock rate).

Direct GPIO communication

The GPIO tutorial shows how to send a 5V voltage signal to an Arduino or microcontroller from a Jetson TK1. This can be used if you only need one-way signals or communication from Jetson TK1 to an Arduino, rather than two-way communication. The Arduino or microcontroller can either "poll" for the signal (repeatedly read the value over & over again until it changes), or be configured to automatically trigger an interrupt when the voltage changes between 0 and 5V.