How to make a Laser protection security system with Nodemcu ESP8266

How to make a Laser protection security system with Arduino

Hello and welcome back. In this project, we will learn how to make a Laser protection security system with Nodemcu ESP8266. For that, I have mainly used the Nodemcu ESP8266 board, Laser module, and LDR sensor module. These components will work together to ensure the security of your space.  Also, using this system we can get the security alert to your telegram app. One of the standout features of this system is its ability to keep you informed and alert in real-time. It has the capability to send security alerts directly to your Telegram app, which is a fantastic way to stay updated on any security events. I think that’s a good point.  Additionally, I have used the buzzer and LED bulb to indicate the security alerts. A buzzer has been included to provide audible notifications, and an LED bulb will flash to visually indicate security alerts.

You must keep in mind that’s an example project. You can modify it as you like.

What’s the Laser module and how to use it step by step – Click on me

OK, let’s do this project step by step. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.

Step 2

Secondly, place the Nodemcu board on the breadboard. Then, connect the power pins to the breadboard power lines.

Step 3

Thirdly, place the buzzer, LED, and resistor on the breadboard. Then, connect these components to the Nodemcu board. For that, use the circuit diagram below.

How to make a Laser protection security system with Arduino

Step 4

Now, let’s install the Laser module and LDR sensor module. For that, I have created a simple structure.

  • First, cut the base part of this structure. For that, you can use cardboard, foam board, or any other suitable material.
  • Now, cut another two parts. Then, paste the Laser module and LDR module as you like. For that, follow the picture below.
  • Next, paste these parts on the base part.

Step 5

Now, connect these components to the Nodemcu board. For that, use the circuit diagram above.

Step 6

OK, now let’s set up the Telegram bot. For that, follow the instructions below. You can do it using your Telegram mobile app or Telegram web app. I have used the web app.

  • First, open your app and search it on “botfather”. Then, open this bot and click the start button.
  • Next, click the “/newbot” button and enter the name of your project. Then, enter your project username. You must remember that the username must be unique. Now, you can see the HTTP API key.
  • Then, search for “idbot” on the search bar. Now, click the “/getid” button. Now you can see the chat ID.

Ok, The telegram app setup is complete.

Step 6

Now, connect the Nodemcu board to the computer. Then, copy and paste the following program to the Arduino IDE.

How to make a Laser protection security system with Arduino
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
#include <ArduinoJson.h>


const char* ssid = "************";
const char* password = "**************";


#define BOTtoken "***********************"
#define CHAT_ID "**********"

#define LED D4
#define Buzzer D3
#define LReceiver D5
#define Laser D6

X509List cert(TELEGRAM_CERTIFICATE_ROOT);
WiFiClientSecure client;
UniversalTelegramBot bot(BOTtoken, client);


void setup() {
  Serial.begin(115200);
  configTime(0, 0, "pool.ntp.org");// get UTC time via NTP
  client.setTrustAnchors(&cert); // Add root certificate for api.telegram.org

  pinMode(LReceiver, INPUT);
  pinMode(LED, OUTPUT);
  pinMode(Laser, OUTPUT);
  pinMode(Buzzer, OUTPUT);
  digitalWrite(Laser, HIGH);

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  Serial.print("\nWiFi connected. IP address: ");
  Serial.println(WiFi.localIP());
  bot.sendMessage(CHAT_ID, "System is Ready", "");
  delay(1000);
}

void loop() {
  bool value = digitalRead(LReceiver);
  Serial.println(value);
  if (value == 1) {
    digitalWrite(LED, HIGH);
    digitalWrite(Buzzer, HIGH);
    bot.sendMessage(CHAT_ID, "Warning!", "");
  } else if (value == 0) {
    digitalWrite(LED, LOW);
    digitalWrite(Buzzer, LOW);

  }
}

  • Now, enter your WIFI SSID and password. Then, enter your telegram HTTP API key and chat ID.
  • Next, select the board and port. After, click the upload button.

Step 7

Finally, open your telegram “botfather” chat and click the bot username you created above. Now, you can test this project. Please test this project under the low low-light conditions. In this case. you have to enable the internet connection.

Troubleshooting

  • Check all jumper wire connections.
  • Check your internet connection.
  • Check the HTTP API key and chatID.

OK, enjoy this project. The full video guide is below. So, we hope to see you in the next project or tutorial. Have a good day.

How to make a Laser protection security system with Arduino

Similar Posts

Leave a Reply

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