If your project runs out of resources, be it IO, RAM or flash when using the ATmega328 found in the standard Arduinos you might think of upgrading to the very well endowed ATmega2560P as used in the Arduino Mega but as maniacbug points out there is another option that might make more sense in a lot of situations, the ATmega1284P. Compared to the 328P the 1284P has 9 more digital IO pins, 2 more analogue pins, an extra interrupt, an extra UART and 3K more EPROM but where it really shines is the 128K flash (compared to 32K on the 328P) and a huge 16K of RAM, dwarfing the 2K on the 328P and even beating the 2560P with its 8K. It isn’t hugely more expensive than a 328P either and quite a bit cheaper than a 2560P.
I’d had this in the back of my mind since maniacbug’s post, especially when I hit RAM issues when building my Nanode based web based infrared remote control but I needed ethernet for that and although I considered using a spare W5100 ethernet shield I’ve got I never got round to it. Recently however the new Wiznet WIZ820io SPI ethernet module (W5200 based) kept cropping up and after seeing @andrewdlindsay and @stuartpoulton mentioning their work on a 1284P based board using the WIZ820io I had to have a play. They aren’t the easiest things to get hold of in the UK yet but I was lucky enough to find someone selling a few on eBay for £19.95 posted so snapped one up.
Getting it all running is very easy.
First off, grab maniacbug’s mighty-1284p core for the Arduino and unzip it into a directory named hardware in your sketchbook location, eg. ~/sketchbook/hardware/mighty-1284p/
Start the Arduino IDE and you will find some new entries under the Tools > Board menu. The one we are interested in is “Mighty 1284p 16MHz using Optiboot”
The next thing we need to do is get a bootloader onto the 1284P, I used an Arduino as an ISP programmer for this as I do with the ATtiny, just connect it up as below:
You will also need a 16MHz crystal across pins 12 and 13 with a 22pF ceramic capacitor from each of those to ground.
Load the ArduinoISP sketch (the example one supplied with Arduino 1.0.1 now seems to work OK) onto your Arduino then go to the Tools > Board menu and set the board as “Mighty 1284p 16MHz using Optiboot” then use Tools > Burn Bootloader to burn the bootloader to the 1284P.
You can disconnect the Arduino now but leave the crystal and caps connected.
Now we need an FTDI connector for uploading sketches to the chip, connect a 6 pin header as follows:
|DTR||Pin 9 via 0.1uF capacitor
& a 10K pull up between
the capacitor and pin 9
|VCC||Pin 10 & Pin 30|
|GND||Pin 11 & Pin 31|
Also stick a 0.1uF capacitor across VCC and GND. If any of that isn’t clear you can also refer to maniacbug’s schematic. I note he has the FTDI CTS pin tied to ground as well but I’ve never found that necessary with either of my FTDI leads and have always left it unconnected.
Connect an FTDI lead/adapter and you can now upload a sketch in the normal manner. Note the pin mappings for the IO pins is shown on maniacbugs blog post.
You might notice in my picture something different on the FTDI connection, I’m actually using a little board I made for one of my previous projects, it has a 3V3 regulator and smoothing caps plus the capacitor and pull up resistor required for the reset line. I only used it because it was handy and because I need 3v3 for the WIZ820io anyway. If you wanted to make one it is the small board in the left of this stripboard layout (note the pins change order on the output), it’s proved useful for quick prototyping a number of times.
The WIZ820io SPI ethernet module
This is where we need 3V3, the WIZ820io module does have 5V tolerant IO but it needs to be powered from 3.3V so you will need either a 3V3 FTDI lead, some sort of regulator setup like I have used or use a regulator to power the 820io module.
Other than that it’s very easy, connect up as follows:
You can use the standard Arduino ethernet library by swapping a couple of files but this sounds messy to me, better to use this modified version. That’s it, I said it was easy!