Questions tagged [mqtt]

MQTT (Message Queuing Telemetry Transport) is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. The MQTT protocol enables a publish/subscribe messaging model in an extremely lightweight way. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.

Filter by
Sorted by
Tagged with
0 votes
1 answer
86 views

PubSubClient hanging on ESP32C3

I may have done some things incorrectly here, but this I what I have for publishing image that I read from serial camera to the MQTT broker: void capturePicture() { if (!cam.takePicture()) ...
greengold's user avatar
  • 111
1 vote
0 answers
29 views

Arduino secure mqtt example not subscribing to topic

I am wrestling with the below example. I have a RasPi on the network running Mosquito with username and password credentials setup and I know this is working. If I load the below example, I can ...
little-rich's user avatar
1 vote
1 answer
38 views

Weird Behaviour with BearSSL on GPIO ESP8266

I use GPIO 5 to trigger a relay, my code also connects with a secure MQTT connection for which I have to use the BearSSL certificate definitions. Without the BearSSL certificates, when the esp ...
Shreyansh Jain's user avatar
1 vote
0 answers
104 views

How to connect to MQTT broker from NodeMCU with SSL?

I cannot connect to a MQTT broker from a NodeMCU, when using SSL. This is the error message: Attempting MQTT connection...failed, rc=-4 try again in 5 seconds. When connecting to the same broker via ...
Nicht Oeffentlich's user avatar
1 vote
1 answer
393 views

Problem with using PubSubClient, the "callback" function doesn't seem to work correctly

I have a program that communicate between a esp8266 and a atmega328 using Serial, the esp8266 will connect to a MQTT server running on local network, and publish/subscribe to some topics. In the ...
J. C. Stark's user avatar
2 votes
0 answers
238 views

MQTT on ESP8266 cannot connect if using Last Will service

Issue (short) description An ESP8266 using PubSubClient fails to establish connection to MQTT broker (mosquitto) if requesting Last Will Testament (LWT) on connection, though it is able to connect ...
Vadim's user avatar
  • 145
1 vote
0 answers
72 views

Empty message parse using ArduinoJSON from aedes MQTT server

I'm using aedes as my custom MQTT broker and PubSubClient at the ESP32 side, together with the ArduinoJSON package. My server test code: import Aedes from "aedes"; import net from "net&...
Mendes's user avatar
  • 111
2 votes
0 answers
136 views

AsyncMqttclient publish affects accelerometer readings

Using M5StickC ESP32 with built-in MPU6886 accelerometer to read vibrations. In the loop() section the code gets 10 readings per second and if the readings exceed a threshold, it starts publishing the ...
febalci's user avatar
  • 21
3 votes
1 answer
540 views

how to transfer json to string?

I am getting a json object from aws iot MQTT. Assuming that json from aws is {status:opened}. Here is my code. #include <ArduinoJson.h> void messageHandler(char *topic, byte *payload, unsigned ...
Jess's user avatar
  • 53
1 vote
2 answers
503 views

Arduino does not connect to MQTT local broker

I have an Arduino Mega with Ethernet connected to a router by cable. Also I have a PC connected to the router (by Wifi) where also the local MQTT broker is installed (mosquitto). Althought the Arduino ...
bardulia's user avatar
  • 141
0 votes
1 answer
423 views

ESP32- Sporadic slow receive of MQTT messages

Problem description: Every ~20+ published messages (using terminal), MCU receives that message in a very noticeable delay (mostly ~10 sec, few time it got up to 1 min). Upon receive (printed in Serial ...
guyd's user avatar
  • 993
0 votes
1 answer
216 views

Arduino + ESP8266 to send MQTT messages

I'm wondering if an Arduino Uno (or any other 328 family) that connects via Serial to an ESP8266 can send MQTT messages, rather than AT commands.
guyd's user avatar
  • 993
0 votes
0 answers
81 views

Arduino MQTT Library sending disconnect packets even though it is not called

I am trying to connect to AWS IoT through the Arduino Portenta H7 and I am following this blog (https://create.arduino.cc/projecthub/Arduino_Genuino/securely-connecting-an-arduino-mkr-wifi-1010-to-aws-...
Electric Dragon's user avatar
0 votes
1 answer
278 views

PubSub'a - KeepAlive function not as expected

I'm using PubSubClient to pub/sub MQTT messages using ESP8266. As far as I know "Keep-alive" detects when a client went off-line after a period of time. I'm using library's example ...
guyd's user avatar
  • 993
1 vote
0 answers
1k views

ESP32 CAM : How to send good quality images via MQTT

Has anyone here ever used a ESP32 CAM to send an image via MQTT? I'd like to know what are the parameters to initialize the camera with (resolution, jpeg quality, etc.), because once I receive the ...
Johnny boy's user avatar
1 vote
0 answers
435 views

ESP8266 How to run MQTT Client and Http Client in one loop

Scenario: Existing project: read soft serial then do http post New project: MQTT player from other (MrDIY / MrDIY Audio Notifier · GitLab) Objective: Combine together (Result: successful ) Issue: When ...
Rex's user avatar
  • 11
1 vote
0 answers
409 views

How to correctly use SSL certs with the Adafruit SIM800H

I am trying to use a Adafruit Sim800H to connect to Azure using MQTT with an SSL certificate. My first step is trying to put a new SSL certificate onto the board. To do this I am using this example ...
Andrew's user avatar
  • 111
2 votes
2 answers
222 views

ArduinoJson library parsing error

I am trying to retrieve JSON mqtt message I received in ESP32. void mqttMsgCallback(char* topic, byte* payload, unsigned int length) { payload[length] = '\0'; String _message = String((char*)...
Abhishek bhatia's user avatar
2 votes
1 answer
2k views

OTA over MQTT for ESP32

Before starting working, I am just researching around how can I achieve OTA over MQTT in ESP32 in using Arduino IDE. The process I understand the esp listen to MQTT messages and then received that ...
Abhishek bhatia's user avatar
1 vote
0 answers
128 views

How to get the value of a measurement transmitted by a BLE device?

I would like to use a BLE temperature sensor (such as the Inkbird IBS-TH1 Mini BLE Sensor), however, I want to be able to display the temperature measurements in my own website. To do this I am ...
Nina's user avatar
  • 175
1 vote
0 answers
323 views

Is it possible to upload a private root certificate to an Arduino Nano33?

I'm trying to connect an Arduino Nano 33 to an mqtt broker with TLS authenticaton on the broker side. To do that I need my Arduino board to have access to the the root certificate. My understanding is ...
RR_28023's user avatar
2 votes
0 answers
823 views

Multiple MQTT topics

I have 3 nodemcu's(ESP32) each connected with a sensor, from which I get data and send it to aws IoT-core. How can I send all 3 sensor's data by a single MQTT subscription? The below code is for a ...
Shridatha Hegde's user avatar
3 votes
1 answer
2k views

Connect ESP32 via MQTT

For a project I am working on, I need to connect my ESP32 board to another server via MQTT protocol. I am using the Mosquitto MQTT Broker and it is presently on my laptop. Following is the test code I ...
P_K's user avatar
  • 57
1 vote
1 answer
593 views

Message parsing from MQTT server

I'm making a NodeMCU based home automation. I adapted code I found on internet for controlling a device (say LED) via MQTT broker hosted on a Raspberry Pi. It works fine. But when I try to scale it up ...
coldbreeze16's user avatar
1 vote
0 answers
2k views

How to avoid MQTT reconnect Loop

I have the following code designed to allow me to control my device from my website using mqtt broker while internet is available. I also built in a local webserver to control the device in case of ...
ASH's user avatar
  • 45
0 votes
1 answer
820 views

I Can't Connect to my MQTT server via arduino

I have mosquitto MQTT installed on my VPS server which I can subscribe and publish to it using paho client thorugh websockets. However when I tried to connect to it through Arduino, I get the ...
motion channel's user avatar
0 votes
1 answer
2k views

PubSubClient: Subscription working, but callback never called

I am using an ESP32 (https://heltec.org/project/wifi-kit-32/) with a AM2302 DHT22 and an LDR, talking to mosquitto on a Linux box. Publishing data is working fine, other than the "exceeded ...
dj_segfault's user avatar
0 votes
2 answers
3k views

couldn't connect to MQTT broker via esp8266/32 and pub/sub client

I want to use hiveMQ public broker in my project that's the same broker as what available in PubSubClient esp8266 examples but when I change WiFi SSID and password in example and upload it I got this ...
radinParsaei's user avatar
1 vote
0 answers
35 views

4004 (NOT_FOUND) ON MQTT

I tried to send random data to MQTT but it's not working and I get: { "m2m:rsp" : { "rsc" : 4004, "rqi" : "123456", "pc" : "Resource not found", "to" : "5a185cedc6ad749b:...
daffa faiz's user avatar
2 votes
1 answer
154 views

MQTT connection not being recognised in void loop()

I am trying to publish MPU 9250 readings in the Adafruit IO sending the data from ESP32. The WiFi connection is being established, but the code is not going inside the if(mqtt.connected()) inside the ...
Ajay Raj's user avatar
-1 votes
1 answer
318 views

Modbus TCP together with MQTT over same ethernet

I'm currently in a planning phase for a project. I want to read some sensor data over Modbus TCP, do some simple calculations on the Arduino and publish the results over MQTT. Which means I have 2 RJ-...
Jakube's user avatar
  • 99
1 vote
0 answers
499 views

Arduino Uno + NodeMCU serial to MQTT

I made a pool monitor with ORP + pH + temp sensor. I had everything working (apart from ORP sensor causing interference with pH sensor, but that is a different topic...) for the past couple days in a ...
edge360's user avatar
  • 11
1 vote
1 answer
2k views

PubSubClient - MQTT_MAX_PACKET_SIZE How is it calculated

I'm using an ESP32, and I want to rule out a probable MQTT error. In PubSubClient , MQTT_MAX_PACKET_SIZE is set to 256. Is 256 the size for message only ? if not, what is left for message only ?
guyd's user avatar
  • 993
1 vote
0 answers
75 views

how to serially off leds in an esp running mqtt

hi im using at tiny 85 to monitor dc switches and to serial print with this code below to esp8266 with local broker to turn leds on and off but its only working through mqtt but not with physical ...
Dharani Sharma's user avatar
0 votes
1 answer
219 views

ESP32 using PubSub, creating an error when implemted inside a library

I wish to combine into a single library Wifi + MQTT, for a multi devices project. right after boot, getting Wifi - I get an error the moment MQTT server is trying to connect: mqttClient.connect(...
guyd's user avatar
  • 993
0 votes
2 answers
326 views

writing mqtt payload to spiffs file

I'm trying to write the payload of a MQTT message into a file in the SPIFFS file system of my esp32 board. I've tried this: if(file.print((long)payload)) { Serial.println("File was written"); }...
Johnny's user avatar
  • 1
1 vote
0 answers
509 views

node mcu disconnect from mqtt server

/* Basic ESP8266 MQTT example This sketch demonstrates the capabilities of the pubsub library in combination with the ESP8266 board/library. It connects to an MQTT server then: - ...
sepehr's user avatar
  • 63
0 votes
1 answer
3k views

Convert JSON into string for MQTT

I am trying to publish json object into string with following snippet JSONVar data; data["chipid"] = chipId; data["co2_equivalent"] = co2_equivalent.c_str(); data["tvoc"] = tvoc.c_str(); data["...
rp346's user avatar
  • 113
4 votes
2 answers
12k views

How to connect to MQTT broker with TLS?

I have ESP8266 which is connecting to MQTT broker and it is working ok using user+pass with following code: #include <ESP8266WiFi.h> #include <PubSubClient.h> const char* ssid = "...
iWizard's user avatar
  • 143
1 vote
0 answers
162 views

How to edit code from Node-Red to Cayenne

I am working on a project to run some (relays or LED's) on an inputs (Pins) Arduino by esp8266-01s . now while searching on internet I found a video divided it two step that talks about the issue ...
Khalid Abu-Khadija's user avatar
1 vote
2 answers
8k views

esp32-cam publish image to mqtt

I want to publish image capture through ESP32-CAM to MQTT. Have following code : #include "WiFi.h" #include "esp_camera.h" #include "esp_timer.h" #include "img_converters.h" #include "Arduino.h" #...
rp346's user avatar
  • 113
1 vote
0 answers
216 views

How to set ALPN ProtocolName when negotiating SSL using ArduinoBearSSL

I am trying to set up an Arduino MKR Wifi 1010 to push MQTT messages to AWS IOT. I am following this tutorial https://create.arduino.cc/projecthub/Arduino_Genuino/securely-connecting-an-arduino-mkr-...
simon's user avatar
  • 111
0 votes
1 answer
312 views

How to transmit data from Arduino to Raspberry Pi?

I am planning to build a network with five Arduino Mega devices, each of which will collect data using multiple sensors. Each Arduino will periodically transmit the sensor data to a gateway Raspberry ...
Adnan Ali's user avatar
  • 119
1 vote
0 answers
2k views

esp32 arduino wifi disconnect

I have this code running on ESP32 connected to SVM30-J #include <WiFi.h> #include <PubSubClient.h> #include <Arduino_JSON.h> #include <svm30.h> // Replace the next variables ...
rp346's user avatar
  • 113
1 vote
0 answers
497 views

ESP8266 mqtt publish + subscribe + serial read

seems I have some issues in my code as I subscribe for specific mqtt topic and also read same value via serial and publish it to mqtt. It takes time for device connected to serial to change setting ...
Vaikis2006's user avatar
0 votes
1 answer
5k views

cast from 'char*' to 'char' loses precision

Bit of a noob here. Im trying to use the sensor number (float) in my mqtt topic, but cant seem to get this right. Any help would be appreciated. Keep getting this error (cast from 'char*' to 'char' ...
Pieter Janse van Rensburg's user avatar
0 votes
1 answer
49 views

How to execute commands over desired amount of time

I have a program that receives 4 commands on 4 channels to change the color of an LED using mqtt communication. Lets just focus on two of the channels, the time and the red. I am sending a length of ...
Jordan Klaers's user avatar
0 votes
1 answer
1k views

MQTT on nano with Ethernet shield not working

I'm using an arduino nano with an ethernet shield (ENC28J60), and ethernet eem to be working (I can create a webserver with Ethercard library).However, i'm stuck when i try to connect to a MQTT ...
Neil's user avatar
  • 143
1 vote
0 answers
1k views

How to parse data most efficiently coming through mqtt with ESP8266

I am writing a program that is currently set up like so: Python script running on my computer. Raspberry pi is the broker for the mqtt data transmission An ESP8266 is programmed to listen to/...
Jordan Klaers's user avatar
1 vote
1 answer
95 views

How do I change the scope of an object?

I am using the File/Examples/Adafruit MQTT Library/mqtt_ESP8266 example as a model for my code. In the example, the mqtt object is created as a global variable, and everything works fine. However, I ...
David's user avatar
  • 11