Show Posts
Pages: [1] 2
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Help with pinging a website on: August 25, 2009, 08:20:38 pm
Update:

I just uploaded the stock web client sketch and it too doesn't work.  Is it possible I may have a hardware failure in either the Arduino or Ethernet shield?

Thanks again.
2  Forum 2005-2010 (read only) / Troubleshooting / Re: Help with pinging a website on: August 25, 2009, 07:39:53 pm
Thanks for the help!

I have been making some good progress but just ran into a snag.  Here is my setup:

-An arduino
-an official ethernet shield
- three LEDs (Red, Green, White)

The Arduino checks if it can connect to google to verify the internet connection to my house.  While checking the connection the white LED is on.  

If it confirms that it has an internet connection it twitters "the house is online" then turns the green LED on.

If it cannot connect to the internet it turns the red LED on.  

It checks the internet connection every 2.5 minutes.

My ultimate goal is to automatically reset the internet modem if it verifies there is no connection to the internet.  I have had many issues with needing to reboot the router every 2-3 days.

The code below was working wonderfully for the last 3 days but as of today it cannot connect to the internet.  I even took the unit over to my neighbors and tried it on his internet connection with zero luck.

I have also tried commenting out the twitter functionality to see if it was causing the issue.  No luck.

Any ideas? Thanks!

#include <Ethernet.h>
#include <Twitter.h>


// these are the LED definitions
int greenPin = 8;                // Green LED connected to digital pin 8.  indicates intenet is working
int redPin = 9;                 // Red LED connected to digital pin 9.  indicates internet is not working
int whitePin = 7; // white LED connected to digital pin 7.  indicates arduino is testing the internet connection

unsigned long time; // this defines the time variable

byte mac[] = { 0xAE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 0, 32 };
// byte gateway[] = { 192, 168, 0, 1 };
// byte subnet[] = { 255, 255, 0, 0 };

byte server[] = { 64, 233, 187, 99 }; // Google
// byte server[] = { 69, 147, 76, 15 }; // Yahoo

Client client(server, 80);

// this is the twitter definition
Twitter twitter("twitterusername:twitterpassword");
char msg[] = "This is the 13th Test.  I am the Arduino DSL internet Watchdog!!";  // not currently using this, see below


void setup()
{
  pinMode(greenPin, OUTPUT);      // sets the digital pin as output
  pinMode(redPin, OUTPUT); // sets the digital pin as output
  pinMode(whitePin, OUTPUT); // sets the digital pin as output
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
  delay(1000);
}

void loop()
{
  digitalWrite(whitePin, HIGH);  // Sets the white LED on
  Serial.println();  
  Serial.println("Testing your Internet connection...");
  
  if (client.connect()) {
    Serial.println("You are connected to the Internet");
    Serial.print("Time: ");
    time = millis();
    //prints time since program started
    Serial.println(time);
    // wait a second so as not to send massive amounts of data
    delay(1000);
    Serial.println("Connecting to Twitter...");
  if (twitter.post("The house is online!")) {
    int status = twitter.wait();
    if (status == 200) {
      Serial.println("Tweet Successful!!");
      digitalWrite(redPin, LOW);    // sets the red LED off
      digitalWrite(greenPin, HIGH);   // sets the Green LED on
    client.stop();
    digitalWrite(whitePin, LOW);  // sets the white LED off
      delay(150000); // delays restart of program after success for 2.5 minutes
      }
    }
  } else {
    Serial.println("You are not connected to the Internet!");
      digitalWrite(greenPin, LOW);   // sets the Green LED off
      digitalWrite(redPin, HIGH);   // sets the red LED on
      delay(500);            // waits for half a second
    client.stop();
    digitalWrite(whitePin, LOW);  // sets the white led off
    delay(150000); // delays restart of the program after failure for 2.5 minutes
  }    
}
3  Forum 2005-2010 (read only) / Troubleshooting / Re: Help with pinging a website on: August 18, 2009, 10:50:44 pm
Spinlock, Thanks for the help! This works great.

Now a new question.  I am trying to input the milliseconds since the program has been running in my Tweet (or just changing the static Tweet to a counter for that matter).  Looks like the twitter library only allows static tweets.  Any ideas around that? I am kind of new to this stuff.  Here is my code so far.  I am using green and red LEDs right now to visually indicate status as well as the serial port.

Thanks again!

#include <Ethernet.h>
#include <Twitter.h>

// these are the LED definitions
int greenPin = 8;                // Green LED connected to digital pin 11
int redPin = 9;                 // Red LED connected to digital pin 8

unsigned long time; // this defines the time variable

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 0, 35 };
byte server[] = { 64, 233, 187, 99 }; // Google

Client client(server, 80);

// this is the twitter definition
Twitter twitter("TwitterUserID:TwitterPassword");
char msg[] = "This is a Test.  I am the Arduino DSL internet Watchdog!!";


void setup()
{
  pinMode(greenPin, OUTPUT);      // sets the digital pin as output
  pinMode(redPin, OUTPUT); // sets the digital pin as output
  
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
  
  delay(1000);
  
}

void loop()
{
    Serial.println("connecting...");
  
  if (client.connect()) {
    Serial.println("connected");
    Serial.print("Time: ");
    time = millis();
    //prints time since program started
    Serial.println(time);
    // wait a second so as not to send massive amounts of data
    delay(1000);
    Serial.println();
    Serial.println("connecting to Twitter ...");
  if (twitter.post(msg)) {
    int status = twitter.wait();
    if (status == 200) {
      Serial.println("Tweet Successful!!.");
      digitalWrite(redPin, LOW);    // sets the red LED off
      digitalWrite(greenPin, HIGH);   // sets the Green LED on
    client.stop();
      delay(300000); // delays restart of program after success for 5 minutes
      }
    }
  } else {
    Serial.println("connection failed");
      digitalWrite(greenPin, LOW);   // sets the Green LED off
      digitalWrite(redPin, HIGH);   // sets the red LED on
                  // waits for half a second
    client.stop();
    delay(300000); // delays restart of the program after failure for 5 minutes
  }    
}
4  Forum 2005-2010 (read only) / Troubleshooting / Help with pinging a website on: August 18, 2009, 02:17:13 pm
Hello,

I am working on this project:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1250344151

and need to ping a website to verify I have an active internet connection.

I have been using the web client example sketch as a start and it accomplishes what I need to do but with it performing a google search and returning the output it takes many seconds to return the message that it can connect.

Is there such a thing as a simple ping command for the ethernet shield?  Thanks!

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
byte server[] = { 64, 233, 187, 99 }; // Google

Client client(server, 80);

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(9600);

  delay(1000);

  Serial.println("connecting...");

  if (client.connect()) {
    Serial.println("connected");
    client.println("GET /search?q=arduino HTTP/1.0");
    client.println();
  } else {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;smiley-wink
      ;
  }
}


5  Forum 2005-2010 (read only) / Troubleshooting / Re: Trouble with Ethernet Shield as a client on: August 28, 2009, 06:29:56 am
Thank you!  I can't believe I overlooked that.  It is the IP address provided in the example code and I took it as gospel.

Thanks!!!
6  Forum 2005-2010 (read only) / Troubleshooting / Trouble with Ethernet Shield as a client on: August 27, 2009, 07:30:26 pm
Hello,

I had this sketch running successfully for 3 days then it stopped working.  All sketches I try now that are clients using the ethernet shield do not work.  I can send a twitter using the basic twitter example though.

I am using Arduino 17 to build these sketches.  Am I running into a memory issue?  Thanks for the help.  I am a newb.

#include <Ethernet.h>
#include <Twitter.h>

// these are the LED definitions
int greenPin = 8;                // Green LED connected to digital pin 8.  indicates intenet is working
int redPin = 9;                 // Red LED connected to digital pin 9.  indicates internet is not working
int whitePin = 7; // white LED connected to digital pin 7.  indicates arduino is testing the internet connection

// unsigned long time; // this defines the time variable

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 0, 35 };
byte gateway[] = { 192, 168, 0, 1 };
byte subnet[] = { 255, 255, 0, 0 };

byte server[] = {
  64, 233, 187, 99 }; // Google
// byte server[] = { 69, 147, 76, 15 }; // Yahoo

Client client(server, 80);

// this is the twitter definition
Twitter twitter("TwitterUsername:TwitterPassword");
// char msg[] = "This is the 13th Test.  I am the Arduino DSL internet Watchdog!!";


void setup()
{
  pinMode(greenPin, OUTPUT);      // sets the digital pin as output
  pinMode(redPin, OUTPUT); // sets the digital pin as output
  pinMode(whitePin, OUTPUT); // sets the digital pin as output
  Ethernet.begin(mac, ip, gateway, subnet);
  Serial.begin(9600);
  delay(1000);
}

void loop()
{
  digitalWrite(whitePin, HIGH);  // Sets the white LED on
  Serial.println();  
  Serial.println("Testing your Internet connection...");

  if (client.connect()) {
    Serial.println("You are connected to the Internet");
    // Serial.print("Time: ");
    // time = millis();
    // Serial.println(time);  //prints time since program started
    delay(1000); // wait a second so as not to send massive amounts of data
    Serial.println("Connecting to Twitter...");
    if (twitter.post("The house is online!")) {
      int status = twitter.wait();
      if (status == 200) {
        Serial.println("Tweet Successful!!");
        digitalWrite(redPin, LOW);    // sets the red LED off
        digitalWrite(greenPin, HIGH);   // sets the Green LED on
        client.stop();
        digitalWrite(whitePin, LOW);  // sets the white LED off
        delay(150000); // delays restart of program after success for 2.5 minutes
      }
    }
  }
  else {
    Serial.println("You are not connected to the Internet!");
    digitalWrite(greenPin, LOW);   // sets the Green LED off
    digitalWrite(redPin, HIGH);   // sets the red LED on
    delay(500);            // waits for half a second
    client.stop();
    digitalWrite(whitePin, LOW);  // sets the white led off
    delay(150000); // delays restart of the program after failure for 2.5 minutes
  }    
}

7  Forum 2005-2010 (read only) / Troubleshooting / Pachube & onewire issue on: November 15, 2009, 02:27:48 am
I have had an Arduino successfully pushing two light sensors and one onewire temp sensor to feed 1812 for a week or so. I just added another onewire temp sensor for outdoor temp and now, even though my serial feed looks great, it won't post either temp to Pachube.

Here is the link to my post on the Pachube forums with the full code

Thanks for the help in advance!

http://community.pachube.com/node/313
8  Forum 2005-2010 (read only) / Troubleshooting / Re: DSL modem reset w/ Twitter notification on: August 31, 2009, 06:04:19 pm
jafadmin,

What is the command to ping an IP?  I can only connect to actual webpages.  I looked throuth the ethernet library but couldn't find this.  Thanks
9  Forum 2005-2010 (read only) / Troubleshooting / DSL modem reset w/ Twitter notification on: August 15, 2009, 08:49:11 am
Hello everyone,

I have a DSL modem issue that I think the Arduino will help put a bandaid on.  Every 1-3 days I need to reset my DSL router to restore my internet connection.  Qwest has been out to investigate and has even replaced the router with zero improvement.  This is an issue because our only phone line is VOIP and I have aspirations for adding a home automation system that can be accessed remotely via my iPhone.

Here is what I would like to accomplish:

- Arduino with an Ethernet shield checking a site like Google at a specific interval to verify it is connected to the internet.
- If it cannot access the site, try another popular site or try the same site again to verify it does not have access.
- When lack of internet access is confirmed, cut power to the router, wait a specific interval of time and restore power.
- After power is restored wait enough time for a normal reset cycle to finish and verify it has internet access.

Now for the gravy - I would also like it to Twitter when it has successfully restored the internet connection to the house and maybe even twitter at a specific interval to let me know that the house has internet access.

I have tried searching for someone who has done something similar with no luck.  If anyone has seen an example or has a project that is similar please point me in the right direction as I am pretty new to Arduino.

Thanks!
10  Forum 2005-2010 (read only) / Exhibition / Re: Steering a combine via GPS on: October 06, 2009, 10:40:55 am
Is that a touchscreen monitor hooked to the computer or do you have a keyboard in mouse that you use?  I am looking for a good touchscreen solution for some automotive projects.
11  Forum 2005-2010 (read only) / Exhibition / Re: Steering a combine via GPS on: October 05, 2009, 02:30:18 pm
Nice project.  What computers are you using in the cab?
12  Forum 2005-2010 (read only) / Exhibition / Re: camera shutter tester on: November 16, 2009, 10:06:17 pm
That was quick!  Thanks!  I am hopefully going to make this work detecting my electricity usage.  My meter uses IR instead of a spinning wheel.
13  Forum 2005-2010 (read only) / Exhibition / Re: camera shutter tester on: November 16, 2009, 09:00:10 pm
jerrya.net - neat project.  Some of your pictures of your hardware setup don't work anymore.  Any chance you can fix them?  Thanks!
14  Forum 2005-2010 (read only) / Exhibition / Re: Whole House Telephone Intercom on: September 14, 2009, 12:06:50 pm
Nice project.

I have never used them but sparkfun linked to batchpcb.com in this project post.

http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=144
15  Forum 2005-2010 (read only) / Exhibition / Re: Telephone Interface for Arduino on: December 12, 2009, 10:33:55 pm
This would be a great idea for a shield!
Pages: [1] 2