Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arduino By Example

You're reading from  Arduino By Example

Product type Book
Published in Sep 2015
Publisher
ISBN-13 9781785289088
Pages 242 pages
Edition 1st Edition
Languages
Authors (2):
 Adith Jagadish Boloor Adith Jagadish Boloor
Profile icon Adith Jagadish Boloor
Adith Jagdish Boloor Adith Jagdish Boloor
Profile icon Adith Jagdish Boloor
View More author details

Putting the pieces together


Go ahead and create this circuit for Arduino:

The connections are as follows:

  • PIR → Arduino

  • GND → GND

  • OUT → D02

  • VCC → 5V

  • HC-06 → Arduino

  • VCC → 3.3V

  • GND → GND

  • TXD → D10

  • RXD → D11

Don't get mad, but there is one last library that you need to install in order to allow Arduino to communicate with Python: pySerial. Go to https://pypi.python.org/pypi/pyserial, download pyserial-2.7.win32.exe, and install it just like you install any other software. Then, we are ready.

Open Arduino and load the alarm_bluetooth.ino file that came with this chapter. It is recommended that you have the most up-to-date Arduino software before proceeding:

#include <SoftwareSerial.h> // serial library used for communication

SoftwareSerial burg_alarm(10, 11); // communicates via TX, RX at 10, 11 respectively
int ledPin = 13; // in built LED to show status changes
int pirPIN = 2;   // signal of the PIR sensor goes to pin 2
int pirState = LOW; // initiate the PIR status to LOW (no motion)
int pirVal...
lock icon The rest of the chapter is locked
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}