User Tools

Site Tools


arduino:diy_ardunio:start

This is an old revision of the document!


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. Your premade Arduino also has USB circuitry on it that lets you upload sketches via USB from a host computer. When making your own standalone Arduinos, you are going to need a way to to burn the bootloader onto the virgin microcontrollers, and you'll need a way to upload sketches to the Arduino via USB. There are a few ways to do both 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.1) 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 Arduino2), but I think an Uno, possibly with a custom shield, will work just fine for my needs–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

You can use a spare Arduino board to upload sketches to the standalone Arduino. 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.3) This setup seems prone to error, and because you're likely to be using it a lot it looks like it's 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. So, make sure the board you buy has a DTR output.

The classic chip for USB to serial conversion is the FTDI FT232RL4). 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. Sourcing the proper drivers seems to be a bit muddled though.

TODO: A table with driver requirements for Windows, MacOS, and Linux.

Make sure the voltage level of the adapter matches the voltage the microprocessor is running on. Then connect things up as follows:

Adapter board DIY Arduino's processor
Ground Ground
TXD RXI
RXD TXO
DTR Reset
V+ V+ (optional depending on how things are powered)

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

This video is instructive.

Some references

Videos

Lots more

1)
See “Burning the Bootloader” in From Arduino to a Microcontroller on a Breadboard.
2)
See “Bootloading your chips OPTIONAL” in Building an Arduino on a Breadboard
3)
See “Uploading Using an Arduino Board” in From Arduino to a Microcontroller on a Breadboard.
4)
Beware of counterfeits! See this and this!
arduino/diy_ardunio/start.1426734417.txt.gz · Last modified: 2015/03/19 03:06 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki