Connect with us

Wifi webserver

Discussion in 'Radio and Wireless' started by Divedeep, May 1, 2014.

Scroll to continue with content
  1. Divedeep


    Feb 2, 2014

    I am looking to build a webserver to display information incoming from a number of sensors.

    I have purchased a RN-171XV which will arrive tomorrow.

    I have been looking for some decent info on what i need to do to setup a webserver but information seems to be hard to come by.
    Does anyone have any idea of what i need to do to the wifi module to get it ready and then to send data over wifi?

    Im not looking for all the ins and outs, just a guide of whats required. From there i can work out what commands are needed etc and how the website data needs to be sent.

    I am thinking UDP is the best option to transfer data. Is there any reason why i shouldnt??
  2. kpatz


    Feb 24, 2014
    Looking at the RN-171XV on the web, I see: "Onboard TCP/IP stack includes DHCP, UDP, DNS, ARP, ICMP, HTTP client, FTP client and TCP". You would have to implement an HTTP server. The basic protocol isn't that complicated, it just accepts a connection from a client (browser) which sends a command such as "GET" and then the server responds with HTTP headers and then data, then closes the connection.

    HTTP works over TCP, usually on port 80. UDP isn't useful for a web server.
  3. Divedeep


    Feb 2, 2014
    Implementing the webserver i think i could do. it seems that all i have to do is look out for a get command and then reply to it with a header and the relevant data.
    Im not sure how the device is set to become an access point or server. Also im not sure what settings(if any) i need to change to allow incoming connections.

    Another thing im looking for an answer on is how the connection works. lets say i send a GET command from my PC, the webserver will send the relevant data. If another device were to also then send a GET command, does the webserver know the difference between the devices?? if so how??
  4. kpatz


    Feb 24, 2014
    The datasheet and documentation should explain how to set it up to connect to (or create) a WiFi network.

    To make it a server, you just need to have it "listen" for connections on a TCP port, such as 80 for a webserver.

    If more than one device connects, they will be separate TCP connections. Assuming the TCP/IP stack supports multiple connections, your webserver would see two separate connection requests, with some sort of unique identifier for each. Then when you receive and send data, you'd use that identifier to tell it which connection you're working with.

    If the stack doesn't support multiple simultaneous connections, a 2nd connection attempt would be refused until the first one finishes and is closed.
  5. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    Jan 21, 2010
    By definition, "web" is TCP/IP connections normally through port 80.

    If you want to know how to receive data from your sensors, then UDP is one possibility. However UDP is a send and forget protocol with no assurance that the packets will arrive, and if they do arrive, there is no assurance that they will arrive in order. Use such low level protocols (especially raw UDP) is pretty rare.
  6. Divedeep


    Feb 2, 2014

    I have got me a RN-XV module set up and acting as an access point. I can connect to it and i can see that ip addresses are assigned to connected devices. When i goto the server from a browser ,i.e i get an *OPEN**GET* on the serial output, this would indicate that it has received a get command from the browser??

    When i try to send data back nothing happens. My browser doesnt update and the connection just stays open until i close the browser.

    Anyone have any idea whats happening abd what im supposed ti do from here??
  7. shumifan50


    Jan 16, 2014
    I have not used that module from Microchip, but I did use their TCP/IP stack on one of their other WiFi modules (can;t give the part without going digging). I found it somewhat unstable with connections dropping and sometimes failing to connect. The TCP/IP stack I used was the cooperative multi-processing stack implementation, which also implements the websserver, so maybe yours is different. On that stack sending stuff was quite painful and I had to be careful of flooding the WiFi module. On the other hand, using the same stack through a WiFi router worked reliably. I did not spend too much time on the WiFi module, so maybe I could have made it more reliable, but it did not matter too much in my project(model trains), so I went with the router - not as elegant but much more reliable.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day