Go Down

Topic: [solved]Cannot understand Arduino yun Work-flow … or the board is broked ? (Read 3961 times) previous topic - next topic


I'm new with arduino so sorry if I do some stupid question and sorry for my poor english too :smiley-red:
I buyed an arduino yun and after two week of headache I'm not able to run the examples presente in the arduino IDE 1.5.7 .
I think I did not understand the work-flow of updating sketch on the board and/or what append on restarting (power off/on) the board.
Here what I did :
Using arduino Ide 1.5.7 (with Arduino yun board and port on wifi) I upload via Wifi the following  code (I modified a example to be able to "debug" ):
Code: [Select]

#include "Console.h"
// the setup routine runs once when you press reset:
void setup() {  
 secBlinkingDelay(80);  //80" to be sure arduino ended to reboot
 // initialize the digital pin as an output.
 secBlinkingDelay(5);  // just for know where is the setup
 digitalWrite(13, HIGH);  //if not blonking the is waiting for console
 while (!Console);
 digitalWrite(13, LOW);   //console connected

// the loop routine runs over and over again forever:
void loop() {
 digitalWrite(13, HIGH);
 Console.println("On");  // turn the LED on (HIGH is the voltage level)
 delay(1000);               // wait for a second
 digitalWrite(13, LOW);
Console.println("Off");  // turn the LED off by making the voltage LOW
 delay(1000);               // wait for a second

void secBlinkingDelay (int s)
 while (s > 0){
     digitalWrite(13, HIGH);
     digitalWrite(13, LOW);
  } ;

b)   After successfully uploading it  is see the led blinking for 3-4 times but then it stopped to blink : why  ?
c)   I restarted  (power off/on) the board  I can the led blinking for about 60 times, the stopped bliking when the USB led turned on (I'm not connect to a PC, just to a phone power supply) than mean it  stopped to before beginning the bridge.

So where is the problem ? What I dit'n understand ?

Thank's for any help

Detail of statu of my yun:
Code: [Select]

1. I update the openWrt  via SSH as describe on http://arduino.cc/en/Tutorial/YunSysupgrade
checking upgrade with  uname -a  command:
Linux xxxxx 3.3.8 #1 Thu Sep 4 08:26:57 CEST 2014 mips GNU/Linux

2. I modify the wifi setting , enabling wlan and allow rest open ,
result of   uci show arduino  command:


Code: [Select]


ops ... I did not notice that I changed, in the arduino IDE, tools, programmer to AVR ISP !!

resetting it to Arduino as ISP is now  correctly blinking   and I cann se the text on the console .

So now all is ok until I reboot (power off/on) the board, the is still not working.

I try to follow : http://playground.arduino.cc/Hardware/Yun#rebootStability but not sure in wich case I'm.

I tried to add the reboot file but nothing change.

I'm sure I still missing something ... stupit ... any help ?



Have you tried selecting arduino yun from the boards list and uploading via wifi?


Hi Federico,
Thank's for you answer.
Has your ask I have selected Arduino yun and upload the sketch via Wifi.
Has I said It worke quite  good, but there are some problem after rebooting the board.
I tried to upload  the TemperatureWeb sketch (I modified a little bit those form Tom Igoe):
Code: [Select]

 Temperature web interface

This example shows how to serve data from an analog input
via the Arduino Yún's built-in webserver using the Bridge library.

The circuit:
* DHT++ temperature sensor on digital pin D2
* SD card attached to SD card slot of the Arduino Yún

Prepare your SD card with an empty folder in the SD root
named "arduino" and a subfolder of that named "www".
This will ensure that the Yún will create a link
to the SD to the "/mnt/sd" path.

In this sketch folder is a basic webpage and a copy of zepto.js, a
minimized version of jQuery.  When you upload your sketch, these files
will be placed in the /arduino/www/TemperatureWebPanel folder on your SD card.

You can then go to http://arduino.local/sd/TemperatureWebPanel
to see the output of this sketch.

You can remove the SD card while the Linux and the
sketch are running but be careful not to remove it while
the system is writing to it.

created  6 July 2013
by Tom Igoe

This example code is in the public domain.


modified a little bit adding DHT library


#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>
#include <DHT.h>

DHT dht;

// Listen on default port 5555, the webserver on the Yún
// will forward there all the HTTP requests for us.
YunServer server;
String startString;
long hits = 0;

void setup() {

  secBlinkingDelay (5);
                         // if reboot fails try increasing this number
//                          // The more you run on linux the higher this number should be
//  Serial1.begin(9600); // Set the baud.
////// Wait for U-boot to finish startup.  Consume all bytes until we are done.
//  do {
//     while (Serial1.available() > 0) {
//        Serial1.read();
//        }
//    secDelay(1);
//  } while (Serial1.available()>0);

//Serial.begin(115200); // Set the baud.

// Bridge startup
 digitalWrite(13, HIGH);
 dht.setup(2); // data pin 2

 // Listen for incoming connection only from localhost
 // (no one from the external network could connect)

 // get the time that this sketch started:
 Process startTime;
 while (startTime.available()) {
   char c = startTime.read();
   startString += c;

void loop() {
 // Get clients coming from server
 YunClient client = server.accept();

 // There is a new client?
 if (client) {
   // read the command
   String command = client.readString();
   command.trim();        //kill whitespace
//    Serial.println(command);
   // is "temperature" command?
   if (command == "temperature") {

     // get the time from the server:
     Process time;
     String timeString = "";
     while (time.available()) {
       char c = time.read();
       timeString += c;
//      Serial.println(timeString);
     float humidity = dht.getHumidity();
     float temperature = dht.getTemperature();
     String status = dht.getStatusString();
     // print the temperature:
     client.print("Current time on the Yún: ");
     if (status == "OK")
     client.print("<br>Current temperature: ");
     client.print(" degrees C");
     client.print("<br>Humidity: ");
     client.print("<br>Sensor DHt11 problem:  ");
     client.print("<br>This sketch has been running since ");
     client.print("<br>Hits so far: ");

   // Close connection and free resources.

 delay(50); // Poll every 50ms

void secBlinkingDelay (int s)
 while (s > 0){
     digitalWrite(13, HIGH);
     digitalWrite(13, LOW);
  } ;

But I have always some problem:
After rebooting the board the sketch don't start:
a)    the only way to start it is to push the 32u4 reset button,
b)   then it work but after 30-45' it stop running .

I tried to resolve problem :

a) adding the reboot file as describe on : http://playground.arduino.cc/Hardware/Yun#rebootStability but without resolving it.
What I missing ?
  ... or I need to modify wifi-reset-and-reboot   file  ?  I think is this one i find in /usr/bin folder , right?

Question: how is the uploading work-flow (WF) of sketch via WIFI ?
I ask you because I think will be nice that linino will do quite the same WF at the end of it's rebooting (= run the execution of the sketch).

b) I don't understand how to find why it stop working after 30-45 minute . It's there a way to find it ?



Argh ... I tried to upload my first sketch and now I cannot not see anymore  it correctly running !

May be I have the same problem of Marcella : http://forum.arduino.cc/index.php?topic=263118.15  but I'm using a window 7 !

I'm becoming crazy   :0

Could some one explain the correct Work flow to uploading a sketch:

1. Restart the board
2. Run the arduino IDE 1.5.7 , tools, Board : select the "Arduino Yun"
( It's needed to select under tools, programmer, Arduino ISP ?   )
3. Load a sketch from file or write a  new one
4. Wait until arduino yun is connected via wifi ( tools, port we can see our wifi arduino port) and in case select it.
5. Upload the sketch
6. Done

Are those step correct ?

Question :

a)after step 6 the sketch will immediately run : correct ?
b) If we modify the sketch we need to restart again the board ? we need just to restart the 32U4 ? The Ide will restart it alone ?


Your steps are correct (and "programmer" selection won't change the upload behaviour)
I fear your first failed attempts and subsequent fixes have made your yun unstable, therefore you need to reset it and start over.

Please upload YunSerialTerminal example, power cycle the board, wait a minute or so (if you have already upgraded, wait until the USB led turn bright white), then press and hold the WLAN RST for 40 seconds (it's 30, but we tend to count faster when we are under pressure).
While holding the button pressed, check if the wlan led is blinking. If it's not, stop holding the button, wait a minute and retry: those 30 seconds start when the led blinks.

This will reset your yun to its factory settings (or to your last upgrade).


Hi Federico,

thank's for your help ... I will try again it (it will be the 4th time I need to "restore" the arduino  yun  in the last 3-4 week  =(  )

Another question:You said to install the sketch: YunSerialTerminal example.  On sketch comment I read : upload it via USB and not via WIFI .
--> Why ? what's will happen if I upload via WIFI ?
I think is not a upload problem but just a "running" problem, because the sketch will dialog via Serial (not console) so we will see the print only via COM: right ?

Any way just to know : I have problem to upload sketch via COM with my Windows 7 Home premium: COMx disappear frequently, so is not easy upload it via USB.


Hi Federico,

I don't know if it is because I cannot upload the YunSerialTerminal via USB/COM and  only via WIFI.
But I tried to follow you instruction and I never see blinking the WLan led after keeping push the  "WLAN RST"  ... I have redo it many times !

So I tried to keep the button for longer 30" and the arduino yun restore .
Then I configure the board (new name, password, WIFI internet , open rest).

Now I don't Know if not had see the WLan blinking could be a problem, but uploading the ConsoleRead example I can not see the question "Hi, what's your name?"

So I'm in the back to the situation of the begin of this topic ... board broked or miss configured ?
How I can check it the Uboot is still OK ?
Do you think I need I to follow  this instruction: http://arduino.cc/en/Tutorial/YunUBootReflash ?

Thank's again for the help


I think is not a upload problem but just a "running" problem, because the sketch will dialog via Serial (not console) so we will see the print only via COM: right ?


I don't know if it is because I cannot upload the YunSerialTerminal via USB/COM and  only via WIFI.
But I tried to follow you instruction and I never see blinking the WLan led after keeping push the  "WLAN RST"  ... I have redo it many times !

Double check your usb cable: try with another one if you got a spare. Also, try disconnecting other usb devices as they could draw power from your PC usb host, which may give the yun not enough mA

Once you successfully upload it via usb, open IDE serial monitor then press the YUN RST button near the leds: lots of text should get printed. Can you paste it here?



effectly was the usb cable ... I have already replace it but unfortuntly was not enough good too ...argh ...

Now I abke to upload the YunSerialTerminal and all is now working as needed !

So the problem was coming from wrong cable ... but why this create all this problem? wifi upload method is not so good as the cable?

Anyway thanks again for your assistance!


Sep 11, 2014, 05:20 pm Last Edit: Sep 11, 2014, 05:25 pm by Federico Fissore Reason: 1
Wifi way is good as usb way. But they are physically attached to different parts of the board, parts that (this time) we needed in order to find the root cause of the problem.
In particular, you cannot access raw linux terminal via wifi, and we needed it.
Well done!

Go Up