Reader small image

You're reading from  Raspberry Pi Pico DIY Workshop

Product typeBook
Published inMay 2022
PublisherPackt
ISBN-139781801814812
Edition1st Edition
Right arrow
Authors (2):
Sai Yamanoor
Sai Yamanoor
author image
Sai Yamanoor

Sai Yamanoor is an embedded systems engineer working for a private startup school in the San Francisco Bay Area, where he builds devices that help students achieve their full potential. He completed his undergraduate work in mechatronics engineering from Sri Krishna College of Engineering and Technology, Coimbatore, India and his graduate studies in mechanical engineering at Carnegie Mellon University, Pittsburgh PA. His interests, deeply rooted in DIY and open software and hardware cultures, include developing gadgets and apps that improve the quality of life, Internet of Things, crowdfunding, education, and new technologies. In his spare time, he plays with various devices and architectures, such as the Raspberry Pi, Arduino, Galileo, Android devices and others. Sai has earlier published a book titled Raspberry Pi Mechatronics Projects.
Read more about Sai Yamanoor

Srihari Yamanoor
Srihari Yamanoor
author image
Srihari Yamanoor

Srihari Yamanoor is a mechanical engineer, working on medical devices, sustainability, and robotics in the San Francisco Bay Area. He completed his undergraduate studies in mechanical engineering from PSG College of Technology, Coimbatore, India and graduate studies in mechanical engineering at Stanford University. He is certified in SolidWorks, simulation, sustainable design, PDM as well as in quality and reliability engineering and auditing. His has a wide range of interests, from DIY, crowdfunding, AI, travelling, photography to gardening and ecology.
Read more about Srihari Yamanoor

View More author details
Right arrow

Chapter 5: Building a Weather Station

In this chapter, you will build a weather station to conduct your own citizen science experiments using Raspberry Pi Pico. We will discuss interfacing and testing various sensors with the Pico and installing your Pico outdoors.

By the end of this chapter, you will have built something similar to what is shown in the following figure:

Figure 5.1 – Raspberry Pi Pico interfaced to a weather station

In this project, we will discuss interfacing sensors with the Pico to collect environmental data from the immediate surroundings. We will test all the sensors by discussing the code needed to interface them and put our weather station together.

The topics covered in this chapter will include the following:

  • Conducting citizen science experiments
  • Installing the requisite libraries
  • Testing the sensors
  • Assembling and testing the weather station

    Weatherproofing Your Project

    In this chapter, we want to...

Technical requirements

The following hardware is recommended for this chapter. We will leave it up to you to select the sensors for your weather station:

The code samples discussed in this chapter are available here:

https://github.com/PacktPublishing/Raspberry-Pi-Pico-DIY-Workshop/tree/main/chapter_05

Code in Action videos for this chapter can be viewed at https://bit.ly/3P1uTSz.

Conducting citizen science experiments

Citizen science is a broad approach that involves numerous individuals and groups who volunteer to collect and/or analyze data on various projects that are of wide interest. Participants in these projects may be of any gender, age group, and educational background, and they may span across continents. Some common areas where citizen science can be effective include weather and climate monitoring, wildlife tracking, and related areas. Applications include general science, sustainability, climate change, population health, and smart cities. It is expected that the nature, scope, and number of citizen science endeavors will grow immensely in years to come. The types of data gathered by citizen science may include discrete or continuous parameters such as temperature, Volatile Organic Compounds (VOCs), and other atmospheric content, images, and audio files.

At scale, citizen science projects can be effective at helping solve large-scale data-intensive...

Installing the requisite libraries

We are going to install all the libraries required for this chapter. The first step is to download the CircuitPython Library Bundle. You can download the Library Bundle as a ZIP file from here: https://circuitpython.org/libraries.

Extract the contents of the ZIP file to get started with the library installation.

CircuitPython Installation

We are assuming that you have installed CircuitPython on your Pico. If you are not familiar with the installation process, we recommend following the installation process from Chapter 1, Getting Started with Raspberry Pi Pico.

The AM2315 sensor

We need two libraries for the AM2315 temperature (shown in the following figure) and humidity sensor, namely adafruit_bus_device and adafruit_ahtx0. In the extracted bundle, there is a folder called adafruit_bus_device along with the adafruit_ahtx0.mpy file. Copy over the folder to the lib folder of the Pico.

Library Selection

According to the guide...

Testing the sensors

In this section, we will set up and test the individual components used in the project before we put them together.

Testing the BME280 sensor

In this section, we will test the BME280 sensor (as shown in the following screenshot):

Figure 5.2 – The BME280 Pressure Sensor

The BME280 Pressure Sensor can be used to measure temperature, humidity, and atmospheric pressure. It comes with an I2C interface, and its address on the I2C bus is 0x77.

The sensor is interfaced to the Pico, as shown in the following schematic:

Figure 5.3 – The Fritzing schematic for the BME280 sensor

In the preceding schematic, the sensor is interfaced to the Pico as follows, where the left side of the arrow refers to a pin on the BME280 breakout board, while the right side of the arrow refers to a pin on the Raspberry Pi Pico:

  • VIN → VBUS
  • SCL → GP9
  • SDA → GP8
  • GND

    Pull-Up Resistors for...

Assembling and testing the weather station

We recommend following an excellent guide from SparkFun to assemble the kit. You can refer to the guide here: https://bit.ly/3yTgZZu. We assembled our kit and tried setting it up in our backyard, as shown in the following figure. We made use of a Pico and a weather carrier board for our installation. This is just for the sake of convenience to avoid some messy wires outdoors:

Figure 5.18 – A weather station installation in the backyard

We tested our weather station without the following considerations:

  • A power source for the weather station
  • Assembly of the carrier board onto the weather station
  • Weather-proofing the carrier board inside an enclosure
  • Sturdy installation of the weather station

It is going to take some extensive testing to identify and fix all the problems. The first step is to fix any problems associated with sensor interfacing. Then, we need to ensure that any enclosure...

Summary

In this project, we discussed conducting our own citizen science experiment by building our own weather station using the Raspberry Pi Pico. We tested the sensors and put the weather station together. We also discussed troubleshooting problems associated with deploying the station outdoors, and we also discussed weather-proofing our installation.

Since citizen science experiments benefit from sharing data on publicly available data streams, we plan to make our data available once we have added connectivity to our weather station. We also plan to publish the status of our weather station to a public data stream.

In the next chapter, we are going to have fun with displays!

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Raspberry Pi Pico DIY Workshop
Published in: May 2022Publisher: PacktISBN-13: 9781801814812
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Sai Yamanoor

Sai Yamanoor is an embedded systems engineer working for a private startup school in the San Francisco Bay Area, where he builds devices that help students achieve their full potential. He completed his undergraduate work in mechatronics engineering from Sri Krishna College of Engineering and Technology, Coimbatore, India and his graduate studies in mechanical engineering at Carnegie Mellon University, Pittsburgh PA. His interests, deeply rooted in DIY and open software and hardware cultures, include developing gadgets and apps that improve the quality of life, Internet of Things, crowdfunding, education, and new technologies. In his spare time, he plays with various devices and architectures, such as the Raspberry Pi, Arduino, Galileo, Android devices and others. Sai has earlier published a book titled Raspberry Pi Mechatronics Projects.
Read more about Sai Yamanoor

author image
Srihari Yamanoor

Srihari Yamanoor is a mechanical engineer, working on medical devices, sustainability, and robotics in the San Francisco Bay Area. He completed his undergraduate studies in mechanical engineering from PSG College of Technology, Coimbatore, India and graduate studies in mechanical engineering at Stanford University. He is certified in SolidWorks, simulation, sustainable design, PDM as well as in quality and reliability engineering and auditing. His has a wide range of interests, from DIY, crowdfunding, AI, travelling, photography to gardening and ecology.
Read more about Srihari Yamanoor