/
Raspbery Pi AllSky Camera.txt
157 lines (126 loc) · 6.64 KB
/
Raspbery Pi AllSky Camera.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
A RASPBERRY PI ALLSKY CAMERA
============================
A Raspberry Pi 3B, 4 or 0W, a Pi 8MP camera with an IMX219 sesnor and a an M12 GoPro 220 degree lens
from here https://www.aliexpress.com/item/32430326520.html?spm=a2g0s.9042311.0.0.39e04c4dEm7x8C.
A 1-Wire DS18B20 temperature sensor is included. AllSky Cam costs about $100 without a case.
Here I used a re-purposed Clinton Electronics VX50 with the original electronics removed.
I put a buck regulator board in the case and modified the LAN cable to permit 12V DC to be fed up the
ethernet cable so I only need one cable to the device. You can connect via WiFi but you still
need to provide power. I chose 12V because it is easy to derive the neccessary 5V for the Pi
over longer distances.
However it is quite possible to use a Raspberry Pi 0W and run the whole device from a USB power supply.
Data transfer is not supported via the USB port.
The software runs under Raspian. I'm using Stretch and Buster. I have had a huge amount of help from the folks at the Raspberry Pi forum because I am very far from being a programmer. Thanks guys.
In use the camera takes a single 800 x 600 jpg image every 2 minutes in daytime and 4 minutes at night. Once every 3 minutes it takes
the image to concatenate into one of two videos for day and night. The videos run at 5 fps with the
aim of making two daily videos of about 30 seconds each. The device does not keep data once it has
been depassed. This means you can run the AllSky Cam from an 8GB or smaller microSD card,
The camera alone is not capable of producing usable images from all day and night ambient light levels so
I use sunwait https://github.com/risacher/sunwait to provide daily twilight (dawn and dusk), sunrise and sunset times.
The resultant times may be adjusted to allow exposure switching via cron to provide differing sets of
exposure arguments to raspistill. Sunwait needs the latitude and longitude and GMT offset to provide correct times.
The still image contains a text banner that displays, from left to right:
- The current camera mode T=Twilight, D=Day, N-Night
- The date and time the image was taken, but not neccessarily displayed.
- Today's Sunset time according to PHP's date_sunset(time().
- Current outdoor temperature from the DS18B20 in Celsius and Farenheit degrees
- Current Raspberry Pi CPU temperature in Celsius bcause the Pi COU pack it in at 85C.
A very simple menu system is provided that runs equally simply on PC and phones. The PI has a
lightppd webserver and may be accessed as a normal webpage.
Installation one-time tasks
---------------------------
THIS PROJECT RUN IN ROOT SO PLEASE MAKE SURE THAT YOU INSTALL USING ROOT
Most of this information came from https://www.dronkert.net/rpi/webcam.html
which is what this project is based upon.
apt-get upgrade
apt-get dist-upgrade
rpi-update # If needed.
reboot
raspi-config
------------
- Set up your WiFi connection if you are planning to use a WiFi connection. On a Pi Zero W it is the only way,
- Enable camera
- Enable SSH and 1-Wire in Interfacing Options
SSH is to access the PI once it is in place and 1-Wire is for the DS18B20 temperature probe
Enable the DS18B20 temperature probe, if used.
----------------------------------------------
add
w1-gpio
w1-therm
to the end of the file if this has not already been done by raspi-config.
Install ffmpeg
--------------
apt install ffmpeg
Disable the camera LED
----------------------
nano /boot/config.txt
add
disable_camera_led=1
dtoverlay=w1-gpio
to the end of the file. This may have been done by raspi-config.
Install lighttpd and php
------------------------
apt-get install lighttpd php php-cgi php-gd
Test it
-------
lighty-enable-mod fastcgi
lighty-enable-mod fastcgi-php
service lighttpd force-reload
echo '<?php phpinfo(); ?>' | tee /var/www/phpinfo.php
Install the software
--------------------
Make a directory in /home called /home/allsky
mkdir /home/allsky
Make a directory called /home/allsky/pics and for the day and night images
mkdir /home/allsky/pics
mkdir /home/allsky/pics/day
mkdir /home/allsky/pics/night
Set the file permissions
------------------------
chmod 755 /home/allsky/sunwait/sunwait
cp /home/allsky/sunwait/sunwait /usr/bin
chmod 755 /home/allsky/webcam
chmod 755 /home/allsky/pics/*.sh
Copy the php and html files to /var/www/html
--------------------------------------------
chmod 755 /home/allsky/sunwait/sunwait
cp /home/allsky/sunwait/sunwait /usr/bin
Get and build Sunwait
---------------------
Download sunwait from https://github.com/risacher/sunwait
Build the program via the make file - it works perfectly
Copy sunwait
cp /home/allsky/sunwait/sunwait /usr/local/bin/sunwait
reboot
Edit the webcam file
--------------------
nano /home/allsky/webcam Change the variables lat and lon to reflect your staion, save and exit the file.
Run webcam with:
/home/allsky/webcam
Webcam will now run and produce images and video automatically.
NOTE FOR USING THE RASPBERRY Pi ZERO W
--------------------------------------
The Raspberry Pi Zero W offers a very cheap way on building this AllSKy Camera. To accomodate the Pi Zero W's
lower processing power a couple of mini changes help it out.
1). Edit /home/allsky/webcam and change lines 131 and 132
making sure that there is at least a six (6) mite gap between them with twiSetVid being the highter number.
This makes sure that at camera and night video switch over the raspistill buffer is clear.
2). Edit the webcam file change the value of shotN to 5 at line 143. This makes sure that night images have
time to be processed completely before starting a new image.
127 # Shifts camera mode time at Evening Twilight / NIght
128 # For the night camera mode
129 # HH:MM
130 twiSet=-00:00 # Advance or delay when the camera switches from day to night.
131 twiSetP=-00:09 # Camera switch time. Needs to be at least 1 minute EARLIER than the Video switch time.
132 twiSetVid=-00:15 # Offset advance or delay for the Video Day / Night switch.
133
134 # Number of minutes between movie frame concatenation. Default here is 10 [minutes]
135 concat=10
136
137 # Minutes between movie image copies. Default is 3.
138 # raspistill can take up to 1 minute 45 seconds to process a night time image.
139 cap=3
140
141 # Interval for raspistill to take shots. Night time needs to be longer since raspistill needs longer at night to complete.
142 shotD=2 # Daytime shot interval. Default is 2 [minutes]
143 shotN=5 # Night time shot interval. It can take raspistill up to 1 minute 45 seconds to process a night time image. Default is 4