Arduino Remote Uploader

Andrew Rapp
Mar 22, 2015 · 11 min read

How it works

Wiring

pin 1 (A0)            -> GND
pin 2 (A1) -> GND
pin 3 (A2) -> GND
pin 4 (Vss) -> GND
pin 5 (SDA) -> Arduino SDA
pin 6 (SCL) -> Arduino SCL
pin 7 (Write Protect) -> Unconnected
pin 8 (Vcc) -> Arduino 5V (or 3.3V if 8Mhz)
Programmer Arduino pin 9 -> Reset pin on application Arduino

Setup


XBee (Series 2)

AP=2
ID=1AAA (PAN ID. choose any, just needs to be the same on both)
NI=ROUTER (optional)
AP=2
ID=1AAA (PAN ID. choose any, just needs to be the same on both)
NI=COORDINATOR (optional)
//SH
const uint32_t COORD_MSB_ADDRESS = 0x0013a200;
//SL
const uint32_t COORD_LSB_ADDRESS = 0x408b98fe;
remoteUploader.setup(&Serial, &eeprom, RESET_PIN);
./xbee-uploader.sh --sketch /var/folders/g1/vflh_srj3gb8zvpx_r5b9phw0000gn/T/build1609364047445626536.tmp/Blink.cpp.hex --serial-port /dev/tty.usbserial-A6005uRz --baud-rate 9600 --remote-xbee-address “0013A200408B98FF”
Sending sketch to xbee radio, size 1102 bytes, md5 8e7a58576bdc732d3f9708dab9aea5b9, number of packets 18, and 64 bytes per packet, header ef,ac,10,a,4,4e,0,12,40,3c
………………
Successfully flashed remote Arduino in 6s, with 0 retries
./xbee-uploader.sh --help-a,--arduino-timeout <arg> How long Arduino waits for a command before it exits programming mode (in seconds). Default is 60. Note: This is not the time that programming must complete in, only the max time between commands
-b,—-baud-rate <arg> Baud rate of local xbee (host) radio serial port. Required
-c,--ack-timeout-ms <arg> How long to wait for ACK from Arduino before retrying (in milliseconds). Default is 5000
-d,--verbose Show debug output
-h,--help Show help
-p,--serial-port <arg> Serial port of of local xbee (host radio) (e.g. /dev/tty.usbserial-A6005uRz). Required
-r,--retries <arg> How many times a command is retried before giving up. Default is 10
-s,--sketch Path to compiled sketch (compiled by Arduino IDE). Required
-x,--remote-xbee-address <arg> Address (64-bit) of remote XBee radio (e.g. 0013A21240AB9856)

Nordic nRF24L01+

#define NORDIC_CE 10
#define NORDIC_CS 11
uint64_t baseAddress = 0xca05cade05LL;
const uint64_t pipes[2] = { baseAddress, baseAddress + 1 };
./nordic-uploader.sh --sketch /var/folders/g1/vflh_srj3gb8zvpx_r5b9phw0000gn/T/build1609364047445626536.tmp/Blink.cpp.hex --serial-port /dev/tty.usbmodemfa131 --baud-rate 19200Sending sketch to nRF24L01 radio, size 1102 bytes, md5 8e7a58576bdc732d3f9708dab9aea5b9, number of packets 43, and 26 bytes per packet, header ef,ac,10,a,4,4e,0,2b,1a,3c
…………………………………….
Successfully flashed remote Arduino in 3s, with 0 retries
./nordic-uploader.sh --help

Wifi (ESP8266)

if (esp8266.configure(“ssid”,”password”) != SUCCESS) {
if (COMMUNICATION_TEST) {
Serial.println(“Configure failed”);
}

for (;;) {}
}
192.168.1.115 18:FE:34:9B:A7:4C
./wifi-uploader.sh -d — host 192.168.1.115 — port 1111 -s /var/folders/g1/vflh_srj3gb8zvpx_r5b9phw0000gn/T/build3190504561153569118.tmp/Blink.cpp.hexSending sketch to wifi radio, size 1126 bytes, md5 c571f5e98456711d6b61d1a846dfe7a1, number of packets 44, and 26 bytes per packet, header ef,ac,10,a,4,66,0,2c,1a,3c
Sending page 1 of 44, with address 0, length 32, packet ef,ac,20,20,0,0,c,94,61,0,c,94,7e,0,c,94,7e,0,c,94,7e,0,c,94,7e,0,c,94,7e,0,c,94
...
Sending flash packet ef,ac,40,6,4,66
Successfully flashed remote Arduino in 8s, with 0 retries

Fault Tolerance

Sending sketch to xbee radio, size 1102 bytes, md5 8e7a58576bdc732d3f9708dab9aea5b9, number of packets 18, and 64 bytes per packet, header ef,ac,10,a,4,4e,0,12,40,0
…….
Failed to deliver packet [page 7 of 18] on attempt 1, reason No ACK from transport device after 5000ms.. retrying
..
Failed to deliver packet [page 8 of 18] on attempt 1, reason No ACK from transport device after 5000ms.. retrying

Failed to deliver packet [page 10 of 18] on attempt 1, reason No ACK from transport device after 5000ms.. retrying
……
Failed to deliver packet [page 15 of 18] on attempt 1, reason No ACK from transport device after 5000ms.. retrying
….
Failed to deliver packet [page 18 of 18] on attempt 1, reason No ACK from transport device after 5000ms.. retrying
.
Successfully flashed remote Arduino in 33s, with 5 retries

Troubleshooting

Parts

What’s Next

Andrew Rapp

Written by

mtn rider, software developer, diy electronic'er and that ilk

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade