The diagram below shows the pinouts and connections between the Raspberry Pi Zero and the ATMega328p to enable communication, and firmware updates.
A simple method for providing over the air updates is via a github script. Arduino sourcecode will be pulled from github (by a frequent git pull), and then compiled on-board into a .hex file and flashed to the ATMega via the avrdude software.
ARDUINO_DIR = /usr/share/arduino BOARD_TAG = uno ARDUINO_PORT = /dev/ttyAMA0 ARDUINO_LIBS = include /usr/share/arduino/Arduino.mk
make avrdude -p m328p -c gpio -e -U flash:w:build-uno/TempTest.hex
In the first photo below you can see I’ve created a basic Arduino clone on a breadboard, and have connected it to a Raspberry Pi Zero via a breakout cable. Its a bit cumbersome, so I’ll look to build a veroboard version.
You can see in the second picture it the prototype in place in the greenhouse. Its connected to the Raspberry Pi Zero, which is powered by a small solar panel. The Solar panel is connected to a lithium-polymer battery charging circuit (from Adafruit) and then in turn to a Powerboost 500 board that ensures a nice clean 5v supply to the Raspberry Pi Zero. Unfortunately I didn’t check the amount of power required to drive the RPi for more than a couple of hours, so the battery goes flat within 8 hours or so.
Next I constructed a simple circuit board that contains a Arduino clone and Raspberry Pi Zero header connection. You can also see the temperature sensor (TMP36) and light sensor on this circuit.
In this picture you can see I’ve completed the circuit board, with the RPi connected via a header pin strip.
I wanted to make a custom PCB for this, so I designed the circuit below, using a graphics package (Omnigraffle). I had to measure each component before drawing it out. I used Fritzing first, but preferred to do this by hand.
I wasn’t very successful at creating these. I followed the process of printing out a design on Photopaper, ironing this onto a prepared Copper plate, then washing it off with water.