• 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

Display Temperature and Humidity Readings

Q&A Forum › Category: ESP32 › Display Temperature and Humidity Readings
0 Vote Up Vote Down
tieuphongfx asked 4 years ago

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!

Question Tags: Temperature
21 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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

0 Vote Up Vote Down
tieuphongfx answered 4 years ago

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.

0 Vote Up Vote Down
tieuphongfx answered 4 years ago

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!

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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?

0 Vote Up Vote Down
tieuphongfx answered 4 years ago

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!

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago
  • 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!

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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)”

0 Vote Up Vote Down
tieuphongfx answered 4 years ago

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?  

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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/

0 Vote Up Vote Down
tieuphongfx answered 4 years ago

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!

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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?

0 Vote Up Vote Down
tieuphongfx answered 4 years ago

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 

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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?

0 Vote Up Vote Down
tieuphongfx answered 4 years ago

yes I use that version

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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!

0 Vote Up Vote Down
tieuphongfx answered 4 years ago

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 

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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?

0 Vote Up Vote Down
tieuphongfx answered 4 years ago

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!   

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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.

0 Vote Up Vote Down
tieuphongfx answered 4 years ago

Yes my Pi connected to router using an Ethernet cable

0 Vote Up Vote Down
Rui Santos Staff answered 4 years ago

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.

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.