Report of a weather Station with Raspberry PI

Page 1

Tutored Project: Weather Station Project and specifications

I. General explanation

II. Functional analysis (Bluetooth part)

The Bluetooth projects

I. Materials and tools used

II. What is a Raspberry Pi?

III. Use of the Arduino environment

IV. Connection of the Bluetooth module

V. Acquisition and sending of data

VI. User interface

Project members

Simon Ugo/ Marco Pierre/Galzin Jules

Project teacher

Terrier Clément

Tutored Project Weather Station

Project and specifications

General explanation:

Students in BUT Physical Measurements, we must realize for our training an end of year project.

This project is in 2 parts and consists in conceiving an autonomous weather station measuring thanks to sensors various climatic data then to consult them quickly and simply.

The objective for this project is to improve the station on the roof of the IUT.

Functional analysis (Bluetooth part)

The different steps of realization are the following:

• Understanding and use of the programming environment Arduino with the card that contains the Bluetooth module

• Management of the integrity of the data

• Management of the autonomy of the Arduino system

• Acquisition of the measurements of the various sensors

• Sending the measurements to a named and dated file.

The objectives of the metrology part are different, and it is possible to advance separately

Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 2 / 13
Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 3 / 13 The Bluetooth projects Materials and tools used Raspberry pi 4 8GB RAM Arduino board Bluetooth module Prototyping plate + cable (Only a few cables will be needed)

What is a Raspberry Pi?

A Raspberry Pi is an inexpensive computer that plugs into a computer monitor or TV and uses a standard keyboard and mouse. It’s a powerful little device that allows people of all ages to explore computers and learn how to program in languages like Arduino or Python. Using Raspberry Pi we can play high resolution video, create spreadsheets, process text… Rasberry Pi can interact with the outside world and has been used in various digital maker projects (weather stations, infra red cameras, …)

Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 4 / 13

Use of the Arduino environment

schematic of an arduino board

The Arduino part is the one that connects the two projects of the weather station

On the Raspberry in arduino we write a program to retrieve data from the calibrated sensors of the other project. Then we upload the program on the arduino. We made a program to retrieve the data from the brightness, temperature and wind direction sensor.

You can see the code in the annexe 1.

Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 5 / 13

The Bluetooth connexion

The part of the Bluetooth connection was complicated to achieve. We first tried to pair the Arduino with the Raspberry Pi, but we didn’t have the pairing code, so we had to change our method.

We followed a tutorial of the Bluetooth connection between Arduino and Raspberry Pi 3 found on the internet.

https://www.alex design.fr/Projets R A/Douche connectee/Connection bluetooth entre Arduino et Raspberry Pi 3

On the tutorial, we do not take care of the arduino cabalge part and the arduino program does not work.

We use the part about the configuration of the raspberry Pi. The tutorial asks us to do the pairing which is not possible for us.

we add a bluetooth management module by typing this command line: sudo apt get install bluetooth pi bluetooth blueman

We check the installation with the command:

We launch the discovery of the bluetooth devices by using the bluetooth command interface: bluetoothctl. Then we use the commands agent on, power on and scan on as shown below.

bluetoothctl [NEW]ControllerB8:27:EB:29:46:68raspberrypi[default] [bluetooth]# agent on Agent registered

Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 6 / 13

[bluetooth]# power on Changing power on succeeded [bluetooth]# scan on Discoverystarted

We managed to connect the arduino with the raspberry with the connect command and the mac address as shown below.

[bluetooth]# connect 18:93:D7:49:BC:04

[CHG]Device18:93:D7:49:BC:04Connected:yes

Then we wanted the Bluetooth connection to be automatic at each Raspberry reboot.

To do that we use a crontab task. This is a task that runs every time you reboot the raspberry pi. To create this task we used the command below.

nano reconnectionBluetooth.sh

#/bin/sh

bluetoothctl connect 18:93:D7:49:BC:04

After that, we had to add this task and gave it the rights with the following commands:

sudo crontab e

@reboot sleep 15 && sudo sh /home/pi/reconnexionBluetooth.sh

chmod 777 reconnexionBluetooth.sh

Thanks to all these commands, a bluetooth connection is established between the arduino and the raspberry at each reboot.

We do not use the part of the python program on this tutorial.

Acquisition and sending of data

For the acquisition and the sending of the data it is necessary to create a python program allowing to sort the data according to the day and the hour.

Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 7 / 13

The cron function is used because as seen previously we can use it to connect in Bluetooth and open a file where there is a code allowing this data processing.

Here is a picture of an example program and what we get The Program is annexe 2 Board

Example of what we observe in our files is annexe 3

User interface

With the red node it is possible to create an interface displaying the measurements given by the weather station

To do this you have to install the following function blocks

in the 2 orange blocks of "function" you have to write in the console a code to get the values that pass through the raspberry.

For the return function you just have to put in the value you want to output

Here is an example of this interface

Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 8 / 13

Now that the blocks are programmed (one block for each type of measurement) we have to create with the other blocks of Node red a system taking the values and displaying them; Here is an example of a system

it is also advised via an internet connection to create a local server and to send the interface of node red to another device with the Unitag website it is possible to create and personalize a qr code from a link, so by entering the link of the server and being on the same connection as him it is possible to have the values on a phone

This is an exemple of the user interface

Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 9 / 13

Conclusion

We managed to recover and index the data, but it is impossible without the password of the Bluetooth module to send the data without any wire between the card and the raspberry to improve the project, it would have been easier to take an Arduino board with integrated Bluetooth to not have to go through a Bluetooth module; (We were never able to contact or meet with the IT people on the first floor of the building to ask them questions).

We tried to contact programmers, but nobody was able to help us, or we just didn't get an answer.

Finally, we can establish a bluetooth connection between the arduino and the raspberry at each reboot.

We can get the data from the sensors of the other project but by wire. We have created a user interface so that it can read the measurements of the weather station.

Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 10 / 13

Annexe

Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 11 / 13
Annexe 1 : Program arduino
Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 12 / 13 Annexe 2 : Programme of acquisition and sanding of date
Tutored Project Weather Station Writing : U. SIMON P. MARCO J. GALZIN Date of writing : June 17, 2022 Page number : 13 / 13 Annexe 3 : what we observe in our files is annexe 2

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.