Motion Controlled AWS IoT Button

You can use it as remote switch, anti theft beacon, counter, movement detector and so on.

First, I would like to thank Amazon for announcing AWS IoT, a great environment for   Internet   of   Things.   After   three   weeks   experiment   I  have  successfully implemented  my  project  with  AWS  IoT. Actually, I am thinking to make a Motion control  IoT button  which can  be  used  to  detect movement or thief from remote place and I was inspired by Amazon IoT button. Finally, I made it by Raspberry Pi and Amazon AWS IoT. I used  PIR sensor for detecting the movement. Raspberry Pi  is  used  here  as  a  gateway  which  transmit  a  message to AWS using MQTT protocol. AWS IoT is working as a MQTT broker. Another Raspberry  Pi is  used as MQTT   subscriber.  When  publisher  publish  message   to  a  specific  topic  after detecting   any   movement   MQTT   broker( AWS   IoT)  transmit  it  to  subscriber. According to  received  message  subscriber (Raspberry Pi) implement predefined action. Action may be an alert or switching any light or camera etc. System also sends notification email or sms to your email address or phone number using Amazon SNS service.

Before  going  to  the  main  task  I  want  to  give  a  brief  introduction about mqtt protocol and PIR sensor.

MQTT  protocol:  MQTT   is  a   machine-to-machine  (M2M) / ‚ÄúInternet  of  Things‚ÄĚ connectivity  protocol.  It   was   designed   as  an  extremely  lightweight  publish/ subscribe messaging  transport.  It is useful for connections with remote locations where   a  small  code  footprint   is  required  and/or  network  bandwidth  is  at  a premium. ‚ÄĒ

MQTT protocol  uses a publish/subscribe  architecture in contrast to HTTP with its request/response   paradigm.  Publish/Subscribe   is   event-driven   and   enables messages  to  be pushed to clients. The central communication point is the MQTT broker, it is  in  charge of  dispatching  all messages between the senders and the rightful receivers. Each client  that  publishes  a message to the broker, includes a topic into  the  message. The topic  is  the routing information for the broker. Each client that wants to receive messages subscribes to a certain topic and the broker delivers  all messages  with  the matching  topic to the client. Therefore the clients don’t  have  to  know  each  other,  they  only  communicate  over  the  topic.  This architecture enables highly scalable solutions without dependencies between the data producers and the data consumers.

Details of MQTT is available here:

PIR Sensor: PIR-based  motion  detector  (PID)  or a  passive  infrared sensor (PIR sensor)  is  an  electronic  sensor  that  measures  infrared (IR) light radiating from objects  in   its  field  of  view.  They  are  most  often  used  in  PIR-based  motion detectors. When a warm body like a human or animal passes by, it first intercepts one  half  of  the PIR sensor, which causes a positive differential change between the  two  halves.  When  the  warm  body  leaves  the  sensing  area,  the  reverse happens,  whereby  the  sensor  generates  a negative differential change. These change pulses are what is detected.

PIR motion sensor pin out

PIR motion sensor pin out

PIR sensor details

PIR sensor details

I hope you understand about MQTT and PIR Sensor. Now it is the time to start working:

Setup AWS IoT

All  services  in  AWS  are  delivered  via   a  rich  set  of REST APIs. You can use a service  programmatically  through the APIs by leveraging one of  the many SDKs. You can use AWS cli. Alternatively,  you  can  invoke  services  through   the web-based AWS Management Console. To build my AWS  environment, we will invoke AWS Management console.  But  keep  in mind  that every step we perform today can be done completely programmatically, which is one of the many reasons why the AWS cloud is so powerful. Follow the steps:

1. Create an AWS account from the link:

2. Sign in to AWS Management console and from the Services select AWS IoT (Fig-1)

a. Click on Get Started (Fig-2)

b. Click on Create a thing

c. Type a thing name (e.g. raspberry) & click to Create

A thing named raspberry will be created (Fig-5)

Source: Motion Controlled AWS IoT Button

About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top