1

I'm pretty new to arduino and need some help.

My task is to connect my UNO R3 to wifi AND then send data (sketch for blinking led) to it. I successfully connected my arduino with my wifi, but how do I send the sketch?

I didn't find a tutorial for this. Do you know a good one or can you help me, please?

  • I would prefer you to use a simple Adafruit EZ Link that provides you serial communication with a reset line with the help of Bluetooth. Well the solution that Majenko gave is also applicable but that will need a bit of work. – Sagnik Pradhan Jun 21 '17 at 12:39
  • Once you involve wifi, an ATmega-based Arduino is rarely the right choice. You'd be better off figuring out how to get an ESP8266 to reprogram itself, or using a Linux-based router chip which can load a new "OTA" image to its external SPI flash store. Both solutions will be cheaper than Arduino + Ethernet Shield. – Chris Stratton Jul 20 '17 at 15:25
1

There is a difference between communicating via WIFI while a sketch is running or to send the sketch itself ... for the latter, I don't think there is an easy solution; you probably have to write your own AVR programmer, receiving the sketch via WIFI and store it on the Flash memory.

  • 1
    Given the bootloader, there's not as much difference as you think, if you have a wifi adapter that functions as a mostly transparent bridge, but ideally can also be commanded to toggle a modem status line to reset the ATmega. – Chris Stratton Jul 20 '17 at 15:24
1

You can't with a normal Arduino and WiFi shield.

However it is possible (if you are cunning) to do it with the ESP8266.

The basic idea is that you program an ESP8266 module to act like a transparent TCP/IP to UART bridge. Connect it to the TX and RX pins of the Arduino, listen on a port number of your choice, then when you connect to it (with telnet, netcat, socat, etc) all data is forwarded directly back and forth to the UART interface. If you monitor the connection state as well and use that to drive an equivalent of the DTR pin you can reset the Arduino automatically when you connect.

There is an example in the ESP8266 core that does it all apart from the connection monitoring, which is easy enough to add.

Then it's just a case of getting your computer to connect a virtual serial port with the remote socket on the ESP8266 and you have OTA programming for your choice of target board.

On Linux you can use socat for that:

root@foo:~# while `true`; do echo "ready"; socat pty,link=/dev/ttyACM99,raw,wait-slave,user=youruser,group=dialout tcp:192.168.0.16:24; done

(yes, you have to run it as root).

Quite how you'd go about that on other operating systems I don't know. I think socat is available on OS X. Windows is anyone's guess though.

  • Can we use a Adafruit Bluetooth EZ Link ? – Sagnik Pradhan Jun 20 '17 at 10:58
  • No idea. If it can be a serial port, has the facility to reset the target MCU, and can be used without needing an active sketch on the Arduino (it is configured separately to the Arduino) then possibly. – Majenko Jun 20 '17 at 12:02

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.