In this project we are going to show you how to use the PiJuice HAT as either a remote camera system or as backup power when primary power has failed. The software we are going to use is called MotionEye OS and we are going to adapt it to overlay the status of the PiJuice battery.
You will need the following parts to build this project. Some optional parts are required for the initial setup on the Raspberry Pi:
- Raspberry Pi Computer
- 16GB MicroSD card with the latest Raspbian Lite installed
- Power supply 2.5A
- PiJuice HAT
- Raspberry Pi camera module
- PiJuice Solar Panel (optional)
Step 1 – First connect your Raspberry Pi camera module to the Raspberry Pi CSI port. It is important to make sure that the camera cable is inserted into the camera module and the Raspberry Pi CSI connector the correct way round otherwise the Raspberry Pi will not recognise the camera in the software.
Step 2 – Now we can add the PiJuice HAT to the Raspberry Pi. Simply insert it on top of the GPIO pins and the secure it in place using the provided standoffs and screws. Make sure the camera cable comes out the back of the Raspberry Pi between the PiJuice and Pi board.
Step 3 (optional) – If you wish to power your remote camera setup via power over ethernet (PoE) then you can add our Pi Supply PoE Switch on top of the PiJuice. This will also charge the PiJuice battery as well as allow network access to the camera. Insert the PoE Switch HAT on top of the PiJuice GPIO pins, making sure you push down firmly all the way (as far as it can go). You will also need to remove the jumper on header CM2, this will remove the need to push the button to apply power so power will be instantaneous when connecting the ethernet cable. Don’t forget to connect the ethernet jumper wire too.
Step 1 – Download the latest Raspbian Lite OS from https://www.raspberrypi.org/downloads/raspbian/
Step 2 – Download and install Balena Etcher software, which will allow you to flash the OS to the micro SD card at https://www.balena.io/etcher/. Insert your micro SD card into your SD card reader and then open up Etcher to flash Raspbian OS Lite.
Step 3 – For the initial setup of your device you will need to connect a HDMI cable and a USB keyboard & mouse. Insert the micro SD card into your Raspberry Pi and power up your device either via the PoE Switch HAT or through the PiJuice micro USB. You will need to press the SW1 button the PiJuice HAT.
Once booted up into the Raspbian command line you can login with the following default credentials:
Step 4 – At this point you will need to make sure you have internet access to download an dinstall the software. If you have connected the Raspberry Pi via Ethernet or through the PoE HAT then you should be ready to go. If not then you will need to connect to your local Wi-Fi network and you can do this through the raspi-config menu. Simply type in the following command:
From here you should see a menu system with various options. Select option 2 “Network Options” and the select N2 “Wi-Fi” to configure your Wi-Fi. You will need to enter the name of your Wi-Fi network exactly how it is spelt (SSID) and also the password.
Step 5 – Now we can go ahead and run the auto-installations script. Type in the following command:
curl -sSL https://raw.githubusercontent.com/PiSupply/PiJuice/master/MakerKits/remote-camera/motioneye-install.sh | sudo bash
The installation could take between 5-10 minutes.
Step 6 – Once the installation has finished it will then reboot your Raspberry Pi. On your computer open up a web browser and navigate to the following link:
Replace [your_IP] with the IP address of the Raspberry Pi. You can check this by running command “ifconfig” from the command line or by checking your router configuration.
Login using default credentials:
Step 7 – Now we can add our camera. At the top of the page select “Add Camera” and then select the following settings:
Click “OK” to add the camera.
You should see the camera now displayed in the main window. We have also added a script to report the battery level as an overlay to the camera. Click on the camera image and you should see the battery status.
You can view all the source code for this project on our GitHub page at – https://github.com/PiSupply/PiJuice/tree/master/MakerKits/remote-camera
You can also see the motioneye software here – https://github.com/ccrisan/motioneye
This project is a working progress and we will be adding features to it. If you have an idea or feature that you would like implemented then please contact us at firstname.lastname@example.org.