Yun Hangs, tried everything i could find in the forum, still no luck

Hi, I had success using Arduino Uno for some personal projects and now for a new project I want to use Arduino Yun for the wireless option.

I had running two boards for some time, maybe days and suddendly they stop working and cannot be found on the network. It's just some simple code that reads a DHT21 sensor and sends the data over the internet. I checked for the "-u" python flag in the Bridge and its present. Also when a board hangs there is no Access Point with the name Arduino-YUNXXXX, they just die. I cannot understand why something so simple will fail.

#include <Bridge.h>
#include <HttpClient.h>
#include <dht.h>

dht DHT;

#define DHT21_PIN 4

unsigned long previousMillis = 0;
long interval = 300000;

void setup() {
  // Initialize Bridge
  Bridge.begin();

  Serial.begin(9600);

  delay(5000);
}

void loop() {
  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis > interval) {
    Sensor();
    previousMillis = currentMillis;
  }
  
  delay(50);
}

void Sensor() {
  //variables
  float h, t;
  unsigned long l;
  String s; char tmp[10];
  
  do {
   int chk = DHT.read21(DHT21_PIN);
    h = DHT.humidity;
    t = DHT.temperature;
    delay(10000);
  } while (isnan(h) || isnan(t));
  
  
  s = "http://domain.example/add?" ;
  //sensor: humidity
  dtostrf(h,1,2,tmp);
  s += "h1=";
  s += tmp;
  //sensor: temperature
  dtostrf(t,1,2,tmp);
  s += "&t1=";
  s += tmp;
  
  sendGet(s);
}

void sendGet(String s) {

  HttpClient client;

  client.get(s);

  // if there are incoming bytes available
  // from the server, read them and print them:
  while (client.available()) {
    char c = client.read();
    Serial.print(c);
  }
  Serial.flush();
}

Any thoughts?

Did the 2 Yuns stop working at the exact same time?

Have you cycled power on the boards?

Have you tried connecting via ethernet? At the very least you can do this to see the status of the WiFi connection.

Did anything change with your wireless access point?

Are you able to connect with PC to WiFi still?

whisprer:
Did the 2 Yuns stop working at the exact same time?

Have you cycled power on the boards?

Have you tried connecting via ethernet? At the very least you can do this to see the status of the WiFi connection.

Did anything change with your wireless access point?

Are you able to connect with PC to WiFi still?

The Yuns stop working at different times. Could be a day or a week.

By cycling power do you mean disconnecting and connecting power? It's the only thing I can do to make them Work again.

Didn't try connecting vía ethernet to check.

Nothing changed on the AP.

Network works fine. Cannot connect to Yun .

Do I hace to use a static IP? Now i'm using DHCP. As you can see the code is prerty straightforward.

Thanks for the reply

Some users reported a more stable wifi after upgrading OpenWRT-Yun. Have you already upgraded? (see my signature)

Hello Federico,

Where I can find the firmware version that I'm running on the Yuns before trying to upgrade?

Thanks in advance,

Login via SSH or via YunSerialTerminal and type

cat /etc/arduino/openwrt-yun-release

if it says the file is missing then you're running the first version, one year old.

Thanks, updated to latest build. Now testing the boards.

let me know how it goes. I have a very similar issue.

I've run into a lot of problems with the early releases.

I wish it was made a little more obvious that it needs to be upgraded out of the box. I only found it by joining the forum and searching for an unrelated topic.

I'd say they should really add this process to the "Getting Started" guide prior to folks getting unstable behavior.

Find out which version Yun is running:

=== Release 1.4.2 - September 4th, 2014
=== Release 1.4.1 - August 8th, 2014
=== Release 1.4 - July 15th, 2014
=== Release 1.3 - July 14th, 2014
=== Release 1.2 - July 11th, 2014
=== Release 1.1 - June 23rd, 2014
=== Release 1.0 - April 17th, 2014

root@Arduino:/mnt/sda1# uname -a
Linux Arduino 3.3.8 #1 Fri Jun 20 12:50:18 CEST 2014 mips GNU/Linux
root@Arduino:/mnt/sda1# cat /etc/arduino/openwrt-yun-release
built=Fri Jun 20 07:32:45 CEST 2014

Why ~5 hours difference?

That's because compiling openwrtyun on our build server takes around 36 hours (it's a slow machine, so that it consumes less power when it's idle)
However, the difference between the date in the file and the date in the changelog is misleading. I'll fix it asap

I've been having a very similar issue. I collect a data from 3 analog inputs every sec, average them, and upload the average to thingspeak.com every minute. I then make a graph using highcharts. As you can see in my graph
there are several instances where thingspeak does not receive data. This "dead time" usually lasts ~12 minutes. However, it can sometimes last indefinitely (the little graph on the very bottom shows some 1-2 day long deadtimes, which only ended when I rebooted the yun).

At ~9:10am today (during the temporary peak and deadtime in the green pressure trace), I updated the Yun, following the tutorial at http://arduino.cc/en/Tutorial/YunSysupgrade. Despite this, the Yun continued to lose WiFi connection or whatever other issue it may be...

any other ideas? thanks.

I also should also mention that I cannot access the arduino's web panel during the downtimes but I have no problem accessing it otherwise.

ntallari, out of curiosity: does your project need to write on the SD card?

No, it does not. I could have it do that, though.