Introduction: Home Security With Orange Pi
Essentially it is about the same idea like in my previous instructable:
The only change is use of Orange Pi board (my choice was PC2) and one 4050 level shifter to protect boards IOs.
To sum up - a cheap home security system that sends you emails with pictures of your possessions when someone visits your appartment unexpectedly. A system which is easily armed and disarmed the more conservative way than you could expect - a switch and a RFID tag. Sorry, I like it a lot ;-)
You can get an Orange Pi for 10$ , a USB camera maybe 2$ (actually I use two clumsy junk ones!), the rest maybe 30$ all together.
To be more specific about what you need - an OPi board, its power supply, 74HC4050 level shifter, one or more PIR motion sensor, a RFID reader, a momentary switch, two LEDs, 2x 220Ohm + 1x 10kOhm resistors, a breadboard and cables for connecting all together, and USB cameras of course.
Step 1: Wiring
My configuration and source code use 2 cameras with 2 PIR sensors. This pullup resistor for the switch is used because ... I didn't have time to look through pyA20 library docs, after a few days I accedentally found the right call (see README.txt in the directory which you are going to get with the GIT - see next step), so you may change the code and get rid of it. I use PC2 board but other Orange Pi boards have similar IOs. The 4050 level shifter is used bacause sensors and the RFID reader use 5V but the OPi board accepts 3V (or 3.3V if you like). Important - wire all "ground" signs to one of the boards GND! Do not forget to plugin your USB cameras ! :)
Step 2: Software
The sequence below will assume that you install Raspbian_desktop_lxde_For_PC2_H5_V0_1.img on your SD card. You may be advised to use Armbian instead but I have not tested it.
1) passwd - change the password of orangepi user, which is orangepi initially.
2) This Raspbian comes with chinese local, so put this to /etc/default/locale and reboot:
3) I extended the initial partition with fdisk /dev/mmcblk0 , reboot and resize2fs /dev/mmcblk0p2 . You will find some tutorials on that with Google.
4) sudo apt-get update
5) sudo apt-get install build-essential
6) sudo apt-get install python-setuptools
7) sudo apt-get install python-dev
8) sudo easy_install pip
9) sudo pip install pyserial
10) sudo pip install pyA20
11) sudo apt-get install git
12) git clone https://github.com/duxingkei33/orangepi_PC_gpio_p...
13) cd orangepi_PC_gpio_pyH3
14) sudo python setup.py install
15) get the code from (I will try to put it to the Github soon; I put it under GNU public, feel free to redistribute!):
I mean myzm-OPI-PC2-pyA20.py.
16) sudo python myzm-OPI-PC2-pyA20.py
Remember to change IO names if you use other board or wiring. If the green LED blinks each 10 seconds, then wiring and software is OK.
17) sudo apt-get install streamer
18) install postfix just as described here:
Step 3: Final Considerations
I have nearly forgotten - browse thru the code and find the following line:
if '?00020E7C0' in sl or '?F002CA226' in sl
you have to change these codes to your own RFID tags. I have two - for me and my wife ;-)
Attach the RFID tag to your keys and run:
sudo python myzm-OPI-PC2-pyA20.py
You may also use
nohup sudo python myzm-OPI-PC2-pyA20.py &
and logout from the terminal.
You can press the switch and go into the range of PIR sensor after 10 seconds. You should get a nice picture to you email box ;-)
See the initial Raspberry Pi tutorial for the different LED signals.
Next tutorial - using GSM module, maybe MMS instead of Postfix.
We have a be nice policy.
Please be positive and constructive.