The original idea was proposed by Mr. Dubick. However, I followed no instructions and produced all code and design files. Help with interpreting the output layer matrix was provided by pyimagesearch.com. The MobileNetSSD model was designed and trained by Google.
Software
Corel Draw
Fusion 360
PyCharm
Python 3.7
OpenCV 4
MobileNetSSD network
OpenVNC client and server
Hardware
Laser cutter
20% Speed
100% Power
3 runs to ensure full cut
Cyanoacrylate and CA accelerator
Multi-purpose glue
Flex Seal
3D Printer
High speed preset
No supports
Electrical Tape
Calipers
Creating Acrylic Cases
Using the most updated Corel Draw files cut out the acrylic pieces for the top Case, bottom case, solar panel, regulator case, and RPi case
Use calipers to measure the thickness of the acrylic being used and modify the height of the teeth accordingly
The solar panel requires color mapping as the green lines are to be engraved with 10% power and 100% speed
The camera shield and top case need to be clear acrylic in order to allow solar cell and camera functionality
Glue together the pieces by matching the corresponding teeth together using multi-purpose glue
Do not glue the top and bottom cases to the solar panel as the solar cells must be done first
Do not glue the top piece of the RPi as it is deprecated in favor of the RPi case cap
Clamp the pieces together and allow allow the pieces to sit one day to dry
Water proof all the cases by sealing all the cracks on the edges with multiple passes of flex seal
Use masking tape to keep the seal clean
Placing Solar Cells
Glue the solar cells to the corresponding engravings on the acrylic pieces using multi-purpose glue
Wire the solar cells in series by soldering a wire between one panel's positive contact and the other panel's negative contact.
Solder the remain positive and negative contacts to the USB regulator using correspondingly colored red and black wires.
Place the USB regulator into the USB regulator housing on the solar panel
Creating Solar Panel Assembly
Glue the top and bottom case to the solar panel, matching the edges of both cases to the edges of the solar panel.
Apply a good amount of glue to attempt to seal any cracks
Use flex seal to seal the edges of the entire solar panel assembly.
Use masking tape to keep the seal clean
Printing RPi Cap
Measure the thickness of the acrylic used to make the RPi box using calipers.
Adjust the STL model of the RPi cap accordingly by changing the height of the teeth holes.
Import the model into Cura and print
Test the fit of the print on the RPi case
Readjust and reprint if necessary
Creating the RPi Case
Glue the camera shield onto camera hole in front of the RPi case
Make sure to surround the camera hole with glue to insure a water tight seal
Install the PiJuice HAT onto the RPi by connecting the GPIO pins
Orient the RPi in the RPi Case so that the MicroUSB port of the HAT is aligned with the hole in the case
Setting Up RPi Software
Make sure the Raspberry Pi is a model 3b and the MicroSD card has more than 8gb of free storage.
Flash the Raspbian Buster image onto the MicroSD card using a MicroSD card reader.
Do not use NOOBs as that will use unnecessary space
Plug the MicroSD card into the RPi as well as HDMI, power, mouse, and keyboard, and boot up the RPi
Wait for Raspbian Buster to install
Open up a command prompt and install the dependencies for OpenCV
sudo apt install libpango-1.0-0 libatk1.0-0 libcairo-gobject2 libpangocairo-1.0-0 libqt4-test libtiff5 libqtcore4 libwebp6 libavcodec58 libavutil56 libqtgui4 libavformat58 libgdk-pixbuf2.0-0 libgtk-3-0 libilmbase23 libjasper1 libcairo2 libswscale5 libopenexr23
Install the prebuilt libraries for OpenCV
sudo pip3 install opencv-contrib-python==4.1.25
Use version 4.1.25 because later versions do not work properly
Install the dependencies
sudo pip3 install pijuice-gui
sudo pip3 install apscheduler
Enable SSH and OpenVNC support
sudo raspi-config
Navigate to interfaces and select enable for SSH and OpenVNC
Download the software files
Run the main_test.py to test if the installation went correctly.
Configure the PiJuice to wakeup every hour by selecting the every hour tickbox
Added the main_camera.py to the user crontab.
The line should be prefixed with @reboot to allow the script to run at boot
Point the runtime at where the python environment is located
Point the script at where main_camera.py is located
Final Installation
Connect the PiJuice HAT to the USB regulator via a MicroUSB cable
Seal both ends of the cable with electrical tape
All files and code for object detection
Programmed in PyCharm
Utilizes APScheduler, MobileNetSSD, OpenCV, and built-in Python libraries
All files used to laser cut the solar components
Designed in Fusion 360
Exported to Corel Draw
All files used to laser cut the RPi case and 3d print the top cap
Laser cut
Designed in Fusion 360
Exported to Corel Draw
3D Model of the top cap
Designed in Fusion 360
Exported as .STL
One of the things that I learned near the end of the working prototype deadline was to not assume your capability to do anything. I spent way too much time on perfecting the models and designs because I assumed that my software and programming prowess would allow me to setup and finish the software portion of the project in less than 3 hours. By the time I was working on the software, I realized that I was dead wrong. The software installation was filled with nothing but trouble. I spent hours racking my brain and the internet to bog through that mess. The installation guides were misleading and I spent nearly 5 hours troubleshooting to find a solution that fixed by problem in 2 minutes. I stayed at the lab until 8 PM. I should have realized that things will go wrong no matter what and allocated more time to the software portion of my project.
Another things that I learned within the revision period of the personal projects was that waterproofing electronics requires some ingenuity. After working prototype deadline, I had a working prototype that would completely unprotected. Unfortunately, I didn't have time to create a new waterproof project from scratch, so I had to design something that could added onto the prototype to add waterproofing without impairing the functionality of the prototype. The result was three fold: the design of a top and bottom case for the solar panel to protect the sensitive electronics on the top and bottom of the solar panel, a revision to the RPi case cap that added elongated flaps to ward off water, and the extensive use of Flex Seal.
In the future, I hope to improve the project by transitioning the machine learning aspect of motion detection from the RPi to the cloud. Currently, I have limited the RPi to only run when solar energy is sufficient because the machine learning model hammers the CPU of the RPi and eats the PiJuice's battery. I hope to bypass this deficiency and increase the life of the PiJuice by offloading the heavy work to servers. The cloud also has the advantage of providing realtime streams of the RPi camera. I could create a website that streams the segmented images from the cloud and display it on a website. In addition, I could allow downloads of image where the machine learning detected images of animals. If cloud is not possible, then an alternate improvement is use of Intel's Movidius NCS module that acts as a coprocessor for OpenCV models. This would allow the model inferences to greatly speedup.