Announcement

Collapse
No announcement yet.

How to use XPico WiFi shield as web browser

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use XPico WiFi shield as web browser

    xPico Arduino Shield
    The xPico shield is mounted on a UNO board and linked to the Serial port of the Uno board. The Uno is programmed to send this string "S123.45 123.45" which basically is Analog 0 and 1 input , once every 100 millisecond. That's happening when checked through Putty .

    The xPico AP0 and WLAN0 interfaces are all configured and the xPico WLAN and my laptop are connected to the same router ( WiFi).

    I am able to read the data stream on telnet on the AP as well as WLAN.

    I just want to know what needs to be added to the data stream to the datastrem to be able to view it on a browser ? Its enough if I am just able to type in the XPico IP address + port in this browser address bar and see the data as a simple text stream. I can then ask a web designer to create the required user interface to show the data
    Last edited by MogaRaghu; 02-22-2017, 02:30 PM. Reason: Add solved to Subject ..

  • #2
    Looks like you have Line 1 in the xPico Wi-Fi configured for Tunnel. That allows for a transparent connection between the serial port and a TCP connection (in your case Telnet, using Putty).

    However, a browser doesn't transfer data like that, but uses HTTP. You will need to change the protocol of Line 1 to something that can be more easily converted to HTTP.

    See this page:
    http://wiki.lantronix.com/developer/...erialPortSetup

    If the Arduino is constantly sending data, then look at the Monitor protocol (http://wiki.lantronix.com/developer/XPicoWiFi/Monitor). If you need more control from the browser, then look at Web to Serial (http://wiki.lantronix.com/developer/...WebAPItoDevice and https://github.com/Lantronix/xpwJSlib)

    Mariano

    Comment


    • #3
      Looks like its not going to be easy...

      Mariano,

      Thanks for your detailed support post. While I read all of the links, I must admit that I need to first learn HTTP ... something which I am not familiar with. Also it looks converting the stream data from Serial to be viewed on a browser involves other languages like Java.

      Just to get started is there any sample Arduino sketch that does this where data streamed from the serial port updates on a browser periodically?? There is one such example sketch called WebServer.ino which uses the Ethernet interface of a Arduino shield.

      I just happened to locate a good article on the web . Would this do the job ? https://www.tigoe.com/pcomp/code/arduinowiring/1109/
      Last edited by MogaRaghu; 02-17-2017, 03:01 PM. Reason: Add more info...

      Comment


      • #4
        Mogaraghu,
        We have exact example code for this feature. So I would like to suggest you to download the code into xPico-wifi and modify the code to learn it. I think this is the fast way to get familiar with web developping.I checked the link you gave.Its samiliar but you still need to modify the code like the function names all are not same. so please download the code from the link that Mariano shared.

        Comment


        • #5
          I guess this is THE link...

          Leowang... thanks for the response.

          The post by Mariano was very useful to understand more about the X-Pico WiFi.

          When you ask for me to download the link and try is this the one you are referring to : https://github.com/Lantronix/xpwJSlib

          ( Other links are more like documents )

          Please confirm..

          Comment


          • #6
            Yes. you are right. from the link: https://github.com/Lantronix/xpwJSlib
            download it and upload it to xPico-wifi over Webserver page. find the 'filesystem' ,creat 'http' folder then upload it. you can follow the instruction from the wiki link or send me email to get assist how to do it.
            my email: LeoWang@lantronix.com

            Comment


            • #7
              Files uploaded ... but not being served

              Hi Leowang,

              Follwing your guideline i was able to upload the relevant files from the GitHub repository link. The http directory was created. And into that i had uploaded chat.html, serial.html, gpio.html, quickConnect.html, xpwLib.js. I even restarted the XPico to confirm if the loaded files are there. They were very much there.

              After doing this i typed the following in the Chrome browser which was still connected to the XPico WiFi. http://192.168.0.1/serial.html

              But i got a 400 error saying its a bad request. Have i missed or did something wrong ?

              Thanks

              Comment


              • #8
                guess you missed one part-----Important configuration: To use the Web to Serial function, the Line configuration must be set to None so that there is no conflict with other serial applications (like Mux or Monitor, for example).

                Comment


                • #9
                  Line set to None... yet no luck.

                  OK i did manage to set both Line 1 and Line 2 to NONE and tried again.

                  Still i get the same Bad Request error.

                  Tried with IE9 and Chrome with same verdict...

                  I am running firmware Version : 1.1.0.2R10. Let me upgrade to 1.4.0.0R28 and again check ?

                  Comment


                  • #10
                    Problem Solved...!!

                    I went ahead and upgraded the firmware to the latest one and immediately the Serial.html worked fine. Checkout all other sample pages also. Fine.

                    I think i can develop my own custom web page to visualize the Serial data that i am sending. Is there any limitation on the kind of web page that can be loaded ( within the 3MB space ) ?

                    I also suppose i can control the GPIO from the web interface ??

                    Thanks Leowang !!

                    Comment


                    • #11
                      Yes. you can use web interface to control the GPIO. also Has limitation for web. xPicowifi has 1MB Flash ,128 KB SRAM and 8MB SPI Flash storage.

                      Comment


                      • #12
                        Please clarify on the Flash size

                        >>Has limitation for web. xPicowifi has 1MB Flash ,128 KB SRAM and 8MB SPI Flash storage.

                        COuld you please clarify on following ?

                        1. What is the actual size of total web pages that I can load ? 1 MB ??

                        2. 8MB Flash storage is used for what ? If your firmware resides on this space how much more is balance ?

                        Thanks

                        Comment


                        • #13
                          Nope,
                          Please check available space on the webserver:
                          go to the File System Status page. you can see the detail info:
                          so the max space left for you is 386372 Bytes
                          Property Status
                          File System Size: 389120 Bytes
                          Available Space: 386372 Bytes
                          Clean Space: 377832 Bytes
                          Dirty Space: 8540 Bytes
                          Total Space Used: 2748 Bytes
                          Data Space Used: 2531 Bytes

                          Comment


                          • #14
                            Connecting X-Pico via Static IP router

                            OK its clear now Leowang. Thanks.

                            I have now set up the X-Pico with a WLAN address of 192.168.1.150

                            My home WiFi router to which the X-Pico is linked has a static Public IP which is xxx.yyy.zz.171

                            I have carried out a Port Forwarding on my home router on port 900 to direct incoming traffic to the X-Pico @ 192.168.1.150. ( Camera is on port 800 and works fine - so Router is good )

                            Now I log on to another WiFi network and type http://xxx.yyy.zz.171:900/serial.html in a browser

                            I get a message : "Server refused to connect !! "

                            Am I doing something wrong ??

                            ( Except above if I log on to my Home router on which the X-Pico is linked and type 192.168.1.150/serial.html , it works well )

                            Comment

                            Working...
                            X