Difference between revisions of "Open Source WiFi Weather Station System"

From Microduino Wiki
Jump to: navigation, search
(Programming and Uploading)
(13 intermediate revisions by 3 users not shown)
Line 6: Line 6:
 
*Objective: To get temperature, humidity, light intensity and even PM2.5 data around you.   
 
*Objective: To get temperature, humidity, light intensity and even PM2.5 data around you.   
 
*Difficulty: Medium   
 
*Difficulty: Medium   
*Time-consuming: 2-Hour
+
*Project Time: 2 Hours
*Maker: Ray   
+
*Creator: Ray   
  
Instroduction:   
+
Introduction:   
*It can get temperature, humidity, light intensity and even PM2.5 data around you, and display those data on the screen.
+
*The station monitors temperature, humidity, light intensity and even PM2.5 (particulate matter) data around you.
*Upload the data to Blynk.   
+
*Display the sensor data on the OLED screen.   
*You get weather information via your phone or send information to the weather station with your phone.  
+
*The station can be synced with Blynk to upload sensor data.  
*The system is completely achieved by Microduino.
+
*Access the data anytime using the Blynk app.
  
 
==Bill of Material==
 
==Bill of Material==
Line 65: Line 65:
  
 
==Principle of the Experiment==
 
==Principle of the Experiment==
This Weather Station can detect data including:
+
This Weather Station collects the following:
*Temperature and humidity via [[Microduino-Temp&Hum]]
+
*Temperature and humidity with a [[Microduino-Temp&Hum]]
*Light intensity via [[Microduino-Light]]
+
*Light intensity with a [[Microduino-Light]]
*Air quality via [[Microduino-Air Quality]]
+
*Air quality with a [[Microduino-Air Quality]]
*PM2.5 via GP2Y1010AU0F
+
*PM2.5 with a GP2Y1010AU0F module.
  
  
*Adopt [[Microduino-Core+]] to analyze and process sensor data.   
+
*Uses a [[Microduino-Core+]] to analyze and process sensor data.   
*Display on [[Microduino-OLED]]
+
*Display data on a [[Microduino-OLED]]
*Connect the Weather Station with Blynk via [[Microduino-WIFI(ESP)]]  
+
*Connect the Weather Station with Blynk via a [[Microduino-WIFI(ESP)]]  
*Each sensor connects with [[Microduino-Sensorhub]]  
+
*Each sensor connects with the [[Microduino-Sensorhub]]  
 
[[File:Wifistationtheory.jpg||600px|center]]
 
[[File:Wifistationtheory.jpg||600px|center]]
  
Line 82: Line 82:
  
 
===Get Blynk Phone Client===
 
===Get Blynk Phone Client===
*Please refer to [[https://www.microduino.cn/wiki/index.php/Microduino-Blynk_Getting_start/zh#.E5.88.9B.E5.BB.BA.E9.A1.B9.E7.9B.AE Get and Configure Blynk]]
+
*Please follow the getting started with Blynk guide: https://www.blynk.cc/getting-started/
  
 
===Add Configuration Items ===
 
===Add Configuration Items ===
Line 89: Line 89:
 
|-
 
|-
 
|width="50%" valign="top" align="left"|
 
|width="50%" valign="top" align="left"|
**You can scan the two-dimension code below to get Weather Station APP.
+
*Scan the two-dimension code below to get Weather Station APP onto Blynk.  
 
|width="50%" valign="top" align="left"|
 
|width="50%" valign="top" align="left"|
 
[[File:BlynkWeatherStationLink.png||300px|center]]
 
[[File:BlynkWeatherStationLink.png||300px|center]]
Line 192: Line 192:
 
* Similarly, set the '''INPUT''' of the Light Sensor as V4 and the frequency is to get value every 3s.  
 
* Similarly, set the '''INPUT''' of the Light Sensor as V4 and the frequency is to get value every 3s.  
 
|width="50%" valign="top" align="left"|
 
|width="50%" valign="top" align="left"|
[[File:BlynkSetting12.png||200px|center]]
+
[[File:BlynkSetting7.png||200px|center]]
 
|}
 
|}
  
Line 219: Line 219:
 
* The '''INPUT''' of the methane gas is V5 and the frequency is to get value every 5s.   
 
* The '''INPUT''' of the methane gas is V5 and the frequency is to get value every 5s.   
 
|width="50%" valign="top" align="left"|
 
|width="50%" valign="top" align="left"|
[[File:BlynkSetting7.png||200px|center]]
+
[[File:BlynkSetting8.png||200px|center]]
 
|}
 
|}
  
Line 246: Line 246:
 
* Set '''OUTPUT''' as V6 and '''MODE''' as SWITCH, meaning each time you press the button, you can switch electric level of the D6 pin at the Microduino Client.   
 
* Set '''OUTPUT''' as V6 and '''MODE''' as SWITCH, meaning each time you press the button, you can switch electric level of the D6 pin at the Microduino Client.   
 
|width="50%" valign="top" align="left"|
 
|width="50%" valign="top" align="left"|
[[File:BlynkSetting8.png||200px|center]]
+
[[File:BlynkSetting9.png||200px|center]]
 
|}
 
|}
  
Line 257: Line 257:
 
*Can be set as data graph displaying V2 and V3. (can achieve four data display at most.)  
 
*Can be set as data graph displaying V2 and V3. (can achieve four data display at most.)  
 
|width="50%" valign="top" align="left"|
 
|width="50%" valign="top" align="left"|
[[File:BlynkSetting9.png||200px|center]]
+
[[File:BlynkSetting10.png||200px|center]]
 
|}
 
|}
  
Line 267: Line 267:
 
*The second '''History Graph''' can be used for displaying V6, PM2.5.   
 
*The second '''History Graph''' can be used for displaying V6, PM2.5.   
 
|width="50%" valign="top" align="left"|
 
|width="50%" valign="top" align="left"|
[[File:BlynkSetting10.png||200px|center]]
+
[[File:BlynkSetting11.png||200px|center]]
 
|}
 
|}
  
Line 277: Line 277:
 
*Finally, your phone panel turns into this:   
 
*Finally, your phone panel turns into this:   
 
|width="50%" valign="top" align="left"|
 
|width="50%" valign="top" align="left"|
[[File:BlynkSetting11.png||200px|center]]
+
[[File:BlynkSetting12.png||200px|center]]
 
|}
 
|}
 +
 +
==Programming and Uploading==
 +
*Stack the '''[[Microduino-Core+]]''' and the '''[[Microduino-USBTTL]]''' together. 
 +
**Connect the '''[[Microduino-USBTTL]]''' to your computer with the included MicroUSB cable.
 +
**<span style="color:red">Attention: Please upload program before stacking all modules together. As having the WiFi module connected will cause programming issues.<span>
  
  
==Program Download==
+
*Follow the software setup guide for your OS at: http://wiki.microduinoinc.com/Software_Setup:_Arduino
 +
*Once your software is successfully installed, open the software.
 +
*Configure the software to program the Core+ module:
 +
** Select '''Tools > Board > Microduino/mCookie-device''' (for Windows) or '''Tools > Board > Microduino/mCookie-Core+ (644pa)''' (for Mac OS).
 +
** Select '''Tools > Processor > Microduino/mCookie Core+ (644pa)@16M,5V''' (for Windows) or '''Tools > Board > Atmega644pa@16M,5V''' (for Mac OS).
 +
** Select '''Tools > Port''' (Usually what is selectable, if using Mac, it is not the Bluetooth one).
  
Weather Station Code: [https://github.com/Microduino/ESP8266BlynkWeatherStation ESP8266BlynkWeatherStation]
 
  
==Programming==
+
*Download the code for Weather Station here: [[File:ESP8266BlynkWeatherStationV2.zip]]
*Stack '''[[Microduino-Core+]]''' and '''[[Microduino-USBTTL]]''' together.
+
*Unzip the file. Under the software (Arduino IDE), go to '''File > Open...''' and navigate to the unzipped folder and open the '''ESP8266BlynkWeatherStation.ino''' file.
**Connect '''[[Microduino-USBTTL]]''' for program uploading with a USB cable. 
+
*Click on the '''upload button''' (right arrow icon on the top left) to upload the program.
**Attention: Please upload programs before stacking all modules together.  
+
*The program will compile and upload. Once completed a upload successful message will appear on the bottom left.
*Open Arduino IDE for Microduino development environment. (Please refer to: '''[[AVR Core:Getting started]]''')
 
*Click '''【Tool】''', make sure the right ''' board card(Microduino-Core+) and processor(Atmega644pa@16M,5V)''', select the corresponding '''port (COMX) '''.  
 
*Click'''【File】'''->'''【Open】''', scan to the program address, click '''“ESP8266BlynkWeatherStation.ino”''' and open it.
 
*After that, please click the button '''"→"''' to upload programs to the development board.  
 
  
 
==Hardware Buildup==
 
==Hardware Buildup==

Revision as of 19:16, 17 April 2018

Outline

  • Project: Open Source WIFI Weather Station System.(ESP8266 connected to Blynk)
  • Objective: To get temperature, humidity, light intensity and even PM2.5 data around you.
  • Difficulty: Medium
  • Project Time: 2 Hours
  • Creator: Ray

Introduction:

  • The station monitors temperature, humidity, light intensity and even PM2.5 (particulate matter) data around you.
  • Display the sensor data on the OLED screen.
  • The station can be synced with Blynk to upload sensor data.
  • Access the data anytime using the Blynk app.

Bill of Material

Microduino Equipment

Module Number Function
Microduino-Core+ 1 Core board
Microduino-USBTTL 1 Program download
Microduino-WIFI(ESP) 1 Internet connection
Microduino-Sensorhub 1 Sensor pin board
Microduino-Duo-h 1 Extension board
Microduino-OLED 1 Display
Sensor Number Function
Microduino-Temp&Hum 1 Digital temperature and humidity sensor
Microduino-Air Quality 1 Air quality detector
Microduino-Light 1 Light-sensitive sensor
GP2Y1010AU0F 1 PM2.5 sensor

Other Equipment

Equipment Number Function
Micro-USB cable 1 For program download and power supply
GP2Y1010AU0F 1 PM2.5 sensor
Screw 7 Fixate modules
Screwdriver 1 Fixate screws
Shell 1
WeatherStationMatiralAll.png

Principle of the Experiment

This Weather Station collects the following:


Wifistationtheory.jpg

Get and Configure Blynk

Next, we'll learn how Microduino interacts with Blynk through the configuration process of the Weather Station.

Get Blynk Phone Client

Add Configuration Items

  • Scan the two-dimension code below to get Weather Station APP onto Blynk.
BlynkWeatherStationLink.png


  • Also, you can make your own one.
  • In this case, you can click the panel and call out WIDGET BOX, on which you can see many choices.
BlynkSetting3.png


  • Add Value Display item and name "temperature" to display Temperature value acquired.
  • Select V2 on INPUT; Choose PUSH on READING FREQUENCY, which indicates the temperature is sent from the Weather Station and the frequency is controlled by Microduino Client.
BlynkSetting4.png


The corresponding code at the Microduino Client is:

void senTempHumi() {
  am2321.read();
  float sensor_tem = am2321.temperature / 10.0;
  float sensor_hum = am2321.humidity / 10.0;
  Blynk.virtualWrite(V2, sensor_tem);
  Blynk.virtualWrite(V3, sensor_hum);

  oled(sensor_tem, sensor_hum, sensor_light, sensorPM25, Sensor_etoh); 
}


  • The setting of the humidity is similar with that of temperature; Set INPUT as V3 and send it through a timer function " senTempHumi()".
BlynkSetting5.png


  • The frequency of the timer can be achieved by codes below:
void senTempHumi() {
  SimpleTimer temHumtimer;
  temHumtimer.setInterval(2000L, senTempHumi);
}


  • Set PM2.5's INPUT as V6, READING FREQUENCY as 5s, which represents frequency of the acquired PM2.5 data.
BlynkSetting6.png



  • The corresponding code at the Microduino Client is:
BLYNK_READ(V6) {
  Blynk.virtualWrite(V6, sensorPM25);
}


  • Similarly, set the INPUT of the Light Sensor as V4 and the frequency is to get value every 3s.
BlynkSetting7.png



  • The corresponding code at the Microduino Client is:
BLYNK_READ(V4) {
  sensor_light = map(analogRead(A0), 0, 1023, 0, 255);
  Blynk.virtualWrite(V4, sensor_light);
}



  • The INPUT of the methane gas is V5 and the frequency is to get value every 5s.
BlynkSetting8.png



  • The corresponding code at the Microduino Client is:
BLYNK_READ(V5) {
  Sensor_etoh= map(analogRead(A2), 0, 1023, 0, 30);
  Blynk.virtualWrite(V5, Sensor_etoh);
}


  • See "Button Setting" next.
  • Set OUTPUT as V6 and MODE as SWITCH, meaning each time you press the button, you can switch electric level of the D6 pin at the Microduino Client.
BlynkSetting9.png


  • For more intuitive data display, you can add one or more History Graph.
  • Can be set as data graph displaying V2 and V3. (can achieve four data display at most.)
BlynkSetting10.png


  • The second History Graph can be used for displaying V6, PM2.5.
BlynkSetting11.png


  • Finally, your phone panel turns into this:
BlynkSetting12.png

Programming and Uploading

  • Stack the Microduino-Core+ and the Microduino-USBTTL together.
    • Connect the Microduino-USBTTL to your computer with the included MicroUSB cable.
    • Attention: Please upload program before stacking all modules together. As having the WiFi module connected will cause programming issues.


  • Follow the software setup guide for your OS at: http://wiki.microduinoinc.com/Software_Setup:_Arduino
  • Once your software is successfully installed, open the software.
  • Configure the software to program the Core+ module:
    • Select Tools > Board > Microduino/mCookie-device (for Windows) or Tools > Board > Microduino/mCookie-Core+ (644pa) (for Mac OS).
    • Select Tools > Processor > Microduino/mCookie Core+ (644pa)@16M,5V (for Windows) or Tools > Board > Atmega644pa@16M,5V (for Mac OS).
    • Select Tools > Port (Usually what is selectable, if using Mac, it is not the Bluetooth one).


  • Download the code for Weather Station here: File:ESP8266BlynkWeatherStationV2.zip
  • Unzip the file. Under the software (Arduino IDE), go to File > Open... and navigate to the unzipped folder and open the ESP8266BlynkWeatherStation.ino file.
  • Click on the upload button (right arrow icon on the top left) to upload the program.
  • The program will compile and upload. Once completed a upload successful message will appear on the bottom left.

Hardware Buildup

Waetherstep1.jpg
  • Step2
    • Assemble Structure-B1~B5 with Structure-B6.
Waetherstep2.jpg
Waetherstep3.jpg
Waetherstep4.jpg
Waetherstep5.jpg
  • Step6
    • Complete the steps above, then fixate with Structure-B0 and plug in a USB cable. Congratulations! You just finished the buildup of the Weather Station.
  • Step7
    • You can see sensor data on Microduino-OLED after setting.
    • At the same time, you can also see uploaded data of the Weather Station on your phone Blynk.
BlynkSetting13.png

Notes

  • Please make sure the verification code is configured right.
  • Make sure your router runs normally, the SSID and password are correct.