-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This document provides step-by-step guidance on how to assemble, program, and operate a Power interval Camera [and sensor] Automation Module (PiCAM) designed by the Terrestrial Ecosystem Science & Technology (TEST) Group at Brookhaven National Laboratory. This guidance is provided in alignment with a Wikipedia version that can be found on PiCAM GitHub: https://github.com/TESTgroup-BNL/PiCam/wiki. For any questions you have regarding this guidance, please contact:
Andrew McMahon ([email protected]), Daryl Yang ([email protected]), Jeremiah Anderson ([email protected]), Shawn Serbin ([email protected])
A complete guide on how to assemble a PiCAM can be found at: https://github.com/TESTgroup-BNL/PiCam/wiki/How-to-assemble-a-PiCAM
A complete guide on how to program a PiCAM can be found at: https://github.com/TESTgroup-BNL/PiCam/wiki/How-to-program-a-PiCAM
When first powered on, the PiCAM will first turn on the nRF supervisory microcontroller. The nRF will then attempt to:
- Power on the Pi Zero,
- Read the configuration file stored on SD card,
- Power on the Pi Camera module and take a picture,
- Power on the GPS module and get a GPS lock for time and location (the GPS module has a green LED that is visible through the camera window). This step might take one to a couple of minutes to complete.
At this point, the camera will show up as a Bluetooth device and can be scanned by any device with Bluetooth Lower Energy (BLE) capacity, but will not yet show accurate information (ID, date, time) in the advertising string. Once a GPS lock is acquired (or times out), the camera will enter “normal” operation mode, where the scheduled event loop takes over. Once in the main loop, the Bluetooth advertising information will be updated every 5 seconds, and it will respond normally to Bluetooth connections.
Once operating, the PiCAM will capture images at the interval specified in the configuration file (https://github.com/TESTgroup-BNL/PiCam/blob/main/Pi_Firmware/cam_cfg.txt). The image interval is synchronized to hours/minutes so that offsets are evenly spaced throughout the day starting from 12 AM, rather than a timed interval between images. For example, if a camera is set to a 15-minute interval and powered on at 11:52 AM, its first image will be at 12:00 PM and the next at 12:15 PM, rather than a direct offset of 15 minutes from power on, which would give uneven times of 12:07 PM, 12:22 PM.
Turning on/off: The camera starts when the batteries are connected and stops when they are disconnected; there is no other start/stop mechanism. Disconnecting power while an image is being saved should be avoided as much as possible as this could cause SD card corruption. (Users can look at the UART terminal or dashboard to check if an image is currently being captured). There is no other “safe power down” requirements.
The Bluetooth function of a PiCAM stays on at all times and can provide information in a variety of ways:
An advertising string is visible without connecting or any specific software. Any device (phone, computer, etc.) that can scan for Bluetooth Low Energy (BLE) devices should be able to “see” it. The format of the advertising string is shown below:
-
Example: PiCam001 95 0512 08/07 13:08
This connection provides a terminal-like text interface. The Adafruit Bluefruit Connect app works great for this and is available for both Android and iOS. Usage: Once connected to a PiCAM, the app will receive periodic strings from the camera with basic status information. Sending any character will trigger the app to print out a menu with several options:
-
'c': Print cfg
-
'g': Get GPS fix
-
'i': Capture image now
-
'r': Reload cfg
-
't [YYYY,MM,DD,hh,mm,ss]': Set time
Sending a specified character listed above will trigger the command. If users do not wish to print the menu, sending a double character of any command above will execute it without displaying the menu. For example, to quickly trigger getting a GPS fix, sending ‘gg’ will immediately start that command.
Link to Dashboard: file:///Users/darylyang/Desktop/gdrive/protocols/phenocam/picam/CamInfo_Nome2021/Dashboard/index.html
The web dashboard provides the most remote functionality including all the items from the UART menu as well as getting preview images and syncing time to the host. It displays the UART data as a text feed and additionally parses it to better display the data.
The dashboard utilizes Web Bluetooth, which is currently an experimental API but has reasonable support for Chrome (the progress of adoption can be checked here). Nevertheless, some bugs and changes should be expected as this continues to develop. The current site being used for testing is hosted at https://web-picam.glitch.me/. Tip: Connecting can take 10-15 seconds; if the Bluetooth icon hasn’t appeared on the tab yet, clicking connect again sometimes does the trick. Other times it causes a disconnect or a “double connection” where everything is printed twice (though commands still work fine).
Preview image: When triggered, this powers up the Pi, captures a low-resolution image, and transfers it to the nrf52840, which finally transfers it to the dashboard. Transferring from the Pi to the nrf52840 can be very slow (it’s 230400 baud serial), so it may take 15-30 seconds even for a small image. The Bluetooth transfer is generally much faster, taking only a few seconds. Chrome can be picky about rendering the image once it’s received; if it isn’t displayed immediately, try opening/switching to a different tab and then back to force it to redraw.
Important: While connected to Bluetooth (UART or dashboard), the camera is consuming about 10 times as much power as in “normal” standby, so it is important to not stay connected indefinitely and to remember to disconnect! (If a connection is dropped by a device moving out of range or interference, the camera will automatically drop the connection rather than being stuck in connected mode.)
- The SD card can be safely removed or inserted without powering down the camera provided it’s not actively trying to save an image. This allows checking data without restarting a run, but should still be done with caution.
- It is highly recommended to use tweezers to pull out the SD card. The D-cell case containing the Pi and nrf52840 cannot slide out of the camera body with the camera and GPS modules connected. Trying to pull it will likely pull the ribbon cable out of the Pi, requiring the camera and GPS modules to be disconnected and removed, the cable reattached to the Pi, and then fed back through the body. (In other words, an annoying amount of work.)