Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: Suggestions for Wifi without router wanted on: November 23, 2013, 11:57:35 am
Thanks for the suggestions. 

I am thinking that what the simplest solution is to go to walmart, spend 35 bucks on a cheap wifi router, then just hardwire the arduino into that with a short cable. I can set the router up with open access.  The ethernet sheild plus the cost of the router is less than the wifi shield, and solves the problem.  The router will run on 12 volts so that will work on the boat.  The project is to put up a bunch of engine monitor signals onto a web page.  So what I want, is just to type in the address of the arduino, and have it connect directly to the device and bring up the page with the data.  T

The solution provides for wifi access with the arduino with no problems at all.  Just a bit clunky  but much simpler than plugging in a shield and writing some code.  I don't need to have internet access, just local. 

2  Using Arduino / Networking, Protocols, and Devices / Re: Suggestions for Wifi without router wanted on: November 22, 2013, 08:06:01 pm
Hi,

Thanks for the suggestions.  Further investigation has not found a wifi sheild that has a 'good' reputation of being bug free and can serve as a server, at least without a wifi router.  Right now, the best solution has been to use the wifi router and a hard wired cable.

Here is what I working with right now.  I wrote this program, and am now trying to get rid of the wired cable and the router.  What i want to do is run a similar web program, (not x10, but on the boat to do some interfacing) and i want to access it without having to put in a router or the ethernet cable.  I have the new program working with the cable and the ethernet router as the wifi access.  So a solution that will take the router functionality and merge it on to a board that can be directly connected to the arduino would be great.  The program is only a couple of pages, the thing is pretty simple and i can deal with the 'delays' of the overhead in the arduino.  Below is a program i wrote for this that works with the ethernet cable.  Its stable and has been running without modification for over a year now.  No problems at all.  I dont need the arduino to act as a router, just let one device, access it.

I think the exact term for what i want to do is a peer to peer server/web browser set up, with the arduino running a wifi board and the iphone/ipad/computer/smart device/ that can run any old web browser see the web page in the arduino.  I want to migrate, using the code approach shown in my video below , migrate this to a wifi sheild.  Not sure if something exists that does this.  Any help would be great.  The other thing about the approach is that it would be app free on the other end, hence the desire to continue the use of an browser.



Thanks,
Walt,
3  Using Arduino / Networking, Protocols, and Devices / Suggestions for Wifi without router wanted on: November 21, 2013, 10:28:52 pm
Hi,

I am thinking about using a WiFi shield for a project that would allow me to use my web browser and a server running on the arduino.  I have done this type of set up with a Ethernet shield that connects directly to the home wifi router router via a 10baseT cable.  This works great.  But I would like to get rid of the home wifi router, and also the Ethernet shield.  The way I was thinking this would work is that I would run the server on the arduino and use the wifi shield but I then want to connect directly using my wifi device, (ipad for example,open safari) and then see the page served up from the arduino.  I want to do this away from any wifi router with a direct connection from the arduino to the PC, or other wifi enabled browser.  Can this be done?  How do I set this up?  And, which shield should I purchase.?  I have read that these shields are not very stable and having one that is known to work ok would be great.  I do have a router, and could use that for debugging, but really need the system to end up with the wifi router out of the picture, if possible. 

Thank You,
Walt
4  Using Arduino / Networking, Protocols, and Devices / Re: arduino web server client.println wireshark view of the ethernet question on: October 29, 2012, 07:48:47 pm
Good question.    I'll have to try that, but here is the problem if i dont use the F, then then sram gets used up too fast and then the arduino crashes...  and you get no reason why.  So a few weeks ago, the F macro was suggested to move the data inside the client.print off into the the flash.

Thanks,
Walt,
5  Using Arduino / Networking, Protocols, and Devices / arduino web server client.println wireshark view of the ethernet question on: October 29, 2012, 06:30:10 pm
Hi,

I have a question concerning the implementation of the webserver code for client.println.  Here is what i did, i decided to watch the transmissions using wireshark when the PC goes to the Arduino, and gets the web page.  Just to see how the packets were being formed and if they made sense.  (You know, speed, net traffic, etc).   The HTML could not easily be seen for some reason, but with some work, it became apparent that the arduino is serving up the web page one character at a time, that is, on each back and forth with the computer, the message appears to be being formed as 1 byte long.  For each HTTP, the length was one byte! 

So, for each byte in the client.println(F'<some html junk..>') you end up with over 114 characters being sent, one ethernet frame at a time.  54 going one way, then 60 going into the PC.  This means that the single client.println shown below, with almost 100 characters to transmit, will result in 11,400 bytes being transfered.    Every single character in the line below consists of a back and forth's between the arduino and the PC.

Code:
                   client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/H\r'><INPUT TYPE='submit' VALUE='Light Brighten'></FORM>  "));

Could someone explain how i get the arduino to send the entire line in one proper frame!  I would expect that this would have taken, 54 bytes from the PC, and then about 160 bytes from the arduino, and not 11,400 bytes, for this line.

The stuff seems to work, but appears to be really inefficient use of the network.

Suggestions, comments..

Thanks,
Walt


6  Community / Exhibition / Gallery / Re: arduino enclosure using plexiglass for the X10 webserver on the arduino on: October 22, 2012, 06:18:36 pm
Quote
A very nice mini tutorial on controlling arduino via the web, including your smartphone.  Useful for lots of applications!

yes, this is just an example, but using the x10 became a simple solution.  What is nice is that you don't need any app. 

There are a couple of tricks in this, one being the button, the other is the F for forcing the storage in the flash.  I would have assumed that this would be a compiler optimization automatically, but  it does not do that, so by forcing the F in the client print, it will save a bunch of memory, and it eliminated a bunch of unreported SRAM overflow issues that resulted in some erratic operations with the debugger.

Glad you found it useful,

Walt, 
7  Community / Exhibition / Gallery / arduino enclosure using plexiglass for the X10 webserver on the arduino on: October 20, 2012, 07:56:42 pm

Here is a simple enclosure for the Arduino.  It is for the x10 webserver project.







8  Topics / Home Automation and Networked Objects / Re: Pushing a html page to a client device when a push button is pressed on: October 15, 2012, 06:45:47 pm
Quote
This works also:

<FORM METHOD='BARACKOBAMA' ACTION='http://arduino.cc/forum/index.php/topic,122196.0.html'><INPUT TYPE='submit' VALUE=' click here and you this post '></FORM>

That doesn't make it right.

Ok, then i just removed it and tried it, didnt do to much from what i can tell either, and may have just wasted my program space.  It works just fine with out  METHOD='LINK' apparently the method='link' is not required at all.  maybe you can explain this.

This being the case, then maybe i can simplify my code to be much better in my original program and recover a few bytes of code.

<FORM ACTION='http://arduino.cc/forum/index.php/topic,122196.0.html'><INPUT TYPE='submit' VALUE=' click here and you this post '></FORM>

Ill try this...

Code:
client.println(F("<FORM ACTION='http://192.168.1.177/A\r'><INPUT TYPE='submit' VALUE='Den Pole Light On '></FORM>

Thanks,
Walt







9  Community / Website and Forum / how do i put in a youtube video on the form related to your project? on: October 14, 2012, 04:20:54 pm
Hi,

I noticed that some people have been able to put in youtube videos of their projects.  How does one do that?  I can post the link, but i just see the cryptic http://.... stuff.  Others have the video visible and you can just click on it. 

What is the method to do this?

Thank You,
Walt,
10  Topics / Home Automation and Networked Objects / Re: Pushing a html page to a client device when a push button is pressed on: October 14, 2012, 04:12:22 pm
Hi,

I am not sure I understand your comment...  There are lots of web pages that discuss this simple solution.  See link below.  You are correct that this will result in a Get.  But this is standard HTML and its a form method with an action of going to a link. 

http://www.htmlgoodies.com/tutorials/buttons/article.php/3478871/So-You-Want-A-Link-Button-Huh.htm

Is there a better or simpler way to do this type of control for the arduino?  That is, to have a page shown on the web browser (running on any platform), with a set of button shown that causes an action in the arduino?   I guess I was thinking that not having a program on the computer or an app on the phone, would be a plus.

for example, if you run this line in your browser, you will end up with a button that links back to this topic when you push it, (Copy and put it into a HTML file to try).  You might be able to put it here but i don't know all the syntax for this list server.

<FORM METHOD='LINK' ACTION='http://arduino.cc/forum/index.php/topic,122196.0.html'><INPUT TYPE='submit' VALUE=' click here and you this post '></FORM>


Thanks,
Walt,
11  Topics / Home Automation and Networked Objects / Re: X10 webserver with button control HTML video on: October 09, 2012, 06:03:43 pm
Hi,

I have put links in buttons on the Arduino that will go right to a youtube video.  So that is not my question.

My question is how do I post a video here, so you see it in the forum, not just the link.   In some forums one might use something like [youtube]videolinkinyoutube[/youtube].... But that didnt work here.  Tried it via the insert flash and that didnt work either.  So, i know it can be done, but dont know the syntax for this specific forum.

You might know this answer or know where I would find it.

Thank You,
Walt,
12  Topics / Home Automation and Networked Objects / Re: Using android phone to control remote dimmer on: October 08, 2012, 09:12:32 pm
Hi,

I just posted a way to do this using a windows phone, no app required, so it should work with the android.  The Arduino doesn't need to be connected with a wifi shield.  I used the wireless router in the house, just an ethernet shield and a cable.  The Arduino serves up a webpage and then it runs the x10 which do the dimming.  So, you access the web page from the android and click the buttons.  I have put 'dim and brighten', along with a number of x10 on/off command buttons.  The thing about x10, you have to select a specific address and then send an on, then you can dim/brighten.  Here is the video link. I posted the code in a previous post.

http://youtu.be/0a1vkSB2LQY

Regards,
Walt,
13  Topics / Home Automation and Networked Objects / Re: X10 webserver with button control HTML video on: October 08, 2012, 06:29:06 pm
Hi,

ok, here is the code...

forgot to upload it.

Walt,

Code:




/*
  Web Server with X10 Firecracker control
 
  No need for a app, or a program on the PC, this simple arduino program allows web based html button control of the arduino from any browser, on a PC, IPAD, IPOD, smart phone. 
 
  A Waltsailing Production
 

 
* Ethernet shield attached to pins 10, 11, 12, 13
*  x10 Firecracker attaches to pins 8 and 9


*/

#include <SPI.h>
#include <Ethernet.h>
#include <X10Firecracker.h>
#include <WString.h>

#define RTS_PIN     8                 // RTS line for C17A - DB9 pin 7
#define DTR_PIN     9                 // DTR line for C17A - DB9 pin 4
#define BIT_DELAY   1                   // mS delay between bits (1 mS OK)

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 177);

String s = String(30); //string for fetching data from address
String cmd = "/X" ; //X is an example of the command that will come after the ethernet address in the GET...


// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
 
  Serial.print("Pgm started  ");

  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
 
 

  X10.init(RTS_PIN, DTR_PIN, BIT_DELAY);
}


void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
   
   
    boolean currentLineIsBlank = true;
    boolean DoPage=true;
   
    while (client.connected()) {
        if (client.available()) {
               char c = client.read();
               Serial.write(c);
               if (s.length() < 7) { s.concat(c); }   // build up a short string to parse
               if(s.substring(0,3) == "GET" & DoPage){    // check for the GET from the web page
                   
                     cmd=s.substring(4,6);        // get the 2 letters in the string out and call this the CMD,  /A, or /B or /H etc, these come in after the GET
                     // Serial.println("CMD=");
                     //Serial.println(cmd);
                     
         
                     // Got a GET so, compare the received command to the specific command and then do something
                     
                     if (cmd == "/A" && DoPage) {
                                Serial.println(F("Found A Pole Light on "));     
                                X10.sendCmd( hcE, 14, cmdOn );
                               DoPage = false;
                     } 
                     if (cmd == "/B" && DoPage) {
                                Serial.println(F(" Light Dim"));
                                X10.sendCmd( hcE, 14, cmdDim );
                               DoPage = false;
                     }
                     if (cmd == "/H" && DoPage) {
                                Serial.println(F(" Light Bright"));
                                X10.sendCmd( hcE, 14, cmdBright );
                               DoPage = false;
                     }
                     if (cmd == "/C" && DoPage) {
                                Serial.println(F("Found C Pole Light Off"));
                                X10.sendCmd( hcE, 14, cmdOff );
                               DoPage = false;
                     }
                     if (cmd == "/S" && DoPage) {
                                Serial.println(F("Found S  Ceiling on"));
                                X10.sendCmd( hcE, 7, cmdOn );
                               DoPage = false;
                     }
                     if (cmd =="/R" && DoPage) {
                                Serial.println(F("Found T Ceiling Off"));
                                X10.sendCmd( hcE, 7, cmdOff );
                               DoPage = false;
                     }       
                     if (cmd == "/U" && DoPage) {
                                Serial.println(F("Found U  Light on"));
                                X10.sendCmd( hcE, 8, cmdOn );
                              DoPage = false;
                     }
                     if (cmd =="/W" && DoPage) {
                                Serial.println(F("Found W pole lamp Off"));
                                X10.sendCmd( hcE, 8, cmdOff );
                               DoPage = false;
                     }       
                 
               }
       
       
              // if you've gotten to the end of the line (received a newline
              // character) and the line is blank, the http request has ended,
              // so you can send a reply
              if (c == '\n' && currentLineIsBlank) {
              // send a standard http response header
                      client.println(F("HTTP/1.1 200 OK"));
                      client.println(F("Content-Type: text/html"));
                      client.println(F("Connnection: close"));
                      client.println();
                      client.println(F("<!DOCTYPE HTML>"));
                      client.println(F("<html>"));
                      client.println(F("<head>"));
                      client.println(F("<meta content='text/html; charset=ISO-8859-1'http-equiv='content-type'>"));
                      client.println(F("<title>Walts Arduino Program"));
                      client.println(F("</title>"));
                      client.println(F("</head>"));
                      // the next line sets the background color to something nice like blue
                      client.println(F("<body style='background-color: rgb(0, 0, 153); color: rgb(255, 255, 0);'alink='#cc6600' link='#cc0000' vlink='#993300'>"));
                      //  load in a background .jpg for the web page.
                      client.println(F("<BODY BACKGROUND='http://home.comcast.net/%7EWaltschn1/Waltschn1/la_dolce_vita_near_dock_2s.jpg' style='width: 481px; height: 690px;'></span><br>"));
                      //  set up some HTML that has buttons with specific actions that link back to the arduino at the address of the arduino and have a specific string
                      client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/A\r'><INPUT TYPE='submit' VALUE='Den Pole Light On '></FORM>  "));                 
                      client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/C\r'><INPUT TYPE='submit' VALUE='Den Pole Light Off '></FORM>  "));     
                      client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/S\r'><INPUT TYPE='submit' VALUE='Den Ceiling Light On  '></FORM>  "));
                      client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/R\r'><INPUT TYPE='submit' VALUE='Den Ceiling Light Off '></FORM>  "));
                      client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/U\r'><INPUT TYPE='submit' VALUE='Den Table Light on '></FORM>  "));
                      client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/W\r'><INPUT TYPE='submit' VALUE='Den Table Light Off'></FORM>  "));   
                      client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/B\r'><INPUT TYPE='submit' VALUE='Light Dim'></FORM>  "));
                      client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/H\r'><INPUT TYPE='submit' VALUE='Light Brighten'></FORM>  "));
                      client.println("</html>");
                      // Clear out the received string
                      s="";
                      break;
                }
                if (c == '\n') {
                      currentLineIsBlank = true;
                }
                else if (c != '\r') {
                      currentLineIsBlank = false;
                }
          }
    }
    client.stop();
    Serial.println("client disonnected");
   
  }
 
}  // end
14  Topics / Home Automation and Networked Objects / X10 webserver with button control HTML video on: October 08, 2012, 06:19:54 pm
Hi,

I put a video together that explains how I control the Arduino  and X10 from any web browser.  It works app free from the ipad, iphone, windows phone or from the computer without any program other than the web browser.  I have it set up for operation locally, but I am sure it could be easily modified to run from anyplace outside.  No program required anywhere else either, so no apps, or programs running in the PC.

http://youtu.be/0a1vkSB2LQY

The Ethernet shield is plugged into the wireless router via the cable.  I have an X10 CM17A hooked up to it run the lights. The video is a bit long but explains the code.

This works pretty good.   But...

I would like to know if there is a more standard way to do this, or perhaps a simpler way. 

And, how do I put the video in to this forum so I can see it rather than just the link showing up?  I see other posts like this.

Comments/Suggestions?

Thanks,
Walt,

15  Topics / Home Automation and Networked Objects / Re: Pushing a html page to a client device when a push button is pressed on: October 07, 2012, 09:23:33 pm
Hi,

Not sure if this helps, but it works for me.  This code puts a button on the web page and then the action can take you to a different page, or can control the arduino.  If you are running a server on the Arduino, then these do the submit action which is like a specific web page request.  The labeled Button is on the web page... and it sends it to the arduino.  The arduino serves up the web page, so you don't need a separate server.

The first example code sends your browser off to google, from the arduino.

The second example, the action 192.168.1.177/A and action 192.168.1.177/B  gets you the  /A  or /B after the GET which is sent back to the server running on the Arduino.  This can be parsed out and you can then take action in the arduino code to either do the A function or the B function.

Regards,
Walt,

Code:
           client.println(F("<FORM METHOD='LINK' ACTION='http://www.google.com'><INPUT TYPE='submit' VALUE='go and google stuff'></FORM>  "));

Code:
    client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/A\r'><INPUT TYPE='submit' VALUE='Den Pole Light On '></FORM>  "));                 
client.println(F("<FORM METHOD='LINK' ACTION='http://192.168.1.177/C\r'><INPUT TYPE='submit' VALUE='Den Pole Light Off '></FORM>  "));     

         
Pages: [1] 2