9
\$\begingroup\$

My Arduino is hooked up to some lights over my aquarium and I can control them from a web browser on my LAN. I wonder if I can modify the program on the Arduino without having to plug it into a machine via USB which would be a little inconvenient. There must be some way I can take advantage of the wifi connection.

I have used Pololu's wixel shield to send programs wirelessly (it just acts as a serial port radio) but that's a different technology than my WiFi shield.

Does anybody know of a way I can do this via WiFi? Maybe if I upload new code to the flash memory in the WiFi shield, it could then bootload from the flash memory? I'm not sure how to do that or if its even possible.

Perhaps a completely different approach would be simpler?

\$\endgroup\$

2 Answers 2

8
\$\begingroup\$

It is possible, in theory, but not trivial in practice. The piece of code responsible for loading your new sketch to the Arduino is called the bootloader. All the popular versions of bootloaders I know of are serial/USB based. In order to load a sketch over the WiFi shield, the bootloader would have to be rewritten to communicate with the WiFi shield instead of serial. This would take some work, but not impossible in practice.

Note that you'll have to do this regardless of whether you are storing the sketch on the WiFi shield (which I think would be difficult: I am not sure if this is possible at all) or uploading the sketch directly to your Arduino: the bootloader will need to communicate with the shield to read the sketch data.


There is a way to reprogram your Arduino wirelessly easily, and that's Bluetooth. You will need to get a Bluetooth module (I don't know if a Bluetooth shield will work) and connect it to hardware serial ports. The bootloader that is on your Arduino can already talk serial, so that problem is solved. You will have to (potentially) solve two other problems though:

  • The lowest-cost bluetooth modules you find on Ebay are 3.3V. This means you will have to supply them with 3.3V power, and the send line from your Arduino will need to be voltage-shifted from 5V to 3.3V. You can solve the first (power) sub-problem by purchasing a Bluetooth module that is made for 5V communication, or if your Arduino has 3V3 power using that to power the Bluetooth module. A 5V-ready module also solves the second problem; alternatively, you can voltage-shift the 5V output from your Arduino using any of the techniques describe in this question.
  • In order to program your Arduino automatically, the Arduino needs to be reset right before the sketch is uploaded: when Arduino runs normally the bootloader is not active. Resetting the Arduino activates the bootloader, enabling uploads of new sketches. on the Arduino USB cleverly uses the DTR line to reset the device. Most Bluetooth serial modules, however, only provide TS/RX out, so you will probably have to reset the Arduino manually to upload a sketch, unless you can find some signal output on the Bluetooth module that you can marshall to connect to a reset circuit.
\$\endgroup\$
2
\$\begingroup\$

Today, I became aware of a product that can achieve this: the ESP8266. It will allow you to program/reprogram your arduino via a wifi connection. Various companies produce versions of the chip on various breakout board arrangements. Specifically, it can become a WiFi AVRISP for an Arduino.

You can also program the ESP8266 itself with the Arduino SDK and it has plenty of power of its own.

See here on whatimadetoday (not my post) for a good introduction of how to get going with the ESP8266 and the Arduino SDK. Once the SDK is set up to program the ESP8266 you can browse into the IDE's Examples and find "Arduino_Wifi_AVRISP".

You can find the board for prices that range from around $5-$15.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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