Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

This page is under construction for a new project called ThruLoad.

ThruLoad

Using an Arduino to load sketches into an ATmega chip on a breadboard.

This tutorial explains how to use an standard Arduino board (the Gateway) to upload sketches to an ATmega 168/328 chip inserted into a breadboard without having to remove the ATmega from your Gateway Arduino board.

There's the easy way for Arduino UNO Gateways or the more complicated way for everyone. Both methods require the same connections between the Gateway Arduino and the breadboard. You may leave the bootloader ISP leads connected whilst downloading sketches to the breadboard, this enables you to burn the bootloader and then download a sketch by just changing the sketch in the Gateway Arduino.

  • Insert a Fritzing wiring diagram here *****

The easy way

Firstly, ensure that you are able to successfully follow the instructions to burn an "Arduino Duemilanove w/ ATmega328" bootloader into the ATmega on the breadboard. I have successfully used both the resistor and capacitor methods to prevent the UNO download auto-resets.

Secondly, load the following sketch into your UNO Gateway Arduino - ensure that you remove the anti-reset capacitor or resistor before downloading.

/*
** ThruLoad :- pass program download data through a standard Arduino
** onto another AVR chip running a standard bootloader.
**
** Arduino UNO requires the ISP resistor or capacitor fix to ignore
** download resets.
**
** pin 8 is RX
** pin 9 is TX
** pin 10 is remote reset
**
** Version 1.00 16/05/2012 Alex Goodyear.
*/


#define THRU_BAUD     57600
#define REMOTE_RESET  10
#define STK_GET_SYNC  0x30  // '0'

#include <AltSoftSerial.h>

AltSoftSerial altSerial;

enum {IN_RESET = 0, RUNNING};

static int mode = IN_RESET;

void setup (void)
{
  /*
  ** Initialise the comms.
  */

  Serial.begin (THRU_BAUD);
// Need to insert rest of the code here
Thirdly, re-insert the anti-reset capacitor or resistor into the Gateway Arduino and then select (or write) the sketch you want to download to the breadboard. Select "Arduino Duemilanove w/ ATmega328" from the "Tools->Boards" pull-down menu and then press the "upload" button in the Arduino development environment. When all the UNO LEDs have finished flickering and the environment has displayed the message "Done uploading" the breadboard Arduino will be executing your sketch. If the breadboard sketch uses the standard serial communication mechanism then you can use the "Tools->Serial Monitor" to communicate with your sketch - remember to set the Serial Monitor baud rate to 57600.

Here's a simple sketch to convert upper to lower case and vice versa.

/*
** upDown :- read text from the serial port and convert all
** lower case characters to upper case and vice versa.
**
** Version 1.00 16/05/2012 Alex Goodyear.
*/


#define THRU_BAUD     57600

void setup (void)
{
  /*
  ** Initialise the comms.
  */

  Serial.begin (THRU_BAUD);
// Need to insert rest of the code here

The more complicated way

Determine the type of Gateway Arduino you're using, this will be the arduino you usually select from the development environment "Tools->Boards" pull-down menu when you upload a new sketch. Find the description for this board in the hardware/arduino/boards.txt file within the directory structure where you installed the Arduino development environment. Find the upload.speed for your Gateway Arduino, now look for another board definition similar to your Gateway (all the build.mcu, f_cpu, core and variant fields are the same) but with a lower upload.speed.