-
Notifications
You must be signed in to change notification settings - Fork 6
RPI Camera Setup
Chenming Zhang edited this page Aug 9, 2022
·
2 revisions
To set up a weather station camera, you should prepare:
- Pi Zero W camera kit (camera module + Pi Zero W + ribbon cable + SD-card)
- One 3D-printed camera housing;
- One cable (3m-5m);
- Gadgets for soldering (pin headers + wires with header + heat shrink)
The main components of the camera are shown as follows:
@reboot home/pi/pyduino/bash/camera_weather_station.sh
#!/bin/bash
sleep 120 #need enough time for pi to reboot and load modules required by camera, and connect to wifi
cd /home/pi/photo_weather_station/
FILENAME=$(date +"%Y-%m-%d_%H%M")_field_camera.jpg
raspistill -vf --thumb none --quality 13 -o $FILENAME
sleep 5
scp /home/pi/photo_weather_station/$DATE <user>@mango.eait.uq.edu.au:/storage/www/dropbox.eait.uq.edu.au/<user>/Bribie/
sleep 5
scp /home/pi/photo_weather_station/$DATE <user>@mango.eait.uq.edu.au:/home/users/<user>/Bribie/photo/
sleep 5
- --vflip, -vf : Flip image vertically (if camera installed right side up, image viewed as POV)
- --hflip, -hf : Flip image horizontally (if camera is installed upside down)
- --thumb, -th : Set thumbnail parameters (x:y:quality) or none.
- --quality, -q : Set jpeg quality <0 to 100>. Quality is logarithmic.
-q 13
is approximately 80% jpeg quality.
https://forums.raspberrypi.com/viewtopic.php?t=73174#p526713
https://forums.raspberrypi.com/viewtopic.php?t=73174#p1727499
try:
ard.write("power_switch,8,power_switch_status,1,debug,1")
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
print("Switch on. Taking photo ...... ")
time.sleep(180) #must be long enough to update images via 3G or 4G connection.
ard.write("power_switch,8,power_switch_status,0,debug,1")
print("Switch Off. See you next loop ......")
except Exception as error:
if SCREEN_DISPLAY:print('Taking photo failed')
print(type(error))
print(error)
Below is the commands to convert the existing large jpg files in a folder to reduced sizes.
mkdir converted
for file in *.jpg; do
echo $file
convert -resize 30% $file ${file}_resized.jpg;
mv ${file}_resized.jpg converted/;
done