FreeStanding Wireless Weather Station
by Yongqiang Wang for ECE 4180 @ Gatech
Introduction
This is a miniproject for ECE 4180 @ Gatech. My plan is to build a freestanding wireless weather station, which includes: temperature and humidity sensor, air pressure sensor, GPS receiver module and a Wireless Wifly module. The main idea is: using all of the sensors to collect the temperature, humidity, air pressure and GPS location information; then use Wifly send all of the information to Internet and post them on a website. Finally, we can remotely monitor the weather condition online.
This weather station could be used to improve the weather forecast accuracy, and keep daily weather information as history record with geography information as well.
Code
#include "mbed.h"
#include "WiflyInterface.h"
#include "Websocket.h"
#include "SHTx/sht15.hpp"
#include "SCP1000.h"
#include "GPS.h"
SCP1000 scp1000(p5,p6,p7,p8);
DigitalOut busy(LED1);
Serial pc(USBTX, USBRX);
SHTx::SHT15 sensor(p28, p27);
GPS gps(p9, p10);
/* wifly interface:
* - p13 and p14 are for the serial communication
* - p25 is for the reset pin
* - p26 is for the connection status
* - "mbed" is the ssid of the network
* - "password" is the password
* - WPA is the security
*/
WiflyInterface wifly(p13, p14, p25, p26, "MOTOROLA-D339A", "2b226b3a33cf026d36f3", WPA);
int main() {
sensor.setOTPReload(false);
sensor.setResolution(true);
char John_str[200];
wifly.init();
while (!wifly.connect());
pc.printf("IP Address is %s\n\r", wifly.getIPAddress());
Websocket ws("ws://sockets.mbed.org:443/ws/yongqiang_wang/rw");
while (!ws.connect());
pc.printf("IP Address is %s\n\r", wifly.getIPAddress());
while (!gps.sample());
while (1)
{
busy = true;
sensor.update();
busy = false;
float TempC, TempF, Humidity;
int Pressure;
float Longitude, Latitude;
// Temperature in celcius
sensor.setScale(false);
TempC = sensor.getTemperature();
pc.printf("Temperature [ %3.1f C ]\r\n", TempC);
// Temperature in fahrenheit
sensor.setScale(true);
TempF = sensor.getTemperature();
pc.printf(" [ %3.1f F ]\r\n", TempF);
// Relative Humidity
Humidity = sensor.getHumidity();
pc.printf("Humdity [ %3.1f %% ]\r\n", Humidity);
// Air pressure
Pressure = scp1000.readPressure();
pc.printf("The pressure is %d Pa\n\r", Pressure);
Longitude = gps.longitude;
Latitude = gps.latitude;
pc.printf("I'm at %f, %f\n\r", Longitude, Latitude);
pc.printf("\n\r");
sprintf(John_str, "The Temperature is %3.1f C, Humidity %3.1f %%, Pressure %d Pa, My location is: %7.5f, %7.5f", TempC, Humidity, Pressure, Longitude, Latitude);
ws.send(John_str);
wait(2.0);
}
}
[Not found]
Wiring
List of Parts:
- Sensirion SHT15 Dual Temperature and Humidity Sensor http://mbed.org/cookbook/SHT15
- SCP1000 Pressure Sensor https://mbed.org/cookbook/SCP1000-Pressure-Sensor
- GlobalSat BR355 Serial GPS unit with RS232 Breakout and Breakout for Power http://mbed.org/users/snavare3/notebook/mbed-with-low-cost-serial-br355-gps-using-rs232-br/
- WiflyInterface https://mbed.org/cookbook/WiflyInterface
Temperature and Humidity Sensor
| SHT15 | mBed |
|---|---|
| GND | GND |
| V3.3 | Vcc |
| p28 | Data |
| p27 | Sck |
Air Pressure Sensor
| SCP1000 | mBed |
|---|---|
| Csb | p8 |
| Miso | p6 |
| Mosi | p5 |
| Sck | p7 |
GPS Signal Receiver
| GPS ps/2 b/o pin | mBed |
|---|---|
| Vcc | Vv =5V |
| GND | GND |
| GPS RS 232 b/o pin | mBed |
|---|---|
| Vcc | Vv=5V |
| GND | GND |
| Tx | p10 |
Wireless Connection
| Wifly | mBed |
|---|---|
| GND | GND |
| Vdd | Vout |
| UART_Rx | p13 |
| UART_Tx | p14 |
| GPIO | p26 |
| Reset | p25 |
Future Works
For further extension of this project, we can include more weather sensors into this weather station, such as: wind speed, wind direction, rain precipitation rate, etc.
Image
Weather Station Sensors Setup Photo
Website ScreenShot
Video
Please log in to post comments.
