Umbra-la: a Raspberry Pi weather station.

We went to Nashville to see the great American Eclipse, and it was awesome. We spent the weekend there, and got to see the the Frist Center For The Visual Arts and the Johnny Cash museum, do some bar-hopping on Broadway street, visit the Belle Meade Plantation, and eat some hot chicken.

A nerd like me would not go to see the eclipse empty-handed, so I built a small weather station from a Raspberry Pi that I had lying around. I bought a temperature and humidity sensor, a pressure sensor, and a light sensor from DigiKey. They are all already mounted on breakout boards built by Adafruit, which saves a lot of time. I had this post in mind when I put everything together, so I started by designing the circuitry on Fritzing. I’m not a huge fan of Fritzing, as it crashes a lot, but it does help when you actually assemble your circuit, and you get nice images to put on your blog post. Like this one:

 

All three sensors use I2C for communication, which makes the circuitry really easy, as they all share the same lines. I modified some Python code I found for these sensors on Control Eveything’s github page. Basically, I turned every sensor into a class. I gave them all the same interface, which I have recently learned is called “Duck Typing” – if a class looks like a duck, quacks like a duck, and has the same interface as a duck – it can be considered a subclass of a duck, and therefore can be pushed into an array of ducks for the main program to call in sequence. I added a pseudo-sensor for the time, also responding to the same interface, so I that I can treat the time stamp the same way I treat the other measurements.

I assembled the whole thing on a breadboard ant put it back inside the cardboard box that I got from DigiKey. Since it looks kinda sketchy, I included a letter to the TSA explaining what this thing is, and added my Exploratorium business card for good measure.

The program displays each measurement for two seconds on the LCD. Once it’s done going through all the sensors, it writes all the results to a CSV file. I later uploaded the CSV file to a Google sheet to create some graphs. It’s cool to see the temperature drop during the eclipse, and how the changes in temperature lag behind the changes in light.

 

Sensor list

  • Temperature and humidity: Si7021. Get from Adafruit here, code from ControlEverything here.
  • Altimeter and pressure (and some more temperature): MPL3115A2. Get from Adafruit here, code from ControlEverything here.
  • Light: TSL2561. Get from Adafruit here, code from ControlEverything here.

Links

Check out the code, as well as the Fritzing file, on Github.

Julia also took some measurements and had fun with shadow bands. Check out her write-up.

 

Leave a Reply

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