CWatters
Posts: 8
Joined: Tue May 27, 2014 9:14 am

Degree of difficulty?

Tue May 27, 2014 9:41 am

Would be interested to know how difficult you think this project might be for a beginner. I can build hardware but have done very little programming. Just some Basic and assembler and that was 20 years ago!

Looking to set up a pi so that when an I/O port is triggered it issues an HTML command to a web site on the same network.

The I/O port would be connected to a PIR sensor and the web site would be located on a Synology NAS running Surveillance Station (SS). SS has the facility to be triggered by a script/HTML command in this way.

Does it sound like this is the sort of think a pi could do easily? I don't actually have one yet!

Thanks.

User avatar
topguy
Posts: 6169
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Degree of difficulty?

Tue May 27, 2014 11:31 am

So basically you want to add a motion sensor to a IP based surveillance camera that doesn't have such a sensor ?

Should be fairly easy. AdaFruit has the components and some tutorials you can follow.
https://learn.adafruit.com/adafruits-ra ... g-movement

CWatters
Posts: 8
Joined: Tue May 27, 2014 9:14 am

Re: Degree of difficulty?

Tue May 27, 2014 1:58 pm

So basically you want to add a motion sensor to a IP based surveillance camera that doesn't have such a sensor ?
Yes exactly. I'll have a look at the link you posted. Thanks.

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Degree of difficulty?

Tue May 27, 2014 2:24 pm

I think you are describing in adult terms what the Raspberry Pi Foundation call a Parent Detector, and they have a project written up in very basic terms here -

http://www.raspberrypi.org/learning/parent-detector/


That description is based around their own Raspberry Pi camera module, but I hope you will be able to see how to modify it to use the webcam provided by the NAS.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

CWatters
Posts: 8
Joined: Tue May 27, 2014 9:14 am

Re: Degree of difficulty?

Tue May 27, 2014 4:40 pm

Thanks but that's not quite what I want to do.

I have a Synology NAS using Surveillance Station to turn it into an NVR with 5 IP cameras. I'd like to be able start recording in response to a hardware trigger (eg when a PIR device or my burglar alarm is triggered).

It looks like I can trigger recording using a simple PHP script running on a web site hosted on the NAS. So I think the issue is how to get a pi to "browse" the website on the NAS and so trigger the scripts?

I suppose there are probably better (more professional) ways but this looks the simplest?

CWatters
Posts: 8
Joined: Tue May 27, 2014 9:14 am

Re: Degree of difficulty?

Tue May 27, 2014 4:44 pm

Oops sorry I missed this line..
That description is based around their own Raspberry Pi camera module, but I hope you will be able to see how to modify it to use the webcam provided by the NAS.
Yes that is what I want to do. The hardware part is easy for me it's how to get the pi to brows the web server on the NAS I can't find info on.

CWatters
Posts: 8
Joined: Tue May 27, 2014 9:14 am

Re: Degree of difficulty?

Tue May 27, 2014 4:47 pm

I guess I'd need a browser on the pi...
http://www.makeuseof.com/tag/how-to-cho ... i-browser/

Then perhaps another script running on the pi that gets the browser to access the web server.

CWatters
Posts: 8
Joined: Tue May 27, 2014 9:14 am

Re: Degree of difficulty?

Tue May 27, 2014 4:55 pm

but then I think I need an extension to PHP to allow it to access pi hardware :-(

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Degree of difficulty?

Tue May 27, 2014 5:02 pm

CWatters wrote:it's how to get the pi to brows the web server on the NAS I can't find info on.
Right, I think we're homing in on this...

Surely you won't need to 'browse' in the sense of looking at pages and making intelligent decisions about what to do next? My guess is that the server will have a particular weblink or url that you retrieve, or send a message to, in order to trigger recording? (I've had a quick look at the Synology site here but I can't see details of the web interface.)

If I'm right then programming this sort of simple interaction is relatively simple using pre-written libraries or modules for the common languages you might want to use on your RPi including C, Python and Ruby. httplib2 for python is an example.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

CWatters
Posts: 8
Joined: Tue May 27, 2014 9:14 am

Re: Degree of difficulty?

Tue May 27, 2014 5:33 pm

Surely you won't need to 'browse' in the sense of looking at pages and making intelligent decisions about what to do next? My guess is that the server will have a particular weblink or url that you retrieve, or send a message to, in order to trigger recording?
Yes that's right you just need to "touch" a url not browse it and analyse the page. I found some details here...

https://community.zipato.com/responses/ ... est-method

However you need to drill down the thread to get to a solution that actually works.

In short the method that works just requires you to touch the web page in the NAS and a PHP script on the NAS does something like..

$response = get_web_page("http://[IP_NAS_Synology]:5000/webapi/SurveillanceStation/extrecord.cgi?api=SYNO.SurveillanceStation.ExternalRecording&method=Record&version=1&cameraId=2&action=start&_sid=".$sid[sid]);

although there is a bit more to it.

CWatters
Posts: 8
Joined: Tue May 27, 2014 9:14 am

Re: Degree of difficulty?

Tue May 27, 2014 5:41 pm

Code: Select all

If I'm right then programming this sort of simple interaction is relatively simple using pre-written libraries or modules for the common languages you might want to use on your RPi including C, Python and Ruby. httplib2 for python is an example.
Ok right so I could use that lib to do a simple page retrieval (discarding the result), that would trigger the PHP script on the server and that would start recording.

It's beginning to look like even I could do this. Thanks.

Return to “Beginners”