Raspberry Pi 3 Model B16GB MicroSD installed with Raspbian OS
Raspberry Pi 4 Camera Module 5MP Webcam
USB power bank (as big or little as you want, but needs to be able to power the Pi)
USB flash drive (as big or little as you want)
USB A-Male to B-Male Cable (short to link Arduino to Raspberry Pi)
Format the flash drive as FAT32 (it probably is already), then make a folder on the flash drive called "DATA" and a subfolder in the DATA folder called "Photos". Insert the flash drive into the bottom left usb port as you look at the 4 usb ports on the Pi.
Connect the USB port of the Arduino Uno into the bottom right USB port of the Raspberry Pi.
Insert camera ribbon into the Pi (https://thepihut.com/blogs/raspberry-pi-tutorials/16021420-how-to-install-use-the-raspberry-pi-camera).
Add a power button to the Pi (https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi).
Connect the power bank and the Pi should start up.
Some code needs to be added to the Pi to make automatically take photos on start up.
Firstly install the code to make the power button work following step 3 of https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi.
Copy the following into a python editor on the Pi and save as "camera.py" in folder "/home/pi/":
import serial
from picamera import PiCamera
from time import sleep
from datetime import datetime
for i in range(5000):
ser = serial.Serial('/dev/ttyACM0', 9600)
line = ser.readline()
line1 = str(line)
line2 = line1.translate({ord(i): None for i in 'brn'})
line2 = line2.replace("'","")
line2 = line2.replace("\\","")
print(line2)
filePath = "/media/pi/DATA/Photos/"
currentTime = datetime.now()
picTime = currentTime.strftime("%Y.%m,%d,%H,%M,%S,")
picName = picTime + line2 + '.jpg'
completefilePath = filePath + picName
timestampMessage = currentTime.strftime("%Y.%m.%d - %H:%M:%S")
camera = PiCamera()
camera.exposure_mode = 'sports'
camera.resolution = (2592, 1944)
camera.framerate = 15
camera.annotate_text_size = 100
camera.annotate_text = line2
sleep(10)
camera.capture(completefilePath)
camera.close()
Open Terminal and type:
sudo nano /etc/rc.local
Scroll down, and just before the "exit 0" line, enter the following:
python /home/pi/camera.py &