Shop OBEX P1 Docs P2 Docs Learn Events
QuickStart W5200 IO Demo Available? — Parallax Forums

QuickStart W5200 IO Demo Available?

Jon KeinathJon Keinath Posts: 146
edited 2015-01-06 10:06 in Accessories
Is there a simple W5200 demo available showing what is required to have the prop respond to an input (GET) from a webpage. For example toggle one of the QuickStart's LEDs when clicking a link with a GET request? I have found plenty of examples for viewing variables generated from the prop, but have not had success finding one for the other way around.

If one doesn't exist I'll keep experimenting with all the info available. I can probably figure it out. If I do I'll definitely create a demo and post it...

My W5200 with simple demo information should be available here (if my firewall is configured correctly)...

http://97.84.219.12:8080/

Thanks!

Comments

  • LtechLtech Posts: 380
    edited 2014-12-27 02:10
    Yes I can read it in Belgium
    It refresh every 2 sec
  • tjwebertjweber Posts: 20
    edited 2014-12-28 19:04
    Jon,

    I'm trying to replicate what you've done using the Simple_server demo code. The demo code works correctly when I use my browser to access wiznet on my LAN. I think the issue I'm having is with my router configuration.

    Would you be able to outline what steps you took to setup your router so that your wiznet was accessible from the internet? I've run out of ideas to try setting up port forwarding.

    Thanks,
    Tom
  • MoskogMoskog Posts: 554
    edited 2014-12-29 02:02
    tjweber
    The Attached jpg file show the portforwarding on my router. It should not be more complicated then that, as long as you can access Your quickstart or spinneret on your domestic network. The spinneret is the device Connected to port 5000 with its own intern ip address.If you are using port 5000 or anything else to access quickstart/spinneret from outside your network you have to add the :5000 to your current wan ip address like Jon also does. If you use port 80, like my PINK on the first line, that should not be necessary.




    portforwarding.jpg
    1024 x 346 - 67K
  • MoskogMoskog Posts: 554
    edited 2014-12-29 02:30
    Jon
    MikeG used to have a Spinneret server tutorial available on his own Spinneret some time ago where you could do exactly what you say, to turn of an on an LED on the Spinneret PCB. That was very helpful but I cant seem to find it no more. There is a chance I do have the files saved on one of my other computers so I can take a look and post them if no one responds before me. I Guess that .spin-file should probably be easy to modify for the wisnet 5200 on the quickstart. On the corresponding html-file you could send the commands via internet.

    OK, look at MikeG's web server w5100: https://code.google.com/p/propeller-w5200-driver/source/browse/trunk/%20propeller-w5200-driver/Spinneret/WebServer_W5100.spin

    and also http://forums.parallax.com/attachment.php?attachmentid=109570&d=1405074625 for the html files. I think epin.htm was the page where you could manipulate pins on the spinneret.
  • tjwebertjweber Posts: 20
    edited 2014-12-30 18:33
    Jon,

    Thanks for the screen shot. It helped, but I still have a problem somewhere else. Looks like I need learn a bit more about networking.

    Thanks again,
    Tom
  • Jon KeinathJon Keinath Posts: 146
    edited 2014-12-30 19:12
    What router do you have? That may help. By the way, it was Moskog who posted the screenshot.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-12-30 20:19
    @tjweber, Are you using a static IP? If so, which router are you using and also which port? Several ISP's will block port 80. If you have a DMZ setting on your router try enabling it for the specific IP address you are trying to access just to see if it works. Keep in mind that unless you have a Loop Back Network internally, an outside static ip address will not be accessible from inside.
  • tjwebertjweber Posts: 20
    edited 2014-12-31 14:39
    I am using a static IP and the router is a DLink DIR-601.

    The attachment shows my setup for both the DMZ and port forwarding.

    I've tried accessing from outside my network (includes a quick test with my firewall turned off0. The message "Unable to connect" is displayed.


    http://76.185.192.5:8080
    700 x 250 - 32K
  • Jon KeinathJon Keinath Posts: 146
    edited 2014-12-31 15:33
    You need to set up a port forward to direct the port 8080 to the port 80. Or just try accessing without the :8080 at the end. http://76.185.192.5 it worked for me from here.
  • MoskogMoskog Posts: 554
    edited 2014-12-31 16:13
    Works from here too:

    Testing simple_server.spin

    This is a test: 828652


    Btw Happy New Year!
  • tjwebertjweber Posts: 20
    edited 2014-12-31 17:45
    Everyone,

    Thanks for all the help. I tried again by leaving off the port number and it now works for me too.

    Now all we need is someone to help Jon with his original post.

    Thanks again,
    Tom
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-12-31 18:24
    Now you need to disable the DMZ. You do not want that enabled unless absolutely sure of what you are doing as it will open up your system to hacks. Once you do that test again from outside and it should work fine.
  • tjwebertjweber Posts: 20
    edited 2014-12-31 18:48
    DMZ is disable and things are still working.

    Thanks Andy,

    Tom
  • Jon KeinathJon Keinath Posts: 146
    edited 2014-12-31 19:12
    Works here too. I haven't had a chance to do any testing with the additional information above. I'll probably get to it in the next couple days.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-12-31 19:20
    Works fine on Port 8080 on my end. The fun part is getting LED's to turn on and off!!!! I did not do this with the WizNet but have used the Spinneret and the PINK for this. Mike G's samples work great and the Serverbeer site is awesome!!! I will see if I can find the link.
  • MoskogMoskog Posts: 554
    edited 2015-01-01 01:31
    Seems like Mike G's serverbeer site is no longer available, I found something here:

    http://code.google.com/p/spinneret-web-server/source/browse/trunk/MultiSocketServer_MikeG/TutorialSourceArchives/#TutorialSourceArchives%253Fstate%253Dclosed

    The problem [for me] is to download the zip files from this site, I haven't found the key yet.
  • Jon KeinathJon Keinath Posts: 146
    edited 2015-01-03 15:27
    I had a chance to do some more testing but I still have not been able to determine what is required to be able to control an LED attached to the propeller. My research lead me to the following additional information:

    I found a html file http://192.168.1.156/led.htm in the documentation that appears to be the beginning of controlling an LED.

    If I use the sample code I can get the following output in the terminal which looks promising:
    COG[0]: QuickStart Web Server v1.2
    COG[1]: Parallax Serial Terminal
    COG[2]: Starting SD Driver
            Mount SD Card - OK
            Init RTC: 01/03/2015 16:17:38
    COG[3]: Started W5200 SPI Driver
            WizNet 5200 Firmware v3
    COG[4]: Started Touch Demo
    COG[5]: Loaded Touch Demo PASM
    COG[n]: 6 COGs in Use
    ---------------------------------------------------
    
    Retrieving Network Parameters...Please Wait
    ---------------------------------------------------
    Assigned IP.......192.168.1.156
    Lease Time........86400 (seconds)
    DNS Server........192.168.1.1
    DHCP Server.......192.168.1.1
    Router............192.168.1.1
    Gateway...........192.168.1.1
    
    Sync RTC with Time Server
    ---------------------------------------------------
    Remote IP.........64.113.32.5
    Web time..........01/03/2015 16:17:40(GMT - 7:00) 
    DHCP Renew........04:00:00
    
    Initialize Sockets
    ---------------------------------------------------
    Socket 0 Port.....80; MTU=1460; TTL=128
    Socket 1 Port.....80; MTU=1460; TTL=128
    Socket 2 Port.....80; MTU=1460; TTL=128
    Socket 3 Port.....80; MTU=1460; TTL=128
    Socket 4 Port.....80; MTU=1460; TTL=128
    Socket 5 Port.....80; MTU=1460; TTL=128
    Socket 6 Port.....80; MTU=1460; TTL=128
    
    Start Socket Services
    GET /led.htm?led=on HTTP/1.1
    Host: 192.168.1.156
    Connection: keep-alive
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36
    Referer: http://192.168.1.156/led.htm?led=off
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: en-US,en;q=0.8
    
    GET /led.htm?led=off HTTP/1.1
    Host: 192.168.1.156
    Connection: keep-alive
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36
    Referer: http://192.168.1.156/led.htm?led=on
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: en-US,en;q=0.8
    

    I think all I need to do know is find out how to process the line
    GET /led.htm?led=on HTTP/1.1
    
    and have the P1 react to this, any ideas on how to parse this line and get the on/off value into a spin variable to allow control of the LED?
  • Jon KeinathJon Keinath Posts: 146
    edited 2015-01-03 18:49
    I've got it working...

    http://97.84.219.12:8080/led.htm

    If you click the links the LEDs on my QuickStart will either all turn on or all turn off.

    I added the following code into the "Webserver_W5200_RTC.spin" code under the line "fn := req.GetFile:Name" around line 320:
     xn := req.Get(string("led"))
      
        if(strcomp(xn,string("on")))
            'pst.Str(string(CR, "ON FOUND"))
            dira[23..16]~~
            outa[23..16] := %1111_1111
        
        if(strcomp(xn,string("off")))
            'pst.Str(string(CR, "OFF FOUND"))
            dira[23..16]~~
            outa[23..16] := %0000_0000   
    

    Now to work up a full tutorial post so others can repeat...
  • Jon KeinathJon Keinath Posts: 146
    edited 2015-01-05 09:48
    Can anyone verify that the following link works on their devices? Please let me know what you tried it on, and please try multiple pages (like the LED test page).

    http://97.84.219.12:8080/

    It works fine (no issues) on my PC with Chrome and IE, however it rarely works with Chrome or "Browser" on my Android smart phone.

    What is even weirder is that, when manually typing in the LED ON or LED OFF link will cause the LEDs to turn on or off (respectively) however the page never appears in the browser. Any idea on what would cause this? I have ruled out a CSS issue as I removed the CSS and the problem remains the same.

    Thanks!
  • NWCCTVNWCCTV Posts: 3,629
    edited 2015-01-05 09:59
    It seemed to have worked from my end. Not sure about that device, but I know when I played around with my Spinneret with similar code I had weird things that happened on internal network also. It seemed that some times the LED's would go on or off by themselves!!!! I never really investigated too much as I was just happy it was working!!!
  • PublisonPublison Posts: 12,366
    edited 2015-01-05 10:11
    Can anyone verify that the following link works on their devices? Please let me know what you tried it on, and please try multiple pages (like the LED test page).

    http://97.84.219.12:8080/

    It works fine (no issues) on my PC with Chrome and IE, however it rarely works with Chrome or "Browser" on my Android smart phone.

    What is even weirder is that, when manually typing in the LED ON or LED OFF link will cause the LEDs to turn on or off (respectively) however the page never appears in the browser. Any idea on what would cause this? I have ruled out a CSS issue as I removed the CSS and the problem remains the same.

    Thanks!

    Works OK on PC Windows 7 Pro Service Pack 1 with Chrome Version 39.0.2171.95 m

    Does not work on HP Stream 7 Tablet Windows 8.1 with Chrome.
  • tjwebertjweber Posts: 20
    edited 2015-01-05 17:51
    Jon,

    I look forward to your tutorial.

    I've tried the above link, but the connection times out.

    Tom
  • Jon KeinathJon Keinath Posts: 146
    edited 2015-01-06 10:00
    NWCCTV wrote: »
    It seemed that some times the LED's would go on or off by themselves!!!!

    Could this have been a bot (Google Bot, etc.) searching the page? During testing with the debug window open I noticed a couple requests coming from the Google bot. This could explain it if you had any links from other pages available like I do.
  • Jon KeinathJon Keinath Posts: 146
    edited 2015-01-06 10:06
    tjweber wrote: »
    I've tried the above link, but the connection times out.

    If the page simply timed out, you probably tried accessing it after I had disconnected it from the network. It is currently still disconnected. I have an idea on how to indicate this (device disconnected) with the help of an additional web server. Hopefully I have a chance to implement this soon.

    I was going to try and get the tutorial complete, but now that I found an issue with the non PC devices connecting reliably I'm going to delay and do some more troubleshooting.
Sign In or Register to comment.