billw
Posts: 404
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Aug 08, 2016 12:17 am

jbeale wrote:

Code: Select all

daily 14:49  "@brightness 50"
That should be working, it is for me. But there's no logging for those camera
parameter commands. I'll have to go back and see why that's so.

After doing it for a set time like your command above, I changed the at-command to

Code: Select all

daily minute  "@brightness 50"
and after each minute change did an echo brightness 30 > FIFO
The brightness change happens for me each time, so for now I'm not sure.
Do you see in the log file that the at-command is loaded?

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Aug 08, 2016 12:49 am

You are right, it is actually working! I thought it wasn't because I was just checking the log file, instead of actually watching the video.

At first I couldn't get the motion alarm to work, but I'd been blindly copy-and-pasting; had not noticed the comment in the script says to add

Code: Select all

on_motion_begin $C/motion_send_alarm
to the .pikrellcam/pikrellcam.conf file, but I had just cropped down the filename from /home/pi/pikrellcam/scripts-dist/example-motion-send-alarm1 without noticing those are dashes and not underscores! So the basic alarm broadcast system is working as well, a very cool feature.

billw
Posts: 404
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Aug 08, 2016 1:04 pm

jbeale wrote:

Code: Select all

on_motion_begin $C/motion_send_alarm
Thanks, '-' and '_' always gives me problems. I fixed those typos and added a pkc-recv script
you can run in a terminal for debugging. It listens and prints all network traffic on the pikrellcam
multicast group. It's simple, just this:

Code: Select all

#!/usr/bin/env python

# Listen for traffic on the PiKrellCam multicast group and print all lines.
# Run this in a terminal for debugging multicast traffic.

import socket
import struct

PKC_MULTICAST_GROUP_IP = '225.0.0.55'
PKC_MULTICAST_GROUP_PORT = 22555

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind((PKC_MULTICAST_GROUP_IP, PKC_MULTICAST_GROUP_PORT))
mreq = struct.pack("4sl", socket.inet_aton(PKC_MULTICAST_GROUP_IP), socket.INADDR_ANY)

sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)

while True:
	print sock.recv(1024)

tomtgrp
Posts: 41
Joined: Thu Jul 09, 2015 8:35 am

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 11, 2016 10:12 am

billw wrote:PKC 3.1.0 has some upgrades.

1) A Multicast interface for communication and control between all PKCs and
desktops running on your LAN.

....

Hello,

great improvement, but: where can I disable this Multicast listening feature ?
I have cameras in a big inhouse network with hundreds of users and it is a security break if anybody there
can disable motion or do other things w/o authentication.

Br
Tom

billw
Posts: 404
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 11, 2016 2:32 pm

tomtgrp wrote:great improvement, but: where can I disable this Multicast listening feature ?
There's now a multicast_enable option in pikrellcam.conf

rpiatf2f10
Posts: 27
Joined: Sat Apr 23, 2016 10:16 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Aug 14, 2016 6:24 pm

HI Jbeale,

I tried leveraging your script to keep disk with at least some free by deleting old ones. However, it seems that my 30G card filled up after my trip.
The calendar archive function seems working fine.

Do you have any thoughts whether I got your script implemented correctly?
Thanks

[email protected]:~ $ crontab -l
15 * * * * sudo -u pi /home/pi/pikrellcam/scripts/pk-archive 2>&1 | /usr/bin/logger -t PK-Archive

[email protected]:~ $ cat /home/pi/pikrellcam/scripts/pk-archive
#!/bin/bash

_ARCHIVE_OLDER_DAYS="-1 Days" # how many days old for media before archiving
_VOLUME="/dev/sda1" # volume to check for disk space usage
#_VOLUME="/dev/root" # volume to check for disk space usage
_USED_SPACE_LIMIT=85 # percent disk space used over which files are deleted

echo "archive_still day `date --date="$_ARCHIVE_OLDER_DAYS" +'%F'`"
# Move _ARCHIVE_OLDER_DAYS stills and video to that date's archive folder
echo "archive_still day `date --date="$_ARCHIVE_OLDER_DAYS" +'%F'`" > /home/pi/pikrellcam/www/FIFO
echo "archive_video day `date --date="$_ARCHIVE_OLDER_DAYS" +'%F'`" > /home/pi/pikrellcam/www/FIFO

# if used space is over threshold, delete old files and directories to save storage space until threshold reached
# this keeps as much as possible files present
_USED_SPACE=`df | grep $_VOLUME | awk '{print $5}' | sed -e "s/\%//g"`
# echo "used space: $_USED_SPACE%"


if [[ ( "$_USED_SPACE" > "$_USED_SPACE_LIMIT" ) ]] ; then
echo -e "used space over $_USED_SPACE_LIMIT%, deleting old files..."

_LOOP=0;

while [[ ( "$_USED_SPACE" > "$_USED_SPACE_LIMIT" ) && ( "$_LOOP" < "100" ) ]] ; do
_OLDEST=`find /home/pi/pikrellcam/media/archive/ -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d "+" -f 1 | sed -e "s/\-/\//g"`
echo "oldest files:$_OLDEST"

echo "delete oldest folder:/home/pi/pikrellcam/media/archive/$_OLDEST"
rm -rfv "/home/pi/pikrellcam/media/archive/$_OLDEST"
sync

_USED_SPACE=`df | grep $_VOLUME | awk '{print $5}' | sed -e "s/\%//g"`
echo "used space now: $_USED_SPACE%"
_LOOP=$((_LOOP + 1))
done

echo "done"
df
else
echo -e "used space below $_USED_SPACE_LIMIT%, nothing to do!"
fi

[email protected]:~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 28.9G 0 disk
└─sda1 8:1 1 28.9G 0 part /home/pi/pikrellcam/media
mmcblk0 179:0 0 7.4G 0 disk
├─mmcblk0p1 179:1 0 60M 0 part /boot
└─mmcblk0p2 179:2 0 7.3G 0 part /

[email protected]:~ $ ls -la /home/pi/pikrellcam/scripts
total 56
drwxr-xr-x 2 pi pi 4096 Aug 13 21:12 .
drwxr-xr-x 10 pi pi 4096 Aug 13 21:11 ..
-rwxr-xr-x 1 pi pi 1665 Apr 16 19:05 ds18b20.py
-rwxr-xr-x 1 pi pi 1463 Aug 13 21:12 example-motion-send-alarm1
-rwxr-xr-x 1 pi pi 3287 Aug 13 21:12 example-motion-send-alarm2
-rwxr-xr-x 1 pi pi 2335 Apr 30 18:03 motion-end
-rwxr-xr-x 1 pi pi 1800 Jul 14 20:07 pk-archive
-rwxr-xr-x 1 pi pi 2692 Aug 13 21:12 pkc-alarm
-rwxr-xr-x 1 pi pi 1757 Aug 13 21:12 pkc-motion
-rwxr-xr-x 1 pi pi 2093 Aug 13 21:12 pkc-reboot
-rwxr-xr-x 1 pi pi 647 Aug 13 21:12 pkc-recv
-rwxr-xr-x 1 pi pi 1827 Apr 23 12:47 preview-save
-rw-r--r-- 1 pi pi 436 Apr 16 19:05 Readme
-rwxr-xr-x 1 pi pi 1719 Jun 22 12:29 startup
Attachments
test.png
test.png (29.7 KiB) Viewed 5080 times

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Aug 16, 2016 7:11 pm

Does the log file contain anything useful? If you run the script /home/pi/pikrellcam/scripts/pk-archive manually, what does it say?

punacmc
Posts: 31
Joined: Tue Nov 19, 2013 4:07 am

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Aug 19, 2016 2:37 am

I could use some assistance. I would like to use the at-command.conf to adjust the camera, picture, and exposure settings at sunrise and sunset. I have examined this file and the help file, but I do not see a list of possible commands that can be used. Are the commands the same as the labels in the OSD? With the sunrise and sunset, other than the Lat. and Long. in the config file, is there anything else that needs to be done? Perhaps I am overthinking all of this...

User avatar
Gavinmc42
Posts: 4069
Joined: Wed Aug 28, 2013 3:31 am

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Aug 19, 2016 3:09 am

Finally got around to getting WiFi working on a Zero.
Pikrellcam works fine, even updated to the new release no problem over WiFi:P
Looks like I have two more cameras to install now if I can figure out remote powering.

Using Jessie Lite, what large apps are not needed, that can be uninstalled to save space?

The Zero has test points that can be used for soldering USB WiFi and Power to it.
http://hackaday.com/2015/11/28/first-ra ... back-wifi/
This allows the Zero to be installed inside alloy fence posts etc

Has anyone tried solar powering?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

mosespi
Posts: 508
Joined: Mon May 12, 2014 3:35 pm
Location: 34,-118
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Aug 19, 2016 5:21 am

I have yet to get a Zero.. but I have a Pi 2B on solar with a camera and wifi. Runs around 3 watts. I have a 20 watt solar panel with a 7ah (84wh) battery and in the California sun I get 24 hour operation on good days, but just barely. Summer seems a bit better now and it hits 24 hours most days. Details on the setup can be found here..

http://www.allspectrum.com/mopower/sola ... solar.html

I don't know how much a Zero with wifi and camera would run, but I'm guessing at least half of that (1.5 watts?), which means my setup/numbers should provide a good amount of reserve.

Solar is too variable in most places.. so it all depends on how much reserve you want. You can overbuild/overpower and get 99.9% runtime or build a 'reasonable' setup and maybe get 95-99%?

Regards,
-Moses
Power problems? MoPower UPS for the Pi
http://www.allspectrum.com/mopower/

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Aug 21, 2016 1:13 am

mosespi wrote:I have yet to get a Zero.. but I have a Pi 2B on solar with a camera and wifi. Runs around 3 watts. I have a 20 watt solar panel with a 7ah (84wh) battery and in the California sun I get 24 hour operation on good days, but just barely. Summer seems a bit better now and it hits 24 hours most days. Details on the setup can be found here.. http://www.allspectrum.com/mopower/sola ... solar.html
If you run your battery down to the 11.8 V cutoff every night/morning, doesn't that reduce the life of the battery quite a bit?

mosespi
Posts: 508
Joined: Mon May 12, 2014 3:35 pm
Location: 34,-118
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Aug 21, 2016 2:33 am

jbeale wrote:
mosespi wrote:I have yet to get a Zero.. but I have a Pi 2B on solar with a camera and wifi. Runs around 3 watts. I have a 20 watt solar panel with a 7ah (84wh) battery and in the California sun I get 24 hour operation on good days, but just barely. Summer seems a bit better now and it hits 24 hours most days. Details on the setup can be found here.. http://www.allspectrum.com/mopower/sola ... solar.html
If you run your battery down to the 11.8 V cutoff every night/morning, doesn't that reduce the life of the battery quite a bit?
Indeed, that is pretty much a 100% discharge. I would expect it to last about a year or so. It was more of a demonstration then something I really needed at the moment.. proof of concept really.

I could double up on the battery capacity, then my discharge would be about 50% (most of the time anyway). It would prolong the life of the battery and buy me more reserve, but of course it's more expensive.

A full discharge is not the best, but I say use it if you need it, it's a wear item anyway.

Regards,
-Moses
Power problems? MoPower UPS for the Pi
http://www.allspectrum.com/mopower/

rpiatf2f10
Posts: 27
Joined: Sat Apr 23, 2016 10:16 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Aug 22, 2016 7:15 pm

HI Jbeale,

I deleted some of videos and now, when I issued command,
[email protected]:~ $ /home/pi/pikrellcam/scripts/pk-archive
archive_still day 2016-08-21
used space below 85%, nothing to do!

What other command are there that I may use to check other logs? Is the script I pased ok?
thanks.

rpiatf2f10
Posts: 27
Joined: Sat Apr 23, 2016 10:16 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Aug 22, 2016 7:16 pm

HI Billw,

Hope that this Jbeable's archive script could be integrated into future versions......tks

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Aug 22, 2016 8:00 pm

rpiatf2f10 wrote:I deleted some of videos and now, when I issued command,
[email protected]:~ $ /home/pi/pikrellcam/scripts/pk-archive
archive_still day 2016-08-21
used space below 85%, nothing to do!
When you type 'df' what is the % used on your storage medium (/dev/sda1 or whatever you are using)?
Try editing the script to have a lower threshold that what you are currently using, and see if then running the modified script deletes some files. If it does, you are good but if there is a permissions problem, etc. then you will find out.

It is not my own script, as I recall someone else posted it here earlier in this thread and I only modified it slightly.

Mike-DC
Posts: 3
Joined: Wed Aug 24, 2016 5:02 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Aug 24, 2016 9:35 pm

Hi,

Im not sure if I should start a new topic or not if so please feel free to move this post.

But my question is, I have a usb microphone attached, is there anyway to trigger recording the audio when motion is detected and stop recording when there is no motion ?

And even better still I would like to save the audio in the recorded video stream like picam does. is this possible ? :)


thanks
Mike

punacmc
Posts: 31
Joined: Tue Nov 19, 2013 4:07 am

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 25, 2016 1:52 am

punacmc wrote:I could use some assistance. I would like to use the at-command.conf to adjust the camera, picture, and exposure settings at sunrise and sunset. I have examined this file and the help file, but I do not see a list of possible commands that can be used. Are the commands the same as the labels in the OSD? With the sunrise and sunset, other than the Lat. and Long. in the config file, is there anything else that needs to be done? Perhaps I am overthinking all of this...
Ok I've got most of this figured out. The only setting I can not get to work is the exposure. I use the following in my at-commands.conf file.

daily sunset "@exposure night"

Can anyone advise as to what the command should be?

billw
Posts: 404
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 25, 2016 3:26 am

punacmc wrote:Ok I've got most of this figured out. The only setting I can not get to work is the exposure. I use the following in my at-commands.conf file.

daily sunset "@exposure night"
Use

Code: Select all

daily     sunset     "@exposure_mode night"
The text you see on the OSD for settings arguments should be the same as you would use for
at-commands, but the web page button just says "Exposure" instead of "exposure_mode".

punacmc
Posts: 31
Joined: Tue Nov 19, 2013 4:07 am

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 25, 2016 4:27 pm

billw wrote:
punacmc wrote:Ok I've got most of this figured out. The only setting I can not get to work is the exposure. I use the following in my at-commands.conf file.

daily sunset "@exposure night"
Use

Code: Select all

daily     sunset     "@exposure_mode night"
The text you see on the OSD for settings arguments should be the same as you would use for
at-commands, but the web page button just says "Exposure" instead of "exposure_mode".
Thanks for the help! I altered the at-command file to include "@exposure_mode night" for sunset and "@exposure_mode auto" for sunrise. I checked the OSD, and the changes did not happen. I tried stopping Pikrellcam, and then starting, however that did not work either. I then rebooted the Pi. All other settings have been changed as expected. I checked for an update, but the log says I have the latest software. Not sure what else I should try.

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 25, 2016 5:22 pm

punacmc wrote:I altered the at-command file to include "@exposure_mode night" for sunset and "@exposure_mode auto" for sunrise. I checked the OSD, and the changes did not happen.
Are you using the new RPi v2 camera? I am not sure but I have the impression that night mode does not work the same way on v2 as it did on v1.

If your use is as a security camera, it is also my experience that night mode (since it uses longer shutter speeds) is not useful for identifying any person in motion because the large motion blur removes all distinguishing features. That was what prompted me to make an IR strobe system that generates a bright 1.5 msec long blink at (very nearly) the camera framerate. That does allow the Pi NoIR camera to deliver usable image quality on moving objects at night. You could do the same thing with continuous illumination and a short shutter speed, but you'd be wasting a large fraction of the light energy because it would fall outside of the active exposure time.

punacmc
Posts: 31
Joined: Tue Nov 19, 2013 4:07 am

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 25, 2016 9:18 pm

jbeale wrote:
punacmc wrote:I altered the at-command file to include "@exposure_mode night" for sunset and "@exposure_mode auto" for sunrise. I checked the OSD, and the changes did not happen.
Are you using the new RPi v2 camera? I am not sure but I have the impression that night mode does not work the same way on v2 as it did on v1.

If your use is as a security camera, it is also my experience that night mode (since it uses longer shutter speeds) is not useful for identifying any person in motion because the large motion blur removes all distinguishing features. That was what prompted me to make an IR strobe system that generates a bright 1.5 msec long blink at (very nearly) the camera framerate. That does allow the Pi NoIR camera to deliver usable image quality on moving objects at night. You could do the same thing with continuous illumination and a short shutter speed, but you'd be wasting a large fraction of the light energy because it would fall outside of the active exposure time.
It is a Pi B+ with the v1 camera. I did notice that the log shows that the software is 3.1.1, but the OSD shows 3.0.2, so I am not sure what is going on.

My use is a security camera, and I have deployed 7 of them. Lets just say that my career has me exporting lots of surveillance video, along with my normal digital forensics duties. I have observed that usable video needs lots of resolution (with no binning!), and I prefer to have color vs IR. I use motion activated lights which provide lots of light when needed, so I can get away with 12fps depending on the settings. It is far from optimal at this point, but I can add more lights to the circuit if need be. I've recently purchased a Pi zero and v2 camera, so I will test with it also. Anyway, I would like to set and forget, so during my free time I am trying to use the functions provided in the software. Very interested in deleting files after a certain time, and having an option to turn on or off emailing previews from the OSD. I need to pick up programing again...I remember the basics of C++...

punacmc
Posts: 31
Joined: Tue Nov 19, 2013 4:07 am

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 25, 2016 9:21 pm

jbeale, I would like to research your project with the strobe. Have you complied your information anywhere other than this forum?

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Aug 25, 2016 9:47 pm

I have not documented my IR strobe circuit, but it's simple- just a constant-current opamp drive circuit going to a string of IR LEDs which is switched on and off by a 1.5 msec signal from an Arduino at 23.1 Hz (which is the actual frame rate that I get from my Ebay OV5647 IR-cameras running at the default "24 fps" from PiKrellCam).

If you require color images and not IR, I would stay with normal lights and not recommend the strobe light idea. The flickering bright light would be very annoying in the least, and maybe cause seizures in some people. My 850nm IR strobe lights are visible to the eye at night, but relatively dim, so the fact that it flickers is not too annoying.

In my quest for a good security camera, I have experimented with various forms of the RPi camera (visible and NoIR) as well as various USB cameras and IP cameras with S-mount (M12) and C/CS mount lenses. I even tried a 2/3" sensor GigE machine vision camera with a Canon EF f/1.4 lens. In general, all of these cameras generate good clear images during the day, and variously poor to awful images at night. So for good performance at night, IMO it is not so much about the camera, but mostly about how much lighting you can or want to use.

YvesG
Posts: 46
Joined: Wed Oct 03, 2012 6:54 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Aug 26, 2016 11:24 am

Hi Billw
For your info a Pull request is waiting your approval here : https://github.com/billw2/pikrellcam/pull/16
It's not optimal but my goal was to update the minimum numbers of files
Cheers
Yves

User avatar
Gavinmc42
Posts: 4069
Joined: Wed Aug 28, 2013 3:31 am

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Aug 28, 2016 4:01 am

Additional USB webcams?
I have one Pikrellcam camera at the end of a 20m cable.
It can only point it one direction unless I put another pkcam there.
That would mean I need a Ethernet switch, another Pi, more power.

But there are 4 USB ports free.
Can one or more USB cameras be used to take videos that are triggered from the Pi camera/Pikrellcam by a "on motion detect" script?

Got a bunch of PS3 Eyecams that got made redundant when I upgraded from Motionpie to Pikrellcam/Pi cameras.
Pi camera + 4 usb cams = nearly 360 coverage.

Option 2 is pikrellcam triggered USB connected Zero 1.3's, this can probably be done now with the Network broadcast mode?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Camera board”