Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Internet of Things Programming with JavaScript

You're reading from  Internet of Things Programming with JavaScript

Product type Book
Published in Feb 2017
Publisher Packt
ISBN-13 9781785888564
Pages 298 pages
Edition 1st Edition
Languages

Table of Contents (15) Chapters

Internet of Things Programming with JavaScript
Credits
About the Author
www.packtpub.com
Customer Feedback
Preface
Getting Started with Raspberry Pi Zero Connecting Things to the Raspberry Pi Zero Connecting Sensors - Measure the Real Things Control-Connected Devices Adding a Webcam to Monitor Your Security System Building a Web Monitor and Controlling Devices from a Dashboard Building a Spy Police with the Internet of Things Dashboard Monitoring and Controlling Your Devices from a Smart Phone Putting It All Together

Chapter 9. Putting It All Together

The previous chapters have provided us with the foundation and elements to design and put together our entire domestic system, which we will study in this chapter. I hope that I've guided you through this journey in a fairly structured and logical way, so that you are ready to do that.

As a guide to building the whole system, in this chapter, we will guide you through how to integrate and give you some ideas to put everything together, and also give you the final details. You can then make your own projects with the ideas that we will mention in this final chapter.

In this chapter, we will cover the following topics:

  • Integrating the system - development projects

  • Controlling access with a matrix keyboard

  • Integrating the system control with relays and devices

  • How to set up the power supplies

Integrating the system - development projects


In the previous chapters, we have seen different projects on home automation and domestic that is control and monitor home appliances. In this chapter, we will give some ideas to develop some projects that they can be done in different areas using electronics, controlling and monitoring.

Getting into the details of light sensor

As its name implies, the Light Dependent Resistor (LDR) is made from a piece of exposed semiconductor material, such as cadmium sulfide, that changes its electrical resistance from several thousand Ohms in the dark to only a few hundred Ohms when light falls upon it, by creating hole-electron pairs in the material. The net effect is an improvement in its conductivity, with a decrease in resistance for an increase in illumination. Also, photosensitive cells have a long response, time requiring many seconds to respond to a change in the light intensity.

In this section, we will look at how to use a light sensor to control different...

Solar power monitor circuit


Here we have another real project that shows a control panel that will monitor the energy of the solar panel using the Arduino board. The following diagram shows the connection of the sensors and solar panel to Arduino board:

Automatic irrigation system with a soil sensor


In the following figure, we have another project; we are integrating the tools that were used before. In this case, we will control the watering when it is present or not, using a soil sensor:

Until now you have seen very interesting and valuable projects that can be applied to real situations, in different areas, such as domestic, home automation, and even in a garden. In the following sections we will look at more projects. Let's do it!

Arduino water-level controller


In this project, we will make an automatic level sensor to control the level of water using your Arduino board, as shown in the following diagram:

Bluetooth based home automation


In this section, we will look at a project that can be used in home automation, to control the devices in a house, using a Bluetooth module to communicate, and a relay module and the integration of the hardware as software tools.

The following diagram shows how to connect the relay module and the HC05 Bluetooth module to the Arduino board:

Controlling access with a matrix keyboard


In this section, we will look at how to control the access with a code using a matrix keyboard. In the following image, we can see the keyboard that we will use:

The keypad

In the following diagram, we see the hardware connections to the Arduino board. They are connected to the digital pins:

Connecting an LCD screen to display the code

In the following diagram, we show the hardware connections of the LCD screen to the Arduino board:

We have looked at some interesting projects that you can develop by adding new sensor to control other devices. In the next section, we will look at a very interesting project. Get ready for the next step, this is a great goal. 

Controlling the door lock with a keypad


In the following image, we see a keypad with a lock. This section can be merged along with the last project. This device can be controlled from your Raspberry Pi Zero or your Arduino board:

 Code to access using the keypad

You can now either copy the code inside a file called Project_keyboard_Access_Control.ino, or just get the complete code from the folder for this project using the Arduino IDE:

void captura() 
{ 
  tecla = customKeypad.getKey(); 

  if (tecla) 
  { 
    digito = digito + 1; 
    if(tecla==35){tecla=0;digito=0;valorf=0;lcd.setCursor(0,0);lcd.print(valorf);
      lcd.print("          ");}          
    if(tecla==48){tecla=0;} 
    if(tecla==42){tecla=0;digito=0;valor = valorf;} 

   if(digito==1){valorf1 = tecla; valorf=valorf1;lcd.setCursor(0,0);
       lcd.print(valorf);lcd.print("          ");}  
     if(digito==2){valorf2 = tecla+(valorf1*10);valorf=valorf2;lcd...

Integrating the system control with relays and devices


In the following figure, we're integrating important parts of the book. We will show the connections in a house using a relay, and how you will apply and control the real load using a lamp:

Controlling multiple appliances

In real life, we will see the devices connected and controlling the real world. In the following image, we can see the relay module that can control the loads with the electronics part:

The following image shows the final circuit. We see the real connections to the Arduino board, and how they control the real world.

The complete system

In the following figure, we see the final circuit for controlling real devices in a home automation system. This can be used in all areas of the home, in each room we can have a relay module, connected to each module communicating with control system:

How to set up the power supplies


For our system, it is very important to set up the power supply that will be used in the system. First we need to ensure that the voltage for the Arduino is about 5V. In the following diagram, we have shown how to configure the voltage to about 5 volts:

Power supply for AC loads

If we need to connect AC loads to the Arduino or Raspberry Pi Zero and make an industrial control system, we need to use a voltage of 24 V of DC, as you can see in the following circuit diagram:

Connecting a relay of 24 DC volts to the Arduino board

In the following diagram, we have the circuit to control an AC load using a relay of 24 volts of DC:

We have the final circuit, which represents the interface to control an AC load, connected to the output digital pin to the Raspberry Pi Zero or the Arduino board: this is not very common to see, but it's necessary to learn how to connect a relay that can be energized with 24 volts of DC to the Arduino board:

Finally we have the final circuit...

Summary


This is the last chapter of the book, Internet of Things Programming with JavaScript. In this chapter, you learned how to integrate all the elements that you need to take into consideration when you want to apply the tools of hardware and software in the projects that we showed you. This is going to help you to continue developing your own projects, following the basics and the knowledge shared in this book.

lock icon The rest of the chapter is locked
arrow left Previous Chapter
You have been reading a chapter from
Internet of Things Programming with JavaScript
Published in: Feb 2017 Publisher: Packt ISBN-13: 9781785888564
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}