Module1. DoorWatcher - GachonCapstoneDesign/DoorWatcher GitHub Wiki

Summary:

Do Streaming for the scene taken by Raspberry Pi camera through Mobile application.

function

You can download the source code in github

  • Github. hyper-link to github repository

Streaming

Do streaming for the scene of the front door from Raspberry Pi camera on mobile application. Can watch the scene on real-time streaming.


Unsuspected_Person_Detection

Raspberry Pi starts counting when motion is detected while viewing the front door from the camera. If there is a change of motion and we actually go through the threshold, which is calculated after lots of tests to get, we are judged to be suspicious.


PushMessage

If it is judged to be a suspicious person, the Raspberry pie camera sends a message to the server. At this time, when the server receives the message, it sends PushMessage to the token number recorded in the server. It will be broadcast in the App and pop up to the user.


DefaultSetting

1. External network configuration

In order to access Raspberry Pi from external network, we set the IP address of Internet connected to Raspberry Pi to connect from external network. How to set up connection from external network is explained in detail by clicking URL below.

  • If you want to see an explanation, please click URL.

2. Run 'app.py' from the raspberry pi

When you run this file, Raspberry Pi will open its own web server. When an access request is made to the opened web server, the requestor displays index.html in the templates folder. It also displays the frame that the Raspberry pi camera module takes on index.html. The streaming is doing by the user to show the screen shot by the camera on the index.html. At this time, Access requests to the web streaming will reduce the load of Raspberry pi. Access to the web is addressed to:

[Raspberry Pi IP address]:5000

3. Enter the Android project and open 'StreamingActivity.java'

browser = (WebView) findViewById(R.id.webview1);
browser.getSettings().setJavaScriptEnabled(true);
browser.loadUrl("http:/192.168.0.12:5000/");

In the upper part, change the IP Address to your Raspberry IP Address. You can also set password and id after login activity. The default is `id:" ", pwd:" "`.

4. Turn on the application and check the streaming

If you run app.py from Raspberry Pie and install the project on your smartphone and run it, you can stream it.

5. Sets the path for the Push Message

Replace your server address with the address inside urlopen. (94 line)

 urllib2.urlopen("http://pesang72.cafe24.com/push/GCMSender.php").read()

and inside of 'GCMSender.php'

$devices = array() 

Put your Android token number in (). Upload 'GCMSender.php', 'GCMPushMessage.php' to your server. When you are done with this setting, you will receive a message if you detect someone suspicious at home.





[ 한글 위키 ]

Summary:

라즈베리파이의 카메라를 이용해서 스트리밍하는 장면을 스마트폰으로 스트리밍 합니다.

function

이 코드는 현재 깃허브에 올려놨습니다.

  • Github. 하이퍼링크를 클릭하시면 깃허브 페이지로 이동합니다.

Streaming

라즈베리파이 카메라를 통해서 현관문 앞의 상황을 스트리밍 합니다. 실시간으로 스트리밍 하는 장면을 스마트폰으로 지켜볼 수 있습니다.


Unsuspected_Person_Detection

라즈베리 파이 카메라에서 현관문을 보는 도중에 움직임이 감지되면 카운트를 세기 시작합니다. 계속되는 움직임의 변화가 있고 저희가 실제로 수 많은 테스트를 거쳐서 결정한 카운트를 넘어가면 수상한 사람이라고 판단하게 됩니다.


PushMessage

수상한 사람이라고 판단하게 되면 라즈베리파이 카메라에서 서버로 message를 보냅니다. 이때 서버에서 메시지를 받으면 서버에 기록해놓은 토큰번호로 ㅔㅔPushMessage를 보내게 됩니다. 이를 App에서 Broadcast 로 잡아내어 유저에게 팝업을 띄워줍니다.


DefaultSetting

1. 외부망 설정

외부망에서 라즈베리파이에 접근하기위해선 라즈베리파이에 연결된 인터넷의 IP address를 외부망에서 접속할 수 있게 설정해 놓습니다.
외부망에서 접속 가능하게 설정하는 방법은 아래 URL을 클릭하시면 자세하게 설명되어 있습니다.

  • 설명을 보고싶으시면 URL을 클릭해 주세요.

2.라즈베리파이에서 app.py 를 실행합니다.

이 파일을 실행하게되면 라즈베리파이 자체적으로 웹서버를 열게됩니다.
열어놓은 웹서버에 접근 요청이 오면 요청자에게 templates 폴더속의 index.html을 띄워줍니다.
또한 라즈베리파이 카메라 모듈이 찍는 frame을 index.html에 띄워줍니다. 계속해서 카메라 모듈에서 찍는 화면을 index.html에 띄워주는걸 유저가 봄으로써 스트리밍이 이루어집니다.
이때 웹에 Access 요청이 오면 스트리밍이 되므로 라즈베리파이의 부하를 줄여줍니다.
웹의 접근은 아래와 같은 주소로 접근합니다.

[라즈베리 파이 IP주소]:5000

3.Android project에 들어가서 StreamingActivity.java를 엽니다.

browser = (WebView) findViewById(R.id.webview1);
browser.getSettings().setJavaScriptEnabled(true);
browser.loadUrl("http:/192.168.0.12:5000/");

위 부분에 IP Address를 자신의 라즈베리파이 IP Address로 변경합니다.
또한 Login Activity에 들어가면 비밀번호와 아이뒤 설정을 할 수있습니다.
기본값으로 id : "", pwd : "" 으로 설정되어 있습니다.

4.어플리케이션을 켜고 스트리밍을 확인합니다.

라즈베리파이에서 app.py를 실행한 상태에서 프로젝트를 스마트폰에 설치하고 실행하게 스트리밍이 가능합니다.

5. Push Message를 위한 경로를 설정합니다.

자신의 서버주소를 urlopen안에 있는 주소에 대체합니다. (94 line)

 urllib2.urlopen("http://pesang72.cafe24.com/push/GCMSender.php").read()

그리고 GCMSender.php 안에서

$devices = array() 

()안에 자신의 안드로이드 토큰번호를 넣어 놓습니다.
자신의 서버에 GCMSender.php , GCMPushMessage.php 을 업로드 합니다.
이 설정을 마치면 집앞에서 수상한 사람이 감지되면 메시지를 받게 됩니다.

⚠️ **GitHub.com Fallback** ⚠️