Go Down

Topic: Connectivity Questions - Why can't I connect to my network (Read 1 time) previous topic - next topic


Hi all,

I've configured the Yun to connect to my home wireless network.  I've been through the whole dance of connecting to the Yun's network, configuring it to use my home wireless, etc.  It works sometimes, but sometimes, I'm getting no readings.  The Yun is taking voltage readings from a solar battery and communicating them through Curl to my web server via POST.  Again, sometimes it works, sometimes it doesn't.

I'm looking at the MiFi device which I'm currently forced to use for home internet (thanks RCN) and the only device connected to the network is my laptop.  I have to think that the not-so-great connection that my MiFi is able to pull down is partly the cause, but is there any other reason that the Yun wouldn't connect to my home network?

A secondary problem is that the sketch crashes pretty frequently when connected to the home network and not connected to the laptop via USB.  If there are issues that are going to pop up with crashing because of a lack of connection, I'd like to figure out a way to circumvent, or at least mitigate them via code (i.e. check for an internet connection before trying to report data).

Any info that you all can provide would be very helpful in trying to troubleshoot this.

- Zack

Code: [Select]

#include <Bridge.h>
#include <time.h>

Process p;
const int voltPin = 0;
double denominator;
double resistor1 = 100000;
double resistor2 = 10000;

char final_command[200];
char test[15];
char volts[50];
char times[20];
int loops = 0;

float total_voltage;
float voltage;
int v_int;
void setup() {
  // put your setup code here, to run once:
  pinMode(13, OUTPUT);
  pinMode(11, OUTPUT);
  denominator = (float)resistor2 / (resistor1 + resistor2);
  sprintf(volts, "voltage=", 0);

void loop() {
  total_voltage = 0;
  for (int i=0; i<1000; i++) {
    total_voltage += analogRead(voltPin);

  //digitalWrite(13, HIGH); delay(500); // It has gotten stuck with the red light on and this line uncommented 6 time(s) (Issue would be with the analogRead commands)

  digitalWrite(11, HIGH); delay(500);
  voltage = total_voltage / 1000;
  voltage = (voltage / 1024) * 5.0;
  voltage = voltage * (resistor2+resistor1);
  voltage = voltage / resistor2;
  v_int = voltage * 100;
  memset(final_command, 0, sizeof final_command);
  sprintf(final_command, "curl -A \"Mozilla/4.0\" --data \"", 0);
  digitalWrite(13, HIGH); delay(500); // It has gotten stuck with the red light on and this line uncommented 1 time(s) (Issue would be with voltage calculations, memset for final command, and first sprintf)
  //Console.println("Sending command to Libra Project...");
  memset(test, 0, sizeof test);
  sprintf(test, "%d,", v_int);
  strcat(volts, test);
  strcat(final_command, volts);
  strcat(final_command, "&code=caseylynnncampbell\" http://thelibraproject.com/solar_recorder.php");
  loops = loops + 1;
  //Console.print("Loop "); Console.println(loops);
  if(loops == 1){
    p.runShellCommand(final_command); delay(500);
    memset(volts, 0, sizeof volts);
    sprintf(volts, "voltage=", 0);
    //Console.println("Reset voltages to: ");
    loops = 0;
  memset(test, 0, sizeof test);
  digitalWrite(13, LOW);
  digitalWrite(11, LOW);

Go Up