Build instructions from a Raspberry Pi - AudioMorphology/waft GitHub Wiki

I found it convenient to develop the Arduino code using the ArduinoIDE installed on a Raspberry Pi, and to upload the resulting .hex file to the Arduino using AVRDude.

In order to do this, you will need to connect the following pins from the Pi to the Arduino programming header:

Pi Pin     Arduino
21         1
23         3
19         4
7          5
GND        6

Note the position of Pin 1 in the following footprint image from the Waft PCB and note that Pin 2 is opposite Pin 1:

Arduino nano Footprint

So the pin numbers look something like this, with the edge of the board downwards:

 246
 135
-----

Install PuTTY client

Waft sends informational and debug messages out over a serial connection, which is available on the single-pin header J2.

In order to monitor these, you'll need to install a terminal Emulator on the Pi.

sudo apt-get install putty

PuTTY should then be available under the Internet menu on the Pi. You need to configure PuTTY to listen to serial comms at 9600 Baud on device /dev/ttyS0

Note that you may need to run raspi-config and, in the Interfacing Options -> Serial section disable the login shell, but enable the serial comms hardware.

Install AVR Dude

The following instructions came from a tutorial on Ozzmaker.com:

http://ozzmaker.com/program-avr-using-raspberry-pi-gpio/

To program the ATmega328P microcontroller for the Waft, you first need to install AVRDude as follows:

Prerequisites

pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo apt-get install bison flex -y

Install AVRDude from source

pi@raspberrypi ~ $ wget http://download.savannah.gnu.org/releases/avrdude/avrdude-6.2.tar.gz
pi@raspberrypi ~ $ tar xfv avrdude-6.2.tar.gz
pi@raspberrypi ~ $ cd avrdude-6.2/

Enable linuxgpio in the avrdude source, make and then install;

pi@raspberrypi avrdude-6.2/~ $ ./configure --enable-linuxgpio
pi@raspberrypi avrdude-6.2/~ $ make
pi@raspberrypi avrdude-6.2/~ $ sudo make install

Now we need to tell avrdude to use the GPIO and we need to let it know what GPIO pins to use. This can be done by editing the config file:

pi@raspberrypi avrdude-6.2/~ $ sudo nano /usr/local/etc/avrdude.conf

Look for “linuxgpio” and uncomment the following section and add the GPIO Pin numbers:

programmer
  id    = "linuxgpio";
  desc  = "Use the Linux sysfs interface to bitbang GPIO lines";
  type  = "linuxgpio";
  reset = 4;
  sck   = 11;
  mosi  = 10;
  miso  = 9;
;

Next: Install the Arduino IDE