How to build a wireless Bluetooth weather station (Arduino)

In this tutorial we will take a look at how you can use a Arduino with a hc-06 and hc-05 Bluetooth module and a dht11 or dht22 temp and humidity sensor to make a wireless Bluetooth weather station…

 

Links For More INFO:

How to set up and use a 1602 I2C serial LCD with your ARDUINO.

DHT11 and DHT22 temp and humidity sensor

Parts List:

2X ARDUINO board’s

DHT11 or DHT22

I2C LCD Screen

HC-05

HC-06

2X Logic LVL Converters

 

 

 

SCHEMATICS:

RX –

TX –

ARDUINO Code:

 

TX code:

#include <SimpleDHT.h>
#define pinDHT11 6 //data pin
SimpleDHT11 dht11;

void setup() {
Serial.begin(9600);

}

void loop() {
byte temperature = 0;
byte humidity = 0;
dht11.read(pinDHT11, &temperature, &humidity, NULL);
Serial.write(temperature);
delay(1000);
Serial.write(humidity+200);
delay(1000);

}

RX Code:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
int temperature;
int humidity;
void setup() {
Serial.begin(9600);
lcd.begin(16, 2); // initialize the lcd for 16 chars 2 lines
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“Temperature”);
lcd.setCursor(15, 0);
lcd.print(“C”);
lcd.setCursor(0, 1);
lcd.print(“Humidity”);
lcd.setCursor(12, 1);
lcd.print(“%”);
lcd.setCursor(12, 0);
lcd.print(temperature);
lcd.setCursor(9, 1);
lcd.print(humidity);
}

void loop() {
if (Serial.available() > 0){
int val = Serial.read();

if (val <= 199)
{
temperature = val;
}

else if (val >= 200)
{
humidity = (val – 200);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“Temperature”);
lcd.setCursor(14, 0);
lcd.print(“C”);
lcd.setCursor(0, 1);
lcd.print(“Humidity”);
lcd.setCursor(11, 1);
lcd.print(“%”);
lcd.setCursor(12, 0);
lcd.print(temperature);
lcd.setCursor(9, 1);
lcd.print(humidity);
}

delay(100);
}
}

Advertisements