KenYEAH! 2k15


1 week Microcontroller Lab at Oxford University

Weather Station

By Rees Davison & Howard Tam

The weather station team was tasked with recording all weather variables and sending the data to the interface. This team was also responsible with receiving time from the internet to synchronise with other machines.

Design Brief

  1. Set up the sensors in appropriate circuits.
  2. Write the code allowing our mbed to receive useful data.
  3. Calibrate sensors which output only voltage readings so it can be interpreted as useful weather data.
  4. Find a reliable way to send weather data to the interface team so that they can read it and display it on their screen.

With More Time

With more time we would set up an mbed allowing us to connect to the internet. From here we would receive the time and ideally we would want to transmit weather data back to the internet where it could be saved. This would allow the usage of the station to be monitored once up and running.

The Build

Temperature and Pressure Sensor

For this we used the ms5637 with data sheet : http://www.farnell.com/datasheets/1756129.pdf

/media/uploads/ree5yd/20150611_164128-1-.jpg

For setting up the sensor we used the circuit diagram given on page 11. /media/uploads/ree5yd/ms5637circuit.jpg

By using the I2c interface for SDA /SCL and connecting VDD to 3v3 voltage supply on the mbed the sensor was relatively easy to setup.

For the code, multiple libraries can be found already on the mbed website and the code was very simple to setup just to print the data to the pc terminal. The libraries include the code for second order temperature corrections as well cyclic redundancy checks.

LDR - Light Dependent Resistor

For this we used the LDR NORPS12 with given data sheet: http://www.farnell.com/datasheets/409710.pdf

/media/uploads/ree5yd/ldrpotentialdivider.jpg

We would be using the LDR to measure light intensity in Wm^-2. Since the device acts as a variable resistor we set it up in a potential divider circuit using the " " voltage source on the mbed. Reading out a voltage was very simple, however the calibration required to gain accurate light intensity values as measured against a light meter proved to be very difficult. Since the LDR is made up of a semiconductor material it is also highly affecting by changes in temperature so truly accurate readings with this sensor would prove tricky.

Using the light meter we took values of light intensity for the voltage printed out by our device. By plotting the data using matlab we found that it's characteristic definitely could not be desribed as linear. As the graph resembled a 1/x function, we used the form y=constant/x .Using matlab's linear regression function we found a value for the constant. When the curve was displayed against the data we decided this to be a close enough fit.

Humidity and Temperature Sensor

For this we used the DHT11 with given data sheet: http://www.micropik.com/PDF/dht11.pdf

/media/uploads/ree5yd/dht11.jpg

For setting up this sensor we used the circuit given in the data sheet. We also made use of 22nF decoupling capacitor between ground and the 5v supply voltage from the mbed to limit noise.

/media/uploads/ree5yd/dht11circuit.jpg

For the code we found multiple libraries on the mbed website. However upon running our code there was a problem witha huge number of errors returned by the device. To get around this problem we created a while loop which is only left when no error is shown

The Full Weather Station

/media/uploads/ree5yd/fullweathercircuit.jpg

We could now print all weather data to the pc console.

Making Connections

We now had the arduous task of sending data to another mbed in our group. For the project we were aiming for the data to be sent via wireless to the LCD display team. However, to test sending data we began with a serial link.

Using the RX/ TX lines we began by trying send data to an unused mbed. Starting with a simple stub program we found we were able to send a single character with no complications. Further research showed sending all the weather data as a string would be difficult and so we decided to split the data into a character array and, using a for loop send the individual characters at spaced out intervals. After a number of iterations of code this proved to be a success. Copying the code into our main weather station program required a few slight changes.

Wireless

To send our weather data by wireless we set it up as shown. Using the libraries graciously provided by Malcolm McCulloch and by careful wiring we were first able to send a simple string message. We then transferred this to our main program so that weather data would be sent.

/media/uploads/ree5yd/wireless.jpg


All wikipages