High-Volume Arduino Programmer and Tester

I need to program several dozen Atmega168s and I only own ICSP Atmel programmers; what to do? Bodge one up of course. Best of all, the bodged programmer functions as an Arduino test bed.

Starting with an Arduino platform (I used an iDuino but anything should work), pull out the Atmega168 and set it aside.

Now, connect the following pins from the Arduino to a 28-pin ZIF socket:- Reset to pin 1 - RX to pin 2 - TX to pin 3 - +5 to pin 7 - Ground to pin 8 - Digital 13 to pin 17

Connect pins 9 and 10 from the Arduino’s (now empty) socket to pins 9 and 10 of the ZIF socket. These provide the clock signal.

Attach your programmer’s ICSP connector to the Arduino’s ICSP header (using a 10 to 6 adaptor if necessary). Connect the USB cable to your Arduino (with it set to USB power), or the power and serial connector to a serial based Arduino.

Insert a blank Atmega168 in the socket and use your programmer to burn the bootloader; now you may use the Arduino IDE to upload a test sketch. If all goes well, remove the Atmega, rinse, repeat.

I use the following command to burn ADABoot with avrdude (beep is a batch file that beeps the PC speaker).

avrdude -c siprog -p m168 -P \\.\com1 -u -U lock:w:0x3f:m -U efuse:w:0x00:m -U hfuse:w:0xdd:m -U lfuse:w:0xff:m
avrdude -c siprog -p m168 -P \\.\com1 -u -U flash:w:ATmegaBOOT_168_ng.hex:i -U lock:w:0x0f:m
beep

Obviously, with a ZIFDuino, you could avoid all the wiring.

I prefer this to a conventional programmer if only because I can upload a basic sketch to the chip after burning the boot loader. I use a hacked up version of the Fading sketch to pulse LED13

// Fading LED 
// by BARRAGAN <http://people.interaction-ivrea.it/h.barragan> 

int value = 0; 
int rep = 0; 
int ledpin = 13;                           // light connected to digital pin 9
 
void setup() 
{ 
  pinMode(ledpin,OUTPUT);
} 
 
void loop() 
{ 
  for(value = 4 ; value <= 250; value++) // fade in (from min to max) 
  { 
    for(rep=0;rep <= 10;rep++){
    digitalWrite(ledpin, HIGH);           // sets the value (range from 0 to 255) 
    delayMicroseconds(value);                            // waits for 30 milli seconds to see the dimming effect 
    digitalWrite(ledpin, LOW);
    delayMicroseconds((255-value));
    }
  } 
  for(value = 250; value >=4; value--)   // fade out (from max to min) 
  { 
    for(rep=0;rep <= 10;rep++){
    digitalWrite(ledpin, HIGH);           // sets the value (range from 0 to 255) 
    delayMicroseconds(value);                            // waits for 30 milli seconds to see the dimming effect 
    digitalWrite(ledpin, LOW);
    delayMicroseconds(255-value);
    }
   }  
}