Introduction: Wireless Indoor & Outdoor Thermometer
I would like to introduce you to one of my interesting projects. It is a wireless thermometer that measures the indoor and outdoor temperature. The device consists of two parts. One is a transmitter that contains one digital temperature sensor and a transmitter module. A second receiver consisting of an LCD screen, the digital sensor and receiving module.
Step 1: Parts
You need:
1. Two arduinos any version
2. Two DS18B20 digital temperature sensor
4. LCD 16x2
5: RF 433MHz or 315 MHz module
Step 2: Transmitter
Transmitter is very simple. Connect the wires as shown in pictures.
Here is transmitter code:
#include <VirtualWire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 7
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
char msg[6];
void setup() {
sensors.begin();
vw_setup(2000);
vw_set_tx_pin(3);
}
void loop() {
sensors.requestTemperatures();
float temperature = sensors.getTempCByIndex(0);
dtostrf(temperature, 6, 2, msg);
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx();
delay(200);
}
Step 3: Receiver
Receiver is a little more complicated than the transmitter. Connect the wires as shown in pictures.
Here is the code for receiver:
//www.facebook.com/njizi.dvizi
#include <LiquidCrystal.h>
#include <VirtualWire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
int i;
LiquidCrystal lcd(12, 10, 5, 4, 3, 2);
#define ONE_WIRE_BUS 7
OneWire ourWire(ONE_WIRE_BUS);
DallasTemperature sensors(&ourWire);
void setup(){
lcd.begin(16, 2);
sensors.begin();
vw_setup(2000);
vw_rx_start();
vw_set_rx_pin(11);
}
void loop(){
sensors.requestTemperatures();
lcd.setCursor(0, 1);
lcd.print("Indoor:");
lcd.setCursor(14, 1);
lcd.print(sensors.getTempCByIndex(0));
lcd.setCursor(9, 1);
lcd.print((char)223);
lcd.print("C");
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if( vw_get_message(buf, &buflen) )
{
lcd.setCursor(0, 0);
lcd.print("Outdoor:");
for (i = 0; i < buflen; i++)
{
lcd.write(buf[i]);
}
lcd.setCursor(14, 0);
lcd.print((char)223);
lcd.print("C");
}
}
Step 4: Library
For this project you need three types of libraries. Two for digital sensor and the other for RF module. In the link below have all the files needed for this project.