Hardware and software requirements
The first thing you will need is an Arduino Uno board. We will use this board throughout this book to connect sensors, actuators, and wireless modules and make them interact with Android. Then, we will need a relay module. A relay is basically an electrical switch that we can command from Arduino, which can allow us to control devices such as lamps. This project uses a 5V relay module from Polulu, which properly integrates a relay on a board, along with all the required components to control the relay from Arduino. The following is the image of the relay module that was used in this chapter:
You will also need a DHT11 (or DHT22) sensor, along with a 4.7K resistor, for temperature and humidity measurements. A resistor is basically a device to limit the current flowing into an electrical device. Here, it is necessary to ensure the correct functioning of the DHT sensor.
Finally, you will need a small breadboard and jumper wires to make the different hardware connections.
The following is the list of all hardware parts you will need for this project, along with links to find these parts on the Web:
- The Arduino Uno board (http://www.adafruit.com/product/50)
- The 5V relay module (http://www.pololu.com/product/2480)
- The DHT11 sensor and 4.7K Ohm resistor (https://www.adafruit.com/product/386)
- The breadboard (https://www.adafruit.com/product/64)
- Jumper wires (https://www.adafruit.com/product/758)
On the software side, you will need the Arduino IDE that we will also use in the rest of this book. You can get it at http://arduino.cc/en/Main/Software.
The installation process of the IDE is very simple; you simply have to open the file and follow the onscreen instructions.
You will need the library for the DHT11 sensor, which can be found at https://github.com/adafruit/DHT-sensor-library.
You will also need the aREST library found at https://github.com/marcoschwartz/aREST.
To install a given library, simply extract the folder in your Arduino/libraries
folder (or create this folder if it doesn't exist yet). Your Arduino
folder is where all the sketches are stored, and you can define this folder in the preferences of the Arduino IDE.
Preparing for Android development requires that we get ready to design and develop the app, and the following checklist will guide you with having the basics ready for any project:
- Java Developer Kit Version 6 (or higher)
- Android Studio
- Android Software Development Kit
- Android Device with Bluetooth SMART technology
We will also work together to make sure that you have everything properly set up.