In this post I will show how to construct an Arduino based wireless thermometer which can monitor the room temperature and external ambient temperature. The data is transmitted and received via 433 MHz RF link.
Using 433MHz RF Module and DHT11 Sensor
The proposed project utilizes Arduino as brain and the heart as 433 MHz transmitter/receiver module.
The project is divided into two separate circuits, the one with 433 MHz receiver, LCD display and DHT11 sensor which will be placed inside the room and also measures the room temperature.
Another circuit has 433MHz transmitter, DHT11 sensor for measuring outside ambient temperature. Both the circuit has one arduino each.
The circuit placed inside the room will display the internal and external temperature readings on LCD.
Now let’s take a look at 433 MHz transmitter/receiver module.
The transmitter and receiver modules are shown above; it is capable of simplex communication (one way). The receiver has 4 pins Vcc, GND and DATA pins. There are two DATA pins, they are same and we can output the data from either of two pins.
The transmitter is much simpler it has just Vcc, GND and DATA input pin. We have to connect an antenna to both modules which is described at the end of the article, without antenna communication between them won’t be established beyond few inches.
Now let’s see how these modules communicate.
Now assume we are applying clock pulse of 100Hz to the transmitter’s data input pin. The receiver will receive exact replica of the signal at receiver’s data pin.
That’s simple right? Yeah… but this module works on AM and susceptible to noise. From author’s observation if the transmitter’s data pin left without any signal for more than 250 milliseconds, the receiver data output pin produce random signals.
So, it is only suitable for non-critical data transmissions. However this project works very well with this module.
Now let’s move on to schematics.
RECEIVER:
The above circuit is arduino to LCD display connection. 10K potentiometer is provided for adjusting contrast of LCD display.
The above is the receiver circuit. The LCD display should be connected to this arduino.
Please download the following library files before compiling the code
Radio Head : github.com/PaulStoffregen/RadioHead
DHT sensor library : https://arduino-info.wikispaces.com/file/detail/DHT-lib.zip
Program for Receiver:
//--------Program Developed by R.Girish-----//
#include <LiquidCrystal.h>
#include <RH_ASK.h>
#include <SPI.h>
#include <dht.h>
#define DHTxxPIN A0
LiquidCrystal lcd(12,11,5,4,3,2);
RH_ASK driver(2000, 7, 9, 10);
int ack = 0;
dht DHT;
void setup()
{
Serial.begin(9600);
lcd.begin(16,2);
if (!driver.init())
Serial.println("init failed");
}
void loop()
{
ack = 0;
int chk = DHT.read11(DHTxxPIN);
switch (chk)
{
case DHTLIB_ERROR_CONNECT:
ack = 1;
lcd.setCursor(0,0);
lcd.print("INSIDE:");
lcd.print("NO DATA");
delay(1000);
break;
}
if(ack == 0)
{
lcd.setCursor(0,0);
lcd.print("INSIDE:");
lcd.print(DHT.temperature);
lcd.print(" C");
delay(2000);
}
uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
uint8_t buflen = sizeof(buf);
if (driver.recv(buf, &buflen))
{
int i;
String str = "";
for(i = 0; i < buflen; i++)
{
str += (char)buf[i];
}
lcd.setCursor(0,1);
lcd.print("OUTSIDE:");
lcd.print(str);
Serial.println(str);
delay(2000);
}
}
//--------Program Developed by R.Girish-----//
Transmitter:
The above is the schematic for Transmitter, which is fairly simple as receiver. Here we are using another arduino board. The DHT11 sensor will sense outside ambient temperature and send back to receiver module.
The distance between transmitter and receiver should not be more than 10 meter. If there are any obstacles between them, transmission range may get reduce.
Program for Transmitter:
//------Program Developed by R.Girish----//
#include <RH_ASK.h>
#include <dht.h>
#define DHTxxPIN A0
#include <SPI.h>
int ack = 0;
RH_ASK driver(2000, 9, 2, 10);
dht DHT;
void setup()
{
Serial.begin(9600);
if (!driver.init())
Serial.println("init failed");
}
void loop()
{
ack = 0;
int chk = DHT.read11(DHTxxPIN);
switch (chk)
{
case DHTLIB_ERROR_CONNECT:
ack = 1;
const char *temp = "NO DATA";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
break;
}
if(ack == 0)
{
if(DHT.temperature == 15)
{
const char *temp = "15.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 16)
{
const char *temp = "16.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 17)
{
const char *temp = "17.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 18)
{
const char *temp = "18.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 19)
{
const char *temp = "19.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 20)
{
const char *temp = "20.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 21)
{
const char *temp = "21.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 22)
{
const char *temp = "22.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();;
}
if(DHT.temperature == 23)
{
const char *temp = "23.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 24)
{
const char *temp = "24.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 25)
{
const char *temp = "25.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 26)
{
const char *temp = "26.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 27)
{
const char *temp = "27.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 28)
{
const char *temp = "28.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 29)
{
const char *temp = "29.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 30)
{
const char *temp = "30.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 31)
{
const char *temp = "31.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 32)
{
const char *temp = "32.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 33)
{
const char *temp = "33.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 34)
{
const char *temp = "34.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 35)
{
const char *temp = "35.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 36)
{
const char *temp = "36.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 37)
{
const char *temp = "37.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 38)
{
const char *temp = "38.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 39)
{
const char *temp = "39.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 40)
{
const char *temp = "40.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 41)
{
const char *temp = "41.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 42)
{
const char *temp = "42.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 43)
{
const char *temp = "43.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 44)
{
const char *temp = "44.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
delay(500);
if(DHT.temperature == 45)
{
const char *temp = "45.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 46)
{
const char *temp = "46.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 47)
{
const char *temp = "47.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 48)
{
const char *temp = "48.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 49)
{
const char *temp = "49.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
if(DHT.temperature == 50)
{
const char *temp = "50.00 C";
driver.send((uint8_t *)temp, strlen(temp));
driver.waitPacketSent();
}
delay(500);
}
}
//------Program Developed by R.Girish----//
Construction of Antenna:
If you are building projects using this 433 MHz modules, follow the below constructional details strictly for good range.
Use a single core wire which should be sturdy enough to support this structure. You can also use insulated copper wire with insulation removed at bottom for solder join. Make two of these, one for transmitter and another for receiver.
Have Questions? Please Comment below to Solve your Queries! Comments must be Related to the above Topic!!