I made a homemade safe.

Web server also on it:

Intructions

1. Hardware:

First, buy a raspberry pi($35), an Adafruit CharLCD plate, an electric lock,an NPN transistor and an adapter, that has both 12V and 5V output. Then build a case(could be wood, like mine or anything you want.) For setting up the raspberry pi see this tutorial. Enabling vnc and ssh is also helpful.

2. Building it:

First, buy a raspberry pi($35), an Adafruit CharLCD plate, an electric lock,an NPN transistor and an adapter, that has both 12V and 5V output. Then build a case(could be wood, like mine or anything you want.) For setting up the raspberry pi see this tutorial. Enabling vnc and ssh is also helpful.

3. Wiring:

Connect the wires as shown. You can connect the NPN to another pin, but then you will need to change the code.

4. Software:

Configure the Adafruit CharLCD plate using this tutorial. Download the safe.py and the code.txt file and paste it in /home/pi/safe (you can put it anywhere, but then you will need to change the code.) Run it. It work’s! Button up and down change the value of the digits, and the left and right set’s what digit to change. And it start’s to display the time if it’s inactive for 2 minutes. To start it every time on startup edit the /etc/rc.local and type sudo python /path/to/safe.py/file before the ‘exit0’.

If you want also web server on it intall the apache2 web server and configure python script running using this tutorial. Paste this file in /var/www/html. Download the safeweb.py file and paste it in /usr/lib/cgi-bin. Make it executable, so type in the terminal window sudo chmod +x/usr/lib/cgi-bin/swafeweb.py. Restart the web server using sudo service apache2 restart. Make the code.txt writeable by anyone, so code.txt →right click →Properties →Permissions →Change content →Anyone. Reboot rpi. Enter the raspberry pi’s IP adress in your browser. Login with password ‘mypassword’. It should now go to a page like the 2. image. You can change the password by editing the safeweb.py at the 11. line.