Smart Package Reception Box
0 1077 Medium

An IoT smart package reception box and getting notification on telegram app

projectImage

Things used in this project

Hardware components

HARDWARE LIST
1 DFRobot FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth)
1 Ultrasonic Sensor - HC-SR04 (Generic)
2 LED (generic)
1 SG90 Micro-servo motor
1 Solderless Breadboard Half Size
7 Male/Female Jumper Wires
9 Male/Male Jumper Wires

Software apps and online services

Arduino IDE

Telegram

Hand tools and fabrication machines

Tape, Double Sided

Story

 

In the daily activities of society in general, in this digitalization era, the use of the internet is inseparable. One of them is online shopping. Buyers don't have to bother going to the market because the groceries will be delivered directly to the front of the buyer's house. However, sometimes when the parcel courier arrives, the buyer is not at home. This situation will definitely make it difficult for the courier to work and also worry about losing goods if the goods are placed carelessly. Not a few of the consumers lost their goods when the package was simply placed on the home page.

 

To minimize this incident, the author will design and build a package receiver box tool that is integrated with the owner's telegram to get notifications when the courier arrives. This tool will replace the function of the buyer to receive the package when he is not at home.

Schematics

projectImage

Code

CODE
// Device libraries (Arduino ESP32/ESP8266 Cores)
#include <Arduino.h>
    #include <WiFi.h>
    #include "CTBot.h"


#include <Servo.h>
static const int servoPin1 = 5; //pin servo
Servo servo1;

int trigPin = 23;          //pin triger ultrasonik
int echoPin = 22;           //pin echo ultrasonik
long distance;
long duration;
int OPEN = 120;             //open angle
int CLOSE = 0;              //close angle
#define sensor 15           //pin infrared
#define led 18              //pin led 1
#define led2 19             //pin led 2

CTBot myBot;
String ssid = "xxxx";      //ssid WiFi
String pass = "xxxx";      //password Wifi
String token = "xxxxx";      //token bot telegram
const int id = 123456;          //id telegram


void setup()
{
  
  Serial.begin(9600);

  servo1.attach(servoPin1); 
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(sensor, INPUT_PULLUP);
  digitalWrite(led, LOW);
  digitalWrite(led2, LOW);
  servo1.write(0);
  Serial.println("Starting TelegramBot...");
  myBot.wifiConnect(ssid, pass);
  myBot.setTelegramToken(token);

  if (myBot.testConnection()) {
    Serial.println("Good Connection");
  } else {
    Serial.println("Bad Connection");
  }

  myBot.sendMessage(id, "Hello, Welcome to Bot Prototype Package Receiving Box");
  Serial.println("Pesan Terkirim");
}


void loop()
{
  TBMessage msg;
  Serial.println(distance);
  //Opening Door
  digitalWrite(trigPin, LOW);
  delayMicroseconds(1);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(1);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = duration*0.017;
  if(distance <= 30 && distance !=0){
  myBot.sendMessage(id, "Punten Paket, Mau buka pintu? /bukapintu");
  }

  //Sinyal paket diterima
  if (digitalRead(sensor) == LOW){
    digitalWrite(led, HIGH);
    delay(500);
    myBot.sendMessage(id, "Paket Telah Diterima... Tutup Pintu? /tutupintu");
    digitalWrite(led, LOW);
    delay(500);
    
    }
  if (myBot.getNewMessage(msg, "/bukapintu")) {
    servo1.write(OPEN);
    delay(100);
    digitalWrite(led2, HIGH);
    myBot.sendMessage(id, "Pintu dibuka");
  }else if (myBot.getNewMessage(msg, "/tutupintu")) {
    servo1.write(CLOSE);
    delay(100);
    digitalWrite(led2, LOW);
    myBot.sendMessage(id, "Pintu Ditutup");
  }
  

}

The article was first published in hackster, December 21, 2021

cr: https://www.hackster.io/ilhamhizbuloh/smart-package-reception-box-40874b

author: Ilham Hizbuloh

License
All Rights
Reserved
licensBg
0