The AVRPi-32U4 is an Atmel ATmega32U4 add on board for the Raspberry Pi A+, B+ and 2B. It runs on 3.3V at 8 MHz.
The ATmega32U4 is programmable as a USB device. This is useful if you want a USB HID device that can be controlled by the Raspberry Pi or yourself such as a keyboard, joystick, mouse, midi, audio or virtual serial device.
All software is easy installable navigating a simple menu. Choose 'install everything in 1 easy step', and 'burn fuses for your board'. That's all it takes to get you started.
The ATmega32U4 can be programmed in the Arduino IDE, but also using the Arduino library and a Makefile, or straight C or assembly. All software that is used on the Pi and the ATmega32U4 is open source with the source code provided.
Using the LUFA library is recommended for the AVRPi32u4, but the Arduino library works great as well. Either in the IDE or using Arduino-Makefile in your favourite text-editor.
AVRPi boards use the latest avrdude-6.1 with the built-in linuxgpio interface.
To use the AVRPi-32u4 board standalone, upload the Caterina or DFU bootloader and connect a PC or laptop with a USB cable to program the chip.
The repository with all installation scripts is here: https://github.com/onandoffables/avrpi-tools.
cd git clone https://github.com/onandoffables/avrpi-tools cd avrpi-tools ./setup
- Option 'e' installs everything in 1 easy step.
- Don't forget to set the fuses the first time! (option 'f')
Frequently asked questions
So... this is an Arduino?
No. It's an ATmega328p and ATmega32U4 addon/breakout board. That's the same chip as used on the Arduino Uno or Leonardo so it's perfectly capable of running firmware that's compiled against the Arduino libraries. All boards that have these chips can do this. The AVRPi boards are no exception.
But I can use the Arduino IDE?
Yes. If you really must. It works out of the box, but there's a saying "friends don't let friends use the Arduino IDE". People say that for a reason.
The Arduino library itself is pretty useful though. Try the 'Arduino Makefile' project. It uses the same Arduino source code to compile the libraries, but you can use your favorite text editor and a very simple Makefile. Type 'make ispload' to compile and upload your firmware.
Why not run it full speed on 5V?
Most modern sensors and chips you'll want to attach to the ATmega328 or ATmega32U4 are probably 3.3V. Having everything (including the GPIO pins of the Pi) run on 3.3V will save you a lot of headaches. Some older sensors and chips that still want 5V are sometimes also happy enough with 3.3V. If they don't, you'll only have a headache in those specific situations in stead of having voltage level conversion going on most of the time.
The 'slower' speed is a trade-off for convenience or precision. If you want speed and precision, have look at the ARMinARM board on this website.
I can choose other boards in the software. What's up with that?
All boards for the Raspberry Pi that use Gordon Henderson's 'gpio' avrdude-5.10, can use avrdude-6.1 with the 'linuxgpio' programmer. They use the same pins, so it was trivial to add them to Arduino's 'boards.txt' file.
That means if you have a Gertboard, Gertduino[*], RasPiO duino or you soldered something up yourself you can also use this software setup. Yay for choice!
[*] Gertduino needs extra scripts to handle the reset pin.
What are the advantages ATmega32U4 over ATmega328p?
The ATmega32U4 can act as a USB device. This is useful if you want a USB HID device that can be controlled by the Raspberry Pi or yourself such as a keyboard, joystick, mouse, midi, audio or virtual serial device. That means you can interface USB host devices with your Raspberry Pi. Or if you're just building an arcade cabinet with a Raspberry Pi, that you can also connect to your game PC and only use the buttons and joystick.
The 32U4 doesn't share I2C and SPI with 'standard' Arduino pins like the 328 does. You can use Arduino digital pins 0-13 and analog pins A0-A5 without your I2C or SPI (and programming) interface messing things up.
The Arduino library adds a USB CDC device to every sketch. The 'Serial' class now uses this new USB serial port. Connect to it on '/dev/ttyACM0' (with a USB cable to either the Raspberry Pi or a laptop / PC). If you want to use the Raspberry Pi serial pins as on the ATmega328p and connect to '/dev/ttyAMA0', then use the 'Serial1' class. You can also use both of course.
To use the AVRPi-32u4 board standalone, you can upload the 'Caterina' or 'Atmel DFU' bootloader from the setup menu and use any PC or laptop to program the chip.