We have a small project to collect water well data in the field, basically a PCB with an ATmega2560, SD card and a bunch of sensors. The current version works well, but over the past few months, we had to change the firmware a few times. Bit of an issue, take laptop to field, connect and reload. Can be done but.

I would like to put a new file on the SD card and have the PCB load the new firmware and run.

My thoughts are to add another microcontroller to a new board that runs after reset and checks for a new version for the ATmega and loads as required. Similar (I think to the way the Uno and Mega boards currently work)

The problem I'm having is I'm new to this embedded electronics thing and have been have troubles locating any info.

Could someone point me in the right direction and any other help would be greatly

This question is asked now & again. The bootloader as currently written checks to see if anyone is sending sketch-load commands after a reset, and starts the sketch load process if there is, otherwise the loaded sketch starts.

What would need to be done for Option 1 is to write a bootloader that checked for a sketch file on the SD card, if one existed then load that sketch up. If no sketch file found, check if anyone is sending sketch-load commands, and if neither, the loaded sketch runs.

For Option 2, the current bootloader just runs normally, not really caring who is providing the data.

I am pretty sure Option 2 has been done before, I recall reading about an art installation or similar where someone had a sketch that loaded new sketches into installed Arduino's.In fact, that sounds a lot like what Optiloader does:http://arduino.cc/forum/index.php/topic,68183.0.html

That's option 2. Option 1 would be hacking the bootloader, which normally only looks at the UART to see if a new program is being uploaded, to check a digital pin or such for a flag that says it should start reading from a flash chip at a predefined location.

It would be kinda neat and magical but would make the bootloader larger. I nominate Crossroads to begin work immediately.

I think what OP is after, and this would make a great combination, is basically taking an Uno/equivalent with an SD/uSD sheild, and run basically Optiloader but put a sketch from the SD card into the target board instead of loading a bootloader.

Getting an SD capable bootloader is probably one of the best if you can spare the 2k for the boot loader. I don't know of any off hand but I know I've seen some of the guys here starting to think about one recently.

The BootDrive is a nice option as well, leaving the stock bootloader on the micro and emulating AVRDude talking over the serial line.

For my own project I used a 2nd micro controller similar to the BootDrive, but I'm directly SPI programming my main chip, removing the need for a bootloader entirely and allowing faster communication between the two devices. I get around needing 2 SD cards or switching between them by talking through my updating micro controller to the same card that it reads to update the main controller. It impacts throughput significantly, but should also reduce write latency at the same time. If you're interested in perusing this option I can link you my code and schematics, but they are very early in development.

pnewman,Why not field boards with ZIF sockets, another at the shop. Program extra chips at the shop, exchange them with the ones in the field, then reprogram again if necessary, back at the shop, for the next update?No fancy stuff, easily done, and a few more chips.TomJ

Einstein once said you don't really understand anything until you can explain it to your Grandmother