loading

How many times did you got out of the house in the morning only to find out that you are too lightly/heavily dressed for the day? Want to make a clock that on top of the time also reads the room's and outside temperature and humidity? Moreover, we will add 3 menu screens to our LCD and display the day's minimum and maximum values of temperature and humidity for our room and the outside environment.

It's easy! The complete setup includes two devices:

* The device that will be reading and displaying on a 20X4 I2C LCD the room's and outside temperature and humidity, time and date

* The device that will sit outside and transmitt outside temperature and humidity via a 433MHz RF module

Step 1: Bill of Materials

The parts we will need are cheap and easily found in the usual online or physical electronics shops. My proposals are based on lowest price only, you can always choose your own vendor!

For the transmitter:

  1. 1pc An Arduino UNO/Nano 5V (Ebay EUR 3.10)
  2. 1set RF 433MHz module (Ebay EUR 0.71)
  3. 1pc I2C Si7021 temp/humidity sensor or whichever sensor you like to use.Just replace the Si7021 library with the needed library for your sensor and adjust the code accordingly (Ebay EUR 2.31)
  4. 1pc 18650 battery, the largest capacity you can afford (Ebay EUR 1.85)
  5. 1pc Plastic Battery Case Holder Storage Box for 18650 Batteries (Ebay EUR 0.71)
  6. 1pc 5V MICRO USB 1A Lithium Battery Charging + Protection Board Module to charge the battery. If you have a 18650 battery charger you can skip this item (Ebay EUR 0.71)
  7. 1pc 3V to 5V 1A Charger DC-DC Converter Step Up Boost Module to supply power to the Arduino from the battery (Ebay EUR 0.99)
  8. 1pc 400 point breadboard (Ebay Euro0.71) or 1pc single sided 5 x 7 cm DIY Prototype PCB (Ebay Euro1.21)
  9. One case to fit all inside

For the receiver:

  1. 1pc An Arduino UNO/Nano 5V (Ebay EUR 3.10)
  2. 1pc Si7021 temp/humidity sensor or whichever sensor you like to use.Just replace the Si7021 library with the needed library for your sensor and adjust the code accordingly (Ebay EUR 2.31)
  3. 1pc 20x4 I2C LCD with your favorite backlight colour (Ebay EUR 4.50) - Caution: Keep a note of the LCD's I2C address you 'll buy, it should be stated by the seller!!
  4. 1pc DS3231 RTC Real Time Clock I2C module with LIR2032 Rechargeable Battery (Ebay EUR 0.71)
  5. 1pc 100K Ohm Linear Potentiometer for brightness adjustment
  6. 1pc tactile push button for the menu select button (Ebay EUR 0.71)
  7. 1pc 10k Ohm resistor (for the menu select button)
  8. 1pc 400 point breadboard (Ebay Euro0.71) or 1pc single sided 5 x 7 cm DIY Prototype PCB (Ebay Euro1.21)
  9. 1pc 220v/1A USB wall charger (Ebay EUR 1.18) and the appropriate USB cable that fits your Arduino (usually micro or mini). This is for EU residents, use the appropriate charger socket for your country (110V or 220V etc)

Step 2: The Transmitter

The transmitter's sole role is to sit outside, take readings for temperature and humidity and send them to the receiver.

We will use a Si7021 sensor to take the readings and send them through a RF 433MHz module to the clock sitting inside. The RF module will need a 17.32 cm antenna soldered in order to increase the range of the module. Please choose a waterproof case and make a hole on top for the antenna. Seal the hole with some silicone to prevent water leakage and add some holes in the bottom to help the sensor take more accurate readings.

The circuit diagram for the transmitter is shown below. You can use either a small breadboard to connect everything together or make a custom PCB to save some space.

The Si7021 sensor uses the I2C communication protocol, its connections are:

VCC -> 5V

GND -> GND

SCL -> SCL

SDA -> SDA

Pretty simple!

The RF 433MHz module is connected like this:

VCC -> 5V

GNC -> GND

Data -> Arduino Digital pin 12

The transmitter is powered by the 18650 battery. The battery is 3.7V and Arduino needs 5V at Vin so we will use the DC-DC step up converter between the battery and Arduino Vin. The connection goes like this:

18650 battery -> 3V to 5V DC-DC Converter Step Up Boost Module -> Arduino.

Connect the + red wire of the battery case to IN+ and the - black wire of the battery case to IN- of the DC-DC converter. Next, connect OUT+ of the DC-DC converter to Vin of the Arduino and OUT- to GND of the arduino. Make sure you have charged the battery first! Once you connect it, the Arduino LED will start blinking showing that our Arduino is now ON.

Please check STEP 4 for an explanation of the transmitter's code.

Step 3: The Receiver

The receiver monitors inside temperature and humidity, receives outside measurements through the RF 433MHz module and displays them together with time and date on the LCD.

Again, we will use a Si7021 sensor and the RF receiver module which will also need a 17cm antenna. The circuit diagram for the receiver is shown below. Here as well, you can use either a small breadboard to connect everything together or make a custom PCB.

The tactile push button is used to select the LCD menu. A 10k Ohm resistor goes between GND pin of the button and Arduino GND.

VCC -> 5V

GND -> 10k resistor -> GND

OUTPUT -> Arduino Digital pin 5

A 100k Ohm is used to adust the LCD brightness. You can see how it is attached to the LCD pins in the photos

The Si7021 sensor uses the I2C communication protocol, its connections are:

VCC -> 5V

GND -> GND

SCL -> SCL

SDA -> SDA

The RF 433MHz module is connected like this:

VCC -> 5V

GNC -> GND

Data -> Arduino Digital pin 11

The RealTimeClock module is also I2C and these are its connections:

VCC -> 5V
GND -> GND

SCL -> SCL

SDA -> SDA

These are the 20 x 4 I2C LCD connections:

VCC -> 5V
GND -> GND

SCL -> SCL

SDA -> SDA

So, what we will do is make a common SCL line and a common SDA line and connect Si7021, RTC and LCD SCL and SDA connections to the common lines respectively. This is the beauty of the I2C protocol, you can connect as many modules as your arduino processor can handle in just two pins. If your Arduino UNO/Nano doesn t have separate SCL and SDA pins, then use analog pin A4 to connect SDA and analog pin A5 for SCL.

The receiver is powered by a 220V/1A wall socket adaptor, you can use a spare mobile phone charger for example as long as the USB cable is compatible to your Arduino's USB adaptor.

20 x 4 I2C LCD

We use a 20 x 4 I2C LCD display for our project. On top of its connections it has two additional adjustments, contrast and brightness. Contrast is adjust by turning the rotary knob on the back of the LCD with a flat head screwdriver as shown in the photo. For brightness we will use a 100k rotary potentiometer. These particular displays are pretty bright so you will want to turn it down a bit if you have it by your bed at night. Please see the attached photo and diagram for the connection of the potentiometer.

Please check STEP 5 for an explanation of the receiver's code.

Step 4: Transmitter Code

You can download the transmitter code below. You will need to install three additional libraries on top of the standard libraries already installed in Arduino IDE.

VirtualWire library:

This is needed for the RF 433MHz communication. It is not the latest library for these modules but it is easy to use. You can download it here or -the easy way- through Arduino IDE Sketch > Include library > Manage libraries. Search for virtualwire and install it directly.

The particular library allows messages up to 27bytes to be send in one packet. However, it does not allow for float numbers to be sent and we need this since our SI7021 sensor reads float numbers. We don t want integer accuracy to our temperature and humidity measurement, do we?! So, we will use a little trick which is to multiply the float measurement by 100, send it as an integer and then divide the x100 interger by 100 in the receiver side to have a float number with 2 decimal number accuracy to display on our LCD. This is the part of the code that does the conversion:

temp_float = temp_float * 100; // Multiply by 100 for 2 decimal point precision
int b = int(temp_float);

int temperature = round(b); // Round float number to nearest integer

Adafruit Si7021 library

You can download the library needed for the Si7021 sensor here, follow the instructions in this page.

LowPower library

In order to increase the transmitter's battery life, we will use the LowPower library. You can download it here. Click on Clone or Download > Download ZIP and add the library to Arduino IDE by following Sketch > Include library > Add ZIP. Library..., browse for the zip file you just downloaded.

Since LowPower only supports up to 8s of sleep time, we will use a loop to increase this time to 4 minutes. This way we will conserve the battery and have a reading of temp and humidity every 4 minutes which is more than adequate:

for(int i=0;i<30;i++) // sleep for 4 minutes (30 x 8s = 240s)
{ LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); }

Step 5: Receiver Code

You can download the receiver code below. On top of VirtualWire and Si7021 library we installed for the transmitter we will also need to install 2 additional libraries in Arduino IDE.

LiquidCrystal I2C

This is needed for the LCD display. You can download it here or through Arduino IDE Sketch > Include library > Manage libraries. Search for LiquidCrystal I2C by Frank de Bradander and install it directly.

RTClib

Used by the RealTimeClock module. Download it through Arduino IDE Sketch > Include library > Manage libraries and search for RTClib by Adafruit.

Step 6: To Sum Up...

I hope you find the instuctions useful, it's an easy project for someone starting up Arduino programming like me. Let me know if you make one!

<p>Hi Ropotis,</p><p> Thank you so much for responding; I am sure there is no problems with your code, as I said I think it is a great project and will persevere. When I run the example sketch from Si7021 it functions correctly but when I run it from the Adafruit Si7021 example it gives correct humidity reading but temperature 128.87 degs. C. the same as when I run your code. I tried to eliminate the Adafruit library but it will not compile. You do need to respond to this message, I would just like to say thanks again and when it runs I will let you know. Best regards. John.</p>
<p>can you tell me how you solved this issue, cause i am have the same one.</p><p>correct humidity reading but temperature 128.87 degs</p>
<p>Hi again! I have a strange behavior on my version...After I power on the receiver or reset it by pressing the reset button, the receiver refreshes the outside values for two-three times and after that never updates them. I have disabled in the transmitter program the section of power down in order to send continuously new outside values. Clock and inside values work fine. Any ideas?</p><br>
<p>well my mistake!!! the strange behavior was caused by wrong connection: receiver data was connected on pin 12 instead of pin 11!! The strange here is that despite the wrong connection the arduino - receiver sometimes was getting data!!!</p><p>Some future improvements:</p><p>a) If receiver does not get data, just show &quot;---&quot; on display to indicate lost connection and maybe low battery</p><p>b) The decimal values on receiver could be more &quot;stable&quot; not changing on every cycle (every second)</p>
<p>That s great Marios, I am glad you made it work for you and thanks for the suggestions! </p>
<p>Hi!</p><p>I assembled everything on breadboard and works fine! Some notes:</p><p>a) the default address for I2C sensors are 0x40 (in my case)</p><p>b) the command lcd.init does not supported. Instead of it there is lcd.begin</p><p>Now I will try to extend the distance for RF soldering cables as antennas. Without antennas (using the internal they have) the distance is 1-2 meters</p><p>A practical question: what is the power consumption of transmitter unit? So how often do we have to charge batteries?</p><p>GREAT PROJECT overall!!! thank you!</p>
<p>&Gamma;&epsilon;&iota;ά &sigma;&omicron;&upsilon; &Mu;ά&rho;&iota;&epsilon;! I have installed a cheap 18650 battery from ebay in the transmitter and it lasts for 3-4 days.</p>
<p>&Gamma;&epsilon;&iota;&alpha; &sigma;&omicron;&upsilon; Ropotis! Maybe by increasing the &quot;low power&quot; time it will last longer.....I will use rechargeable AA batteries so not to move the device inside the house to charge it! I added wire antennas and the RF distance now is ok! </p>
<p>HI again Ropotis, </p><p>SUCCESS ! ;your code was perfect. The sensors though marked Si7021 were HTU21D; I Loaded that library changed the sensor identity and working perfectly, thanks again, best regards. John</p>
<p>Wow, of all probable problems likely to encounter in a project, that s a new one! I am glad you made it work John!</p>
<p>You did an amazing job! really liked the push button option. I completed it but unfortunately my temperature readings were consistently 128 inside and out, with a reading of 119 for humidity inside but a correct humidity reading outside. Checked wiring etc. both sensors worked correctly on test program, any suggestions? Thank you for the excellent tutorial and great details.</p>
<p>Hello John and sorry for the late reply. That is quite strange, you suggest that both sensors run ok when loaded with the library's example code but not when running the project's code and with the same wiring? I d do these things: check wiring and contacts first, load library's example code and see the serial output without changing the wiring. Be sure that you use the code I uploaded, as it is tested and it should work. I am sorry I can t help you more </p>
<p>Great idea. That would be really useful information to know when deciding what to wear when you get up in the morning. </p>

About This Instructable

2,707views

50favorites

License:

More by ropotis.:Bedside 20x4 LCD / RF 433MHz Clock & Weather monitor with Arduino 
Add instructable to: