Problem connecting to MQTT broker
Posted: Tue Oct 08, 2024 2:08 pm
I’m new to MQTT so forgive my ignorance. I have designed a simple interface board around an ESP32-C3-WROOM module, which I have loaded with ESP-AT firmware. The ESP-AT documentation explains all the allowable commands, but in general terms. I cannot manage to access a broker.
I have installed HiveMQ on a laptop and the log shows that it has loaded correctly and started. I can then access it through the HiveMQ dashboard. However, I can’t communicate with it from the ESP32. This is the sequence of commands I’m using:
The next step should be to connect, so I need an IP address or a web address. I’m trying initially to access the local HiveMQ broker. However, I tried looking at the router and it doesn’t show HiveMQ as a connected device, so I can’t see an IP address there. I have tried various combinations without success:
When I succeed in accessing the local broker my next step would be to access a cloud broker. I want to use encryption but can’t find a means to do that other than hard-programming an encryption code into each ESP32 module. Does anyone have any guidance?
I have installed HiveMQ on a laptop and the log shows that it has loaded correctly and started. I can then access it through the HiveMQ dashboard. However, I can’t communicate with it from the ESP32. This is the sequence of commands I’m using:
Code: Select all
WIFI CONNECTED
WIFI GOT IP
AT+CWMODE=1
OK
AT+CWLAPOPT=1,31
OK
AT+CWJAP=“Virgin2.4”,“Wjsh318263”
WIFI DISCONNECT
WIFI CONNECTED
WIFI GOT IP
OK
AT+CIPSNTPCFG=1,0,“0.uk.pool.ntp.org”,“1.uk.pool.ntp.org”,“2.uk.pool.ntp.org”
OK
+TIME_UPDATED
AT+MQTTUSERCFG=0,5,“esp32”,“espressif”,“1234567890”,0,0,“mqtt”
OK
AT+CIPSTA?
+CIPSTA:ip:“192.168.0.136”
+CIPSTA:gateway:“192.168.0.1”
+CIPSTA:netmask:“255.255.255.0”
OK
Code: Select all
OK
AT+MQTTCONN=0,“0.0.0.0”,1883,1
+MQTTDISCONNECTED:0
ERROR
AT+MQTTCONN=0,“192.168.3.102”,8883,1
+MQTTDISCONNECTED:0
ERROR
AT+MQTTCONN=0,“192.168.188.20”,1883,0
+MQTTDISCONNECTED:0
ERROR