Machine To Machine Talk Using ESP8266

Machine to Machine talk is a subpart of IoT (Internet Of Things) in which a machine gives a command or signal to another machine for doing some task. And in this article, I’ll be teaching you how you can make a simple yet useful project on M2M technology using you very own ESP8266 01 module.

How this all started?

I was facing one problem with the structure and location of my room. I wanted to know if anyone is coming in my room so that I can hide my private stuff. I have made one video on what problem I was facing and why I wanted to make this project. Watch this video to know the story behind this project. https://youtu.be/qXp-Oeai2bo

Possible Solutions of my Problem

In the Intro video of this project, I asked all my viewers to comment the possible solution that comes in their mind which can solve my problem. Many of my viewers gave their views in the comment of that video. I reviewed all that projects and gave my views regarding their ideas. I also made a video on Reviewing Comments. Watch this video if you want to know other similar projects for my problem.

Components Required

For making this project you’ll require:

  • 2 x ESP8266 01 WiFi Modules
  • 2 x 9V Batteries
  • 2 x 3.3V Regulator IC (AMS 1117)
  • 1 X PIR motion sensor module
  • 1 X Piezo Buzzer
Logic behind this project

Here, out of two ESP, one is acting as an Access Point and the other will try to connect to the first one. Hence, this will avoid the use of external router between our ESPs. The first ESP which is an access point, is acting as a server and it will be doing nothing until one particular link is requested from any device connected with this access point. And that particular link is: As soon as it receives this link, it will buzz the buzzer 5 times with some delay in between. Now the other ESP which is acting as a client will first get connected to the ESP acting as a server and then it will request this link ( whenever PIR sensor, which is attached with client ESP detects any motion. Conclusion:Whenever any motion is detected by PIR sensor, the client ESP module will talk to server ESP module and server ESP module will let you know that someone is coming in my room by buzzing the buzzer 5 times.

Making of the Project

For making this project, you first need to code your ESP boards. You can code it with your USB to TTL convertor or with your Arduino Board its up to you. If you don’t know how to program your ESP boards with Arduino Firmware, then watch out my video tutorial on that:


Code of both Server and Client are available on my github account. You can download it from there.

Circuit Diagram

Circuit diagram of ESP as a Server is shown below:

Circuit diagram of ESP as a Client is shown below:

I have also made tutorial videos on this same project in both the Hindi and English language. Watch the video to see my project in action.