Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

2. Software setup

Evan B. Goldstein edited this page May 31, 2023 · 4 revisions

Setting up the camera software on the Pi

After assembling the case and wiring the electronics for the RPi (see the 'hardware directory'), it's time to get the Software and configurations set.

Option 1, Use our premade an image:

Get in touch with us and we will provide you with a working SD card image which you can Flash to an sd card.

Option 2, Roll your own image

Update Pi

Boot up Raspberry Pi and connect to internet, and update Raspberry Pi with commands

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Configure Pi

Applications menu -> Preferences -> Raspberry Pi Configuration -> Interfaces -> ENABLE; Camera, SPI,(SSH, VNC are optional)
sudo reboot

Add Hardware

After reboot
Power Raspi off and add header extension, attach GPS to UART pins. Place RTC on I2C. Connect Pi HQ camera to raspberry pi

Connect Button to GPIO26 and to GND Connect LED light to GPIO18, 5v (back of RTC), and GND
Power Raspberry pi on

Install the Pandas Package

pip3 install pandas

Install the MatPlotLib Package

sudo pip3 install maplotlib

Install scipy

sudo apt-get install libatlas-base-dev

pip3 install scipy

if this does not work, try: sudo apt-get install python3-scipy

set up GPS

sudo raspi-config
interfacing options (3) -> Serial Port (P6) -> No -> Yes -> Finish
then reboot

Install, gpsd, gpsmon and cgps
sudo apt-get install gpsd-clients gpsd -y

config GPS to work with correct serial device
sudo nano /etc/default/gpsd
Look for DEVICES=""
Change to DEVICES="/dev/serial0"
Now save file (control X, Y) pip3 install gpsd-py3 to download gps for python3
Screen Shot 2021-07-02 at 12 17 02 PM

set up RTC

sudo raspi-config Interface options (3) -> (P5) I2C -> yes -> finish
Screen Shot 2021-07-02 at 12 03 23 PM Screen Shot 2021-07-02 at 12 03 43 PM Screen Shot 2021-07-02 at 12 04 38 PM Screen Shot 2021-07-02 at 12 04 50 PM Screen Shot 2021-07-02 at 12 05 08 PM
sudo reboot
Now use i2cdetect to see if the RTC is working
sudo i2cdetect -y 1 will show mounted drives, you should see a 68
Screen Shot 2021-07-02 at 12 06 21 PM
sudo nano /boot/config.txt
Add to the end
#rtc
dtoverlay=i2c-rtc,ds3231
save and exit (control x, y, enter)
Screen Shot 2021-07-02 at 12 07 14 PM
Now that we have the RTC ready to work on boot, restart your pi and.. sudo i2cdetect -y 1 a mounted drive will have a "UU" ID
Screen Shot 2021-07-02 at 12 09 07 PM
Setting up RTC to be the main clock
First disable the fake "hwclock"
sudo apt-get -y remove fake-hwclock
sudo update-rc.d -f fake-hwclock remove
sudo systemctl disable fake-hwclock

Second make the RTC to the main clock
Run sudo nano /lib/udev/hwclock-set and comment out the following lines with #
if [-e/run/systemd/system];then
exit 0
fi
Screen Shot 2022-02-01 at 1 30 48 PM
/sbin/hwclock --rtc=$dev --systz --badyear

/sbin/hwclock --rtc=$dev --systz
Screen Shot 2022-02-01 at 1 31 12 PM

Make sure there is an internet connection so that the clocks can sync

set up Neopixel Lite

sudo pip3 install rpi_ws281x adafruit-circuitpython-neopixel

set up Tensorflow Lite

Follow instructions to pip install the tflite runtime on the Raspberry Pi https://www.tensorflow.org/lite/guide/python

create a /models/ directory on the desktop and place the *.tflite file (the tflite model) in that directory.

set up pyDGS (optional)

visit https://github.com/dbuscombe-usgs/pyDGS to look pyDGS or download to pi with git clone --depth 1 https://github.com/dbuscombe-usgs/pyDGS.git
once downloaded edit test.py script to look like example code in SandCam --> camerasoftware --> pyDGS --> example_test.py
next copy the pycache folder, dgs.pyc, and dgs.py to your SandCam folder


Helpful instructions to get packages for Ring LED, GPS, and RTC
https://www.thegeekpub.com/16187/controlling-ws2812b-leds-with-a-raspberry-pi/
https://ozzmaker.com/berrygps-setup-guide-raspberry-pi/
https://maker.pro/raspberry-pi/tutorial/how-to-add-an-rtc-module-to-raspberry-pi

Clone this wiki locally