Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    How potential buyers could insert WIFI-parameters

    Scheduled Pinned Locked Moved Discussion
    wifiinformation
    25 Posts 12 Posters 7.6k Views 15 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jmarcelino @lsoria
      last edited by

      Hi @lsoria

      There's a fantastic web server already for MicroPython by Jean-Christophe Bos. Check out https://github.com/jczic/MicroWebSrv

      Works perfectly on our boards.

      L 1 Reply Last reply Reply Quote 1
      • L Offline
        lsoria @jmarcelino
        last edited by

        Hi @jmarcelino, thank you for your reply. The troubles I have experienced were because of that repository. It seems really great because of the functionalities ot offers, but unfortunately I wasn't able to run even the example it provides. It always fails to import MicroWebSrv (even if I copy all the files to the LoPy flash). Mi theory is that my device runs out of memory, but I cannot prove it since I don't have a LoPy4 (and there is not stock nowadays, at least in Mouser). If you want I'll post the Terminal output after I run the script, to see what it throws. Perhaps there is something more I could have missed.

        Actually my attempts to embed a webserver are based on the link that @seb sent. I made a rudimentary function to process GET request, but I am not having luck at detecting POST requests. But I would like to use something more "correct" and standard.

        sebS 1 Reply Last reply Reply Quote 0
        • sebS Offline
          seb @lsoria
          last edited by

          @lsoria
          If you could post the whole error message you get, we can help you get it working. Did you copy the library into lib/microWebSrv.py.py?

          L 1 Reply Last reply Reply Quote 0
          • L Offline
            lsoria @seb
            last edited by

            Hi @seb, here there are the captures from the filezilla client:
            0_1519129920549_filezilla1.PNG
            On the left side there is the folder clonned from the repo. on the righht side the root folder of the device. I've copied microWebSocket.py, microWebSrv.py and microWebTemplate.py inside lib/ folder as it follows:
            0_1519130077038_filezilla2.PNG

            Then I go to Visual Studio Code, and run main.py. The first time throws this message:
            0_1519130263987_consola1.PNG
            And the second time this:
            0_1519130291029_consola2.PNG
            If I check the available memory I get values similar to this:
            0_1519130342212_consola3.PNG

            Am I following the right steps? Or my LoPy is really out of memory?

            Thank you in advance, and sorry if I'm distorting the meaning of this thread.

            sebS 1 Reply Last reply Reply Quote 0
            • sebS Offline
              seb @lsoria
              last edited by

              @lsoria

              The first error is caused by your module running out of RAM, try minimising how much HTML you are presenting to lower the memory requirements.

              Secondly can share your main.py code so I can check what you are trying to run.

              L 1 Reply Last reply Reply Quote 0
              • R Offline
                rskoniec @jmarcelino
                last edited by

                @jmarcelino said in How potential buyers could insert WIFI-parameters:

                @rskoniec

                Sure I'll get this up ASAP.

                Any update (ETA) on this?

                The machine is working as good as it's code.

                1 Reply Last reply Reply Quote 0
                • L Offline
                  lsoria @seb
                  last edited by

                  @seb my main.py is the same as the official repo:

                  https://github.com/jczic/MicroWebSrv/blob/master/main.py

                  I've ordered some LoPy4. I'll try the same code when they arrive. for the moment I've managed to process POST request by hand, based on the next example, mixed with the given in the page you shared:
                  https://github.com/RinusW/WiPy/blob/master/AiCWebserver/AiCWebserv.py

                  J 1 Reply Last reply Reply Quote 0
                  • J Offline
                    JohnPiantanida @lsoria
                    last edited by

                    @lsoria I know old thread... but I just found out about AiCWebserv and was trying to get it to work. Did you have any luck with it? I've gotten other webserver examples to work, but not this one (yet).

                    https://github.com/RinusW/WiPy/blob/master/AiCWebserver/AiCWebserv.py

                    Looking for someone who has got it working. I am using a WiPy 3 on a pysense board.

                    C 1 Reply Last reply Reply Quote 0
                    • C Offline
                      cmisztur @JohnPiantanida
                      last edited by

                      @johnpiantanida ESP-IDF has 3 ways of provisioning the network, but not sure if any are supported by Pycom FW.

                      ● Soft AP
                      ○ Manual Wi-Fi change on iOS
                      ● Bluetooth
                      ○ Larger flash footprint
                      ● Smart-Config

                      if (conn_mgr_prov_is_provisioned(&provisioned) != ESP_OK) {  return; }
                      if (! provisioned) 
                      {     
                       /* Starting provisioning */     
                       conn_mgr_prov_start_provisioning(prov_type, security, pop, service_name, service_key); 
                      } else {     
                       /* Start the station */     
                       wifi_init_sta(); 
                      } 
                      
                      esp_err_t event_handler(void *ctx, system_event_t *event)  
                      {      
                       conn_mgr_prov_event_handler(ctx, event);          
                       switch(event->event_id) {      
                        case SYSTEM_EVENT_STA_START: 
                      … 
                      … 
                      … 
                      
                      1 Reply Last reply Reply Quote 0
                      • A Offline
                        andreas @misterlisty
                        last edited by

                        Dear @misterlisty,

                        the other day, you made a remark here that you are using Bluetooth and a standard BLE scanner app to update the WiFi credentials. We also believe this would be a perfect solution unless the Smart Config option might get unlocked through ESP-TOUCH at some point in the future.

                        As you told us that it even works really well and you might be able to share the code, we are humbly asking if you could give us some pointers regarding that.

                        The background of our question is that we are in the process of conceiving a convenient datalogger application [1] for the Hiveeyes project [2] which is well suitable to be used for other environmental purposes beyond monitoring bee hives. We will be happy when this might spark your interest.

                        With kind regards,
                        Andreas.

                        [1] https://github.com/hiveeyes/hiveeyes-micropython-firmware
                        [2] https://community.hiveeyes.org/

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom