logo
background
 Home and Links
 Your PC and Security
 Server NAS
 Wargames
 Astronomy
 PhotoStory
 DVD making
 Raspberry Pi
 PIC projects
 Other projects
 Next >>

Notes index links

Links to all my notes (includes mini-projects and source code etc)

(+) 0001 How do I change the Pi System partition size ?

(+) 0100 Device tree settings

(+) 0201 Power over Ethernet - (PoE)

(+) 0202 Solar Power - (with WiFi)

(+) 0203 Power Bank pass through

(+) 0400 Accessing the SDHC card system image

(+) 0401 Accessing PC shares from the Pi

(+) 0402 Installing samba - (the Pi as a Network Share on your PC)

(+) 0900 Can this approach be scaled up to a PC UPS ?

(+) 1001 Pandora Spotify on the Pi

(+) 1002 Playing movies on the Pi

(+) 1003 Getting VGA from the HDMI socket

(+) 1004 Using the RCA socket

(+) 1005 Using the Pi RS232 serial links

(+) 1006 Using the GPIO pins

(+) 1007 Controlling the Pi Zero ACT LED

(+) 1200 List of standard camera modes



(-) 1300 Auto file names


BASH script, auto file naming

if'var' is a count, then to increment it and then use it as (part of) a file name (file1, file2 etc)

# inc number, convert to 4 digits (i.e. add leading zeros)
var =$( printf '%04d' $((var++)) )
nextname="file$var"

$ means evaluate (so pre-fixes a variable name) - without the $ what follows is taken as constants (i.e. text charcaters)
(( ..)) means evaluate numerically (and ++ just means increment)


Date amd time

	
$(date +"%Y-%m-%d_%H%M%S.%3N")

The '%' prefix indicates a date/time value
 %Y is 4 digit year, %m 2 digit month, %d 2 digit day (if you want 3 character month (Jan, Feb etc), use %b instead of %m)
 %H is 2 digit (24Hr) Hours, %M is 2 digit mins, %S 2 digit seconds
 %N means time in nano seconds, %3N means to nearest 3 digits i.e. time in milli-sconds (for uS, use %6N).

The '-', '_' and '.' are returned as embedded characters (at the positions) in the generated character string


Auto filenames with the Pi camera

Since max. speed burst mode shots using :-

sudo raspistill -n -bm -o %04d.jpg -t 10000 -tl 0 -th 0:0:0
generates 4 digit file names (%04d) automatically, you might think that :-

sudo raspistill -n -bm -o $(date +"%Y-%m-%d_%H%M%S.%3N").jpg -t 10000 -tl 0 -th 0:0:0
would generate data and time stamped files ?

WRONG = the $(date +"%Y-%m-%d_%H%M%S.%3N") is evaluated ONCE (when the command line is 'read') - so all you get the last taken photo, timestamped (to the mS) prior to the start of the burst as 'sudo' will have over-written all intervening photos of same name :-)

raspistill has a -dt option flag which will replace a '%d' serial number a 'date number', however this gets you MMDDHHMMSS as a simple 32bit number (i.e. as a 10 digit string) - so only 'works' for shots no faster than 1 a second (or it's back to later photos overwriting earlier ones again :-) )

To get multiple shots per second with date/time you have to use something like :-

sudo raspistill -n -bm -o $(date +"%Y-%m-%d_%H%M%S-)%02d.jpg -t 10000 -tl 0 -th 0:0:0

This gives you a file name composed of the date and time (when the command was executed) plus a 2 digit sequential photo serial number.

To get more accurate time-stamp, you can use the photo file creation date/time, or for the date time of the actual 'shot', use Image Annotations.

This note last modified: 17th Sep 2016 08:10.

[top]

(+) 6500 How to make the System partition read only ?

(+) 6501 Minimising SDHC corruption on power down

(+) 9000 diode switch

(+) 9001 Auto shut down

(+) 9001 MOSFET switch

(+) C201 High speed photos

(+) Dec 1969 (no desc)

(+) a000 Display setup - (for PhotoFrame)

(+) a001 go photoframe - (how it works)

(+) a002 set photo - (select for display)

(+) a003 go button script - (photoframe pause control)

(+) a005 get photos - (fetch resize)

(+) a00x Other display utilities

(+) c000 CCTV UPS requirements

(+) c001 countering low speed motion detect

(+) c002 Pi Overclocking

(+) c203 Pi ram disk - (tmpfs)

(+) c901 iR illumination

(+) c902 Viewing a video stream

(+) c905 Image anotation

(+) Dec 1969 (no desc)

(+) raspicamdocs.txt (no desc)

(+) s010 Elevation sensing

Next subject :- index

[top]