Introduction

With the bipolar weather of Ithaca New York we thought it was vital to come up with a project that could help us gauge the day-to-day weather here. So, for our final ECE 3140 project we decided to incorporate the WeatherRack Weather Sensor with the FRDM-KL46Z board in order to detect and display current weather forecasts. The Weather Sensor comes equipped with a Wind Vane, Anemometer, and a tipping bucket rain gauge. When placed outdoors, the weather station will collect data which will then be shown on the LCD display of our board.

System Overview

Project Video Demo

Link to our video

Detailed Technical Description

Since we decided to use external peripheral hardware soldering the board was the first step! We made sure to read through the documentation for the FRDM-KL46Z as well as the Weather Station's in order to correctly solder the pins.

We start by importing an SDK with the components fsl_slcd.c, fsl_slcd.h, pin_mux.c, pin_x.h, etc which allows us to interconnect the board with the weather system. Once we had the SDK, we moved our source code to this new project directory in order to start working.

Our main file (weather_station.c) contains the code that controls each of the weather station components as well as the LCD Display.We enabled interrupts (PIT_IRQ) in our time.c file which kept track of the interrupts, updating the seconds, and any alterations we needed to make to the bus frequency. Once we set the interrupts and correctly identified the input/output pins, we were ready to move onto the main bulk of our code. To start, we initialized each component with GPIO pins. We used switch statements in order to switch between different displays. Our first case was the time display. The time display starts at 00:00 where you have within 30 seconds (idle time) in order to change the time. The left button gave you the ability to change hours (0-23) and the right button gave you the ability to change minutes (0-59). This was done with simple if/else statements that could increment the time if the button was clicked. As you can tell, we decided to go with military time for our display. Once the 30 seconds passed, the right button gave you the ability to move onto Case 2 where the wind speed would be displayed. As the anon-meter spun, the wind speed would change according to the measurements it was receiving.In order to do this part of the code, we used the given displayDigit() function to light up certain segments of the display. The first input was the segment you wanted to light up (1,2,3,4) and then the second input is the digit you would like to display. If you were ready to move on, you could click the right button again in order to now display the wind direction.The wind vane (wind direction) would send a set voltage to our board which we would be able to interpret as a certain degree measurement. We then coded up a conversion of the degree measurement to a specific cardinal direction. As you change the positioning of the wind vane, the cardinal direction would be changed. In order to do this part of the code, we used the function turnOnSegment() to light up each segment of the board. We tried to figure out which segments when put together would turn into the shape of a letter (N, S, E, W, NE, etc). Our last case was the rain gauge measurement which displayed how much rain was put into the bucket. The rain bucket contains a bucket inside which when full, signals the board to increase the rain measurements and tips the bucket in order to drain out the water and collect again. Throughout any part of this, you could click the left button to go back and adjust the time.

Additional Resources Used

We were open to using any resources available regarding both our board and the sensors. On Ed Discussion a lot of helper files were posted that we ended up using for our final project.

Files Used

Testing Scheme

Lot of testing was necessary in order to get this weather station to work. We started by working on figuring out the time display. We ran into a major error when we realized we weren't properly placing the source files into the SDK Example from the 3140 Instructors. This was a major setback because we spent a lot of time not even being able to run the LCD Demo code on our board. Once we understood the time display, we began testing each component of the weather station. We ran into errors correctly displaying wind speed, direction, and rain fall but with a lot of trial and error as well as debugging we were able to make it work! Breaking down the testing to each component helped us find the root of our issue quicker.

Work Distribution

Collaborative work environment! We worked together a lot over the finals period in order to peer program and we each tried to research and find reference material and code to use. We also tried to split up the different coding segments so we could come together and connect each part of the code.