Hi, I am considering that could you update this topic by sending Temp and Hum data to Cloud instead of display them through web server? Thank you!
Hi!
- Which project are you referring to? Can you post the full project name?
- Are you using Arduino IDE or MicroPython?
- Which cloud service would you like to have it integrated with?
Regards,
Rui
Hi Rui,
I am working on IoT Lab Prototype project. The purpose of this project is for demonstrating viability of an IoT lab. My solution is using DHT22 for collecting Temp and Hum, ESP32 for processing unit, adafruit cloud service for storing and analyzing data, also MQTT and Node-Red to display and interact with the prototype. I am considering using a fan or a LED in term of user interacting with the prototype.
Regards,
Phong.
Also in the section about MQTT – Connect ESP32/ESP8266 to Node-RED, you use DS18B20 sensor. If I use DHT22, how should I amend your code for DHT sensor? For example:
ds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin))
And some line of code in main as well.
Thank you!
Hello, unfortunately I don’t have any tutorials about posting data to the Adafruit service, but on their blog they have many code examples about their platform. I recommend using their examples.
Are you using Arduino IDE or MicroPython?
Hi Rui, I am using MicroPython. Do you have any tutorial on “MQTT – Connect ESP32/ESP8266 to Node-RED” using DHT11/22. In your book you use Ds18x20 sensor but it just publish only 1 data temperature. I am using DHT22 so I get stuck on how to publish both temperature and humidity to MQTT broker. And also how can I install Mosquitto Broker on ESP32? Thank you!
- Unfortunately I don’t have any tutorials on that exact subject (publishing DHT readings via MQTT). However, if you read the Unit “Web Server – Display Temperature and Humidity Readings”, you can learn how to read the DHT sensor with the ESP32.
- Then, you can read this topic that has extra information on how to send multiple readings: https://rntlab.com/question/python-esp32-course-chapter-node-red-how-does-one-add-an-additional-temp-sensor-ds18b20/ . In summary, you need to create two topics and have two statements to publish two readings.
- No, the MQTT broker needs to be installed in a device that has a full operating system (like a laptop, Raspberry Pi, etc…)
I hope that helps!
To learn how to publish sensor readings to a cloud service, you can read the project in the MicroPython eBook: “Send Sensor Readings via Email (IFTTT)”
Thanks Rui, actually I have tried to do exactly what you mentioned above: create 2 topics with 2 statements but get some errors. As you said we cannot install MQTT on ESP32, so do we have any way ESP32 can work with MQTT instead of installing it?
If you got an error, can you post the exact error message? I might be able to help you out.
Unfortunately for MicroPython I don’t have any instructions on how to do it…
I only have a thread about using MQTT with ESP32 and Arduino IDE connected to CloudMQTT broker: https://rntlab.com/question/using-cloudmqtt/
Hi Rui, I just bought Raspberry Pi and installing Mosquitto on it. When I type auto start boot up command for mosquitto ( pi@raspberry:~ $ sudo systemctl enable mosquitto.service). There is an error showed: “mosquitto.service is not a native service, redirecting to systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable mosquitto“. Do you have any solution for this, if not what is the command for booting up mosquitto service when I power up Raspberry again? Thank you!
Which Raspbian OS version are you using? What happened after running these installation commands?
pi@raspberry:~ $ sudo apt update
pi@raspberry:~ $ sudo apt install -y mosquitto mosquitto-clients
Did it prompt an error message? Or did Mosquitto MQTT broker installed successfully?
I use Raspbian Lite, there are no errors after running these commands above, but error occurs when try to type command for Mosquitto auto start after Raspberry Pi 3 power up and boot up
I’m sorry, but I was asking if you’re using the latest Raspbian Lite version (Version:November 2018
Release date: 2018-11-13).
Are you using that version?
Unfortunately I can’t reproduce that error on my end, I’m not sure what’s different from your installation that is causing/missing that service option to automatically start Mosquitto MQTT broker. If you run the following command:
$ mosquitto
Does mosquitto start properly? What does it print?
Basically, turn off your Pi and power it again. Then, run/open Mosquitto and let me know what you see in the Terminal window.
Thanks for your patience!
Now I even cannot find IP address of my Pi using Angry IP Scanner. The Ethernet cable lights up but don’t see my Pi IP after scanning
Did you added the ssh file to your microSD card?
It looks like your Raspberry Pi doesn’t have SSH enabled and that’s why you can connect or find it in your network…
Are you using PuTTY?
Sr I was busy with my assignment. The problem is the SSH file will disappear after I copy it into my SD card. Every time I cannot find IP address for my Pi board, I take a look at the SD card and can’t see SSH file. Do you have this problem before? Why is SSH file not stay in SD card? Thank you!
Is your Raspberry Pi connected to your router? Does your Raspberry Pi have an Ethernet connection with your router? The file usually disappears, but it enabled the SSH option.
Ok. Let’s try again…
Move the SSH file again to your Raspberry Pi. Turn on your RPi, having the Raspberry Pi connected to your router with an Ethernet cable, in PuTTY type raspberry (instead of the IP address):
Then, click open. Does it work?
If you continue to have problems, I recommend re-flashing the Raspbian OS from beginning to your microSD card, because you probably already removed the Pi from the power source multiple times. That often corrupts the operating system.