Yún – Sketch Uploader

luca 10/02/2014 17

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:


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:

opkg update

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


  1. Dario 13/02/2014 at 11:09 - Reply

    Bravo. Adesso torna su CBC ;)

  2. Dario 19/02/2014 at 16:46 - Reply

    “08 visitor(s) online”
    fai tornare su CBC anche gli altri 7


  3. Michael 23/05/2014 at 18:56 - Reply

    This is so cool! Great work!
    Is it possible to copy/padte the .hex path into the uploaded (instead of navigating to file) since this path changes erverytime… and we have to get this path from IDE window anyway?

    • luca 23/05/2014 at 19:47 - Reply

      Hi Michael,

      thanks! it requires some changes in the javascript code to add a text box where you can paste the path of the hex file… but of course you can paste it in the “open file” dialog instead of navigating to file.

  4. Michael 07/06/2014 at 03:09 - Reply

    Hi Luca,
    I found a strange behavior… sketchUploader loads and reboots Yun… but the code is not actually changes. I get errors like this.. when uploading via ethernet or with sketchUploader. Wifi and usb work just fine. Have you seen this before?

    vrdude: AVR device not responding
    avrdude: initialization failed, rc=-1
    Double check connections and try again, or use -F to override
    this check.

    /usr/bin/run-avrdude: line 4: can’t open /tmp/efuse: no such file
    rm: can’t remove ‘/tmp/efuse': No such file or directory
    sh: 203: unknown operand

    • luca 07/06/2014 at 10:42 - Reply

      Hi Michael,

      that’s strange, it seems the “linux” part of the Yun can’t communicate with the atmega32u4… are you able to upload sketches using the Arduino IDE via wifi?

  5. Michael 09/06/2014 at 14:40 - Reply

    Hi Luca,
    I use 1.5.6-r2 IDE, and recently updated the firmware to the latest from Arduino.
    Wifi and usb upload work fine. I think sketchUploader worked fine at first (confusing now)… but sketchUploader and ethernet definitely don’t work now on multiple Yun modules.
    Still scratching my head. I really like your sketchUploader.. it should be a standard package that makes the Yun so much better!

  6. Tom Russell 23/01/2015 at 19:06 - Reply

    Is it possible for the Yun to fetch the upgrade from a remote website and then do the sketch update? This would avoid the need to access the Yun from a remote site when it is likely behind a firewall.


    • luca 23/01/2015 at 20:51 - Reply

      Hi Tom!

      Of course you can write a script that fetches (via wget, http://ftp...) the new sketch and run the commands to program the ATMega… you gave me the idea for a new blog post ;)

  7. Gabriel 25/01/2015 at 15:30 - Reply


    Firstly, thanks for your work, the project is amazing and very useful for arduino.

    I have been done everything you say in this post and even tried the php example webpage with success, but once I tried with the sketchUploader webpage it appeared with a white background and a simple style.

    I have tried that webpage on my computer and even with the dreamweaver editor and it seems that it is a problem of the webpage directly. Have anyone tried to the las update of this project? I downloaded it from the official repository.

    Anyway, thanks a lot for your job luca!!

  8. Gabriel 25/01/2015 at 15:32 - Reply

    Sorry, there’s an error in the last post. I wanted to say “I have done” in spite of “I have been done”.

    • luca 31/01/2015 at 10:09 - Reply

      Hi Gabriel… could it be that you didn’t install PHP (or one of its required modules) on the Yun? Anyway, did you notice that the latest official images include a “built-in” sketch upload feature?

  9. JT 21/04/2015 at 01:47 - Reply

    I get the sketchuploader page but why does it just sit there after I enter arduino for the password?

    • luca 21/04/2015 at 12:46 - Reply

      Hi Jeff,

      very strange, did you install PHP and all the requires packages? Anyway, the new version of Linino do include a “builtin” function to upload sketches, did you try it?

  10. JT 21/04/2015 at 23:39 - Reply

    yes all packages confirmed installed. Can I install the latest linino from 5 days ago or do I need the arduino one for my yun? thank you!!

  11. JT 23/04/2015 at 01:45 - Reply

    ok all upgraded ran all steps from scratch, I can connect to
    and I type in arduino for the password, click on log in but nothing happens, what may I be missing? thx again for helping!

Leave A Response »

This website uses cookies to ensure you get the best experience on our website maggiori informazioni

Questo sito utilizza i cookie per fonire la migliore esperienza di navigazione possibile. Continuando a utilizzare questo sito senza modificare le impostazioni dei cookie o clicchi su "Accetta" permetti al loro utilizzo.