NodeMCU and WiFi disconnects
Posted: Mon Mar 26, 2018 10:58 am
Hi There
I and a few colleagues of mine are running 1hr workshops with students (themed around IoT), based on NodeMCU, MicroPython, NeoPixels and a temperature sensor (18B20). We want to excite them about IT, show them how easy coding can be; this is supported by a bigger volunteering program of our employer. The students abolutely love it!
Anyway, my question is with regards to WiFi stability and MicroPython. What our final MicroPython script is doing, is basically:
1. initialise all the things, getting WiFi up, NeoPixels (ring of 24), Temp sensor, conntect to an MQTT broker
2. Run a constant animation (just a circling light), the colour can be changed by the students and on every completion of a cycle:
3. read the temperature and send it to the MQTT broker
Towards the end of that hour, the students can then pull their smartphones and check with how little effort you can implement an "IoT thing".
My observation is now, that the NodeMCU is after some time disconnecting from the WiFi. Over the serial line, I can see that it is trying to publish to the MQTT broker, but due to the lost WiFi connection cannot ("mqtt reconnect: OSError(103,)").
I have searched this forum and others up and down and seen some similar cases, but I don't believe that I have found the exact duplication of my problem.
In the end, it is not essential to the workshop, but I'd be interested to find out whether an ESP running MicroPython can be used for other projects. Given this connectivity "problem", I would currently rather go with a C implementation.
We have about 20 or so boards (sys.version 3.4.0). We have run this workshop in several venues. We have tried many different MicroPython versions, from 1.8.6. upwards to now 1.9.3. We have used several different WiFi types (from corporate access points to hotel hotspots to SmartPhone hotspots to my home network). We have used public MQTT brokers, we have setup several MQTT brokers on our own on Raspis. I also tried limited playing around with some capacitors directly at the boards. We have used powering the whole thing from a standard USB board, to a USB charger, to one of these standards breadboard power supplies.
It is always the same problem. After some time (this can be 50 cycles, 150, 400, 766, 831 or 2000 cycles), it loses the WiFi connnectivity.
I'd love to post the code here, but it seems that BBCode is off for me (perhaps because I am new posting now?). In the meantime, you can find the source code here: https://goo.gl/hyAgiy and the bread board setup here: https://goo.gl/GnZxkZ - my apologies if this is not the proper way to do it.
Thank you very much for any help!
Thomas
I and a few colleagues of mine are running 1hr workshops with students (themed around IoT), based on NodeMCU, MicroPython, NeoPixels and a temperature sensor (18B20). We want to excite them about IT, show them how easy coding can be; this is supported by a bigger volunteering program of our employer. The students abolutely love it!
Anyway, my question is with regards to WiFi stability and MicroPython. What our final MicroPython script is doing, is basically:
1. initialise all the things, getting WiFi up, NeoPixels (ring of 24), Temp sensor, conntect to an MQTT broker
2. Run a constant animation (just a circling light), the colour can be changed by the students and on every completion of a cycle:
3. read the temperature and send it to the MQTT broker
Towards the end of that hour, the students can then pull their smartphones and check with how little effort you can implement an "IoT thing".
My observation is now, that the NodeMCU is after some time disconnecting from the WiFi. Over the serial line, I can see that it is trying to publish to the MQTT broker, but due to the lost WiFi connection cannot ("mqtt reconnect: OSError(103,)").
I have searched this forum and others up and down and seen some similar cases, but I don't believe that I have found the exact duplication of my problem.
In the end, it is not essential to the workshop, but I'd be interested to find out whether an ESP running MicroPython can be used for other projects. Given this connectivity "problem", I would currently rather go with a C implementation.
We have about 20 or so boards (sys.version 3.4.0). We have run this workshop in several venues. We have tried many different MicroPython versions, from 1.8.6. upwards to now 1.9.3. We have used several different WiFi types (from corporate access points to hotel hotspots to SmartPhone hotspots to my home network). We have used public MQTT brokers, we have setup several MQTT brokers on our own on Raspis. I also tried limited playing around with some capacitors directly at the boards. We have used powering the whole thing from a standard USB board, to a USB charger, to one of these standards breadboard power supplies.
It is always the same problem. After some time (this can be 50 cycles, 150, 400, 766, 831 or 2000 cycles), it loses the WiFi connnectivity.
I'd love to post the code here, but it seems that BBCode is off for me (perhaps because I am new posting now?). In the meantime, you can find the source code here: https://goo.gl/hyAgiy and the bread board setup here: https://goo.gl/GnZxkZ - my apologies if this is not the proper way to do it.
Thank you very much for any help!
Thomas