Weather Station using Arduino and LabVIEW : Tutorial 4 (original) (raw)

In Tutorial 4 of LabVIEW, we will take a look at designing a Weather Station using Arduino and LabVIEW. In our last tutorial, we saw how to control the speed and direction of a DC motor using LabVIEW and Arduino and how to create a user interface in LabVIEW’s front panel. Now, for this tutorial, we will interface Arduino with LabVIEW and create a simple weather station to display the intensity of light and temperature on the front panel of LabVIEW. For this purpose, we will connect an LM35 and a light sensor for our weather station, which will measure the temperature and intensity of light in real time and, using the LabVIEW interface, display them on the panel of our weather station. We will divide our weather station project into the following steps:

Steps of Weather Station Project

This project’s steps are listed below:

  1. Software Requirements for a weather station.
  2. Hardware Requirements for the weather station.
  3. Circuit Wiring of weather station
  4. LabVIEW VI for a weather station

Software Requirement for Weather Station:

In case you are beginning with Arduino and LabVIEW, we recommend checking: How to Program Arduino with LabVIEW Step-by-Step Guide.

Hardware Requirement for Weather Station

LM 35 sensor

Working of LM35 in Weather Station

In our weather station, LM35 is a sensor used to measure the temperature of the surrounding area. The output is actually an analog voltage, which corresponds to the surrounding temperature when multiplied by 100.

LDR sensor

Working of LDR in Weather Station

In our weather station, a light-dependent resistor is used to detect changes in light intensity or as a light sensor. LDR is basically a variable resistor. LDR resistance changes with the intensity of light. If the intensity of light falling on LDR is high, LDR will have low resistance. When the intensity of light decreases, LDR offers high resistance. Hence, there is an inverse relationship between the intensity of light and the resistance of LDR. So the LDR is used as a light sensor.

Now the question comes to mind: how to measure resistance, which in turn can be used to calculate the intensity of light? As you know, the Arduino UNO R3 board has six analog-to-digital converter channels. All analog-to-digital converters can only measure voltage. These channels cannot measure resistance directly. But resistance can be measured indirectly by converting it into voltage. This is basically called signal conditioning. A 10K ohm resistor is used in series with the LDR through a 5-volt source. This circuit is used to convert resistance into voltage. The voltage measured across the LDR can be measured with the help of the analog-to-digital converter on the Arduino. This measured voltage can be converted back into resistance using the voltage division formula.

Circuit Wiring of Weather Station

Schematic weather station LabVIEW

In this section, we will discuss wiring diagram of this project and show a complete circuit diagram.

Arduino Pins LM35 sensor pins
5V 1
A1 2
GND 3

Connect a 10K resistor between Pin 2 and Pin 3 of the LM35 (not shown in diagram).

Arduino pins LDR sensor pins
5V 1
A0 2

Also, connect a 10K resistor between the second pin of the LDR and ground.

This completes our circuit for the weather station, which measures temperature and light intensity.

Initializing Arduino in VI

initializing Arduino for weather station LabVIEW

Initializing Arduino in LabVIEW

Placing init block of Arduino

Creating constant for init block

COM Port LaBVIEW

Selecting COM port

Setting baud rate

Configuring Arduino for weather station LabVIEW

Configuring Arduino parameters

While Loop Structure

Placing While loop

Arduino Configuration and While Loop

Analog Read Pins for Arduino

Analog read pins with wiring connections

Creating control for analog read blocks

Placing Operators and constants

Adding Divide operator in LabVIEW

Adding Multiply operator and constants in LabVIEW

Multiply operator placement with constant in LabVIEW

Placing Thermometer and Slide in VI

Thermometer indicator for weather station

A thermometer in Front Panel LabVIEW

slide indicator for weather station

Adding slide to the Front Panel in LabVIEW

Connecting slide and Thermometer in VI

Closing Arduino block panel

Circuit block diagram weather station LabVIEW

Circuit block diagram of weather station

This completes our VI of the weather station.

Uploading Program to Arduino

Now we will upload the program to Arduino and run it from LabVIEW, as shown in previous tutorials.

Testing weather station LabVIEW

Simulation of weather station LabVIEW

We can see the temperature and light intensity indications on the front panel of the weather station program. When we change the temperature in the real world, the thermometer shows on the panel of LabVIEW, and when the intensity of light changes, it is also indicated on the front panel of LabVIEW.

Conclusion

In this tutorial, we discussed the following topics

Related Articles

You may also like to read

Arduino Components Amazon Links
Arduino Starter Kit Buy Now
Arduino Development Kit Buy Now
Arduino Smart Robot Car Kit V4 Buy Now
Arduino Sensors Kit Buy Now