• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP8266 Micropthon with MQTT and Node-Red

Q&A Forum › ESP8266 Micropthon with MQTT and Node-Red
0 Vote Up Vote Down
jason asked 3 years ago

Hi everyone. Following the course here, I have a few ESP8266’s running micropython and MQTT to take sensor readings and turn a relay on/off. The sensor readings work great but I’m having an issue with the relay because the clients keep randomly losing connection with the broker (mosquitto on RPi).

When the client loses connection, it reconnects very quickly so doesn’t really impact the sensor readings but it switches the relay off. These disconnects happen frequently and seem to occur anywhere between a few seconds and several minutes after booting.

Apologies but this is a duplicate message but the original is showing as closed and I couldn’t reopen it.

Serial output below:

g...

Failed to connect to MQTT broker. Reconnecting...

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 31088, room 16
tail 0
chksum 0x44
load 0x3ffe8000, len 1028, room 8
tail 12
chksum 0x1e
ho 0 tail 12 room 4
load 0x3ffe8410, len 824, room 12
tail 12
chksum 0x89
csum 0x89
���Connection successful
('10.224.60.165', '255.255.255.0', '10.224.60.1', '10.224.100.1')

Connected to 10.224.60.18 MQTT broker, subscribed to b'test1' topic

machine ID is b'dd62cd00'
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
What pin are you using to connect the relay? And what configuration? Normally-closed or normally-open?
Regards,
Sara

0 Vote Up Vote Down
jason answered 3 years ago

Hi Sara
Many thanks for your reply. I’m using relay shields on D1 mini’s which use pin 5. I have about a dozen of them which were previously running your micropython web server for about a year (flawlessly, thank you!). I’ve spent quiet a bit of time debugging this today and it seems to be pointing to some kind of corruption when re-flashing the boards. When I initially did the first one, I only tested it for a couple of minutes before flashing them all – lesson learnt! Today I’ve re-flashed 5 of the boards and they’ve all been stable for a few hours, so I’m hopeful that it’s sorted.
Thanks for all your work on this site – it’s great.
 
Jason
 

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
Great! I’m glad it is working now.
Then, let me know if you need further help.
Regards,
sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2023 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.