Back to photostream

Raspberry Pi + Arduino (3.3V, 8MHz) just 5 wires 20140105-DSC_6810

I probably didn't need the Adafruit protoboard for this phase, but the plan is to move the ATMega328p chip right onto the protoboard.

 

Running at 3.3V and 8MHz means you don't need a level converter for the Pi and you don't need an external clock chip. You can still use most/all of your favorite libraries. Basically you're wiring the chip right to the pi with not much else (a reset button? some leds?).

 

And I even got the auto-reset to work by messing with the GPIO pins!

 

First I had to burn the ATMega328p chip with a bootloader. Turns out that this is easy to do *IF* you mess with "boards.txt". I duplicated the section for "Arduino Pro or Pro Mini (3.3V, 8MHz)" and changed one line:

atmega328.bootloader.low_fuses=0xE2

(see forum.arduino.cc/index.php/topic,80126.0.html)

Oh, and of course you can't leave the duplicate board.xxxxxx so I added "int" for each. This lets you use the internal oscillator instead of needing an external one.

 

The trick here, is to use a 16MHz oscillator (or resonator) and burn the boot loader at 5V. [I used an ATtinyUSB but you can actually use another Arduino as a programmer.] The chip can handle it. Then you remove the oscillator/resonator and wire it up for 3.3V.

 

Then I had to setup the pi's serial port. By default this is hogged by Linux. You can read the instructions here:

elinux.org/RPi_Serial_Connection

 

I added one step at the end:

sudo ln -s /dev/ttyAMA0 /dev/ttyS0

 

This is because the Arduino software doesn't recognize the pi's serial port.

 

Then you do a "sudo apt-get install arduino -y" and go get a cup of coffee (or a whole lunch) while it installs jre.

 

The most challenging bit, though, was getting the auto-reset working. This means changing one of the pins to its "ATL3" setting. [!!!]

these are all the pins and settings

Eventually I figured out that the code here:

github.com/rewolff/bw_rpi_tools/tree/master/gpio

in the folder gpio_list actually changes its behavior depending on what you name the file!

 

So I renamed the binary to gpio_setfunc and then

sudo ./gpio_setfunc 17 ALT3

[I think I have to do this every time I (re)boot. I'll probably make a startup script.]

 

You'll note that I wired 3.3V and GND to the ATMega328p, and (pi)RXD-TXD(arduino) and vice versa. AND I wired (pi)GPIO17 through a 104cap to RESET(arduino)!

 

And it worked!!!

1,503 views
0 faves
0 comments
Uploaded on January 6, 2014
Taken on January 5, 2014