Book Image

Arduino Home Automation Projects

By : Marco Schwartz
Book Image

Arduino Home Automation Projects

By: Marco Schwartz

Overview of this book

Table of Contents (14 chapters)
Arduino Home Automation Projects
About the Author
About the Reviewers

Measuring the temperature and humidity remotely

Now that the basics of the project are working, we can go further. We clearly don't want to constantly have the serial monitor from the Arduino IDE open and type commands by hand. This is why we need to build a graphical interface on your computer.

In this section, we are going to build a simple graphical interface using Python and the graphical library that comes with it, Tkinter. All the code will simply be contained in a Python file that can be executed later to open the interface.

The first step of the Python code is to import the correct Python modules. Python modules are basically like Arduino libraries; they add additional functions to Python. We need the time module, the serial module that we installed before, and every other component of the Tkinter module:

import time
import serial
from Tkinter import *

If you need more information on the Tkinter module, you can visit the official documentation page at