diff --git a/systemd/camera.service b/systemd/camera.service new file mode 100644 index 00000000..192d0a3a --- /dev/null +++ b/systemd/camera.service @@ -0,0 +1,15 @@ +[Unit] +Description=camera service + +[Service] +TimeoutStopSec=5 +#EnvironmentFile=/home/pi/CubeSatSim/.mode +ExecStart=/home/pi/CubeSatSim/take-photos.sh +WorkingDirectory=/home/pi/payload +StandardOutput=inherit +StandardError=inherit +Restart=always +User=pi + +[Install] +WantedBy=default.target diff --git a/take-photo.py b/take-photo.py new file mode 100644 index 00000000..d6b0102f --- /dev/null +++ b/take-photo.py @@ -0,0 +1,11 @@ +import time +from picamera import PiCamera + +camera = PiCamera() +#camera.resolution = (3280,2464) +camera.resolution = (2592,1944) +camera.start_preview() + +current_time = time.strftime("%H;%M;%S", time.localtime()) +current_time = time.strftime("%m-%d-%H%M%S", time.localtime()) +camera.capture('/home/pi/payload/img'+current_time+'.jpg') diff --git a/take-photos.sh b/take-photos.sh new file mode 100755 index 00000000..b84c8cad --- /dev/null +++ b/take-photos.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +echo -e "\nScript to take pictures every 30 seconds\n" + +while true; do + + python3 /home/pi/CubeSatSim/take-photo.py + echo -e "\nTaking photo!\n" + sleep 28 + +done