Read the statement by Michael Teeuw here.
Motion Detection with RaspiCam, Non-Module version
-
I believe I have it cracked. The white screen was due to MMAL Motion crashing whilst writing a frame to disk. When Motion crashes, it apparently jacks up the video output.
My current solution is to use PM2 to monitor the motion process and restart it when necessary. I’m testing now. If it works for a few more days I’ll report back.
Adding motion to PM2:
pm2 start motion
. Be sure that the motion is not configured to run as a daemon (first option in config file). -
Hi, i do the same at first and restor my sw installation.
But after the same procedure of sw installation this error was again on top.I resolve, by my sw, the reason for that was: motion must start after pm2 startin mm.
My mm start’s automaticly after rebooting.
My motion also. => collision of SW.By doing motion in an cron job with delay time al was fun an running as iwant.
in my case i do following:
don’t foget to install screen.sudo apt-get intsall screen
My motion is running in a screen session.
then the cronjobcrontab -e
and set motion with following parameters:
@reboot sleep 150; screen -S motion -dmS sudo motion -c /home/pi/motion/motion-mmalcam.conf
i hope this is helpfull for you and other persons here.
-
Update: Having PM2 monitor the motion process seems to work quite well. However, I have now discovered that there is a memory leak somewhere in all of this. Using the MMM-SystemStats module, I can watch free memory trickle down throughout the day.
I’ve configured the Pi to reboot early each morning. That’s not an ideal situation, but it seems to have solved the problem. Good enough for me! And more importantly, good enough for the gift recipient.
-
have u increase the swapfile?
-
@lolobyte Negative, I have not. What would you recommend?
-
@bhepler
in general it’s not bad for a raspi3 to increase the swapfile from 100MB to a higher level.at first check your status:
sudo service dphys-swapfile status
U see something like this:● dphys-swapfile.service - LSB: Autogenerate and use a swap file
Loaded: loaded (/etc/init.d/dphys-swapfile)
Active: active (exited) since Mi 2016-11-30 13:17:14 CET; 6h ago
Process: 613 ExecStart=/etc/init.d/dphys-swapfile start (code=exited, status=0 /SUCCESS)Nov 30 13:17:13 raspi3 systemd[1]: Starting LSB: Autogenerate and use a swa…
Nov 30 13:17:14 raspi3 dphys-swapfile[613]: Starting dphys-swapfile swapfile…
Nov 30 13:17:14 raspi3 dphys-swapfile[613]: want /var/swap=1024MByte, checki…t
Nov 30 13:17:14 raspi3 dphys-swapfile[613]: done.
Nov 30 13:17:14 raspi3 systemd[1]: Started LSB: Autogenerate and use a swap…e.
Hint: Some lines were ellipsized, use -l to show in full.Maybe u have 100MB instead of 1024 like in my case.
If u want to change this value the edit your
sudo nano /etc/dphys-swapfile
change to this value and save your file
CONF_SWAPSIZE=1024
the do a
sudo dphys-swapfile setup
and activate your new swap level:
sudo dphys-swapfile swapon
thats all. Now your System can handle wit more than his physical RAM.
In My case i do in raspi-config a new
“Expand File system”
to reorganize the file system an reboot after that my raspi.
If you are a owner of a raspi 2 it’s more common to change the swap file to max 512MB.please inform me what’s your experience after this change
you can also check very niche your tasks mem, swap and other things in a ssh session on your PC with htop
sudo apt-get install htop
have a nice try
-
@lolobyte
Can U specify what this command does,. Am not sure if it isn’t doubling the motion command:@reboot sleep 150; screen -S motion -dmS sudo motion
(ignored the -c path part, cause renamed the config to motion.conf, so not needed)why is there two time motion - in it?
By the way it isn’t working on my mirror
-
I am completely unable to make this work.
The camera wont take any snapshots, maybe just a config error. But can someone confirm that this still works or show me something that works? Dont wanna go out and buy a pir sensor if i can make use of the raspicam. :) -
@Kimzer - If the camera won’t even take a snapshot, then none of this is going to work. Have you tried the various tutorials about getting the PiCam to work? The ones that are at the basic level of “I enter this command and it takes a picture right then and there and I can download it”?
Start with the official Getting Started Guide. Once you can get images from the camera to your Pi, come back.
If you can get the camera to produce images but have trouble getting Motion to work, follow my tutorial and the part where it says “at this point you can test it but…”, stop there. Change the parameter in the
motion.conf
file namedoutput_pictures
toon
and changeon_event_start
toecho Motion Detected!
. That should put a bunch of snapshots on your memory card. Test Motion by entering./motion -c motion.conf
and you should see motion writing messages to the screen. -
Ah my bad, poorly formulated on my end here.
I am able to take snapshots, and i have gotten the camera to work just fine itself. It is the motion part i am struggling with.
But i will have to test some more.