MoMatt
Posts: 2
Joined: Fri Aug 19, 2016 6:22 pm

Re: RPi Cam Web Interface

Mon Aug 22, 2016 11:48 am

btidey wrote: There would only be conflict between the js files if you have used function names that are already used.

When developing code it is helpful to enable php error reporting at the server as then if you have coding errors then the browser will give you line numbers and errors when they occur. There is a setting to enable this. I think it is in /etc/php5/apache2/php.ini and you would need to restart apache2

I suspect it may be easier to add on to the existing js. Follow the model used for the the buttons controlling the pan/tilt controls
Thanks btidey, I have turned on error reporting and it's definitely an easy way to see what's going on in the code. My initial fix was to just have separate webpages for the camera and GPIO control (it operates my garage door). This way, I can easily see the camera remotely while having the control page on a different port which is blocked at my router, so it's impossible for me (or anyone else) to control the door remotely.
nospam wrote:
I had the same idea to use GPIO to toggle a "PiFace Digital" relay output to operate a window defog heater and fan for one of my outdoor camera enclosures. For electrical safety the PiFace relay just provides an electrically isolated contact input to an independent fused timer relay which handles the high voltage end of things.

I added a button called "defog window" in index.php that launches sys_defog(); in script.js which sends the GPIO command "cmd_func.php?cmd=defog". I am attaching the excerpts from my code in each of the three scripts.

index.php

Code: Select all

      <div id="secondary-buttons" class="container-fluid text-center" <?php echo $displayStyle; ?> >
         <?php pan_controls(); ?>
         <a href="preview.php" class="btn btn-default">Download Videos and Images</a>
           
         <?php  if($config['motion_external']): ?><a href="motion.php" class="btn btn-default">Edit motion settings</a>  <?php endif; ?>
         <a href="schedule.php" class="btn btn-default">Edit schedule settings</a>
//my code starts here
         <input id="defog window" type="button" class="btn btn-danger" value="defog window" onclick="sys_defog();">
//my code ends here
      </div>
script.js

Code: Select all

//
// Shutdown
//
function sys_shutdown() {
  ajax_status.open("GET", "cmd_func.php?cmd=shutdown", true);
  ajax_status.send();
}

function sys_reboot() {
  ajax_status.open("GET", "cmd_func.php?cmd=reboot", true);
  ajax_status.send();
}
//my code starts here
function sys_defog() {
  ajax_status.open("GET", "cmd_func.php?cmd=defog", true);
  ajax_status.send();
//my code ends here
}
cmd_func.php

Code: Select all

<?php
  define('BASE_DIR', dirname(__FILE__));
  require_once(BASE_DIR.'/config.php');

  function sys_cmd($cmd) {
    if(strncmp($cmd, "reboot", strlen("reboot")) == 0) {
      shell_exec('sudo shutdown -r now');
    } else if(strncmp($cmd, "shutdown", strlen("shutdown")) == 0) {
      shell_exec('sudo shutdown -h now');
//my code starts here
   } else if(strncmp($cmd, "defog", strlen("defog")) == 0) {
          //do stuff here to defog window using piface digital
      shell_exec('gpio -p write 200 1');
      sleep(2);
      shell_exec('gpio -p write 200 0');
//my code ends here
    } else {
      // unknown
    }
  }


  if(isset($_GET['cmd'])) {
    $cmd=$_GET['cmd'];
    sys_cmd($cmd);
  }

?>
Wow, that's incredibly helpful. Thanks for posting this! And thanks for such a simple explanation, I was having trouble grasping the flow of what I want to do. So, "interact with webpage, which uses js to call some php, which will write the GPIO".

nospam
Posts: 54
Joined: Sun Jun 14, 2015 10:38 pm

Re: RPi Cam Web Interface

Tue Aug 23, 2016 1:47 pm

quavoce wrote:How to set up Push Notifications when motion is detected
I've had this running for a week and it works really well and is quick! For iPhone, Android, and Desktop!
There is a £3.99 lifetime license (per platform) after the 7-day trial, but well worth it for the price.
For anyone looking for a free cross platform push messaging service that also works with Windows/OSX/Linux/Android/iOS try http://www.telegram.org

No affiliation - I found it looking for a free SMS option and it works for me. The only gotcha I am unhappy with is that the Android version will steal your Contacts List and upload it somewhere. Android M, OSX and iOS lets you block access to your contacts list.

L_i_v_e
Posts: 32
Joined: Sun Nov 29, 2015 3:51 pm

Re: RPi Cam Web Interface

Tue Aug 23, 2016 7:02 pm

btidey wrote:
L_i_v_e wrote:Hi, i have an issue with my cam interface. As long as i change parameters, as long as i reinstall it, i still can't have a maximum quality stream, i'm stucked with low preview quality (Preview quality (1...100) Default 10:
Width (128...1024) Default 512:
Divider (1-16) Default 1:

Those value are not changing, and since i need only a good preview it's an issue, any help? Is there any file i can edit?
Default settings for the preview are in /etc/raspimjpeg and you can change width, quality and divider there if you want to change the defaults.

The settings under camera settings override these and changes are stored in uconfig in the web folder. I have just changed my width OK and it took immediate effect.

If you are not seeing those values change then check the scheduler log which should record changes. If they are not changing then maybe something is wrong with permissions. Are other settings changing OK?
I DON'T HAVE THE FOLDER O.o

Sometimes they work, sometimes when i press ok the strem freeze and i must restart the pi but still i can't have the desired changes. I reinstalled rpi cam control 3 times now, always the same (full uinstall).
The point is that i open the camera in another raspberry with chromium command line to stream the video feed. Currently i use http://192.168.0.101/html/cam_pic_new.php to have it without all the other stuffs, but i have not a max quality picture, it takes only 1/4 of the whole space, so it's messy. I need to have it bigger at the source.

quavoce
Posts: 109
Joined: Fri Nov 27, 2015 9:11 am

Re: RPi Cam Web Interface

Wed Aug 24, 2016 9:02 pm

nospam wrote:
quavoce wrote:How to set up Push Notifications when motion is detected
I've had this running for a week and it works really well and is quick! For iPhone, Android, and Desktop!
There is a £3.99 lifetime license (per platform) after the 7-day trial, but well worth it for the price.
For anyone looking for a free cross platform push messaging service that also works with Windows/OSX/Linux/Android/iOS try http://www.telegram.org

No affiliation - I found it looking for a free SMS option and it works for me. The only gotcha I am unhappy with is that the Android version will steal your Contacts List and upload it somewhere. Android M, OSX and iOS lets you block access to your contacts list.
Ahh, nice one! I'll give that a go too! I just found out about Pushover whilst testing Raspi_runner. I should have looked around more, but it seems to work well enough (and I suppose not copying my address book is a bonus!) :)

btidey
Posts: 1623
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Thu Aug 25, 2016 10:28 am

L_i_v_e wrote:
I DON'T HAVE THE FOLDER O.o

Sometimes they work, sometimes when i press ok the strem freeze and i must restart the pi but still i can't have the desired changes. I reinstalled rpi cam control 3 times now, always the same (full uinstall).
The point is that i open the camera in another raspberry with chromium command line to stream the video feed. Currently i use http://192.168.0.101/html/cam_pic_new.php to have it without all the other stuffs, but i have not a max quality picture, it takes only 1/4 of the whole space, so it's messy. I need to have it bigger at the source.
I don't understand the folder O.o reference. uconfig will be stored in /var/www/html. It only exists if some settings have been changed from their defaults but it can also be manually created.

First check it from a browser on another platform (PC / Mac) to make usre you are not having browser issues.

You can also use the new min.php which had been added to recent versions to give a minimal interface. You can put the width, quality, divider settings in uconfig or /etc/raspimjpeg manually instead of using the web control interface.

For example edit the width setting to

Code: Select all

width 1024
into the /etc/raspimjpeg and restart the camera system.

noxx
Posts: 17
Joined: Fri Oct 25, 2013 8:13 pm

Re: RPi Cam Web Interface

Sun Aug 28, 2016 2:05 pm

is it possible to set a autostart for motion detection? if i make a restart of my pi, the
motion detection is allways off....

spex357
Posts: 29
Joined: Fri Jan 10, 2014 5:15 pm

Re: RPi Cam Web Interface

Mon Aug 29, 2016 11:37 am

Hi all
A fresh install of pipan, checked pan & tilt. Installed RPi_Cam. Created pipe and pipan_pipe, rebooted, pan and tilt buttons on show but no action from them. Renamed pipan on to off and back again with no joy.
A fresh install of RPi_Cam, up and running no problem. Installed pipan, checked pan and tilt, created pipan_pipe and Fifo, rebooted, pan and tilt buttons on show but no action. Checked both in developer mode and can see the requests go through from the button press but no action on the pins.
Everything has been on default all the way through, pi2 model b,

btidey
Posts: 1623
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Tue Aug 30, 2016 10:04 am

noxx wrote:is it possible to set a autostart for motion detection? if i make a restart of my pi, the
motion detection is allways off....
Easiest way is to put a md 1 command in all relevant period start in the scheduler set up. E.g. if all day mode then putting md 1 in the one and only period dtat will start with motion detection on

You can also put motion_detection true in /etc/raspimjpeg but I prefer the scheduler mechanism as it gives greater flexibility.

btidey
Posts: 1623
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Tue Aug 30, 2016 10:14 am

spex357 wrote:Hi all
A fresh install of pipan, checked pan & tilt. Installed RPi_Cam. Created pipe and pipan_pipe, rebooted, pan and tilt buttons on show but no action from them. Renamed pipan on to off and back again with no joy.
A fresh install of RPi_Cam, up and running no problem. Installed pipan, checked pan and tilt, created pipan_pipe and Fifo, rebooted, pan and tilt buttons on show but no action. Checked both in developer mode and can see the requests go through from the button press but no action on the pins.
Everything has been on default all the way through, pi2 model b,
pipan integration uses a pipe called FIFO_pipan in the web install folder. It needs to have the permission set up as per the wiki instructions. You should be able to manually test by sending commands into the pipe using echo commands. (servo $pan $tilt) The pan and tilt values are also written to a file called pipan_bak.txt so you should see this being updated with new values.

pforpianist
Posts: 12
Joined: Fri Sep 02, 2016 4:13 am

Re: RPi Cam Web Interface

Fri Sep 02, 2016 4:23 am

Hi,

Firstly, I'm having lots of fun with Rpi and the cam interface.

Good quality picture and running on chrome on a cell phone, and web browser.

when i found out it runs on apache that's familiar ground.

I'm wanting to use the camera on an android app using a WebView element. It was working with motion, however when trying to display the video feed it is perpetually "Loading"

Seeing that the issue was specifically related to RPi Cam and the android app, I decided to come here to see if there was any solutions posted.
Thanks for the tip about apache php logs. I don't think the php is the problem, since it's working on web browser, just not in the WebView element.

Anyone experienced this problem?

quavoce
Posts: 109
Joined: Fri Nov 27, 2015 9:11 am

Re: RPi Cam Web Interface

Fri Sep 02, 2016 1:05 pm

I'm looking to create a low resolution mp4 video alongside the main high-res one so that I can stream motion-detected videos via my low-bandwidth mobile phone (I'm having trouble streaming the video to my iPhone over 3G).

I realise that I could use end_vid.sh within the macro folder to post-process the mp4 file, but I wondered if there's a better way? For example, is there a way to stop the .h264 file from being deleted and create a low res video from that source instead? I guess that MP4Box just puts an mp4 container around the original .h264 file, so am I right in saying this wouldn't be able to lower to resolution?

I realise it's more of a task to have these low res videos appear on the web page, but my idea is to use them via the push message notifications from my previous post by creating a custom URL.

Thanks!

spex357
Posts: 29
Joined: Fri Jan 10, 2014 5:15 pm

Re: RPi Cam Web Interface

Sat Sep 03, 2016 9:45 am

btidey wrote:
spex357 wrote:Hi all
A fresh install of pipan, checked pan & tilt. Installed RPi_Cam. Created pipe and pipan_pipe, rebooted, pan and tilt buttons on show but no action from them. Renamed pipan on to off and back again with no joy.
A fresh install of RPi_Cam, up and running no problem. Installed pipan, checked pan and tilt, created pipan_pipe and Fifo, rebooted, pan and tilt buttons on show but no action. Checked both in developer mode and can see the requests go through from the button press but no action on the pins.
Everything has been on default all the way through, pi2 model b,
pipan integration uses a pipe called FIFO_pipan in the web install folder. It needs to have the permission set up as per the wiki instructions. You should be able to manually test by sending commands into the pipe using echo commands. (servo $pan $tilt) The pan and tilt values are also written to a file called pipan_bak.txt so you should see this being updated with new values.

Thanks for the reply. I knew I'd done my permissions correctly, the odd thing was I had reproduced the problem three if not four times over the weekend, initially on a Pi3 install, which I thought had Servoblaster problems (perhaps not). I left it alone all week, logged in here, read your reply, it was while I was sending echo requests to the pipe, (not something I normally get up to on a Saturday morning), that the lightbulb came on. A quick look in pipan_pipe.py and html was missing out of the address.
Rebooted and all is well.

kallasur
Posts: 82
Joined: Mon Dec 07, 2015 7:25 am

Re: RPi Cam Web Interface

Sun Sep 04, 2016 4:15 pm

Hi

Im trying to do the simple preview ie "Simple live-preview only page" but how do I create the PIPE ... I can see section "Pan-Tilt or Pi-Light" but how do I create the FIFO files and how do I open the FIFO files to see whats in it - Leaf cannot open it.

I Kind of understand how the streaming is working but I just seem to be lost with the PIPEs and FIFO files.
Could anyone please help me with PIPing and how to do it and whats in the FIFO files.

Regards
Kallasur

doughadfield
Posts: 41
Joined: Fri Dec 21, 2012 5:27 pm

RPi Cam Web Interface HDMI output

Sun Sep 04, 2016 9:43 pm

Hi, is there a way to get the camera video to display on the HDMI output (direct hardware output to screen) as well as web streaming? I'm not interested in motion detection, so if the preview stream is being redirected somehow to the motion subsystem, that can be disabled in this mode. How would I go about customising the environment to enable HDMI output?

thanks

Doug

kallasur
Posts: 82
Joined: Mon Dec 07, 2015 7:25 am

Re: RPi Cam Web Interface

Sun Sep 04, 2016 10:38 pm

Hi

I only want to get a live stream to my Apache server. Which are the scripts I need to view this.

Gary Littlemore
Posts: 327
Joined: Thu Oct 11, 2012 11:52 am
Location: Cheshire, UK

Re: RPi Cam Web Interface

Tue Sep 06, 2016 11:52 am

kallasur wrote:Hi

Im trying to do the simple preview ie "Simple live-preview only page" but how do I create the PIPE ... I can see section "Pan-Tilt or Pi-Light" but how do I create the FIFO files and how do I open the FIFO files to see whats in it - Leaf cannot open it.

I Kind of understand how the streaming is working but I just seem to be lost with the PIPEs and FIFO files.
Could anyone please help me with PIPing and how to do it and whats in the FIFO files.

Regards
Kallasur
There is now a min.php page which just shows the preview youripaddress:port/min.php
3b+, 2b, b+, b, Zero & Zero-W

kallasur
Posts: 82
Joined: Mon Dec 07, 2015 7:25 am

Re: RPi Cam Web Interface

Wed Sep 07, 2016 12:04 pm

Thanks Gary Littlemore

Do I just run the min.php ... do I need anything else with that? Other scripts, Settings, Permissions, Softwares to be installed?

kallasur
Posts: 82
Joined: Mon Dec 07, 2015 7:25 am

Re: RPi Cam Web Interface

Wed Sep 07, 2016 12:56 pm

I had the min.php, script_min.js, cam_pic.php in the location var/www where my Appache server runs from but no luck. The video is not presented.

Do I need certain permissions to be added to the etc/sudoer file? or is there something more ...

noxx
Posts: 17
Joined: Fri Oct 25, 2013 8:13 pm

Re: RPi Cam Web Interface

Fri Sep 09, 2016 3:02 pm

some RPI crashed, in the LOG i found

{2016/09/09 08:31:32} DEBUG 2: 2, 6
{2016/09/09 08:31:32} Error: Error in iframe list
{2016/09/09 08:31:32} DEBUG 2: 3, 6
{2016/09/09 08:31:32} Error: Error in iframe list
{2016/09/09 08:31:32} DEBUG 2: 4, 6
{2016/09/09 08:31:32} Error: Error in iframe list
{2016/09/09 08:31:32} DEBUG 2: 5, 6
{2016/09/09 08:31:32} Error: Error in iframe list

what mean this?

and, how can i check the state of RPI via ssh?

Code: Select all

sudo service RPi Cam Web Interface status
dont work

nospam
Posts: 54
Joined: Sun Jun 14, 2015 10:38 pm

Re: RPi Cam Web Interface

Mon Sep 12, 2016 1:54 pm

I use a script to restart the motion service if motion crashes and use cron to keep checking periodically. You can manually check the file '/dev/shm/mjpeg/status_mjpeg.txt' if the word 'Error' is present

Code: Select all

#!/bin/bash
set -x
MYWORD="Error"
FILENAME='/dev/shm/mjpeg/status_mjpeg.txt'
if fgrep -c $MYWORD $FILENAME ; then
echo "MOTION CRASHED FORCE RESTART"
RESET=$(sudo service motion restart)
else
echo "MOTION OK"
fi
exit

Gary Littlemore
Posts: 327
Joined: Thu Oct 11, 2012 11:52 am
Location: Cheshire, UK

Re: RPi Cam Web Interface

Tue Sep 13, 2016 11:49 am

kallasur wrote:I had the min.php, script_min.js, cam_pic.php in the location var/www where my Appache server runs from but no luck. The video is not presented.

Do I need certain permissions to be added to the etc/sudoer file? or is there something more ...
I just view my min.php file in the same way as viewing the index.php file http://myipaddress:portnumber/min.php
3b+, 2b, b+, b, Zero & Zero-W

kallasur
Posts: 82
Joined: Mon Dec 07, 2015 7:25 am

Re: RPi Cam Web Interface

Wed Sep 14, 2016 8:43 am

Hi there Mr Gary Littlemore

The page loads but the video is not seen. It has a little Broken Image Icon thingy on the top middle of the screen.

Gary Littlemore
Posts: 327
Joined: Thu Oct 11, 2012 11:52 am
Location: Cheshire, UK

Re: RPi Cam Web Interface

Fri Sep 16, 2016 2:42 pm

kallasur wrote:Hi there Mr Gary Littlemore

The page loads but the video is not seen. It has a little Broken Image Icon thingy on the top middle of the screen.
Does the http://myipaddress:portnumber/index.php page work?
3b+, 2b, b+, b, Zero & Zero-W

kallasur
Posts: 82
Joined: Mon Dec 07, 2015 7:25 am

Re: RPi Cam Web Interface

Fri Sep 16, 2016 5:09 pm

Im trying to run only the min.php, its works fine if all other scripts are there like FIFO, the javascript files etc, if one is missing then it doesnt work. Im trying to figure out how this code works and what actually allows the video to be displayed.

bergymen
Posts: 5
Joined: Wed Oct 01, 2014 1:26 am

Re: RPi Cam Web Interface

Sat Sep 17, 2016 7:21 pm

Hi,
I love the project and I've been using it for a while.
It would be awesome if the html and styling could be adapted to be better on mobile devices like android phones.
Thanks

Return to “Camera board”