Skip to content

mjScientech/Esp32-And-SHT30

Repository files navigation

Interfacing-SHT30-with-esp32-

Displaying Temperature Data on Ubidots using esp32 and SHT30. alt tag

SHT30

SHT30 is the next generation of Sensirion’s temperature and humidity sensors.

The SHT30 has increased intelligence, reliability and improved accuracy specifications compared to its predecessor. Its functionality includes enhanced signal processing, so that temperature and humidity can be read out using I2C communications.

This I2C Mini Module makes it easy to read termperature and humidity using our standardized sensor footprint. Plug into a Particle interface module for cloud access from anywhere in the world.

alt tag

ESP-32

The ESP32 makes it easy to use the Arduino IDE and the Arduino Wire Language for IoT applications. This ESp32 IoT Module combines Wi-Fi, Bluetooth, and Bluetooth BLE for a variety of diverse applications. This module comes fully-equipped with 2 CPU cores that can be controlled and powered individually, and with an adjustable clock frequency of 80 MHz to 240 MHz. This ESP32 IoT WiFi BLE Module with Integrated USB is designed to fit in all ncd.io IoT products.

Monitor sensors and control relays, FETs, PWM controllers, solenoids, valves, motors and much more from anywhere in the world using a web page or a dedicated server.

We manufactured our own version of the ESP32 to fit into NCD IoT devices, offering more expansion options than any other device in the world! Integrated USB port allows easy programming of the ESP32. The ESP32 IoT WiFi BLE Module is an incredible platform for IoT application development. This ESP32 IoT WiFi BLE Module can be programmed using Arduino IDE.

Hardware needed Interfacing-SI7021-with-esp32:

Software Used:

Library Used:

  • PubSubClient Library
  • Wire.h

Arduino Client for MQTT

This library provides a client for doing simple publish/subscribe messaging with a server that supports MQTT

For more information about MQTT, visit mqtt.org.

Download

The latest version of the library can be downloaded from GitHub

Documentation

The library comes with a number of example sketches. See File > Examples > PubSubClient within the Arduino application. Full API Documentation.

Compatible Hardware

The library uses the Arduino Ethernet Client api for interacting with the underlying network hardware. This means it Just Works with a growing number of boards and shields, including:

  • Arduino Ethernet
  • Arduino Ethernet Shield
  • Arduino YUN – use the included YunClient in place of EthernetClient, and be sure to do a Bridge.begin() first
  • Arduino WiFi Shield - if you want to send packets greater than 90 bytes with this shield, enable the [MQTT_MAX_TRANSFER_SIZE] (https://pubsubclient.knolleary.net/api.html#configoptions) option in PubSubClient.h.
  • Sparkfun WiFly Shield – when used with this library
  • Intel Galileo/Edison
  • ESP8266
  • ESP32 The library cannot currently be used with hardware based on the ENC28J60 chip – such as the Nanode or the Nuelectronics Ethernet Shield. For those, there is an alternative library available.

Wire Library

The Wire library allows you to communicate with I2C devices, often also called "2 wire" or "TWI" (Two Wire Interface),can download from Wire.h

Basic Usage

  • Wire.begin() Begin using Wire in master mode, where you will initiate and control data transfers. This is the most common use when interfacing with most I2C peripheral chips.

  • Wire.begin(address) Begin using Wire in slave mode, where you will respond at "address" when other I2C masters chips initiate communication.

Transmitting

  • Wire.beginTransmission(address) Start a new transmission to a device at "address". Master mode is used.

  • Wire.write(data) Send data. In master mode, beginTransmission must be called first.

  • Wire.endTransmission() In master mode, this ends the transmission and causes all buffered data to be sent.

Receiving

  • Wire.requestFrom(address, count) Read "count" bytes from a device at "address". Master mode is used.

  • Wire.available() Retuns the number of bytes available by calling receive.

  • Wire.read() Receive 1 byte.

Steps to send data to Ubidot using ESP-32 and SHT30-

Connection of SHT30 with shield

alt tag

Connection of ESP-32 with shield

alt tag

Uploading the code to ESP32 using Arduino IDE:

  • Download and include the PubSubClient Library and Wire.h Library.
  • You must assign your unique Ubidots TOKEN, MQTTCLIENTNAME, SSID (WiFi Name) and Password of the available network.
  • Compile and upload the ESP32_SHT30. code.
  • To verify the connectivity of the device and the data sent, open the serial monitor.If no response is seen, try unplugging your ESP32 and then plugging it again. Make sure the baud rate of the Serial monitor is set to the same one specified in your code 115200.

Serial monitor output.

alt tag

Making the Ubidot work:

  • Create the account on Ubidot.
  • Go to my profile and note down the token key which is a unique key for every account and paste it to your ESP32 code before uploading.
  • Add a new device to your ubidot dashboard name esp32.

alt tag

                   Click on devices and select devices in ubidot.

alt tag

 Now you should see the published data in your Ubidots account, inside the device called "ESP32".
  • Inside device create new variable name sensor in which your temperature reading will be shown. alt tag

alt tag

 Now you are able to view the Temperature in degree celsius which was previously viewed in serial monitor.This
 happened because the value of temperature we calculated in degree celsius  is passed as a string and store in
 variable and publish to variable sensor inside  device esp32. 

OUTPUT

  • Now as the temperature increases and decreases new data available inside the sensor variable. alt tag

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages