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.
    • A Offline
      Andy_N.
      last edited by

      Hi there,
      we want to develop an iot-device and made our first tries with the GPY. They run ok.
      One Problem what we are thinking about ist how a potential buyer, who has no ecperience with programming and u-controller stuff, will be able to insert his wifi- information into our script on the Pycom-board.We want to send the sensor-data by using MQTT. So we need connection to the internet over the wifi the customer has.
      Does anyone have experience in the field? Is there a solution?
      We thought of programming a mobilephone-app where you can insert this information and sending them via bluetooth to the Board. Ist this possible?
      But this would be a great effort.
      Does this maybe work with ne Pymate-app(Unfortunately not available for GPY)?

      Thanks
      Andy

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jmarcelino @Andy_N.
        last edited by jmarcelino

        Hi @andy_n,

        We've been successful with this flow:

        • GPy first boots in "setup mode": WiFi is in WLAN.AP with your product name as SSID
        • Setup mode also starts a small micro webserver
        • Users connects phone/computer to this setup SSID and opens browser to 192.168.4.1 for example
        • Micro webserver scans for nearby WiFi networks and shows webpage with this list for user to select
        • Corresponding WiFi password is also requested
        • The SSID and Password are recorded and GPy re-initializes into main script using the new stored settings.

        Bluetooth is another option but as you say you'd need to write mobile apps to support it. We don't yet have a generic app that works for this.

        R J R L 4 Replies Last reply Reply Quote 1
        • R Offline
          rskoniec @jmarcelino
          last edited by

          @jmarcelino Sounds interesting. Any chance for the code? ;o)

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

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

            @rskoniec

            Sure I'll get this up ASAP.

            R 2 Replies Last reply Reply Quote 0
            • R Offline
              rskoniec @jmarcelino
              last edited by

              @jmarcelino Thank you!

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

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jiemde Pybytes Beta @jmarcelino
                last edited by

                Hi @jmarcelino I' m developping an NFC interface with the NTAG I2C from NXP, so you can transfer the necessary informations with your phone.

                J 1 Reply Last reply Reply Quote 0
                • J Offline
                  jmarcelino @Jiemde
                  last edited by

                  @jiemde
                  i don’t think that strategy works with iPhones

                  J 2 Replies Last reply Reply Quote 0
                  • J Offline
                    Jiemde Pybytes Beta @jmarcelino
                    last edited by

                    Hi @jmarcelino I thing that the new Iphone have NFC ( from NXP )

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jiemde Pybytes Beta @jmarcelino
                      last edited by

                      Hi @jmarcelino after some investigations they can read but no write NFC tag, so you're right. But it's work with Androïd without problem

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

                        @jmarcelino Great! I'm trying the same but I'm really novice here.. keep us posted ;)

                        1 Reply Last reply Reply Quote 0
                        • M Offline
                          misterlisty
                          last edited by

                          I have a method that works really well, i enable bluetooth and use a standard BLE scanner app to update the wifi credentials..works really well and can share code if you like.

                          J A 2 Replies Last reply Reply Quote 2
                          • J Offline
                            Jiemde Pybytes Beta @misterlisty
                            last edited by

                            Hi @misterlisty, That can be an other way, can you also send more informations than the wifi credential ? like the Lora or Sigfox informations ?
                            If you could share your code I would like to test it.
                            Best regards Jiemde

                            1 Reply Last reply Reply Quote 0
                            • D Offline
                              danielm
                              last edited by

                              picotui might me another option:
                              https://pypi.python.org/pypi/picotui/1.0

                              I don't have personal experience yet, however I will probably use it in my products.

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

                                Hi @jmarcelino,

                                I was thinkinkg about doing something similar as your flow, but I am having trouble to implement a micro webserver (I'm using a standard LoPy, not LoPy4). Are you capable of process GET or POST requests on your device? Any suggestion on how can I manage that?

                                Thanks in advance.

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

                                  You can run a http server on the device (a good example can be found here: http://docs.micropython.org/en/v1.9.2/esp8266/esp8266/tutorial/network_tcp.html), the sockets available in micropython work just like regular sockets on Windows/Linux and you can read/write the raw GET and POST requests like strings.

                                  1 Reply Last reply Reply Quote 0
                                  • 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

                                            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
                                            • 2 / 2
                                            • First post
                                              Last post

                                            Pycom on Twitter

                                            Pycom