One of the most useful features of Arduino Yun is the ability to upload your sketches via network, directly from the IDE (as I explained in a previous tutorial). Arduino’s IDE uses the Bonjour protocol (running on port UDP 5353) to look for Yun boards on your network: this auto-discovery technique works fine in a local area network, but fails on the Internet.
Today’s project allows to upload a new sketch using a protected web page, easily accessible also on the Internet.
When the IDE uploads a new sketch, it performs three steps (thanks to Federico Fissore that explained it on the forum):
- it copies (using SCP) the compiled version (.hex) of the sketch on the Arduino Yun
- it adds the bootloader (merge-sketch-with-bootloader.lua command)
- it programs the ATMega32u4 microcontroller (run-avrdude command)
I developed a PHP application that performs the operations listed above; for security reasons the application is password-protected (using the same password you type to access your Yun via SSH or to upload sketches using the IDE).
First, I’d like to thank the people behind the following great projects:
- jQuery, library I used for all the Ajax stuff
- jQuery File Upload Plugin, I used to upload the files
- nuoveXT iconset, where I got the icons
The server-side application is developed in PHP: you need to install some packages to run it; the installation can be performed using the WebGUI or a terminal as it follows.
First, always remember to update the list of the available packages:
then install php5 and the CGI module to use PHP within the uHttpd webserver:
opkg install php5 php5-cgi
you also need to install some additional modules:
opkg install php5-mod-json php5-mod-hash php5-mod-session
Finally, configure the uHttpd server as explained here.
The files of the project are available in my Github’s repository.
Click the Download ZIP button to download all of them in a single archive:
Extract the archive in a folder on your harddisk (for example in C:). Move the folder on the SD card, in the following path: arduino\www and rename it to sketchUploader:
Insert the SD card in your Yun and connect to http://yun_ip/sd/sketchUploader/
If the installation was ok, you should get sketchUploader’s login form:
In the next page I’m going to show you how to use it…
Pages: 1 2