I have always wanted to create a home automation system around sensors. So I've decided to start this project by creating a temperature monitor as a first base of my projet.

The project consists in one sensor and one gateway. The gateway will regularly ask the sensor for its temperature, which will be displayed on the gateway's screen.

I have decided to use:

  • an Arduino as a base for my sensor
  • a Raspberry Pi as a gateway with a 7 inches touch screen to display the received data.
  • XBee modules (serie 1) as communication medium between the sensor and the gateway
  • Qt framework to make the gateway

As I want to use Qt on the gateway side, I have started to develop a library to use XBee modules in a very simple way thanks to the power of the Qt framework. You can check my library's repository here on my GitHub: QtXBee

Step 1: System Architecture

Step 2: What Will You Need ?


  1. Getaway:
    • 1x Raspberry Pi
    • 1x Official 7" touch screen
    • 1x XBee module Serie 1
    • 1x XBee explorer (USB)
  2. Sensor:
    1. 1x Arduino Uno
    2. 1x XBee modules Serie 1
    3. 1x DS18S20 temperature sensor (1 Wire)
    4. 1x 4.7 kΩ resistor
    5. 1x 10 kΩ resistor
    6. 1x 18 kΩ resistor
    7. 1x Arduino Uno proto shield with headers


Step 3: Hardware: the Temperature Sensor

As seen before, the temperature sensor is based on an Arduino and 1-Wire temperature sensor.

1-Wire is a device communications bus system designed by Dallas Semiconductor Corp. that provides low-speed data, signaling, and power over a single signal. 1-Wire is similar in concept to I²C, but with lower data rates and longer range. It is typically used to communicate with small inexpensive devices such as digital thermometers and weather instruments. A network of 1-Wire devices with an associated master device is called a MicroLAN [Definition from Wikipedia]

The temperature sensor I choosen is the DS18S20 from Maxim. It has the follwing key features:

  • Measures Temperatures from -55°C to +125°C (-67°F to +257°F)
  • ±0.5°C Accuracy from -10°C to +85°C
  • 9-Bit Resolution
  • No External Components Required

As the XBee module works in 3.3V and the Arduino UNO in 5V, we will have to adjust the voltages levels for the serial interface between the XBee module and the Arduino

Step 4: Hardware: the Gateway

For the gateway there is no electronic to be made. The only thing to do is to assemble the touch screen and plug it on the Raspberry Pi. For this, check this good article: Raspberry Pi 7" touch screen assembly guide

Step 5: Software: Program the Sensor (Arduino)

Use Arduino IDE to program your Arduino.

Create a new Sketch with the code you can find on my GitHub

Step 6: Software: Install the Gateway

This step describes the easiest way to install and setup the gateway (Raspberry Pi), but it is not the lightest one. For advanced users, go to the next step.

Install Raspbian (with PIXEL):

First we need to install the OS on our RPi. Follow this guide which is very well explained: https://www.raspberrypi.org/documentation/installa...

Install build depencencies:

In order to build the Temperature monitor application, we have first to install the build dependencies.

sudo apt-get update && sudo apt-get install git-core qt5-qmake qt5-default libqt5opengl5-dev libqt5serialport5-dev libqt5qml5 libqt5quick5 qtquick1-5-dev qtdeclarative5-dev qml-module-qtquick-window2 qml-module-qtquick2

Get the sources:

cd ~/
git clone https://github.com/ThomArmax/QtXBee.git

Build the sources:

cd ~/QtXBee
qmake -recursive
sudo make install

Launch the application:

LD_LIBRARY_PATH=/usr/lib/QtXBee /op/example_temp_monitor/bin/example_temp_monitor

Step 7: Software: [Advanced Users] Install the Gateway (Rapsberry Pi) Using Yocto Project

I'm quite familiar with Yocto. As I use a lot my Raspberry Pi for personal projets, I have published some yocto layers on my GitHub, espacially the meta-armax layer I've created to build all my librairies and programs.

In the meta-armax layer, I have created a demo image, which boot and starts directly the temperature monitor application thanks to SysV init script.

You can find the code of the temperature monitor application here on my GitHub.

Environmnent setup:

Run the following command to install the environment:

sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm

Get Yocto:

cd ~/
mkdir yocto && cd yocto
git clone http://git.yoctoproject.org/git/poky -b jethro
cd poky
git clone https://github.com/ThomArmax/meta-armax.git
git clone https://github.com/ThomArmax/meta-hyperion.git
git clone git://git.openembedded.org/meta-openembedded -b jethro
git clone https://github.com/agherzan/meta-raspberrypi.git -b jethro
git clone https://github.com/meta-qt5/meta-qt5.git -b jethro

source oe-init-build-env

Then edit conf/bblayer.conf:

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly





/home/thomas/yocto/poky/meta \

/home/thomas/yocto/poky/meta-yocto \

/home/thomas/yocto/poky/meta-openembedded/meta-oe \

/home/thomas/yocto/poky/meta-qt5 \

/home/thomas/yocto/poky/meta-armax \

/home/thomas/yocto/poky/meta-raspberrypi \

/home/thomas/yocto/poky/meta-hyperion \

/home/thomas/yocto/poky/meta-hyperion/meta-raspberrypi \



/home/thomas/yocto/poky-jethro-14.0/meta \

/home/thomas/yocto/poky-jethro-14.0/meta-yocto \


The edit conf/local.conf:

Set MACHINE = "raspberrypi2" for RPi2

Build the image:

Run: bitbake qtxbee-demo-image

Flash the generated image on the SD card:

  1. Plug the SD card
  2. Identify its node using dmesg command
  3. Then type: sudo dd if=tmp/deploy/images/raspberrypi2/qtxbee-demo-image-raspberrypi2.rpi-sdimg of=/dev/sdd

Step 8: XBee Modules Configuration

In order to be able to communicate, we have to create a XBee "network". So our modules must be configured.

The configuration is possible with the XCTU software

The XBee module used on the Gateway will be the coordinator. It's configuration MUST be:

  • MY = 0
  • ID = 3332
  • AP = 1
  • CE = 1 (Coordinator enabled)

The XBee module used for the sensor is en End Device. It MUST be configured as followed:

  • MY = 2
  • ID = 3332
  • AP = 1
  • CE = 0 (Coordinator disabled)

Step 9: Launch

Now all steps are done, you just have to power on both gateway and sensor, and you are done :)

If you have any question, request and issues, feel free to ask

If you liked my project, please vote for me :)



<p>Great idea, I'd love to have one of these set up during winter! It feels like it varies pretty widely between when the heater stops until it kicks on again.</p>
<p>Hi @Swansong. I'm glad you liked my project :)</p><p>If you want, you can vote for me in the following contests:<br><a href="https://www.instructables.com/contest/firsttimeauthors2016/" rel="nofollow">https://www.instructables.com/contest/firsttimeauth...<br></a><a href="https://www.instructables.com/contest/arduino2016/" rel="nofollow">https://www.instructables.com/contest/arduino2016/</a></p><p>Thank you</p>

About This Instructable




Bio: Embedded software engineer
More by tcoin:Remote temperature monitor, using Arduino, Raspberry Pi and XBee modules 
Add instructable to: