9

I will have many microcontroller-based devices which will be independent from each other, but all will run the same program.

I would like to upload a program to all of them at the same time with a wireless broadcast. Ideally the user would plug in a USB controller to his computer, and upload a program from the Arduino environment as if s/he were programming a single device.

To get a better idea of what I'm talking about, please take a look at this video. This was achieved with Atmel microcontrollers but a custom-made, non-Arduino bootloader.

From a Google search for "Arduino infrared programming" this interesting project came up. The main drawback is that the reset button still has to be pressed manually. Ideally I would like the devices to be in a low-power state by default, and wake up to receive a program when they sense a signal from the controller. Still, this may be a good starting point for me.

I just wanted to get some perspectives from people who are familiar with Arduinos as to whether they think this is feasible before I jump in.

2

3 Answers 3

2

TL;DR -

You have the options of either BlueTooth or XBee (amongst others: IR, for example?) for wireless uploading. However, I believe that only one board can be uploaded to, at a time, so you will need to cycle through the boards one at a time, see Programming multiple ATMegas/Arduinos at once.

When uploading a sketch or using a programmer (for sketch or bootloader), the software does not just write the code, it actually communicates with the microcontroller.

You can't program them all at once. But you can program them one by one in some automatic way.


Your question is a very interesting one, and asks a question that I am sure that I would never have thought of, but would be extremely useful and labour saving, especially if one has, as I do, many Arduino controlled sensor points located around the house. Here is one rather inelegant solution that may be worth trying.

Wireless upload hardware

If you use BlueTooth to wirelessly upload your sketches, then this solution might be of use, Wireless upload program to Arduino without USB cable. Note that this solution ties up pins D0 and D1:

But be careful that it maybe not compatible with some projects which need to use the D0 and D1 as hardware UART TX, RX. Because the wireless programmer needs to permanently occupy the two pins.

Looking at it, it employs a custom Arduino Wireless Programmer, to which you may have been referring in your question. However, don't be fooled by the name, it is simply a Bluetooth shield. It is basically a BT HC-05 (or similar) device, bolted onto an Arduino, see also Bluetooth Wireless Upload.

Alternatively, en lieu of BlueTooth, you could use XBee devices, see Wireless Programming of Arduino. The advantage of using XBees is that you would not have to go through the pairing new device loop (see below), that would be required when using BT. Instead you would merely have to cycle through the XBee network IDs.

However, in addition to that, you would need to automate the switching of BT devices, selecting the appropriate port and uploading to each Arduino in turn, as you are not able to broadcast sketches. (If am I wrong, then will someone please correct me).

Selecting the port and uploading the sketch

You could use a script along with the command line version of the Arduino IDE, to select the port that the BT device is connected to, before each upload. How you do this will vary for which ever platform you are compiling upon, see Command line Arduino compiling and downloading? This can be done using the environment variable ARDUINO_COMPORT (see the possibly out of date Windows command line build), or the arduino cmd line option --port <portname> ( see the man page). The sketch would then be uploaded using the option --upload <filename>. You could do this in one fell swoop:

arduino --upload --port <portname> FILE.ino

Note that on Windows you should use arduino_debug.exe.

Or you could use Ino, if you are not using a Windows PC... but that might make the next part, which deals with the looping more complex than it needs be.

Selecting each of the Arduinos (i.e. the BT devices)

Next, you would need to add a loop to the script, that pairs the PC to each BT device in turn and thereafter calls the Arduino IDE, for the port selection and uploading. Unfortunately, this would not be platform agnostic at all, and would require a different solution for what ever platform you are using. Take a look at Bluetooth from the Command Line, but for Windows you would probably require the Blue Tooth Command Line tools suite.

On OS X you may be best off resorting to using AppleScript, see Connect to bluetooth device (iPhone) via command line on MacOSX, as the cmd line tools for controlling BT seem a little scant - there is BlueUtil, see How to control Bluetooth wireless radio from the command line? but that only appears to turn the BT on of off. However, bolting AppleScript on to the rest of the Arduino IDE control script quickly makes things more complex, although you could just put the Arduino command within the AppleScript, I guess.

0

You could use ESP-LINK to program the Arduino over WiFi.

The ESP8266 is simple cheap Wi-Fi MCU that can be programmed with Arduino IDE.

ESP-LINK is firmware for the ESP8266 that makes the ESP act like serial connection (USB) to Arduino.

The firmware can be found here at ESP-LINK ESP8266.

0

One can use something like this. It is a custom bootloader to update a Arduino's code via a NRF24L01+ radio module.*

*It only works under Linux machines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.