Uploading to Arduino Mega without using USB port

Hello all!

My project uses an Arduino Mega, housed in quite a small space. Unfortunately for me, the Mega is mounted onto some ply board so tightly next to another piece of supporting wood, that the USB port is not accessible (no way I can fit the USB cable in there, once everything is assembled).

Is there a way I can upload new Arduino code without using USB? I've tried reading up on ICSP but it seems very confusing, and I don't have an avrdude programmer? Another thought: could I use the TX and RX pins to upload code? I can obtain a spare Arduino Diecimiela, so could turn this into a programmer somehow?

Best wishes

A.

PS. this whole setup is being mounted into the nose-cone of a wind turbine, so space is at a premium! and unfortuantely for us, we need all the capabilities of the mega. any help would be muchly appreciated :-)

ICSP is your best bet. I use this product and it works great. http://www.ladyada.net/make/usbtinyisp/

Thanks ... is this really the only way, though? I'd rather not buy any more stuff than I have to. I also really like the Arduino IDE and don't want to start with another program.

I would try to de-solder the USB socket, and break it out on a wire to its own PCB, but my soldering iron isn't powerful enough to de-solder the tags, heh.

How do xBee / bluetooth devices manage to reprogram Arduinos wirelessly? Do thy plug into the ICSP? If they just have access to RX and TX, surely I can reprogram my Arduino with a wired connection in a similar fashion?

Other ideas: the Arduino Pro and Pro mini from sparkfun program via 6-pin header cables (I've got one) ... what pins do they link to? Can I use this cable to program the Mega, with the appropriate connections?

Thanks ... is this really the only way, though? I'd rather not buy any more stuff than I have to. I also really like the Arduino IDE and don't want to start with another program.

I would try to de-solder the USB socket, and break it out on a wire to its own PCB, but my soldering iron isn't powerful enough to de-solder the tags, heh.

How do xBee / bluetooth devices manage to reprogram Arduinos wirelessly? Do thy plug into the ICSP? If they just have access to RX and TX, surely I can reprogram my Arduino with a wired connection in a similar fashion?

Other ideas: the Arduino Pro and Pro mini from sparkfun program via 6-pin header cables (I've got one) ... what pins do they link to? Can I use this cable to program the Mega, with the appropriate connections?

You can use the Arduino IDE to write your programs and simply run avrdude from a command line to program the board using the usbtinyisp connection. The thing is so cheap that you'd be money ahead just ponying up for it and skip the hours you'll waste trying to desolder or build a serial interface and configure it to the Arduino. I can't help you with any of those other options.

Jim.

Actually with a minimal amount of effort you can modify the Arduino preferences file and use the programmer directly from the IDE so say this:

http://www.arduino.cc/en/Hacking/Programmer

Wow - that’s really cool! Yes, it’d be good to increase my Arduino skillset by doing this too.

Thanks for the info :slight_smile:

Or you could use an external USB serial cable that includes a FTDI chip and wire it's output to pins 0,1, ground and reset. The IDE doesn't care where the FTDI chip is physically.

Lefty

Ooh Lefty - this sounds interesting. I have the USB FTDI cable, but no idea what pins map to GND, reset, 0, 1 ... Does anyone know the pinout for the cable?

Wooh, just got this working, using the pinout from sparkfun where they list the FTDI cable.

Green > Reset on arduino Yellow > TX on arduino Orange > RX on arduino Red > 5V on arduino Black > GND on arduino Brown > GND on arduino

where the colours refer to the colours of the exposed cables on the FTDI cable.

It works, except I can't get auto-reset working. I've since disconnected the green wire, and am just pressing the reset button on the arduino, 2 seconds after i hit upload in the IDE, and it's working swimmingly :-)

Glad to hear it's working!

Keep in mind though that it won't always be 2 seconds. Sometimes it will be less or more depending on the sketch size.

My rule of thumb is to press it as soon as I see the IDE state the script size.

I was needing a similar thing recently, but an expensive FTDI usb to serial cable seemed, well, expensive.

So, to upload to my self-made arduino strip board I just used my existing duemilanove. If the external chip you want to program is powered you just need to connect the reset, tx and rx from the duemilanove to the right pins on your target, and use the IDE to upload.

Obviously you need to remove the chip from your duemilanove to do this, but looking online I find duemilanove clones for cheaper than an FTDI cable! So I'm going to buy a clone, remove the chip and use it as a permanent programmer for my projects, but it's available as a full arduino backup should I want or need one. All for cheaper than a usb to serial cable!

I'm also looking to modify a dil socket with a switch for the TX pin. I think I can rig it so that I could keep the existing 328 in my duemilanove on the board, just disconnect the tx line to the main chip while programming externally. Shouldn't be too hard, just small work.

In fact, I whipped it up and it works: