Upload to multiple Arduino

Is there a way to upload a sketch to more than one arduino on a breadboard at the same time like the method here http://arduino.cc/en/Tutorial/ArduinoToBreadboard

No.
This is because the arduino is writing to its flash memory. The write time for this is not the same on all arduinos, nor the same thorough the arduino's life time. As the arduino has to signal back to the PC to get the next bytes to load you would have to multiplex all the arduino's serial responses to see when they were all ready.
Not impossible but definitely not worth doing.

what if you plug a bunch of USB to the computer with different COM. Is there a way to upload one sketch do different COM connections at a time

Only if you write it yourself.

baligena:
what if you plug a bunch of USB to the computer with different COM. Is there a way to upload one sketch do different COM connections at a time

in bash (or sh) you'd just do this (tested and uploads correctly to an uno and a duemilanove at the same time):

#!/bin/sh

FILE_TO_UPLOAD="$1"

ARDUINO_DIR="/home/adam/arduino-unstable"

for CUR_PORT in $(find /dev/ttyACM*)
do
    echo "$CUR_PORT"
    "$ARDUINO_DIR"/hardware/tools/avrdude -C"$ARDUINO_DIR"/hardware/tools/avrdude.conf -q -q -q -q -patmega328p -carduino -P/"$CUR_PORT" -b115200 -D -Uflash:w:"$FILE_TO_UPLOAD":i &
done

for CUR_PORT in $(find /dev/ttyUSB*)
do
    echo "$CUR_PORT"
    "$ARDUINO_DIR"/hardware/tools/avrdude -C"$ARDUINO_DIR"/hardware/tools/avrdude.conf -q -q -q -q -patmega328p -carduino -P"$CUR_PORT" -b57600 -D -Uflash:w:"$FILE_TO_UPLOAD":i &
done

just call the program with the argument being the name of the .hex file to upload.

And sparkfun did a series on it: Ganged Programming with AVR ISP MKIIs - SparkFun Electronics

EDIT: I just tested the script with a bigger file to upload, and it doesn't work as well (ie fails). It seems like avrdude isn't reentrant. But there's not that big of an advantage to getting it parallelized, so if you just remove the & it works great.

Hi, this is an old thread but hope someone's stil reading. I'm trying to efficiently upload to a large number of Arduino Mini 328's using a USB hub and multiple FTDI cables. I adapted the above solution. My ports are listed correctly but I get the dreaded stk500 errors (I'm trying to upload to 2 boards in this test):

dtrMBP:~ dtr$ sudo bash  /Users/dtr/Sync/130407\ Lampyridae/code/_uploader.sh /var/folders/f8/r94b4krn73l43xj2z_xh11z40000gn/T/build4006946049764176321.tmp/Blink.cpp.hex
/dev/tty.usbserial-A400C24Z
avrdude: stk500_recv(): programmer is not responding
/dev/tty.usbserial-FTF3M94C
avrdude: stk500_getsync(): not in sync: resp=0x1c
dtrMBP:~ dtr$

My script:

#!/bin/bash

FILE_TO_UPLOAD="$1"

ARDUINO_DIR="/Applications/Arduino"

for CUR_PORT in $(find /dev/tty.usbserial*)
do
    echo "$CUR_PORT"
    /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -q -q -q -q -patmega328p -carduino -P"$CUR_PORT" -b57600 -D -Uflash:w:"$FILE_TO_UPLOAD":i 
done

Any ideas? Need different settings for the Mini's perhaps?
I'm using Arduino 1.0.5 on OSX 10.7.5

Thanks D.

Nevermind, this works:

#!/bin/bash

FILE_TO_UPLOAD="$1"

ARDUINO_DIR="/Applications/Arduino"

for CUR_PORT in $(find /dev/tty.usbserial*)
do
    echo "$CUR_PORT"
    /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P"$CUR_PORT" -b115200 -D -V -Uflash:w:"$FILE_TO_UPLOAD":i 
done

I've had to move to a Windows laptop so my bash script won't work anymore. Does anyone have a Windows cmd script for this? Or some pointers in the right direction?

If anyone 's still interested, this works as a Windows cmd script. ports2.txt contains a list of COM ports to try uploading too:

COM4
COM5
COM6

I haven't worked out how to make the script check for the ports automatically yet.

@echo off
SET FILE_TO_UPLOAD=%1

SET ARDUINO_DIR="C:\Program Files (x86)\arduino"

@echo off
for /f "tokens=*" %%a in (ports2.txt) do (
echo Com Port for Arduino device is detected as %comport%.
echo --------------------------------------- & echo Uploading to: %%a & "C:\Program Files (x86)\arduino\hardware\tools\avr\bin\avrdude.exe" -C "C:\Program Files (x86)\arduino\hardware\tools\avr\etc\avrdude.conf" -p atmega328p -c arduino -P %%a -b 115200 -D -V -U flash:w:%FILE_TO_UPLOAD%:i
)
pause