Version: 2.0.0
Release date: 2017 March 31
www.pololu.com
This is an Arduino library that helps establish I2C communication with a Raspberry Pi, with the Arduino acting as the I2C slave. It should work with most Arduino-compatible boards, but we designed it for use with these Pololu products:
These boards are designed to connect conveniently to the Pi's GPIO header. The idea is that the Raspberry Pi can take care of high-level tasks like video processing or network communication, while the AVR microcontroller takes care of actuator control, sensor inputs, and other low-level tasks that the Pi is incapable of.
There are a few reasons we made a library for this instead of just recommending the standard Arduino I2C library, Wire.h:
We have included example Arduino code for the A-Star or Romi and Python code for the Raspberry Pi. Together, the examples set up a web server on the Raspberry Pi that will let you remotely control and monitor a robot from your smartphone or computer.
See this blog post for a complete tutorial including step-by-step build instructions for an example robot.
The included script benchmark.py
times reads and writes of 8 bytes,
to give you an idea of how quickly data can be transferred between the
devices. Because of a limitation in the AVR's I2C module,
we have slowed down reads significantly.
Bus speed | Reads | Writes |
---|---|---|
100 kHz | 21 kbit/s | 53 kbit/s |
400 kHz | 43 kbit/s | 140 kbit/s |