IoT stands for “Internet of Things.” It refers to the growing network of physical devices, vehicles, buildings, and other items that are embedded with sensors, software, and network connectivity, allowing them to collect and exchange data. This data can be used to make better decisions, improve efficiency and automate processes.
IoT devices can range from small, simple devices such as a thermostat or a smart light bulb, to complex systems such as industrial control systems and self-driving cars. IoT devices are connected to the internet and can communicate with each other and with centralized servers to exchange data, allowing them to be controlled and monitored remotely.
IoT has the potential to revolutionize many industries, including manufacturing, healthcare, transportation, and energy. However, it also raises security and privacy concerns, as the data collected and exchanged by IoT devices can be sensitive and potentially vulnerable to hacking.
ESP32 is a low-cost, low-power system-on-a-chip (SoC) series with Wi-Fi & dual-mode Bluetooth capabilities. It is often used in Internet of Things (IoT) devices as it includes a built-in processor, memory, and input/output (I/O) interfaces. ESP32 can be used to create a variety of IoT applications such as home automation, sensor networks, and smart devices. It is also compatible with many different development platforms and programming languages, making it easy to use for both hobbyists and professional developers.
ThingSpeak is an open-source Internet of Things (IoT) application and API that allows users to collect, store, and analyze sensor data in the cloud. It is often used to build IoT projects, such as monitoring environmental data, tracking personal health, and controlling home appliances. ThingSpeak provides a RESTful API that allows developers to send and retrieve data from ThingSpeak channels using HTTP requests. The platform also includes features such as real-time data visualization, data analysis, and the ability to trigger alerts based on certain conditions. Additionally, it provides MATLAB analytics to analyse and visualize data. ThingSpeak is a popular choice for IoT projects due to its ease of use and flexibility.
ESP32 can be used to send data to ThingSpeak, an IoT platform that allows users to collect, store, and analyze sensor data in the cloud. To do this, developers will need to use the ThingSpeak API to send HTTP requests to ThingSpeak from the ESP32.
Here is an example of how to send data from an ESP32 to ThingSpeak:
Using the ESP32 and ThingSpeak together can allow you to build IoT projects such as monitoring environmental data, tracking personal health, and controlling home appliances. ESP32 is powerful, low-cost, low-power device and ThingSpeak provides easy to use platform to store and analyse data.
Thanks to the ESP32 card connected to the Internet of Things (IoT: Internet of Things), it is possible to monitor in real time the temperature and humidity measured by the DTH11 sensor.
To create sensor data recording applications, you can use ThingSpeak which is an API and an open source application for the “Internet of Things”, allowing to store and collect data from connected objects using the HTTP protocol via Internet.
Using the MQTT protocol, we will get data captured from the DTH11 sensor, recording it in the ThingSpeak.com site.
ESP32
The ESP32 is a low-cost, low-power microcontroller with built-in Wi-Fi and Bluetooth capabilities. It is a popular choice for IoT projects and is commonly used for a variety of applications such as home automation, wireless control, and sensor data logging. The ESP32 features a dual-core processor, a rich set of peripherals, and support for a wide range of protocols. It can be programmed using the Arduino IDE and various other programming languages such as C, C++, and MicroPython.
Additionally, the ESP32 has a wide range of features including:
The ESP32 is often used in projects where a low-cost, low-power device with Wi-Fi and Bluetooth capabilities is needed, and it is commonly used with other sensors and devices to build IoT projects, home automation systems, wireless control systems, and data logging systems.
DTH11 sensor
The DHT11 sensor is a low-cost, digital humidity and temperature sensor. It is commonly used in various types of projects such as weather stations, home automation, and HVAC systems.
The DHT11 sensor measures both relative humidity and temperature, and it can provide accurate readings within a certain range. It can measure temperature between 0-50°C with an accuracy of ±2°C and humidity between 20-90% with an accuracy of ±5%.
The DHT11 sensor has four pins: Vcc, Data, Not Connected, and GND. The Vcc pin is used to provide power to the sensor, typically 3.3V to 5V. The Data pin is used to send the temperature and humidity data to the microcontroller. The Not Connected pin is not used and should be left unconnected. The GND pin is used to ground the circuit.
The DHT11 sensor uses a one-wire communication protocol to send data to the microcontroller. The data is sent in a 40-bit packet, which includes the humidity and temperature data, as well as a checksum for error detection.
The DHT11 sensor is relatively simple to use and it’s a popular choice for hobby projects, DIY projects and low-cost monitoring systems. It’s relatively cheap and easy to find. However, it’s important to note that the sensor has a limited measurement range and it’s not as accurate as other types of temperature/humidity sensors.
Connecting wires
Connecting wires refers to the process of physically connecting wires or cables to a device or circuit in order to establish an electrical connection. This can be done by using various connectors such as plugs, sockets, or terminal blocks. The wires are typically color-coded to indicate their function, such as red for power, black for ground, and yellow for signals.
Test plate
A test plate is a type of circuit board that is used to test electronic components. It typically consists of a flat board made of a non-conductive material, such as plastic or fiberglass, with a number of holes or pads that are used to connect electronic components. The test plate allows you to connect electronic components and test them easily.
To perform the assembly
For the DTH11 sensor, we connect:
the DATA pin to pin D23 of the ESP32 board
the VCC pin to the 3.3V pin of the ESP32 board
the GND pin to the GND pin of the ESP32 board
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
from simple import MQTTClient import network import time from time import sleep from machine import Pin WiFi_SSID = "**********" WiFi_PASS = "*************" SERVER = "mqtt.thingspeak.com" client = MQTTClient("umqtt_client", SERVER) CHANNEL_ID = "********" WRITE_API_KEY = "***************" p23=Pin(23, Pin.IN) d=dht.DHT11(p23) def do_connect(): wlan = network.WLAN(network.STA_IF) wlan.active(True) if not wlan.isconnected(): print('connecting to network...') wlan.connect(WiFi_SSID, WiFi_PASS) while not wlan.isconnected(): pass print('network config:', wlan.ifconfig()) do_connect() topic = "channels/" + CHANNEL_ID + "/publish/" + WRITE_API_KEY while True: d.measure() t=d.temperature() #read temperature h=d.humidity() #lire l'humidite payload = "field1="+str(t)+"&field2="+str(h) client.connect() client.publish(topic, payload) # envoyer les valeurs de la temperature et l'humidite au site thingspeak.com client.disconnect() time.sleep(60) #waiting 1 min |
Note: the following library must be imported: simple.py