software

How to build a weather station with arduino? Step by step guide

Versatility is a standout feature that Arduino boards have . This is why it is possible to create a weather station taking into account some concepts in its development.

This will prevent you from making mistakes when choosing materials and programming opcodes. If you want to know how to do it, you will have to continue reading this article until the end. 

We will explain, in detail, the process you must go through to design and assemble a weather station with Arduino. Finally, you will find a list of the best kits that you can use to assemble a project of these .

What does it take to build a weather station with Arduino? Main kits and plates

The materials you will need to build a weather station with Arduino are the following:

Arduino UNO board

You will need that I have an ATmega328P type microcontroller , with an input voltage of 7 to 12 volts, with 5 volt operation of a continuous current of 20 mA . Also, it should have 32 KB memory .

Sensor to detect the relative humidity of the environment

In this case, a supply that is between 2.7 and 3.3 volts will be used . It should also have a temperature range between -10ºC to 60ºC with an accuracy of + -3%. While the measurement range should be 1% to 99%.

Atmospheric pressure detector and temperature sensor

It should have a working range of -40ºC to 60ºC and a detection capacity of 300 to 1100 hPa with 0.03 margin of error. The power supply that this board must have will have to be around 1.8 and 3.6Vdc.

Bluetooth module

This board will be required to handle communication with a phone with an Android operating system. The operating current must be <40mA, while the voltage for the supply must be between 3.3 and 6Vdc .

Arduino programming environment

To program you will need the Arduino software . To do this you will have to go with your trusted browser to the URL to https://www.arduino.cc/en/main/softwaredownload the program that is compatible with Windows, Linux and MacOS.

Notepad ++ text editor

With this editor you can work on programming any type of language . To download it you will have to enter the official page through the link https://notepad-plus-plus.org/downloads/.

Developer App Inventor 2

With this platform you will be able to create in a much easier way the applications that you will use on your Android smartphone via Bluetooth . In order to download it, you will have to enter the page https://appinventor.mit.edu/explore/ai2/windows.htmland then follow the simple installation process.

Learn step by step how to design and assemble a weather station with Arduino

Next, you will find the step by step you must do to design and assemble a weather station with Arduino .

Pay attention to every detail:

Connect the I2c bus

This bus is a protocol used to communicate in a specific way the master with the slaves in an electronic communication process. For this reason, it is convenient to start at this point.

What you will have to do is connect in SDA (Serial Data):

  • The Vcc of 1K.
  • The Arduino board that will work as a master.
  • The atmospheric pressure and temperature sensor .
  • The humidity detector .
  • The bluetooth board .

In SCL – Serial Clock and in the GND you must include:

  • The Arduino Master.
  • The humidity, temperature and atmospheric pressure sensors.
  • The bluetooh board .
  • The Vcc of 1K.

For this you must connect the GND of the humidity sensor with the brown wire to any pin of the Arduino GND, then the black wire will connect the VDD to the 3.3V pin of the Arduino board. While for the temperature and atmospheric pressure sensor you will have to connect the analog pins 4 and 5 of the Arduino with the gray and white wires of the SDA and SLC .

In turn, the bluetooth module must take the GND pin and connect it with a digital pin on the Arduino board . Finally, the blue cable will be in charge of being connected with digital pin 10 to HC-06 and the peripheral with pin 11 of Arduino.

Temperature and pressure sensor algorithm

This process begins with the Arduino library through the l2c bus which, through the reading of calibration data and establishes a decision-making process. If there is no error in the reading of the calibration data, it will be understood that the operations of the floating point data are not valid and returns the value 1 . On the other hand, if there is an error in the reading, the value it returns is 0 and in this way the process ends.

Temperature sensor algorithm library

The algorithm that is in charge of initializing the temperature data tells the sensor that it needs to collect the data through specific bytes . It then registers a control in the first position, after a while it also records it in the second position. Keep in mind that it takes writing in bytes as the temperature command. If an error has not occurred, it returns the value 5, but if there is an error when writing the bytes, it returns the value 0, causing the process to end in both cases.

Atmospheric pressure sensor algorithm

In the case of the atmospheric pressure method, the algorithm process used to return the pressure captured by the sensor starts when it is indicated in the datasheet that the device needs to take the temperature .

The result record is then performed in the first position and returns a byte read. Which, if it has not produced errors, performs the temperature calculation and returns the result to end the process. On the other hand, if there is an error in the reading, it returns the value result and the procedure ends.

To establish the atmospheric pressure reading, the value of the sampling must be indicated, which will return in waiting time. Once the type of sample is indicated, 1 byte will be written to the device that is displayed in the process. Then, if the write method was executed correctly, it will return the time in the unit of measure ms, but if the process has failed it will return the value 0 . In both cases, the measurement process ends.

Humidity sensor

The algorithm used in this case is executed through the library called Wire . This process is responsible for the transmission of data between the device and the sensor, the reading that is made of the data and the availability of the device to perform that reading. In this case, when the process starts, the transmission between the Arduino and the slave begins , then the data is transmitted and a request for bytes is produced indicating the address between the master and the slave.

It is taken as a whole number without signs and the result is established, after a waiting time, to end the process. If the frequency counter is not available, it returns the value 0 and the process ends. On the other hand, if the frequency counter is available, it will work to read the value of this sequence and return in units of measure hr, and then finish the procedure.

Arduino board algorithm

In this case, the algorithm is made up of three parts. The first is the initialization and it is in charge of importing the libraries, establishing the class types and starting up all the devices involved. The second part that this algorithm has is the reading of data that comes from the different sensors . At this stage reception methods are used are related to the libraries of the first part.

Finally, the third section that this algorithm has is to communicate the information through bluetooth . This is done by transmitting the data through the Inventor 2 app. If you do not want to do it through this means, you can choose to transmit the data to a led screen . These programming codes can be found in the next step.

Writing the Arduino codes

To perform the main operations of a weather station you will have to use these codes:

#include <LiquidCrystal.h>

#include "DHT.h" // This is done to add the library that will have control of the sensor

Set the pin to connect to the sensor:

#define DHTPIN 8;

#define DHTTYPE DHT11;

DHT dht (DHTPIN, DHTTYPE);

Incorporates the humidity variable:

int Humidity = 0;

int Temperature = 0;

Next, you have to indicate which pins will use the led screen, for this, you have to write:

LiquidCrystal lcd (12, 11, 5, 4, 3, 2);

void setup () {

begin ();

begin (16, 2);

Indicate the place where the writing will begin:

setCursor (4, 0);

print ("LEANTEC");

delay (2000);

clear ();

setCursor (0, 0);

print ("Robots &");

delay (1000);

setCursor (5, 1);

print ("Electro");

delay (2000);

clear ();

setCursor (0, 0);

print ("STATION");

delay (1000);

setCursor (0, 1);

print ("WEATHER");

delay (2000);

clear ();

}

To read the humidity, the following codes must be entered:

void loop () {

Humidity = dht.readHumidity ();

Temperature = dht.readTemperature ();

At this time you have to indicate where the writing will begin on the led screen:

setCursor (0, 0);

print ("HUMIDITY");

setCursor (12, 0);

print (Humidity);

setCursor (14, 0);

print ("%");

setCursor (0, 1);

print ("TEMPERATURE");

setCursor (12, 1);

print (Temperature);

setCursor (14, 1);

print ("C");

delay (100);

}

Meet the best Arduino Kits to create weather stations from scratch

Next, we will show you the best kits you can buy to create your own weather station with Arduino .

Choose the one you like best:

ESP8266 Weather Station

This weather station element kit includes a temperature sensor, ambient pressure and humidity sensor. It has a led screen for an Arduino IDE IoT Starter board . In addition, you can find a complete guide so that the assembly is not a problem for you.

1602 LCD Kit

The Arduino board that comes with this kit is the UNO R3 with an I2C 1602 bus, which allows a better handling to transmit the information. It has a module to detect humidity and temperature, you can also find a plate for detecting water and sound . The newest thing about this equipment is that it includes a remote control of a servomotor to tilt the components in all directions.

Weather station kit with BMP180

The sensors included in this set of elements are the BMP180, DHT11 and BH1750FVI, in this way it is possible to obtain atmospheric pressure, temperature and humidity data with a high degree of precision. It includes a manual in English with which you can work to make a step-by-step guide.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button