Sakshi Kamal
Published

SafeKeeper

SafeKeeper, an affordable smart safe, through which you can get alerts if someone comes in close contact with the safe.

BeginnerProtip4 hours295
SafeKeeper

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Arduino UNO
Arduino UNO
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB-A to B Cable
USB-A to B Cable
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1

Software apps and online services

Arduino IDE
Arduino IDE
SMS Messaging API
Twilio SMS Messaging API

Story

Read more

Schematics

Circuit diagram

Connections made between Bolt IoT wifi module, Arduino Uno and Ultrasonic sensor HC-SR04

SafeKeeper

Image of Project

Code

smartsafe.py

Python
Server code
import conf, json, time #For configuration, parsing json and sleep

from boltiot import Bolt, Sms #For sending Sms&Bolt class from boltiot library 

safe_dist= 10  #distance between the intruder and safe
  

mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID) #Create object to fetch data 

sms = Sms(conf.SID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER) #Create object to send SMS 

response = mybolt.serialRead('13') #Recieving data from the pin 13 of Arduino

while True:
  response = mybolt.serialRead('13') #Fetching the value from pin 13 ofArduino
  data = json.loads(response)#storing the value received to the bolt from arduino
  distance = data['value'].rstrip() #Removing the decimal part
  print("Distance is: ", distance) 
  if (int(distance) <= safe_dist): 
    print("Too close!")
    response = sms.send_sms('Someone is close to your safe!!') #Sending the sms to your mobile number
  time.sleep(2.5) #Time between two consecutive readings in seconds

Arduino Sketch

C/C++
Code that needs to be uploaded to Arduino using Arduino IDE
#include<Ultrasonic.h>

Ultrasonic ultrasonic(12,13);

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

void loop(){
  Serial.println(ultrasonic.read(CM));
  delay(4000);
}

conf.py

Python
Configuring the Bolt Iot device
SID = 'Your twillio account sid'

AUTH_TOKEN = 'Your twillio account auth token' 

FROM_NUMBER = 'Your twillio number' 

TO_NUMBER = 'Your number to get alert sms'

API_KEY = "Bolt cloud api key" 

DEVICE_ID  = "Bolt Iot Device ID"

Credits

Sakshi Kamal
1 project • 1 follower
Contact
Thanks to Eric Simoes.

Comments

Please log in or sign up to comment.