Introduction: Blynk Weather Station
Receive weather updates directly to your mobile device from your very own weather station! Astonishingly quick & easy build with xChips.
Step 1: Things Used in This Project
Hardware components
- XinaBox CW01 x 1
- XinaBox SW01 x 1
- XinaBox SL01 x 1
- XinaBox OD01 x 1
- XinaBox IP01 x 1
- XinaBox XC10 x 1
Software apps and online services
Step 2: Story
Introduction
I built this project using XinaBox xChips and Arduino IDE. It is a 5 min project , that allows you to receive weather data on your phone via the Blynk app and on the OLED screen of the OD01. This project is so useful because you can monitor weather wherever you choose and get updates directly on your phone via the app. I chose to use the xChips because they are user friendly, they also eliminate the need for soldering and serious circuit design. Using Arduino IDE I could easily program the xChips.
Step 3: Downloading the Libraries
- Go to Github.xinabox
- Download xCore ZIP
- Install it into Arduino IDE by going to "Sketch", "Include Library", then "Add .ZIP Library". As seen below
Figure 1: Adding the ZIP libraries
- Download xSW01 ZIP
- Add the library the same way as you did for the xCore.
- Repeat for the xSL01 and xOD01
- You also need install the Blynk library so you can use the app. You can find it here
- Before you can programme you need to ensure you're using the correct board. In this project I make use of the Generic ESP8266 which is in the CW01 xChip. You can download the board library here.
Step 4: Programming
- Connect the IP01, CW01, SW01, SL01 and OD01 using xBUS Connectors. Make sure the xChips' names are orientated correctly.
Figure 2: Connected xChips
- Now insert the IP01 and connected xChips into an available USB port.
- Download or copy and paste the code from the "CODE" heading into your Arduino IDE. Enter your auth token, WiFi name and password where indicated.
- Alternatively you could create your own code using the relevant principles to achieve the same objective
- To ensure there are no errors compile the code.
Step 5: Blynk Setup
- After installing the Blynk app free from your app store it is time to do the Project Setup.
- Before clicking "Log In" after entering your email address and password ensure your "Server Settings" are set to "BLYNK".
Figure 3: Server Settings
- Log in.
- Create New Project.
- Choose device "ESP8266"
Figure 4: Choosing the device/board
- Assign a project name
- Receive "Auth Token" notification and email containing the "Auth Token".
Figure 5: Auth Token notification
- Go to the "Widget Box"
Figure 6: Widget Box
- Add 4 "Buttons" and 4 "Value Displays"
- Assign the respective "Buttons" and "Value Displays" their Virtual Pins as specified in the "CODE". I used even numbers for "Buttons" and corresponding odd numbers for the "Value Displays"
- This setup can be adjusted to suit your needs as you adjust your code.
Figure 7: Project Dashboard (Disclaimer: Ignore the values this is a screenshot after I tested the weather station. Yours should be similar, just with blank faces like V7)
Step 6: Uploading the Code
- After successful compilation in Step 2(no errors found) you may upload the code to your xChips. Ensure the switches are facing "B" and "DCE" respectively before uploading.
- Once the upload is successful, open the Blynk app on your mobile device.
- Open your project from Step 3.
Figure 8
- Press play and press the respective "Buttons" so that the data can be shown in your app and on the OLED screen.
- Now your Blynk weather station is ready to GO!
Step 7: Code
Blynk_Weather_Station.ino Arduino
Arduino code for Weather Station with Blynk and xCHIPS. This code allows you to wirelessly control the weather station from your mobile device and receive weather data updates straight to your mobile device from the xCHIP weather station
#include <xCore.h><xcore.h> //include core library #include <xSW01.h><xsw01.h> //include weather sensor library #include <xSL01.h><xsl01.h> //include light sensor library #include <ESP8266WiFi.h><esp8266wifi.h> //include ESP8266 library for WiFi #include <BlynkSimpleEsp8266.h><blynksimpleesp8266.h> //include Blynk library for use with ESP8266 #include <xOD01.h><xod01.h> //include OLED library<br><br></xod01.h></blynksimpleesp8266.h></esp8266wifi.h></xsl01.h></xsw01.h></xcore.h>xSW01 SW01; //xSL01 SL01; float TempC; float Humidity; float UVA; float UV_Index; // authentication token that was emailed to you // copy and paste the token between double quotes char auth[] = "your auth token"; // your wifi credentials char WIFI_SSID[] = "your WiFi name"; // enter your wifi name between the double quotes char WIFI_PASS[] = "your WiFi password"; // enter your wifi password between the double quotes BlynkTimer timer; // VirtualPin for Temperature BLYNK_WRITE(V2){ int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable if(pinValue == 1) { Blynk.virtualWrite(V1, TempC); OD01.println("Temp_C:"); OD01.println(TempC); } else{ } } // VirtualPin for Humidity BLYNK_WRITE(V4){ int pin_value = param.asInt(); // assigning incoming value from pin V3 to a variable if(pin_value == 1) { Blynk.virtualWrite(V3, Humidity); OD01.println("Humidity:"); OD01.println(Humidity); } else{ } } // VirtualPin for UVA BLYNK_WRITE(V6){ int pinvalue = param.asInt(); // assigning incoming value from pin V5 to a variable if(pinvalue == 1) { Blynk.virtualWrite(V5, UVA); OD01.println("UVA:"); OD01.println(UVA); } else{ } } // VirtualPin for UV_Index BLYNK_WRITE(V8){ int pin_Value = param.asInt(); // assigning incoming value from pin V7 to a variable if(pin_Value == 1) { Blynk.virtualWrite(V7, UV_Index); OD01.println("UV_Index:"); OD01.println(UV_Index); } else{ } } void setup() { // Debug console TempC = 0; Serial.begin(115200); Wire.begin(2, 14); SW01.begin(); OLED.begin(); SL01.begin(); Blynk.begin(auth, WIFI_SSID, WIFI_PASS); delay(2000); } void loop() { SW01.poll(); TempC = SW01.getTempC(); Humidity = SW01.getHumidity(); SL01.poll(); UVA = SL01.getUVA(); UV_Index = SL01.getUV Index(); Blynk.run(); }