In Networking and Communications week, I was bit confused about what should I do as a assignment. But I decided to use Thingspeak as I was familiar with it which I have used sometimes during my Bachelors. So In this assignment I have describe in brief about the Networking and Communication. I have also documented about how to connect the board and send the sensor data on cloud.
Send a message between two projects
design, build, and connect wired or wireless node(s)
with network or bus addresses and local input &/or
output device(s)
Imagine a network as a digital highway that allows devices to share resources and information. These devices can be computers, printers, smartphones, or any gadget with communication capabilities. They connect through physical links like cables (Ethernet, fiber optic) or wireless signals (Wi-Fi, Bluetooth).
Networks come in various sizes and purposes. A Local Area Network (LAN) connects devices within a limited area, like a home or office. Conversely, a Wide Area Network (WAN) spans a broader geographical region, connecting businesses or cities. Metropolitan Area Networks (MANs) cover a larger area within a city, often connecting LANs.
Think of protocols as the traffic rules on the network highway. These pre-defined rules govern how devices format, transmit, and receive data. Protocols ensure devices from different manufacturers can understand each other.
A common protocol is TCP/IP (Transmission Control Protocol/Internet Protocol). TCP/IP breaks down data into packets, sends them across the network, and reassembles them at the destination.
Other protocols handle specific tasks: HTTP for web browsing, FTP for file transfer, and SMTP for emails.
Data travels on the network in bits (0s and 1s). There are two main methods for transmitting this data:
Sends data one bit at a time, like a single lane on a road. It's simpler and more efficient for long distances, commonly used in phone lines and internet connections.
Transmits multiple bits simultaneously, like multiple lanes on a highway. It's faster for short distances but requires more complex cables and is less common.
Networks can employ different modes for data flow:
One-way communication, like a radio broadcast. Information flows in one direction only (think TV stations sending signals).
Devices can take turns transmitting and receiving, like a two-way radio. Only one device can transmit at a time (think using a walkie-talkie).
Allows simultaneous transmission and receiving in both directions, like a phone conversation. Both parties can communicate at the same time.
Serial communication can be further classified based on timing:
Devices share a clock signal to synchronize data transmission. It's like a marching band where everyone keeps pace with a drumbeat. This method is efficient for large data transfers.
Devices don't rely on a shared clock. Instead, start and stop bits are added to data packets to indicate the beginning and end of transmission. This is more flexible but can be less efficient for large data transfers, commonly used in UART communication (explained later).
Networks use various protocols for specific purposes, like:
A simple protocol for short-distance communication between devices on a circuit board, often used to connect microcontrollers with sensors or displays. It requires only two wires for data and clock synchronization.
Another short-distance protocol ideal for high-speed data exchange between microcontrollers and peripheral devices like SD cards. It uses separate wires for data, clock, and device selection, offering faster data rates than I2C.
ThingSpeak is like a digital scrapbook for your Internet of Things (IoT) projects. Imagine a website where you can send data, like temperature readings from a sensor, and see it plotted on a graph. Created by MathWorks, a company that makes software for engineers and scientists, ThingSpeak is free for basic use and lets you easily track and understand what's happening with your project over time.
ThingSpeak is an online platform where you can send data from your project (like temperature readings) and visualize it over time. It allows you to analyze and understand how your project is performing remotely.:
The ESP32 connects to a Wi-Fi network using the provided SSID and password. This is necessary for the ESP32 to communicate with the ThingSpeak server over the internet.
The data is sent to ThingSpeak using the HTTP protocol. HTTP (HyperText Transfer Protocol) is a protocol used for transmitting data over the internet.
ThingSpeak provides a RESTful API that allows you to send data to its servers. The data is sent using an HTTP GET request to a specific URL that includes the channel number and the write API key for authentication.
WiFi.begin(ssid, password);
starts the connection process.WiFi.status() != WL_CONNECTED
).dht.readTemperature()
and dht.readHumidity()
.temperature
and humidity
.temperature
is sent to field 1 and humidity
to field 2.ThingSpeak.setField(1, temperature);
sets the value of field 1.ThingSpeak.setField(2, humidity);
sets the value of field 2.ThingSpeak.writeFields(myChannelNumber, writeAPIKey);
sends the data to ThingSpeak.http://api.thingspeak.com/update?api_key=YOUR_WRITE_API_KEY&field1=temperature&field2=humidity
http://api.thingspeak.com/update
)api_key=YOUR_WRITE_API_KEY
)field1=temperature&field2=humidity
)
int response = ThingSpeak.writeFields(myChannelNumber, writeAPIKey);
if (response == 200) {
Serial.println("Data sent to ThingSpeak successfully");
} else {
Serial.println("Failed to send data to ThingSpeak");
}
Once the data is sent to ThingSpeak, it is stored in the channel fields. You can access your channel on the ThingSpeak website to view the data.
ThingSpeak automatically generates graphs for each field in the channel. You can customize the visualizations, add widgets, and analyze the data using built-in tools.
This workflow illustrates how the ESP32 communicates with ThingSpeak, ensuring that the data is reliably transmitted and visualized.
Solutions:
Solutions:
Solutions: