This project aims at measuring the parameters related to weather and make that information available online with the help of cloud service. This weather station project measures five parameters namely, wind speed, wind direction, temperature, humidity and carbon monoxide level. Below given is the circuit diagram of the project.
The project is divided into five parts or blocks as follows:-
1. ESP32 block
2. DHT 11 temperature and humidity sensor module.
3. MQ7 carbon monoide gas sensor module.
4. wind speed measurement using anemometer and its interfacing circuit.
5. wind direction using wind vane and its interfacing circuit.
6. IBM watson IoT platform.
ESP32:-
ESP 32 is a series of low cost, low power system on chip microcontrollers with integrated wi-fi and dual mode Bluetooth. The ESP 32 series employs a Tensilica Xtensa LX6 microprocessor in both dual core and single core variations and includes buitlt in antenna switches, RF balun, Power amplifier, low noise receive amplifier, filters, and power management modules. Esp 32 is designed for mobile, wearable electronics, and IoT applications.
Advance peripheral interface:-
• 34 × programmable GPIOs
• 12-bit SAR ADC up to 18 channels
• 2 × 8-bit DAC
• 10 × touch sensors
• 4 × SPI
• 2 × I²S
• 2 × I²C
• 3 × UART
• 1 host (SD/eMMC/SDIO)
• 1 slave (SDIO/SPI)
• Ethernet MAC interface with dedicated DMA and IEEE 1588 support
• CAN 2.0
• IR (TX/RX)
• Motor PWM
• LED PWM up to 16 channels
• Hall sensor
Apart from advance integrated sensors and wireless communication systems. The ESP 32 DEV kit module can be programmed using the Arduino IDE which makes it easier for testing different codes and implementing new ideas.
DHT 11:-
DHT 11 is a module for getting temperature and humidity readings. It sends temperature and humidity data through a single data pin using digital signals. A microcontroller can be programmed to read the digital signals and get the temperature and humidity value. It has three pins , GND, data and VCC.
The digital output is calibrated. This means the readings of temperature and humidity that we will get are accurate according to standards set by laws of physics.
The temperature and humidity sensors include a resistive type humidity measurement component and an NTC temperature measurement component , and connects to a high performance 8 bit microcontroller offering excellent quality , fast response ,anti interference ability and cost effectiveness.
Technical specifications:-
Communication process:-
- MCU sends out a start signal by pulling down the voltage for at least 18ms.
- MCU pulls up voltage and waits for DHT response (20us to 40us).
- DHT sends out response signal by pulling down voltage and keeps it for 80us.
- DHT pulls up voltage and keeps it for 80us.
- Data transmission starts.
After the data transmission starts. The data comprised of bits 0's and 1's is transmitted by modulating the 'on time' of the signal. The 'off time' remains same (50us). For '0' the 'on time' is 26us to 28us. For '1' the 'on time' is 70us.
For data '0' |
For data '1' |
Data format:-
The total data comprising of temperature and humidity is of 40 bit. and is arranged in the following format.
8 bit integral data + 8 bit decimal RH data + 8 bit integral T data + 8 bit decimal T data + 8 bit check sum.
The 8 bit check sum is the addition of previous four 8 bit data.
MQ7 carbon monoxide gas sensor:-
The MQ7 module has got four pins out of which two are for power and ground . Other two are A0 (analog output) and D0 (digital output). In this project we are using the analog output (A0) pin because we have to determine the concentration of gas.
The MQ-7 carbon monoxide is especially designed to be sensitive to carbon monoxide (CO) gas which is emitted by vehicles, factories,etc. Since this gas is considered toxic to humans, at certain levels concentration of CO is used to determine the air pollution in given area.
MQ7 carbon monoxide sensor detects 20 to 2000 ppm (parts per million) of CO in air here is sensitivity characteristic curve:-
The function of CO concentration is given by:-
f(x) = f0 ( (x/x0) ^ ( log(f1/f0) / log(x1/x0) )
From the graph, f1 = 0.25 , f0 = 0.065 , x1 = 10 , x0 = 100 , substituting these values in the above equation, we get:-
f(x) = 0.065 ((x/100) ^ ( log(0.25/0.065) / log(10/100) )
= 0.065 (x ^ -0.585)
The relationship between concentration in ppm and Rs/R0 is now:-
(Rs/R0) = 0.00065 (ppm ^ -0.585)
solving for ppm:-
ppm = (1538.46 (Rs/R0)) ^ (-1.709)
Now we can use this equation to write a program for determining the concentration of carbon monoxide in ppm.
The MQ7 needs to be preheated before using it after a long time. To preheat the sensor coil , keep it on at 5V for about 90 min before running the program.
Wind speed measurement using anemometer and it's interfacing circuit:-
Hardware description:-
The device used for measuring wind speed is a three cup anemometer. The wind pushes against the three cups and rotates the shaft. At the end of the shaft a magnet is attached. The magnet moves with the shaft. The magnet is detected by the detection circuit which uses a hall effect sensor. The detection circuit gives a trigger pulse each time the shaft complete one full rotation. If the number of pulses are counted for a fix time interval then we can determine the wind speed by using simple mathematics.
Circuit description:-
The interfacing circuit's job is to pass the pulses for a fixed time interval. This is achieved with the help of timmer IC 555 in monostable mode. The monostable multivibrator (MMV) is made to pull the output 'high' for a fixed time interval (T) initially when its triggered by the pulse. In this project T = 3 sec ( It is given by formula T = 1.11*R*C ). The MMV must be such that it doesn't gets re-triggered by the pulse for next 3 sec and gets 'low' irrespective of the pulses at the input. This is only achieved by the IC 555 MMV.
The ESP32 does the further job of counting the pulses and calculate the speed. The interfacing circuit just helps to simplify the code.
Calculations:-
Given conditions:- 1. Radius of anemometer from center of the shaft to center of cup is 7.112 cm.
2. Therefore circumference (c) = 2*pi* r = 44.66 cm.
3. Let the number of pulses counted in 3sec = pa.
Solution:- Speed = Distance/Time.
Distance (km) = pa * c = (pa * 44.66 cm) / ( 10 ^ 5 )
Time (hr) = 3 sec / 3600
Substituting distance (km) and time (hr) in eqaution of speed we get:-
Speed = 0.012 * pa * 44.66
Now we can use the above speed equation in our program to get the speed from no of pulses counted.
if only one count is passed then the speed is 0.54 km/hr . This is the minimum speed that can be measured.
Wind vane and its interfacing circuit:-
wind vane is a simple device with a fin attached to a freely rotating shaft, which points to the direction of the wind. Just because of it's one side has a larger surface area then the other side , it orients itself in such a way that it will always point in the direction of wind. Traditionally there is marking on a wind vane for north, south, east and west, directions. In this project, to convert direction information into digital signals, a binary coded disc and a 3 bit scanner is used. The binary coded disc has 8 divisions this makes the wind vane to detect all the directions. see the below given image.
This binary coded disc is attached to the vertical shaft of the wind vane. This disc rotates as the shaft rotates. A 3bit black and white scanner is placed just below the disc to scan the sector and decoded the binary data from which the direction is known. The scanner sequentially scans the surface and the serial data is read by the ESP 32. The image below shows the wind vane's construction diagram, scanner wiring and the binary coded disc.
The code and it's integration with the IoT platform used will be discussed in the next blog.
If you found this blog useful and want to support me, then you can donate me. The money you give will be used to make more advance electronics projects and setting up better lab.
