Chapter 5. Opening a Lock with an SMS

In this chapter, we are going to build another great application for secret agents: opening a door lock simply by sending an SMS! You'll just need to send a message to a given number and then you'll be able to control a door lock or any other kind of on/off digital device, such as an alarm.

For that, we are going to take a number of steps, as follows:

  • First, we are going to use Arduino and the FONA shield from Adafruit in order to be able to receive and process text messages
  • Then, we'll connect this to a relay and LED to see whether we can actually control a device by sending an SMS
  • Finally, we'll see how to connect an actual electronic lock to the system

Let's start!

Hardware and software requirements

First, let's see what the required components for this project are. The most important parts are related to GSM functionalities, which is the central piece in our project. We'll need an antenna in order to be able to connect to the local GSM network. For this project, a flat uFL antenna is used:

Hardware and software requirements

Then, you'll need a way to actually use a SIM card, connect to the GSM network, and process the information with Arduino. There are many boards that can do this; however, I recommend the Adafruit FONA shield, which is very convenient to configure and use with Arduino. The following is the image of the Adafruit FONA shield along with the flat GSM antenna.

Hardware and software requirements

Then, you will need a battery to power the FONA shield, as the Arduino Uno board doesn't allow to power the chip that is at the core of the FONA shield (it can use up to 2A at a time!). For this, I used a 3.7 LiPo battery along with a micro USB battery charger:

Hardware and software requirements

A very important part of the project is the SIM card that you need to place in the FONA shield. You need a normal SIM card (not micro or nano), which is activated, not locked by a PIN, and is able to receive text messages. You can get one at any of your local mobile network operators.

Then, to test the functionalities of the project, we'll also use a simple LED (along with a 330 Ohm resistor) and a 5V relay. This will mimic the behavior of the real electronic lock.

Finally, you'll need an electronic lock. This part is optional as you can completely test everything without the lock and it is quite complicated to set up. For this, you'll need an Adafruit electronic lock, a 1K Ohm resistor, and a power transistor.

Finally, here is the list of all the components that we will use in this project:

On the software side, you'll only need the latest version of the Arduino IDE and the Adafruit FONA library. You can install this library using the Arduino IDE library manager.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.99.71