User Tools

Site Tools


DIY Arduino

It's not that hard to make your own Arduino. In what follows, I am assuming you want to make a barebones standalone microcontroller that runs Arduino sketches.

This is mostly a core dump of something in process.

Setting up for programming

When you buy a premade Arduino, the microcontroller comes preprogrammed with a bootloader. Most premade Arduinos also have USB circuitry on them that lets you upload sketches via USB from a host computer.1) When making your own standalone Arduinos, you are going to need a way to to burn the bootloader onto the virgin microcontroller, and you'll need a way to upload sketches to the Arduino after you've burned the bootloader. There are a few ways to do these. Here's what appeals to me.

Burning the bootloader

The bootloader is a small program that remains constant on the chip and starts off the process of running the sketches that you upload later. You'll only need to burn the bootloader once to the Atmega chip.

You can use an Arduino board to burn the bootloader onto new chips.2) Since you'll only do this once per device, this setup might not be too inconvenient. Making a shield with a ZIF socket would simplify things greatly and reduce the chances for errors.

You can get cards/adapters that you can use instead of an Arduino3), but I think an Uno, possibly with a custom shield, makes a lot of sense in general–particularly since this method is supported by Arduino itself. The other methods might make more sense if you are using an SMD microcontroller and/or want to burn the bootloader while the microcontroller is in circuit.

Nonstandard Arduinos

Depending on what kind of AVR you want to use and what features you are using (internal vs. external clock, for example) you may need to provide your IDE with additional board.txt files and other configuration information. This process consists of dropping extra description files into ../<your-sketches-folder>/hardware. Two common examples are:

Uploading sketches

One way to to upload sketches to the standalone Arduino is to use a spare Arduino board. The idea is that you remove the microcontroller from the spare Arduino board, then connect TX, RX, and Reset from the board to your circuit.4) This setup takes a perfectly good Arduino out of commission for the duration of your development, seems prone to error, and because you're likely to do it a lot seems prone to getting really old!

I think a better approach is to buy an inexpensive USB to serial cable/adapter. Apparently, it can't be just any old serial to USB adapter; the Arduino needs to be reset by the host when new sketches are uploaded, and it appears the serial DTR pin is used for this.5) So, make sure the board you buy has a DTR output.

The classic chip for USB to serial conversion is the FTDI FT232RL6). I believe these were used in earlier Arduinos. Recent Unos use an ATmega16U2-MU with custom software. Note that the FTDI FT232RL requires custom drivers on Windows—ones that may brick the unit if the driver thinks the chip is a fake! There are some low cost alternatives to the FT232RL that promise to work as well and may have better driver support (depending on your platform).

Some options for USB to serial adapters appear to include:

The CH340 in particular seems to be taking off with Arduino clone makers—possibly because it's both cheap and has no dramatic driver issues on Windows. However, sourcing the proper CH340 drivers seems to be a bit muddled and not exactly confidence inspiring.

IC I/O Linux driver Windows driver MacOS driver
FT232RL Selectable 3.3V or 5V Buit-in or FTDI FTDI FTDI
CP2102 3.3V; 5V tolerant and TTL capable Built-in or Silicon Labs Silicon Labs Silicon Labs
CH340 ? Built-in Microsoft Update?7) Available but broken in Yosemite8)

Make sure the I/O levels of the adapter are compatible with the microcontroller you are programming. FIXME Are Atmega programming inputs TTL capable? If not, will they work with the 3.3V CP2102 outputs when working at 5V? If your adapter card has 5V or 3.3V outputs available, you can use that to power your 5V or 3.3V microcontroller if needed.

Connect the data pins as follows:

Adapter board DIY Arduino's processor
Ground Ground
DTR Reset, through a 100nF capacitor*

*The 100nF capacitor takes the adapter's DTR output and converts it into a pulse. The reset pin on the microcontroller should also have a 10K pullup resistor on it. The Arduino Pro Mini has both these already in place, so you can connect the adapter's DTR to the Pro Mini's DTR header pin directly.

As far as I know, you can use the Arduino IDE to upload sketches as normal with this setup.

This video is instructive:

KiCad subcircuit

For (temporary?) safe keeping, here's a hierarchical Arduino Uno subcircuit for incorporating a DIY-Arduino in a PCB design. It requires some of my KiCad libraries.

Some references


arduino/diy_ardunio/start.txt · Last modified: 2016/08/28 18:33 by mithat