Microcontroller Based Embedded System
Microcontroller Based Embedded System
The sensor communicates via I2C interface, ensuring easy integration with
microcontrollers like the ESP32.
Connections:
Power Supply:
Figure 1
Page 1 of 16
Code for SHT- 45
Page 2 of 16
2. Anemometer (Wind Speed)
An anemometer typically has three arms with scoops that catch the wind,
causing the arms to spin.
The reed switch forms a closed circuit each time the magnet passes,
allowing the number of signals to be used to calculate the spin speed.
Connections
Connect the VCC and GND Pin of Anemometer to external VIN & GND.
Figure 2
Page 3 of 16
Code for Anemometer
Page 4 of 16
3. Rain Gauge Sensor
Figure 3
Tipping bucket rain gauges use a bucket mechanism that tips when filled with
rainwater, activating a magnet near a reed switch.
The reed switch's closure creates a circuit change detected by the ESP32,
which counts these closures as tips.
Connections
Pull-up Resistor: Connect 10kΩ resistor between GPIO 33 and 3.3V pin.
Power Supply: Connect ESP32 3.3V pin to rain gauge’s 3.3V input.
Figure 4
Page 5 of 16
Code for Rain Gauge
rainPin Definition: Defines the GPIO pin (pin 33) connected to the rain gauge
sensor.
rainCount Variable: Tracks the number of rain gauge tip events using an
interrupt-driven approach.
rainISR Function: Interrupt Service Routine (ISR) called when the rain gauge
tips, incrementing rainCount with debounce handling to avoid multiple counts
from a single event.
Setup Function: Configures serial communication, sets up rainPin as an input
with pull-up resistor, and attaches an interrupt to rainISR triggered on a falling
edge (tip of the rain gauge).
Loop Function: Periodically calculates and prints the total rainfall based
on rainCount, converting the count to millimeters using a conversion factor
of 0.2794 per tip, ensuring accurate measurement over time.
Page 6 of 16
4. Wind Vane
Utilizes reed switches and a magnet. As the vane rotates, the magnet's position
changes relative to the reed switch, creating electrical signals that indicate the
wind direction.
Connections
Power Supply: Connect ESP32 3.3V pin to Wind Vane’s 3.3V input.
Figure 5
Page 7 of 16
Code for Wind Vane
The code sets up an analog pin to read the voltage from a wind vane.
Converts the voltage reading to a digital value. The digital value is then used to
determine the wind direction.
Maps the digital value to a wind direction. For example, a digital value between
675 and 1100 corresponds to a north wind.
It prints the wind direction to the serial monitor. The serial monitor is a tool that
can be used to view the output of the code.
Page 8 of 16
5. Particulate Matter 2.5
Figure 6
Connections
• Connect the VCC and GND pins of the PM2.5 sensor to the 3.3V and GND
pins of the ESP32.
• Connect the UART TX pin of the PM2.5 sensor to the RX pin (GPIO16) of the
ESP32.
• Connect the UART RX pin of the PM2.5 sensor to the TX pin (GPIO17) of the
Figure 7
ESP32.
Page 9 of 16
Code for PM2.5
Page 10 of 16
6. 4G Module
The 4G module is a wireless communication device that uses the fourth
generation of mobile communication technology, namely LTE (Long Term
Evolution). Through the 4G module, users can quickly and stably achieve
wireless connections around the world and enjoy high-speed, high-quality data
transmission services.
Figure 8
Connections
Page 11 of 16
Figure 9
Figure 10
ThingSpeak is an IoT platform that allows you to collect, visualize, and analyze data
from sensors or devices in real-time. It provides tools for data logging, charting, and
data analysis, making it easy to monitor and understand trends from your connected
devices or sensors. ThingSpeak is often used for applications such as environmental
monitoring, smart agriculture, and industrial IoT projects due to its simplicity and
integration capabilities with various hardware and software platforms.
Important Features-
Real-time Data Collection: Collects data from sensors and devices in real-
time.
Page 12 of 16
Visualization Tools: Provides tools for creating charts and graphs to
visualize data trends.
Data Analysis Capabilities: Includes built-in features for analyzing
collected data.
Integration with IoT Devices: Integrates easily with a wide range of IoT
devices and platforms.
API Access: Offers APIs for easy integration and programmable access
to data.
Conclusion
Key components of our system include the use of high-precision sensors and advanced
communication technology. The SHT45 and PM2.5 sensors provide accurate
measurements of temperature, humidity, and air quality, while the rain gauge, wind
vane, and wind speed sensors offer detailed insights into weather patterns. The
integration of a 4G module ensures continuous data transmission, and ThingSpeak
serves as the platform for data visualization. Future enhancements include the addition
of a Peltier module to control the system's temperature and an SD card for local data
storage, ensuring the system's resilience and reliability.
Looking ahead, the second phase of our project will focus on implementing ICA
algorithms to analyze the collected data more deeply. By applying these algorithms, we
aim to uncover hidden patterns and relationships within the data, providing more
insightful and actionable information. This advanced analysis will enhance the
functionality of our weather station, enabling it to not only monitor but also predict
environmental changes more accurately.
References
Page 13 of 16
1. Weather Shack. (2002). Ed tipping bucket rain gauge. Retrieved from
[https://www.weathershack.com/static/ed-tipping-bucket-rain-gauge.html]
3. Circuit Digest. (2018). Getting started with ESP32 using the Arduino
IDE. Retrieved from
[https://circuitdigest.com/microcontroller-projects/getting-started-with-
esp32-with-arduino-ide]
Page 14 of 16
Glossary
Page 15 of 16
VCC
Anemometer
VCC
Wind Vane
GPIO21
ESP32
SHT 45
GPIO22
RX2 TX2
PM2.5
Rain Gauge
Page 16 of 16