How potential buyers could insert WIFI-parameters
-
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
-
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/
-
@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-Configif (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: … … …
-
@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.
-
@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
-
@jmarcelino said in How potential buyers could insert WIFI-parameters:
Sure I'll get this up ASAP.
Any update (ETA) on this?
-
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.
-
Hi @seb, here there are the captures from the filezilla client:
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:
Then I go to Visual Studio Code, and run main.py. The first time throws this message:
And the second time this:
If I check the available memory I get values similar to this:
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.
-
@lsoria
If you could post the whole error message you get, we can help you get it working. Did you copy the library intolib/microWebSrv.py.py
?
-
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.
-
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.
-
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.
-
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.
-
picotui might me another option:
https://pypi.python.org/pypi/picotui/1.0I don't have personal experience yet, however I will probably use it in my products.
-
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
-
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.
-
@jmarcelino Great! I'm trying the same but I'm really novice here.. keep us posted ;)
-
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
-
Hi @jmarcelino I thing that the new Iphone have NFC ( from NXP )
-
@jiemde
i don’t think that strategy works with iPhones