This is far from a complete step-by-step instruction. It's more intended as a guideline to point you in the right direction:

You will need:

  1. An old Ethernet router the cheaper the better. It needs to have
    1. A USB port (or, in my case, some pads you can solder a USB port to.
    2. To be able to run OpenWRT and have a bit of flash left to install some more software
  2. A USB AVR programmer:
    1. USBASP
    2. A "true" in system programmer (davedarko)
    3. Arduino Nano ISP (Devin McElheran)
    4. ATtiny45 USBtinyISP (Stefan Wagner)
    5. ATtiny programmer using Arduino ISP
    6. ... etc.

What to do:

This all depends on what router you have chosen. Your mileage WILL vary.

  1. Get OpenWRT installed on your old router
  2. Get it's USB port working
  3. Hook it up to your lab network
  4. Install avrdude - the version of OpenWRT that I used just had a pre-compiled avrdude in it repository, which was very handy... I'm not sure if this will be the case for you.


I initially thought it might be cool to use some kind of specific server software on the router but it would still require something to talk to it on the client side. In the end it seemed simpler to just do everything with SSH and have all the detail in the client side script:


# usage: avrnude m324p plop.hex

# My router had some spare LEDs that I had de-configured in the OpenWRT
# Control panel
# This lights the green "internet" LED
command='echo 1 > /sys/class/leds/F@ST2704N\:green\:inet/brightness ; '

# Save the incoming hex file in the temporary directory (RAM idsk)
command+='cat - > /tmp/avrnude.hex ; '

# Now make the "internet" LED go red
command+='echo 1 > /sys/class/leds/F@ST2704N\:red\:inet/brightness ; '
command+='echo 0 > /sys/class/leds/F@ST2704N\:green\:inet/brightness ; '

# Program the hex file using a USBASP
command+="avrdude -c usbasp-clone -p $1 -U flash:w:/tmp/avrnude.hex ; "

# Switch the "internet" LED off
command+='echo 0 > /sys/class/leds/F@ST2704N\:red\:inet/brightness ; '

# cat the hex file from the client device to the remote device via ssh
# and give it the previously constructed wad of commands to execute
cat $2 | ssh root@avrnude $command

Version 2 (work in progress)

Version 2 has homemade programmers for AVR and PIC32 both build around ATMega328p chips and CP2102 USB serial bridges. The software will need to know which CP2102 is connected to which device. So I've used cp210x-cfg to give each a unique "serial number" and set up the following udev rules:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="stk500v1", KERNEL=="ttyUSB*", SYMLINK+="stk500v1"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="pic32prog", KERNEL=="ttyUSB*", SYMLINK+="pic32prog"

The AVR programmer uses the Arduino ISP sketch and the PIC32 uses pic32prog and Pinguino's Cheap DIY PIC32 Programmer.  My chosen old ethernet router can't handle powering either of these programmers let alone both. So instead of adding a simple USB socket to it's USB pads, I've had to use a powered hub.