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:

Temperature and Humidity Sensor

SHT15mBed
GNDGND
V3.3Vcc
p28Data
p27Sck

Air Pressure Sensor

SCP1000mBed
Csbp8
Misop6
Mosip5
Sckp7

GPS Signal Receiver

GPS ps/2 b/o pinmBed
VccVv =5V
GNDGND
GPS RS 232 b/o pinmBed
VccVv=5V
GNDGND
Txp10

Wireless Connection

WiflymBed
GNDGND
VddVout
UART_Rxp13
UART_Txp14
GPIOp26
Resetp25

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 /media/uploads/yongqiangwang/photo.jpg

Website ScreenShot /media/uploads/yongqiangwang/screenshot.jpg

Video


Please log in to post comments.