AVRPi-328

The AVRPi-328 is an Atmel ATmega328p add on board for the Raspberry Pi A+, B+ and 2B. It runs on 3.3V at 8, 12 or 16 MHz (or any other speed you want of course).

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 ATmega328p 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 ATmega328 is open source with the source code provided.

AVRPi boards use the latest avrdude-6.1 with the built-in linuxgpio interface.

Software

The repository with all installation scripts is here: https://github.com/onandoffables/avrpi-tools.

Basic instructions:

cd
git clone https://github.com/onandoffables/avrpi-tools
cd avrpi-tools
./setup

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.

Why mention the different speeds (8,12,16 MHz)?

The AVRPi-328 kit comes with a crystal with one of these 3 frequencies. Here are some things to take into consideration when choosing which crystal to solder onto your board.

The default fuse setting is to run (without a crystal) off the internal 8MHz oscillater, with ckdiv8 enabled. Without setting the fuses, the AVR will run on 1MHz. You can change that in the setup menu (option 'f: set fuses for your board').