Introduction: Wireless Weather Station

Welcome to my first Instructable project. This project will be made for a course for my study. I chose to make a wireless weather station because I have a IT related study: so additional to having the challenge of creating the actual weather station, there's also a challenge regarding the software aspect of it all. More importantly, I can play around with this data as a programmer.

Step 1: Parts and Features

Parts used:

Arduino Uno (includes USB cable): http://eud.dx.com/product/uno-r3-development-boar...

Wireless module: http://eud.dx.com/product/esp8266-wi-fi-wireless-...

Data sheet: http://forum.arduino.cc/index.php?topic=329873.msg...

Temperature/humidity sensor: http://eud.dx.com/product/arduino-digital-temperat...
Data sheet: http://pan.baidu.com/share/link?shareid=72834&uk=6...

Battery case: http://eud.dx.com/product/6-x-aa-batteries-holder-...

Logic level converter: http://www.martoparts.nl/8_kanaals-logic-level-con...
More info: https://learn.sparkfun.com/tutorials/bi-directiona...

Breadboard (I used these ones, larger ones are advised): http://eud.dx.com/product/mini-prototype-printed-...

Cables (Both Male-Female and Male-Male): http://eud.dx.com/product/breadboard-jumper-wires-...

http://eud.dx.com/product/male-to-female-dupont-br...

1k Resistor: http://www.martoparts.nl/weerstand_1K

LCD (16x2): http://www.martoparts.nl/16x2-LCD-Display

Potentiometer (10K): http://www.martoparts.nl/potmeter-10K

MoSCoW:

Must have:
- Record tempature data
- Record humidity data
- Serve the above mentioned data to the internet

Should have:
- Fancy looking encasing
- Battery case for standalone use

Could have:
- Database to create graphs of the temperature over time

Tools used:
- Laptop to write arduino code
- Laser cutter for the encasing
- Adobe Illustrator for designing the parts of the case
- File / Dremel
- Wood glue
- Soldering iron

Step 2: Connecting the Temperature Sensor (DHT11)

This is the easy part (relative to the ESP8266). First off make sure you have the same temperature sensor as I have (DHT11) or consult the datasheet for your particular temperature sensor.
Something I want to mention before we continue is the fact that the temperature sensor I'm using, the DHT11, is not as accurate as I'd hoped it be. Unless the accuracy does not matter to you I'd recommend buying a somewhat more expensive sensor.

Lets continue, first off we need to start off with connecting the wires to the Arduino Uno in my case. They connect as follow:

DHT11 <---> Arduino Uno

Pin 1 (Data) <---> Analog port (0 in my case)
Pin 2 (VDD) <---> 5V
Pin 3 (Ground) <---> GND

Or check the picture attached above if you also have the DHT11.

Next up we need the DHT library, get it here: https://github.com/adafruit/DHT-sensor-library (Download button is in the top right corner).

#include <dht.h>
#define dht_apin A0 // Analog Pin sensor is connected to
 
dht DHT;
 
void setup(){
 
 Serial.begin(9600); // Set console Baud rate<br> delay(500); //Delay to let system boot
 Serial.println("DHT11 Humidity & temperature Sensor\n\n");
 delay(1000); //Wait before accessing Sensor
 
}
void loop(){
    DHT.read11(dht_apin); //retrieve data from the sensor
    
    Serial.print("Current humidity = ");
    Serial.print(DHT.humidity);
    Serial.print("%  ");
    Serial.print("temperature = ");
    Serial.print(DHT.temperature); 
    Serial.println("C  ");
    
    delay(5000); //Wait 5 seconds before accessing sensor again.
 
  //Fastest should be once every two seconds.
 
}

When successful, you should get something like this:

DHT11 Humidity & temperature Sensor

Current humidity = 60.00%  temperature = 22.00C

Step 3: The Wifi Sensor: ESP8266

Now, the complete circuit (same as picture above):

Arduino Uno - Logic Level Converter

5V <----> HV
RX <----> HV8
TX <----> HV7
GND <----> GND
3.3V <----> LV

Logic Level Converter - ESP8266

LV <----> 3.3V
LV <----> CH-PD (through 1k resistor)
LV <----> RST (through 1k resistor)
HV8 <----> TX
HV7 <----> RX
GND <----> GND

Now for the problems.
I did get the ESP working, but only partly; I was able to send commands and get a response, I wasn't able to flash it.
With this setup I did get to the point where it would accept commands and return an appropriate response, however, after accidentally uploading a sketch to the ESP, it would no longer send back those responses. Instead it sent a weird response with random characters.
I tried getting rid of this problem through flashing the device, but all my attempts were without result.

Reflection

The actual problem could have multiple causes:

- The ESP can't get enough electricity from the arduino
- The ESP can't get enough electricity on peek's, when doing heavy work, such as flashing or sending data
- The ESP is simply broken

With hindsight I'd say that I was too ambitious with taking on a Arduino project like this, my project was far too complicated. Especially if you take into account that I had no experience with hardware or Arduino's prior to this project. I did not expect that the ESP8266 would cause so much issues. If I had to redo this project, I would have used a more expensive wifi (or ethernet) module, which was easier to use.

Step 4: The Encasing

For the case I wanted to make it as small as possible, but with the required room for the Arduino circuit. Also I wanted to have easy access to my Arduino, so I could continue working on it without any hassle.

I came up with the following design; a box 18 by 7 by 4 cm (made of 3mm plywood) with a drawer so the Arduino could be accessed quite easily.
Every part was designed in Adobe Illustrator and cut and engraved with a Laser Cutter. I also engraved a thermometer on top for a nice visual effect.
Note the black stripe in the picture above: this was engraved for the purpose of putting in the drawer. However engraving with the laser cutter didn't cut it (hehe), I had to deepen the engraving with a file, in order for the drawer to fit.

All in all, I am very pleased with the end result of the case.

After cutting my case someone told me of this handy website: http://www.makercase.com/ where you can fill in your dimensions and get a box design ready to go. I personally didn't use this, but from what I've seen and heard it seems to do the job.

Step 5: LCD + Temperature Sensor

After I didn't get the wifi sensor working, I decided to go with an LCD screen, to display the data. Additional to this I used a Potentiometer (10K) to adjust the contrast of the LCD accordingly.

The first step is connecting everything together.

From Left to right:

LCD <---> Arduino

VSS <---> GND
VDD <---> 5V
V0 <---> Potmeter signal (center pin)
RS <---> TX
RW <---> GND
E <---> Digital 2
D4 <---> Digital 4
D5 <---> Digital 5
D6 <---> Digital 6
D7 <---> Digital 7
A <---> 5V
K <---> GND

Potentiometer

GND <---> GND
Signal <---> V0
5V <---> 5V

I combined everything above with the previous step of the DHT11. The following code was used to display the temperature and humidity on the screen:

// include the library code:
#include <LiquidCrystal.h>

#include <dht.h>

// Analog Pin sensor is connected to #define dht_apin A0

// initialize the library with the numbers of the interface pins LiquidCrystal lcd(1, 2, 4, 5, 6, 7); dht DHT;

void setup() { //initializes the interface and specifies the dimension of the LCD lcd.begin(16, 2); printTemperature(); printHumidity(); //Wait before accessing Sensor delay(1000); }

//function to print characters of temperature that don't need to be updated void printTemperature() { lcd.setCursor(0, 0); lcd.print("Temp : "); lcd.print(" "); lcd.setCursor(12, 0); lcd.print("C"); }

//function to print characters of humidity that don't need to be updated void printHumidity() { lcd.setCursor(0, 1); lcd.print("Hmid : "); lcd.print(" "); lcd.setCursor(12, 1); lcd.print("%"); }

void loop() { //Let the sensor check the new temperature DHT.read11(dht_apin); //retrieve data from temperature/humidity sensor float temperature = DHT.temperature; float humidity = DHT.humidity;

//functions to update temperature and humidity on LCD updateTemperature(temperature); updateHumidity(humidity);

//wait 5 seconds before updating again delay(5000); }

void updateTemperature(float temperature) { lcd.setCursor(7, 0); lcd.print(temperature, 1); }

void updateHumidity(float humidity) { lcd.setCursor(7, 1); lcd.print(humidity, 1); }