Shop OBEX P1 Docs P2 Docs Learn Events
Webserver for the serial/wifi module. — Parallax Forums

Webserver for the serial/wifi module.

Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
edited 2013-05-07 16:02 in Propeller 1
Thought I'd open a thread for this project instead of posting it to the Bulkbuy thread.

Try it.. http://71.48.70.121:8080

I've added default, index.html and a 404 error page when a request isn't recognized.

Next is to write a parse for web controls.

Jeff
«1

Comments

  • TubularTubular Posts: 4,702
    edited 2012-11-25 16:14
    Nice! Works from here including the 404 page
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-25 16:15
    yes.. I saw the 404 go out.. A request for /ks

    I'm echoing the page counter and http header to my local screen. Fun to watch..

    Jeff
  • TubularTubular Posts: 4,702
    edited 2012-11-25 16:49
    Neat. So I gather the prop could parse the requested page and respond to commands without breaking a sweat.

    I about to be doing some work with video servers, a 4 channel one ideally. One channel could be video direct from a prop, you could embed the ip address of that into the page you serve up for added effect (you don't have to serve video, only the ip address of where to fetch the video stream, if that makes sense)
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-25 16:58
    I can see that working..

    Something tells me I should have used a long instead of a byte for the page counter. 27 hits already in the last 30 mins. :)

    Edit: Just watched the googlebot(at)googlebot.com try to grab the robots.txt. heh..

    Edit2: Ok, which one of you wiseguys asked for xxx.htm? :)

    Someone's doing a repeated refresh. The byte counter will be revealed and roll over soon. :)

    Edit4: i_know_you_are_reading_these.htm. LOL..
    Jeff
  • msrobotsmsrobots Posts: 3,709
    edited 2012-11-25 17:31
    Hi Jeff,

    works perfectly .. and pretty small spin-code.

    I went thru both manuals and - hey this thing is fun ... you can use it s accesspoint also! A Prop-Router!

    VERY nice find. I am sure I will need more of them. 200ma at 3.3 is ok - I need to test the range.

    As you said the configurtion over web-interface works flawlessly and then you need just serial on the prop.

    This WIFI-serial-Adapter is FUN. RSS-Reader? FTP-Server/Client? Hell yes I like this Module.

    You even can run 2 different ports/wan-interfaces at the same time? And you have a ethernet-HW-port on the header. 1 MBYTE buffer for serial io...

    Deep down in the documenttion is a virtual-com-port mentioned. I will look into that. And it is stated that it needs up to 10 seconds to boot its LINUX. (!).

    Unfortuneatly I am still busy with paid work, so very less time for Propeller...

    Enjoy!

    Mike
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-25 17:44
    I'm sitting here tonight, watch you guys slam this sever and designing a little breakout board for these with a more friendly header.

    These appear to be 14pin Hirose DF11-series 2mm connectors.

    Boot/reconnect time here has been around 3-5 seconds pretty consistently.

    Jeff
  • D.PD.P Posts: 790
    edited 2012-11-25 17:56
    FF 16.0.2 and Safari 5.1.7 so empty screens while Chrome Version 23.0.1271.64 works correctly on OSX 10.6.8?

    I think you may have some mal-formed html?

    dp

    emptyscreen.jpg
    944 x 774 - 218K
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-25 18:19
    I've done all my testing with Chrome/Firefox under Linux and the code is hand-coded, so anything is possible. :)

    Edit: It's more likely that my abbreviated headers might be a little too small.

    Jeff
  • kuronekokuroneko Posts: 3,623
    edited 2012-11-25 19:19
    I get something (FF/win32) but the HTML code is preceded by ~500 space/linefeed pairs which FF chokes on. Does that ring a bell?

    IE is fine (ignores the extra stuff).
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-25 19:32
    The 500 space/linefeed pairs were a trick to get the timing right. It's working on Chrome. Time to check FF again.

    Led is connected now.

    Jeff
  • msrobotsmsrobots Posts: 3,709
    edited 2012-11-25 20:41
    Jeff,

    two things.

    first: I think setting content-lenght in the header is essential.

    second:You have CRLF reversed in the DATsection .. try 13,10 not 10,13

    no time yet ... more tommorrow...

    Mike
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-11-25 21:05
    Firefox on Linux: I get all those blank lines, follwed by a display of the HTML source. IOW, the HTML does not get parsed.

    -Phil
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-25 21:25
    Sorry guys, I was looking away for a while.. finishing up a RevA adapter board for this module.

    @mike, yes, those were backwards.. (fixed in my verison)

    The issue with the 500 CR/LF has to do with buffer. I've removed it from the main page, and now it loads without them, but the page isn't displayed until the socket times out. Reading into the settings a little more.

    Jeff
  • Mike GMike G Posts: 2,702
    edited 2012-11-26 10:27
    At the TCP level, send the FIN flag which is a bit in the TCP header. This flag lets the client know no more data is being sent. You might find something in the docs related to FIN.

    At a browser level, do not send the content-length: header. I'm not sure what, if any, header fields are being sent as URL is not currently up. Info just in case...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-26 11:18
    Ah, an expert appears! Thanks MikeG!

    These devices appear to accept raw TCP data, I just haven't gotten to that page yet.

    Jeff
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-26 15:12
    Just put it back online tonight..

    Going back to creating a parsing routine. Feel free to grep it while I'm coding. :)

    Jeff
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-11-26 15:20
    Neat Jeff!
    Yesterday when I tried I only received a page with the details. I like setting the led on/off.
  • doggiedocdoggiedoc Posts: 2,241
    edited 2012-11-26 15:31
    Very cool Jeff. My unit came in the mail today! I look forward to experimenting with it.

    Maybe I should get a couple of more on bulk buy #2 :D
  • msrobotsmsrobots Posts: 3,709
    edited 2012-11-26 15:33
    @Mike G,

    why NOT setting content-lenght in the header? Are you not exactly doing this in response.spin on the spinnerette?

    slightly confused

    Mike
  • Mike GMike G Posts: 2,702
    edited 2012-11-26 15:59
    why NOT setting content-lenght in the header? Are you not exactly doing this in response.spin on the spinnerette?

    slightly confused

    You are correct. I do send content-length: in the POST responses. The browser can figure out the end of an HTTP GET response.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-26 16:36
    Hey Mike..

    Does that content-length include the byte count on the headers themselves?

    Jeff
  • Mike GMike G Posts: 2,702
    edited 2012-11-26 17:09
    No, just the body.
  • dgatelydgately Posts: 1,630
    edited 2012-11-26 17:17
    Just put it back online tonight..
    Jeff

    Able to get to it and toggle the LED from Safari on Mac OS X (which was not successful, yesterday)...

    Not having as much luck getting mine to show me a web page yet. After going through the config steps from the PropellerPowered forum, I was able to talk to the server via telnet, so I know that it's basically there. When I try to reach the server from the web, I get the server's config-mode pages. I'll download your next code drop and try again...

    dgately
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-26 17:21
    @dgately,

    The unit defaults to port 80 for it's config-mode. I'll have to ask the factory if they could do an update which allows us to change this port, as I haven't found it in the instructions. I have mine set to 8080 for this reason.

    Some routers will allow you to redirect one external port to a different internal port which may also solve the problem as well.

    Jeff
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-26 18:43
    Mike G wrote: »
    No, just the body.

    Ah, so if we just read the file from the SD card, we could count the bytes and know where we are going.

    Jeff
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-11-26 19:00
    For pages that are generated dynamically by hosts without adequate memory to hold the entire page beforehand, it's best just to omit the Content-length header. The client won't know how much more data has to arrive before it's finished, but that's not really a huge deal.

    -Phil
  • Don MDon M Posts: 1,652
    edited 2012-12-27 11:17
    I started playing with this module and sample webserver. I was successful in getting it to work with my wireless network and I can access it's page via its assigned IP address. However I cannot get it to communicate with the terminal program. I am not using the VGA setup but am using PST instead. I send the +++ and get nothing in return.

    I confirmed that the baud rate on the WiFi setup page was set to 57600 baud as in the program. I even changed it to 115200 just to test but still no go. All I get is the opening titlescreen from the program.

    Also I notice that the module runs a little warm. Is that normal?

    And yes I tried switching the Tx/Rx pins too.

    Any suggestions?
  • Don MDon M Posts: 1,652
    edited 2012-12-27 11:43
    Oops... I think I know what I'm doing wrong... i'm supposed to send +++ via telnet from another terminal correct?
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-12-27 18:51
    Yes, I used another terminal program to configure the Serial Wifi device, then loaded the webserver spincode.

    Jeff
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-05-06 13:33
    I just received my Wi-Fi module and adapter. Where do I go to find the wiring for a Prop BOE and to get it all set up?

    Edit: I found the link to the setup page but I am a bit lost!!!! Is there any way around using VGA, such as can I just use a debug screen or something? If not, If I am using a Prop BOE, is Pin 16 the correct pin for the VGA adapter? Next, do I have to make the connections on the Single row header or just the double (on the Serial/Wi-Fi adapter board)? If someone has a picture of how this is wired up I would greatly appreciate it if you could post it.
Sign In or Register to comment.