Introduction: How to Make an Mini IOT Weather Station

Picture of How to Make an Mini IOT Weather Station

let's make a little portable IOT weather station for under $20 using arduino and the blynk library! It uses the 433mhz transmitter so if you want you can use multiple clients like a LCD screen in your living room and another in your kitchen. I made the code simple enough that most people can hack it to do whatever they want... Lets get started making!!

You will need the fallowing parts:

433mhz tx and rx

Arduino Uno

Arduino Ethernet Shield

Arduino Nano

DHT11

4x AAA battery pack

wires

Step 1: Prep the Battery Pack

Picture of Prep the Battery Pack

Were going to make the battery easy to remove so we can change the batteries. i soldered a connector directly to the battery pack so there wouldn't be much slack.

Step 2: Add a Antenna to the TX 433mhz Chip

Picture of Add a Antenna to the TX 433mhz Chip

The length doesn't matter. The longer it is the further it can transmit, to an extent. I used a 4" solid piece of wire.

Step 3: Program the Arduino Nano

Picture of Program the Arduino Nano

Download the code here

-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_

or view it here:

#include <VirtualWire.h> //Download Here
#include "DHT.h"

DHT dht(2, DHT11);

int Sensor1Data; int Sensor2Data; char Sensor1CharMsg[4]; char Sensor2CharMsg[4];

void setup() { vw_set_ptt_inverted(true); // Required by the RF module vw_setup(2000); // bps connection speed vw_set_tx_pin(3); // Arduino pin to connect the receiver data pin

//Serial.begin(9600); //uncomment to debug dht.begin(); Serial.println();

}

void loop() { Serial.println("\n");

Sensor1Data = dht.readTemperature(true); Sensor2Data = dht.readHumidity(); delay(2000); // Convert integer data to Char array directly itoa(Sensor1Data, Sensor1CharMsg, 10); itoa(Sensor2Data, Sensor2CharMsg, 10);

Serial.print("Read sensor: ");

char astr[4] = {'t', 'e', 'm', 'p',}; char bstr[4] = {'h', 'u', 'm', 'i',}; Serial.print("Humidity (%): "); Serial.println((float)dht.readHumidity(), 2);

Serial.print("Temperature (oC): "); Serial.println((float)dht.readTemperature(true), 2);

delay(1000);

//Message to send: digitalWrite(13, true); // Turn on a light to show transmitting vw_send((uint8_t *)astr, 4); vw_send((uint8_t *)Sensor1CharMsg, strlen(Sensor1CharMsg)); vw_send((uint8_t *)bstr, 4); vw_send((uint8_t *)Sensor2CharMsg, strlen(Sensor2CharMsg)); vw_wait_tx(); // Wait until the whole message is gone digitalWrite(13, false); // Turn off a light after transmission delay(9000); }

Step 4: Print the Sun Cover

Picture of Print the Sun Cover

I scaled the files down by 50% but you don't need to. When assembling it make sure to run the wire through early so it doesn't add to much stress on it.

Download the files here in the stl folder

Step 5: Solder the Wires on to the Arduino Nano

Picture of Solder the Wires on to the Arduino Nano

The DHT11 - (Power goes to 5v on the Nano, GND goes to GND on the Nano, and signal goes to D2 on the Nano)

The 433 TX - (Power goes to 5v on the nano, GND goes to GND on the Nano, and Data goes to D3 on the Nano)

The Battery Pack connects to Vin and GND

Step 6: Pack It Up

Picture of Pack It Up

I found a 'REALLY USEFUL BOX' at my local staples that fit it perfect i put every thing inside (power on) and closed it up then connected the Sun Shield to it with duck tape.

Step 7: Setup the Receiver UNO

Picture of Setup the Receiver UNO

Download the Blynk Library from Here

Download VirtualWire Library from Here

Download the Code from Here

or view the code below

#include <SPI.h>
#include <Ethernet.h> #include <BlynkSimpleEthernet.h> #include <VirtualWire.h> #include <Wire.h>

int TEMP;

int tempurature; int humidity;

char auth[] = "9bb52b5cfa6b4c4bbcde617a64886ed5";

void setup() { Serial.begin(9600); vw_set_rx_pin(2); vw_setup(2000); vw_rx_start(); Blynk.begin(auth); }

void loop() { Blynk.run(); uint8_t buf[VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN; if (vw_get_message(buf, &buflen)) // Non-blocking {

int i; char c; String input; for (i = 0; i < buflen; i++) { c = ((char)buf[i]); input += ((char)buf[i]); //Serial.print((char)buf[i]); } if (c == 'p') { Serial.print("TEMPURATURE CHECK"); TEMP = true; } if (c == 'i') { Serial.print("HUMIDITY CHECK"); TEMP = false; } if (c != 'p' && c != 'i') { if (TEMP == true) { tempurature = input.toInt(); if (tempurature != humidity) { Blynk.virtualWrite(V12, tempurature); } Serial.print(tempurature); } else { humidity = input.toInt(); if (tempurature != humidity) { Blynk.virtualWrite(V13, humidity); } Serial.print(humidity); /*double celsius = (tempurature - 32) * 5/9; double a = 17.271; double b = 237.7; double temp2 = (a * celsius) / (b + celsius) + log(humidity*0.01); double Td = (b * temp2) / (a - temp2); Td = ((Td*9) / 5) + 32; Blynk.virtualWrite(V14, Td); */ } }

Serial.println();

} }

Step 8: Test Out Everything

Picture of Test Out Everything

If you open the RX serial port you should see something like what is shown in the first picture, if now check your wiring

On the blynk app you should see the same data as what is comming through the serial port

IF YOU WANT TO COPY THE LAYOUT CLICK HERE

I hope you liked this project it took over 3 weeks for me to make, if you have any questions leave them in the comments and i will try to answer them!

Comments

Funguypro (author)2016-08-02

Im using Blynk www.blynk.cc

George IonutM (author)2016-08-02

Hi,

Can you please tell us where you store your data and how you access it with your phone ?

And also what program is that ?

Thank you.

About This Instructable

1,660views

45favorites

License:

Bio: I like to create new things! I'm very interested in IOT and just Internet Stuff. I am not responsible for any injury or deaths ... More »
More by Funguypro:3D Print Your House!!!!!DIY Raspberry Pi Indoor Outdoor WebcamSee Through Buildings With a Drone
Add instructable to: