314_PIE wrote:I went back into it to get another try, i got it to work but only for ssmtp command below that sent to my Outlook account successfully... i used App passwords for thr Auth section in ssmtp.conf. STARTTLS and port 587.

However, it seems to not work with mpack test command in order to send the jpeg motion images. Im not sure if it can talk to ssmtp.conf but i know ssmtp can.

That's exactly the problem. ssmtp uses it's own configuration where mail and mpack uses the linux wide mail system like postfix, sendmail or exim. So to use these commands you have to install and setup one of these mail systems on the pi properly. But if ssmtp works then why not just use it instead of mpack?

Ciao,
Rainer

I edited smtp.conf ~/pikrellcam/scripts/preview-save
and replaced the mpack script with this as i assume would be correct.

When you configured ssmtp.conf with username and password you don't need the -au and -ap parameters. They override the config options. But the main problem i see is that ssmtp seems not to support attachments. So if you want to send an attachment with ssmtp you have to manually mime encode it and add it to the email. I think this disqualifies ssmtp as an easy replacement for mpack (or alternatively mutt) to send the preview jpeg.

Seems you first have to configure your mail system on the Rpi with Exim or Postfix to send emails with attachments.

I'm sure that disk usage and clean up has been covered before, but I will share my script in case it helps others. I'm sure there are better ways to do this, but so far it has worked in the few tests I have done. If anyone sees any syntax errors or better ways to write the algorithm, just let me know. I'm sure I've forgotten to check for some condition that will break it, but programing isn't my forte. I just got fed up with having to manage multiple security cams daily.

It checks for disk usage where the media folder is stored. If a limit is reached, then it deletes the oldest file in the video and thumbs folder. The script is called from pikrellcam.conf file on the
event_motion_end_cmd option. In my testing, the disk usage stays within several percent of the target limit. It depends on the size of the video files removed and added, so leave some room for that. It defaults at 80%.

#!/bin/bash
#cdrof.sh (check disk remove oldest file) Created by PuNacMC on 04-17-2017.
#punacmc@gmail.com for questions or suggestions
#This script is freely given to use as you wish on the condition you give credit
#where credit is due.
#The purpose of this script is to check the disk useage on the partition where
#Pikrellcam stores the media. It then conducts a simple conditional statement
#to determine if the oldest file in the folder should be deleted based on the
#variables the user can define at the begining of the script. The script should
#be set to run by Pikrellcam using "event_motion_end_cmd" in the "pikrellcam.conf"
#file. For example "event_motion_end_cmd $C/cdrof.sh". This will run the script
#after the motion event has ended. This script is not quaranteed to work and you
#use it at your own risk.
#Credit for the syntax for deleting the oldest file goes to the_velour_fog
#located at https://unix.stackexchange.com/questions/355389/delete-oldest-file-in-directory
#Credit for the syntax for checking disk space and storing into variable
#goes to LINOXIDE at https://www.linux.com/blog/linux-shell-script-monitor-space-usage-and-send-email
#Terminate script after the first line that fails (returns nonzero exit code)
set -e
#Echo status on (1) or off (0). This is for debugging outside of Pikrellcam.
ESTAT=0
#Maximum used space variable. Set this to an integer that represents a percentage.
LIMIT=80
#Directory variables. Set these to where your Pikrellcam stores video and thumbnails
DIR="/home/pi/pikrellcam/media/videos"
DIR2="/home/pi/pikrellcam/media/thumbs"
#Navigate to first folder which should point to your videos.
cd $DIR
#Debugging echo statement
if [ $ESTAT -eq 1 ];
then
echo "Navigated to $DIR"
fi
#Get used space of folders partition, and store in variable
USED=`df . | awk '{print $5 }' | sed -ne 2p | cut -d"%" -f1`
#Debugging echo statement
if [ $ESTAT -eq 1 ]; then echo "$USED"
fi
#Debugging echo statement
if [ $ESTAT -eq 1 ]; then echo "Used space is $USED"
fi
#Logic test to see if USED is greater than or equal to LIMIT
if [ $USED -eq $LIMIT ] || [ $USED -gt $LIMIT ];
#If logic test is true
then
#Find the files in the video folder and sort them by date and time, pull the oldest and delete
find . -type f -printf '%T+ %p\n' | sort | head -n1 | awk '{print $2}' | xargs rm -v
#Debugging echo statement
if [ $ESTAT -eq 1 ]; then echo "Deleted from Videos"
fi
#Change directory to second folder which should point to your thumbs
cd $DIR2
#Find the files in the thumbs folder and sort them by date and time, pull the oldest and delete
find . -type f -printf '%T+ %p\n' | sort | head -n1 | awk '{print $2}' | xargs rm -v
#Debugging echo statement
if [ $ESTAT -eq 1 ]; then echo "Deleted from Thumbs"
fi
#If logic test is false, exit conditional statement
else
#Debugging echo statement
if [ $ESTAT -eq 1 ]; then echo "Used Space $USED is not over Limit $LIMIT"
fi
fi
#Script has completed without error
exit 0

When you configured ssmtp.conf with username and password you don't need the -au and -ap parameters. They override the config options. But the main problem i see is that ssmtp seems not to support attachments. So if you want to send an attachment with ssmtp you have to manually mime encode it and add it to the email. I think this disqualifies ssmtp as an easy replacement for mpack (or alternatively mutt) to send the preview jpeg.

Seems you first have to configure your mail system on the Rpi with Exim or Postfix to send emails with attachments.

Ciao,
Rainer

Oops, i ment say in my previous post that i configured ~/pikrellcam/scripts/preview-save instead of ssmtp.conf..

I removed ssmtp and started of using Postfix which i heard is more up to date on security than Exim.
Postfix documentation is quite hard to understand, Im not sure if Postfix is lightweight which includes all sorts of configurations. I started by selecting no configuration on install. followed steps to setup as null client. http://www.postfix.org/STANDARD_CONFIGU ... ull_client

Fox Mulder wrote:
When you configured ssmtp.conf with username and password you don't need the -au and -ap parameters. They override the config options. But the main problem i see is that ssmtp seems not to support attachments. So if you want to send an attachment with ssmtp you have to manually mime encode it and add it to the email. I think this disqualifies ssmtp as an easy replacement for mpack (or alternatively mutt) to send the preview jpeg.

Seems you first have to configure your mail system on the Rpi with Exim or Postfix to send emails with attachments.

Ciao,
Rainer

Do i need to require a registered domain name for my network in order to setup Postfix? hostname@example.com...

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).

Got my IR leds and now finally some 12 degree optics for them.
You know the triple optics looks just like the optics you get in a 12V GU5.3 down light.
Hmm, just checked my GU10 spares, house has GU10 fittings now for LED mains.

We get the GU10's when they are on special, some are diffusers, some have 4, some 3 LED+optics.
The 4 LED optics are 60 degrees, the 3 LED optics are 38 degrees.
Got about 10 years of spares
The 60 degree optics would be good for the standard Pi camera lens.

Made a simple USB A connector resistor/led test setup, just plugs into power bank.
One Osram Platinum Dragon lights up a room for the Noir camera, resistor gets very warm at 350ma
Dragons can go up to 1Amp.

Now it is time to do a driver for them. I remembered your strobe idea.
Been playing with baremetal coding and found out about the GPCLK0,1,2.
GPCLK0 was used by the camera before EMI testing.
Still comes out on GPIO4 Alt0, have you tried to program GPCLK0 on GPIO4 to output the 23.1Hz?
A mosfet/current limiting transistor on GPIO4 should simplify things.

314_PIE wrote:Do i need to require a registered domain name for my network in order to setup Postfix? hostname@example.com...

No. You have to configure postfix to just relay emails to your email provider. There are different kind of setups and you have to use the right one. You can also configure postfix to act as if you have your own domain and send emails directly to the receiver, which is not the case for you. You want to use your existing email provider to sent these email and you just have to forward local emails to your provider.

314_PIE wrote:Do i need to require a registered domain name for my network in order to setup Postfix? hostname@example.com...

No. You have to configure postfix to just relay emails to your email provider. There are different kind of setups and you have to use the right one. You can also configure postfix to act as if you have your own domain and send emails directly to the receiver, which is not the case for you. You want to use your existing email provider to sent these email and you just have to forward local emails to your provider.

Thankyou for this link, i got to the end of it and sent a mail attachment with mpack, but it came back as "You have mail in /etc/mail/pi" and it seems to be that STARTTLS is required for outlook, which i did enabled when i setup Ssmtp and it worked with it on port 587.

I decided to create a new email account which the original email account i used had a hyphen in it which i would think would be the cause of the "invaild email address" that would interfere with the command options when using "mail -s "Test subject" Email-address@outlook.com". But it wasn't, it kept telling me "Invaild Email Address" in /var/mail/pi.. i used a App password for every account i tried previously. I seriously dont understand why ssmtp is the only thing that bloody worked..

I haven't been paying attention and somehow missed that PiKrellCam now has a audio recording feature! I was able to confirm that it works (at least, the audio meter responds realistically) using a Sony PS3 Eye camera as the input device. For only $6 these work well as just a USB mic, even if you don't need a (low-quality 640x480) camera also: https://www.amazon.com/Sony-PlayStation ... B0072I2240 Note this particular device works on older (2016 & earlier) Raspbian releases, but for unknown reasons does not work with the current (2017) Raspbian: viewtopic.php?f=28&t=181578

There is a much smaller USB mic at the same price which I haven't tried, but looks interesting and is claimed to work with RPi also:https://www.amazon.com/Kinobo-Microphon ... B00IR8R7WQ
Similar looking devices on ebay at half the price; no idea if they work. I suspect these are lower quality in every way than the PS3 Eye.

Last edited by jbeale on Wed Apr 26, 2017 5:13 pm, edited 2 times in total.

I now know whats causing this "invaild Email Address", its the 'From' address that is using the pi@outlook.com which is failing to send to outlook.com becuase the email doesnt exist. I never set this address up until it appeared in the error log when using Mutt instead of Mpack. Mpack just tells me its pi@PiZeroW which i assumed was right. I knew it wasn't something to do with my outlook account or sasl_passwd.

314_PIE wrote:I now know whats causing this "invaild Email Address", its the 'From' address that is using the pi@outlook.com which is failing to send to outlook.com becuase the email doesnt exist. I never set this address up until it appeared in the error log when using Mutt instead of Mpack. Mpack just tells me its pi@PiZeroW which i assumed was right. I knew it wasn't something to do with my outlook account or sasl_passwd.

After that change i can send emails from the user root and the "from" field is automatically rewritten to "test@gmx.net". That's all i remember late at night. But maybe the newer generic version is better, don't know.

314_PIE wrote:I now know whats causing this "invaild Email Address", its the 'From' address that is using the pi@outlook.com which is failing to send to outlook.com becuase the email doesnt exist. I never set this address up until it appeared in the error log when using Mutt instead of Mpack. Mpack just tells me its pi@PiZeroW which i assumed was right. I knew it wasn't something to do with my outlook account or sasl_passwd.

After that change i can send emails from the user root and the "from" field is automatically rewritten to "test@gmx.net". That's all i remember late at night. But maybe the newer generic version is better, don't know.

Ciao,
Rainer

Do i need to own a ISP mail account? Or just a random account without login that forwards the mail attachments to outlook.com, the generic version confuses me to how its set out which doesn't suit my needs. Its more for a user to user configuration knowing both the local host and addresses.

Here is an example for a standard email relay configuration if you have an existing email address at the provider gmx.net for example.
Let's say you have an email account at gmx.net like test@gmx.net. Then your email provider gmx has a smtp server available to accept emails from you at mail.gmx.net where you authenticate with your username and password. When you want to send email via postfix you set up your email accout data within "/etc/postfix/sasl_passwd" like "test@gmx.net username:password". The name sasl_passwd can be called like you want and just have to match the corresponding entry in main.cf. Then you set up your email relay in the file "/etc/postfix/sender_relay" like "test@gmx.net mail.gmx.net" which shows postfix that emails for test@gmx.net account should be sent through the mail.gmx.net server from your email provider. And last you set "/etc/postfix/sender_canonical" to something like "root test@gmx.net" which tells postfix to use test@gmx.net for all emails from the user root.

Then you hash all files with help of the program postmap. In main.cf you need at least the following options set.

jbeale wrote:... Raspbian releases, but for unknown reasons does not work with the current (2017) Raspbian: viewtopic.php?f=28&t=181578
...

I've just replied to your troubleshooting thread, as with the recent fw/kernel update, sound recording works again from the ps3 camera. I was unaware of it not working, as I've been busy with other things.

I've installed pikrellcam onto jessie lite, plugged into an A+ RPi, & the ps3cam audio is muxed in fine to the resulting mp4 file. I sshfs'd the A+ from a Pi3 to watch/listen to the result.

As you point out, this ps3 camera audio is very good quality for its low price, & a very useful test device.

I haven't been paying attention and somehow missed that PiKrellCam now has a audio recording feature!

I missed that too, mine have been working fine for months so never checked for updates.
Billw gets sound working and the Eyecam driver get broken
Looks like that's now fixed. Does it take Eyecam videos at the same time?

The Eyecams are a bit big for the Zero Cluster cams I am now trying to get going.
What other microphones work/have been tested with Pikrellcam?
Anything alsa/arecord can detect? i2s mems mics?

Fox Mulder wrote:Here is an example for a standard email relay configuration if you have an existing email address at the provider gmx.net for example.
Let's say you have an email account at gmx.net like test@gmx.net. Then your email provider gmx has a smtp server available to accept emails from you at mail.gmx.net where you authenticate with your username and password. When you want to send email via postfix you set up your email accout data within "/etc/postfix/sasl_passwd" like "test@gmx.net username:password". The name sasl_passwd can be called like you want and just have to match the corresponding entry in main.cf. Then you set up your email relay in the file "/etc/postfix/sender_relay" like "test@gmx.net mail.gmx.net" which shows postfix that emails for test@gmx.net account should be sent through the mail.gmx.net server from your email provider. And last you set "/etc/postfix/sender_canonical" to something like "root test@gmx.net" which tells postfix to use test@gmx.net for all emails from the user root.

Then you hash all files with help of the program postmap. In main.cf you need at least the following options set.

I haven't been paying attention and somehow missed that PiKrellCam now has a audio recording feature!

I missed that too, mine have been working fine for months so never checked for updates.
Billw gets sound working and the Eyecam driver get broken
Looks like that's now fixed. Does it take Eyecam videos at the same time?

The Eyecams are a bit big for the Zero Cluster cams I am now trying to get going.
What other microphones work/have been tested with Pikrellcam?
Anything alsa/arecord can detect? i2s mems mics?

It needs the CSI connected Raspberry Pi camera for video because of needing motion vectors,
but the mic from the Eyecam could be used.

Any microphone detected by arecord -l should work, just note the card number and possibly edit
pikrellcam.conf to match the device. So if you can get arecord to see a paper cup at the end of
a string, that should work fine!

But seriously, you might want to lean towards a more sensitive mic if you want to pick up sounds
away from the mic. Cheap ebay plastic hand held mics work but you will probably be disappointed
in the sensitivity. If yoiu don't have any mics on hand to try, electret mics around -40dB or better
soldered to a 3.5mm plug can be a cheap way to start.

Gavinmc42 wrote:
Now it is time to do a driver for them. I remembered your strobe idea.
Been playing with baremetal coding and found out about the GPCLK0,1,2.
GPCLK0 was used by the camera before EMI testing.
Still comes out on GPIO4 Alt0, have you tried to program GPCLK0 on GPIO4 to output the 23.1Hz?
A mosfet/current limiting transistor on GPIO4 should simplify things.

Wonder if the jitter from the PLL clocks plays a part.
Can the 19.2MHz be divided accurately enough by the PWM or GPCLK0?
GPCLK0 will only give 50% duty cycle clock so a one shot pulse circuit will be needed to reduce LED duty cycle.

It's too bad RPF did not bring the strobe out of the sensor, even a test pint would be nice.
But RPF have a 5 year roadmap and "know" what they are doing so we don't have to tell them this for version V3.
Or V2.?

The software shenanigans needed are a little beyond me at this point.
Still getting latest kernel going with Jessie Lite.
Might just bite the bullet and figure out piCore, much easier to maintain and I have tested the camera working.
But BillW's code has so many dependencies it might take me forever to figure it out

Quick query... Is there a way I can auto-archive video files to the archive folder, once a day (for example)?

I know I could write a script to do this using at-commands, but when you click the 'archive' button in the GUI it puts the videos in useful folders by month and date. Does anybody know if there's a way of automating this?

jamesw1 wrote:I've been using pikrellcam a while now and it's fantastic.

Quick query... Is there a way I can auto-archive video files to the archive folder, once a day (for example)?

I know I could write a script to do this using at-commands, but when you click the 'archive' button in the GUI it puts the videos in useful folders by month and date. Does anybody know if there's a way of automating this?

Many thanks.

Use an at-command, but you don't have to write a script, just use a builtin archive_video command.
For example, do a daily archive of all of yesterdays videos at some time during the day that gives you
a chance to review them first and delete ones you don't want before the archive runs: