Skip to main content
Ingenium Logo

You are leaving IngeniumCanada.org

✖


This link leads to an external website that Ingenium does not control. Please read the third-party’s privacy policies before entering personal information or conducting a transaction on their site.

Have questions? Review our Privacy Statement

Vous quittez IngeniumCanada.org

✖


Ce lien mène à un site Web externe qu'Ingenium ne contrôle pas. Veuillez lire les politiques de confidentialité des tiers avant de partager des renseignements personnels ou d'effectuer une transaction sur leur site.

Questions? Consultez notre Énoncé de confidentialité

Ingenium The Channel

Langue

  • Français
Search Toggle

Menu des liens rapides

  • Ingenium Locations
  • Shop
  • Donate
  • Join
Menu

Main Navigation

  • Browse
    • Categories
    • Media Types
    • Boards
    • Featured Stories
  • About
    • About The Channel
    • Content Partners

Project Log #2: Programming and Sensors

Share
5 m
Aug 1, 2018
Categories
Earth & Environment
Categories
Engineering & Technology
Media
Blog
Profile picture for user Mohamed Ebsim
By: Mohamed Ebsim
Ingenium
Jason helping Mohamed with soldering to a sensor
Photo Credit
Jesse Rogerson

In my first post, I wrote about the first step in my challenge to build a weather station for the Canada Aviation and Space Museum - which was to get the Raspberry Pi and the Arduino communicating. The next step in the project was to connect the weather sensors, and have them output real measurements. 

To begin with, I only had two sensors to work with – a humidity sensor and an altimeter. A humidity sensor is self-explanatory, but an altimeter is a sensor that provides barometric and thermometric data, which means you can measure the atmospheric pressure, temperature, as well as it can estimate your altitude. Both of these sensors are of the breakout variety, which means they lack pins that connect from them.

Close-up images of two sensors

Top: Humidity Sensor, Bottom: Altimeter (pressure, temperature, altitude)

Instead, they require soldering in order to attach connections to them. While I do have experience soldering, I got help from Jason Robinson, the museum's exhibitions maintenance guru, in order to ensure a good job.

Close-up shot of soldering iron and sensor with Jason and Mohamed working

Jason Robinson helping me solder wires to the two sensors

After thanking Jason for the excellent job he did, I began the process of wiring it up. Wiring the components is not as daunting as it seems. Since this is in the early stages, I could simply use a breadboard. A breadboard is a premade board that allows to prototype circuits without making permanent decisions such as soldering wires together. It is the white board in the photo below.

Images of the Raspberry Pi, Arduino, Breadboard and sensors

First image: Raspberry Pi, Arduino, Breadboard and sensors side by side, second image: close-up of altimeter sensor with wires connecting to the Arduino. The top of the breadboard is plastic, but within lies metal. This metal sits in columns, allowing for charges to carry through a column of sockets. In this image, the altimeter has 4 pins each in a seperate columns that allow the wires sharing those columns to transmit unique messages to and from the Arduino (see schematic below).

Each sensor has labels associated with each pin’s functionality. In general, you will have a pin for power, one for ground, and another for data transmission. This is how it was for the humidity sensor; there was a 5V pin, a ground pin, and another pin that I plugged into the analog pin number 0. For those who are inexperienced with Arduinos, there are digital and analog inputs. To visualize the difference, think of a light. A digital input is like having a switch which would turn the light on or off. Only two possible options. Now an analog input is like having a dimmer switch on your light – if you slide it, you can access a variety of brightness levels. The majority of sensors tend to use analog over digital, as they would like to return a point of data from a possible range. 

For the altimeter, I needed a connection to the VIN pin (which acts as our power pin) I also needed a ground pin, but instead of a single pin for data transmission it uses two: an SDA and SCL pin. These are used for I2C communication, which allows for multiple items to communicate with each other. SCL is the clock pin and ensures that data is transmitted at the appropriate rate and time. SDA is the side that accepts data. Together, they enable data to be collected without flaws.

Schematic outlining how the sensors connect to the Arduino.

Schematic outlining how the sensors connect to the Arduino.

Programming the Arduino to get data from the sensors was not too hard, as both sensors had their own libraries with examples for each one. I found them at their respective GitHub pages: (https://github.com/adafruit/Adafruit_MPL3115A2_Library and https://github.com/sparkfun/SparkFun_HIH4030_Arduino_Library ). Adjusting the code in order to combine the two together—in one all-encompassing program—was a matter of looking at the examples and dropping it over in the other.

An section of code that will return data from the sensors to the Raspberry Pi.

An section of code that will return data from the sensors to the Raspberry Pi.

Screenshot of the data coming from the Arduino

Screenshot of the data coming from the Arduino.

After some final adjustments and cleaning up, I quick run came with success. I now can read the values the sensors are measuring. 

The design process was interwoven between all the programming. Conceptualizing and brainstorming the compartment it would be housed in—and other details—was done with Jesse Rogerson, my supervisor and the museum’s science advisor. Since this is being placed outdoors, thinking ahead to how it will all come together is something that will continue to be discussed. 

Looking ahead, I’m excited to try out some possible 3D designing for the compartment. But that’s next week’s stuff...stay tuned to find out about my upcoming adventures!

All the code that has been made can be found at my GitHub page: https://github.com/mebsim/WeatherStation

Tags
DIY, weather, Weather Station, Breadboard, Circuit, Arduino, Raspberry Pi, Soldering, code, data, sensors
Author(s)
Profile picture for user Mohamed Ebsim
Mohamed Ebsim

Mohamed Ebsim is an intern at the Canada Aviation and Space Museum, working under Science Advisor Jesse Rogerson. He is also a high school student at Ashbury College.

Related Stories

A spliced photo, from left to right: Shaun the Sheep in front of a model of ESA’s European Service Module, a top view into a red bucket containing thousands of light-brown, rod-shaped pellets, and a toddler wearing a wool hat and wool sweater holds a grownup’s finger.

3 things you should know about why wool keeps us warm, and about its surprising uses in the garden and in space.

A large impact crater viewed from the rim, a woodern spoon full of small yellow grains, a close up of a forearm being tattooed.

3 things you should know about the untapped potential of millet, the permanence of tattoos, and asteroid airbursts

The thirty or so Mexican peasants who helped clear the Bacubirito meteorite, not far from Bacubirito, Mexico, 1902. N. Rosst, “La grande météorite de ‘Bacubirito’ (Mexique).” La Nature, 14 February 1903, 173.

A blaze in the northern skies and a cinder of sidereal fire: The Bacubirito meteorite

A rear view of a person wearing a yellow coat and backpack in winter, a close-up view of bright red poinsettias with small yellow central flowers.

Two things you should know about the science of wind chill, and the Orion spacecraft's selfies.

Three images side by side, Canada’s White Glacier, dried mealworms shown on a round wooden platter, and a pair of hands rubbing together, covered in soap bubbles.

3 things you should know about insects as an important source of protein, the science superpowers of soap, and monitoring glaciers in Canada’s Arctic

Three images side by side, plastic-wrapped cucumbers, a woman with an inflamed shoulder, and the James Webb Space Telescope.

3 things you should know about plastic-wrapped cucumbers, the James Webb telescope, and inflammation

Three images side by side, grocery shelves full of eggs in clear trays, coral reefs seen from space, and a map of Canada divided into four differently coloured shapes.

3 things you should know about egg refrigeration, coral reef satellite maps, and watersheds

Autumn vista of a river winding between pine trees and snow-capped mountains.

AI-Generated sound therapy for critically ill patients

A wide view of the underwater room in the RIPPLE EFFECT exhibition; the walls, floor, and ceiling are blue and information about water conservation adorns the walls.

A refreshing approach: Students create virtual exhibition to inspire water conservation

A spliced, three-part image depicts several unwashed potatoes on a white background, several springtails on ice pellets, and a black and white view of Saturn’s crater-rich moon Mimas, dominated by a very large impact crater on the right.

3 things you should know about PEI potato wart, Saturn’s moon Mimas, and animals with built in antifreeze.

Tomanowos, better known as the Willamette meteorite, American Museum of Natural History, New York City, New York. Anon., “Ça et là, par l’image.” Le Samedi, 22 February 1947, 8.

Tomanowos, a visitor from the sky or Moon: A brief look at the largest North American meteorite known today

A spliced, three-part image depicts a green-and-red plastic gadget attached to a cow’s tail, a composite image showing hundreds of meteors, and a close-up of a pair of glasses sitting on top of an open book.

3 things you should know about tech-enabled cows, meteors, and presbyopia

Footer

About The Channel

The Channel

Contact Us

Ingenium
P.O. Box 9724, Station T
Ottawa ON K1G 5A3
Canada

613-991-3044
1-866-442-4416
contact@IngeniumCanada.org
  • Facebook
  • Instagram
  • Twitter
  • Channel

    • Channel Home
    • About the Channel
    • Content Partners
  • Visit

    • Online Resources for Science at Home
    • Canada Agriculture and Food Museum
    • Canada Aviation and Space Museum
    • Canada Science and Technology Museum
    • Ingenium Centre
  • Ingenium

    • Ingenium Home
    • About Ingenium
    • The Foundation
  • For Media

    • Newsroom
    • Awards

Connect with us

Subscribe to our newsletter to receive the latest Ingenium news straight to your inbox!

Sign Up

Legal Bits

Ingenium Privacy Statement

© 2023 Ingenium

Symbol of the Government of Canada
  • Browse
    • Categories
    • Media Types
    • Boards
    • Featured Stories
  • About
    • About The Channel
    • Content Partners