Bricktronics Shield compatibility with Arduino Leonardo: All sensors, but no motors :-(
One of the most important motivations and goals of the recent Bricktronics Software libraries upgrades was to make it much easier to use the Bricktronics hardware and software with other boards besides the Arduino Uno and Arduino Mega 2560. To this end, we’ll be testing out the new libraries with a variety of other boards in the coming weeks, and we’ll post a update for each one. This time we are looking at using the Bricktronics Shield with the Arduino Leonardo, a 5v compatible board very similar to the Arduino Uno, but with a few important differences:
The Leonardo differs from all preceding boards in that the ATmega32u4 has built-in USB communication, eliminating the need for a secondary processor. This allows the Leonardo to appear to a connected computer as a mouse and keyboard, in addition to a virtual (CDC) serial / COM port.
The ability to appear as a computer mouse or keyboard makes for a lot of cool possibilities! Want to make a simple LEGO keyboard? Use the BricktronicsButton library to read a series of touch sensors and type in different keystrokes for each sensor. You could use the mouse capability with the BricktronicsUltrasonic library to make a theremin-like mouse for your computer! (Actually I might have to make that mouse theremin someday, that sounds too cool to miss!)
Image credit: “Arduino Leonardo Front with headers” by Arduino LLC, licensed CC-BY-SA 3.0
Since the Leonardo is Rev3 compatible, put the I2C select switch in the “Rev3” position.
Motors
Unfortunately, while the Leonardo has dedicated Rev3 I2C pins, it also has the I2C signals on the D2 and D3 pins, which are used by both motor 1 and motor 2. This means that the Bricktronics shield cannot use any motors without breaking the I2C communications with the on-board MCP23017 chip. However, it is still possible to use NXT and EV3 motors with the Arduino Leonardo using our new product the Bricktronics Motor Driver, currently in pre-release but available in our store. More details about this new product will be released in the next few weeks, but it lets you drive two NXT/EV3 motors with any 5 volt compatible, real-time microcontroller board.
Sensors
If no motors are plugged in, the I2C communication to the MCP23017 chip work perfectly, meaning that sensors will work just fine. We have tested all currently-supported sensors on the Bricktronics Shield on the Leonardo, and they work great! If you are looking for a sensors-only Bricktronics solution, then the Bricktronics Shield is a fine choice, as well as the Bricktronics Breakout Boards.