Recently I needed an Adruino Uno for a project I’m working on. I already have an Arduino Mega2560, but the Atmega2560 is a far more costly chip to embed, and my project requires access to multiple timers, which is more easily facilitated by the Uno.
There are a number of Uno clones on ebay for less than $15, but I didn’t want to wait and I had the majority of the parts lying around already. The best part? The whole project (save for a few passives) didn’t cost me a penny.
How? Well, for starters, Atmel is fantastic about giving away samples, and in this case I imposed upon them for an Atmega328P-PU.
Here’s what it looked like when I first got it up and running:
Now, before I go on, I have to say that there are two things I don’t want to hear about: How shitty my camera is, and how Ben-Heck the solder job is on that .1uF capacitor. I scabbed it off an old PSU board and I couldn’t be bothered to clean the old solder off before using it here.
So while that picture looks like a huge goddamn mess (and it is, really); the majority of what’s shown is just to illustrate that it’s a functioning Arduino Uno (a blinking LED is hard to show in a still image).
A keen observer will notice that I’m using a pre-built CP2102 based USB-to-UART interface. I had this module on hand from when I hacked my Hantek DSO, so it doesn’t violate my “free” statement. However, to be honest, it does feel a little bit like I’m cheating, so once the USB-to-UART chip I ordered as a free sample arrives, I’ll post an update using it instead of what I have here.
Now, even with this pre-built interface, things weren’t entirely straight forward. This particular interface required some slight modding, as the Arduino IDE resets via the CP2102’s DTR pin and not the already-broken-out reset pin. This required some really fine solder work (.20mm), which I had to do with a crusty old Hakko clone.
This is what it looks like:
The nasty snotgob of hot glue is just there to keep the wire from getting yanked off. And no, I didn’t cook the board, the brown stuff is just residue from the liquid flux.
Okay, so what about this goddamn Arduino Uno?
First things first, the barebones schematic:
Barebones indeed. As I said, the majority of the stuff in the first picture was just for the LCD and other various playings around; this is all it takes to get the micro up and running. Note that in the above schematic, TXD and RXD are labeled as they connect to the USB-to-UART interface, not to the chip pinout. SCK, MISO, MOSI, and RESET are labelled for convenience when hooking up the DAPA cable, no special provisions need be made.
Once the bare minimum is breadboarded, the next step is making up a DAPA cable for bootloading the chip via AVRDUDE.
I used one of half a dozen old printer cables I had lying around (free) to make mine. Now, you’ll find guides all over the internets using different resistor values, and sometimes no resistors at all. The first schematic I found when I made mine used the above values, and it works for me, so it’s the one I’m reproducing here.
After the cable is made, it’s a simple matter to connect it up to the barebones Arduino Uno. One thing to keep in mind, the DAPA cable does not supply power to the micro, so an external supply is required.
avrdude -P lpt1 -c dapa -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m
avrdude -P lpt1 -c dapa -p m328p -v -e -U flash:w:BootLoader328REV3_firmata.hex -U lock:w:0x0F:m
Those commands were successfully run on my WinXP machine; linux, mac, and other flavors of Win will likely require something other than “lpt1”.
And that’s it. After that, I simply plugged the USB-to-UART interface into my PC’s USB port, started up the Arduino IDE, specified “Arduino Uno” as my board and started uploading code. I repeated this process on two additional chips (Atmel sent me 3 Atmega328P-PUs) and it worked flawlessly every time.