Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arduino for Secret Agents

You're reading from  Arduino for Secret Agents

Product type Book
Published in Nov 2015
Publisher
ISBN-13 9781783986088
Pages 170 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Marco Schwartz Marco Schwartz
Profile icon Marco Schwartz

Table of Contents (16) Chapters

Arduino for Secret Agents
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
A Simple Alarm System with Arduino Creating a Spy Microphone Building an EMF Bug Detector Access Control with a Fingerprint Sensor Opening a Lock with an SMS Building a Cloud Spy Camera Monitoring Secret Data from Anywhere Creating a GPS Tracker with Arduino Building an Arduino Spy Robot Index

Chapter 3. Building an EMF Bug Detector

In this chapter, we are going to build a very useful tool that every secret agent should have: a bug detector. We will build a simple device that will allow you to detect whether there are any bugs nearby, such as a recording device or a wireless hidden camera.

The following are the topics that we will cover in this chapter:

  • We will build a project with a simple wire antenna and the project will display the EMF readings on LCD screen.

  • We will also add a simple LED to indicate when EMF activity goes above a certain threshold.

Let's dive in!

Hardware and Software requirements


First, let's see what the required components for this project are.

You will, of course, need the usual Arduino Uno, that will act as the brain of the project and process all the information.

You will also need a simple wire, preferably long (such as 10 cm to 20 cm) to act as an antenna. You will need a 1M Ohm resistor along with this wire.

To display the data, we will use a simple I2C LCD screen. I used a 4 x 20 I2C screen from DFRobot:

You can, of course, use the LCD screen of your choice for this project, you will just need to use the right LCD library.

I also integrated a simple red LED along with a 330 Ohm resistor to display when EMF goes above a given level.

Finally, you will also need a breadboard and jumper wires to make the different connections.

Here is the list of all the components that we will use for this project:

Hardware configuration


We are now going to configure the hardware part of the project. As we have a relatively small number of simple components, the configuration of this project will be really easy and straightforward. This is a schematic to help you out:

As you can see, the LCD screen is not present on this schematic. We'll first see how to connect all the other components and then see how to connect the LCD screen at the end of this section.

First, connect the power to the breadboard: connect GND to the blue power rail of the breadboard and the +5V pin to the red power rail.

Then, we are going to connect the antenna: first, place it on the breadboard in series with the 1M Ohm resistor. Then, connect the other end of the resistor to the ground. Finally, connect the antenna to the A0 analog pin.

For the LED, simply place it in series with the resistor, as seen on the schematic. Ensure that you connect the resistor to the anode of the LED, which is the longest pin of the LED. Finally, connect...

Testing the LCD screen


Before we build our EMF bug detector, we want to make sure that the LCD screen is working correctly. Therefore, we are going to test it by printing a very simple message on it.

The following is a complete sketch to do this:

// Required libraries
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Create LCD instance
LiquidCrystal_I2C lcd(0x27,20,4);

void setup()
{
  // Initialise LCD
  lcd.init();
 
  // Print a message to the LCD
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("Hello Secret Agent!");
}


void loop()
{
}

As you can see, the sketch is pretty straightforward. You can now plug the Arduino project into your computer using a USB cable and then copy and paste the sketch into your Arduino IDE.

Then, upload the sketch to your board. This is what you should see:

If you can see this message, congratulations, you are ready to move to the next step!

Building the EMF bug detector


We are now going to dive into the core of this project and configure the project so that it can detect EMF activity around the antenna.

The following is the complete code for this project:

// Required libraries
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Number of readings
#define NUMREADINGS 15

// Parameters for the EMF detector
int senseLimit = 15;
int probePin = 0;
int ledPin = 7;
int val = 0;
int threshold = 200;

// Averaging the measurements
int readings[NUMREADINGS];               
int index = 0;                           
int total = 0
int average = 0;                         

// Time between readings
int updateTime = 40;

// Create LCD instance
LiquidCrystal_I2C lcd(0x27,20,4);

void setup()
{
  // Initialise LCD
  lcd.init();

  // Set LED as output
  pinMode(ledPin, OUTPUT);
 
  // Print a welcome message to the LCD
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("EMF Detector Started");
  delay(1000);
  lcd.clear();
}

...

Summary


In this chapter, we built a simple EMF bug detector that a secret agent can use to see whether there are any bugs present in a room, such as an audio recorder or a spy camera.

There are, of course, several ways to improve this project. You can, for example, connect a battery to the project and integrate it in a small case in order to build a simple and portable EMF bug detector.

In the next chapter, we are going to build another useful device for a secret agent. We will see how to use a fingerprint scanner to secure access to important information.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Arduino for Secret Agents
Published in: Nov 2015 Publisher: ISBN-13: 9781783986088
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}