E.N.O.U.G.H. Safe
Lately, violence resulting from guns has gotten out of hand. There are currently programs in place to limit these losses, but nothing accounts for the guns themselves once they are in someone's possession. Living in the US, I saw the effects of school shootings in my community and have wanted to create a way to limit the losses caused by guns.
E.N.O.U.G.H. is a safe designed to keep its contents, well, safe. Once it is opened, a notification will be sent to the owner's phone that will include a photo of whoever is accessing the safe. It doesn't only have to be used to store weapons; the safe is also a great option to keep personal items, such as jewelry, secure.
This project was completed with Nadine Leonard, who does not have an Instructable account.
If you or someone you know is having thoughts of hurting themselves or someone else, please contact a professional. This website has a great list of resources.
Supplies
- Metal safe
- Raspberry Pi 3 (with WiFi)
- 2 heat sinks
- Power supply
- Micro SD card with preloaded Raspbian
- Wireless keyboard & mouse
- Smart display monitory
- Pi Camera v2 with a ribbon cable
- Breadboard with a 40-pin GPIO ribbon cable
- Smraza case with a cooling fan
- Adafruit magnetic contact switch set
Hardware
To prep the Raspberry Pi, apply the heat sinks to the Pi; one should go to the Central Processing Unit (CPU) and the other to the micro controller. After that, insert the SD card and connect the monitor, keyboard, and mouse according to the instructions on their box. After that, plug in the power supply to the Pi, turn it on, and load Raspbarian from the SD card (ensuring everything loads properly).
Once that is up and running, turn the Pi off and attach the GPIO cable to the breadboard, ensuring correct polarity. Connect the magnetic switch to the breadboard ports GPIO 23 and ground (GND). After that, plug the camera into the Raspberry Pi camera port and reboot the Raspberry Pi.
Software
On a computer, go to Pushetta.com and set up a private channel within the site. This free site will allow you to send push notifications to one or more smartphones. In the Pi, type "$ sudo pip install pushetta" and enter the API token Pushetta gave you once it's requested. After that, paste the following Python code in:
#!/usr/bin/python
# This Python application turns a Raspberry Pi into a gun box tampering warning device. # The Dropbox functionality is not yet working and has been commented out. import time from time import sleep #allows "sleep" to wait between actions from picamera import PiCamera import RPi.GPIO as GPIO #import GPIO library and call it GPIO #import sys #import dropbox #from dropbox.files import WriteMode #from dropbox.exceptions import ApiError, AuthError # define the GPIO port you will use for the door sensor SENSOR = 23 # number of seconds to delay between alarm and snapshot # wait 3 seconds for the person to fully open the box after triggering the sensor DELAY = 3 #setup GPIO using Broadcom SOC channel numbering (take GPIO number instead of pin number) GPIO.setmode(GPIO.BCM) # set to pull-up (normally closed position for a door sensor) GPIO.setup(SENSOR, GPIO.IN, pull_up_down=GPIO.PUD_UP) # text message to send with photo TXT_MSG = "Gun Box Opened!" # hostname or IP address of Raspberry Pi + port number HOSTNAME = "192.168.1.82" # name and dimensions of snapshot image IMG = "snap.jpg" VID = "video.h264" IMG_WIDTH = 800 IMG_HEIGHT = 600 #Dropbox Access Token #TOKEN = uGTbqabBQiAAAAAAAAAAC0IX4- gZpYlVyl4zMVtfdsk_2a_2_9vsPLgZzf284kRP # initalize the Pushetta client from pushetta import Pushetta API_KEY="3070250cede007d97820d7c0412699b18276305c" CHANNEL_NAME="GunBox" try: # setup an indefinite loop that looks for the door sensor to be opened while True: GPIO.wait_for_edge(SENSOR, GPIO.RISING) print("Gun Door Opened!\n") p=Pushetta(API_KEY) p.pushMessage(CHANNEL_NAME, "ALERT: Gun Box Opened") time.sleep(DELAY) camera = PiCamera() #with picamera.PiCamera() as camera: camera.resolution = (IMG_WIDTH, IMG_HEIGHT) camera.start_preview() sleep(1) camera.capture(IMG) #send image to Dropbox #def backup(): #with open(IMG, 'rb') as f: #print("Uploading " + IMG + " to Dropbox as " + IMG + "...") #try: #dbx.files_upload(f.read(), IMG, mode=WriteMode('overwrite')) camera.start_recording(VID) GPIO.wait_for_edge(SENSOR, GPIO.FALLING) camera.stop_recording() camera.stop_preview() print("Gun Door Closed\n") time.sleep(DELAY) p=Pushetta(API_KEY) p.pushMessage(CHANNEL_NAME, "Gun Box Closed") finally: GPIO.cleanup() # ensures a clean exit