Maslow Home Maslow Community Garden Newsletter

Anyway to batch program hundreds of arduino megas with firmware?

Last time I loaded ground control 1.26 on hundreds of Mega2560 boards one by one and it was super boring took me about 2 or 3 days on and off.

I’m guessing that is the only way, but thought the community might know a more efficient method?.

edited to add:
I found this post below, but do not understand what the heck he is saying? Sounds like he made a custom wiring harness that plugged into many boards at once and then connected one via usb to the pc and it programmed the entire batch at once??

SOLVED… Frist thank you all for you input I found it to be extremely invaluable. It was a simple fix but I found out how to upload a sketch to many Arduino’s at the same time. This was key!!! - You connect all the GRN in parallel (from the FTDI - the DTR connection and the Arduino’s GRN) , the TX from the master serial (in this case my FTDI) connects to all the RX on the slave Arduino’s in parallel and the GRD on all connected together as well in parallel. The only down side is that you can’t receive a verify from the uploaded. But it’s not needed in this case. Again thank you for the help.

1 Like

So after some research it sounds like I take this FTDI and run the wires parallel to a bunch of Arduino boards using little header wires (probably best to get a shield made to make it more idiot proof and faster )
wonder how many boards can be programmed in parallel?

Wonder if the time making a motor shields for half a dozen boards will be gained back in faster programming.

Does this sound like I am understanding this correctly or am I totally off track?

1 Like

An alternative path using Linux:

  • Setup your sketch so that it can be uploaded using the arduino cli
    • This involves creating a makefile that references the arduino cli libraries then you can upload by running make upload . Unfortunately this isn’t well documented.
  • Create a udev rule that recognizes when an arduino is plugged in
  • Setup a script (called by the udev rule) that automatically runs a make upload to the new device
    • You should be able to pass in the device path as an environment variable from the udev rule
  • Have the script do something that lets you know when it’s done (logfile or beep)

With this setup you can plug in the USB, wait for the beep, then plug in the next device.

awesome solution if I knew baic linux programming, but honestly would probabaly take me more than 2 days to figgure out, which is about how long it takes to just manually do them one by one.

you could pull the command to flash the arduino from webcontrol, so that fixes the first one.

the udev rule could be a file named:

81-arduinoflash.rules

that would need to be made and placed in the /etc/udev/rules.d folder

inside it could have:

ACTION=="add", ATTRS{product}=="Arduino SA Mega 2560", SYMLINK+="ArduinoPgm";
RUN+="/usr/local/webcontrolprogramscript.sh 'ArduinoPgm';

where the webcontrolprogramscriipt.sh is located in /usr/local/bin and has appropriate permissions. It would then take the ‘ArduinoPgm’ sym link as the device to program as an input arguement and execute.
I don’t know how to make it beep. I can find the webcontrol command later today and try it on my linux system later, but maybe this will get you started.