Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Arduino Home Automation Projects
  • Table Of Contents Toc
Arduino Home Automation Projects

Arduino Home Automation Projects

By : Marco Schwartz
4 (10)
close
close
Arduino Home Automation Projects

Arduino Home Automation Projects

4 (10)
By: Marco Schwartz

Overview of this book

This book is divided into projects that are explained in a step-by-step format, with practical instructions that are easy to follow. If you want to build your own home automation systems wirelessly using the Arduino platform, this is the book for you. You will need to have some basic experience in Arduino and general programming languages, such as C and C++ to understand the projects in this book.
Table of Contents (9 chapters)
close
close
8
Index

Testing the sensors


Before sending the data from our sensors to the cloud, we'll first make sure these sensors are working correctly. To do this, we are going to make the usual test sketch that will try to read data from the sensors and print this data on the serial monitor.

Let's now go to the Arduino IDE. The Arduino sketch starts by importing the correct library for the DHT sensor. The library is as follows:

#include "DHT.h"

We also have to declare the variables to store the measurements:

int lightLevel;
float humidity;
float temperature;

And to define on which pin the DHT sensor is connected, use the following code:

#define DHTPIN 7
#define DHTTYPE DHT11

We also have to create the instance for the DHT sensor:

DHT dht(DHTPIN, DHTTYPE);

In the setup() function of the sketch, we need to initialize the DHT sensor:

dht.begin();

Then, start the serial connection:

Serial.begin(115200);

In the loop() function of the sketch, we make the measurements:

float temperature = dht.readTemperature();
float humidity...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Arduino Home Automation Projects
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon