This is the second post in a series:
- Autonomous Moth Trap Project
- Autonomous Moth Trap Hardware Revisions
- Hardware and Software updates to Autonomous Moth Trap
- Alternatives for Autonomous Moth Trap
- Software components for Autonomous Moth Trap
- Time Lapse module for Autonomous Moth Trap
The Autonomous Moth Trap project seeks to build on the work of Kim Bjerge and his colleagues in developing a simple system controlled by a Raspberry Pi 4 for capturing images of live moths attracted to a UV light and a set of tools using OpenCV image processing and machine learning to recognise the moths imaged. My earlier post documented the results of building a version of the trap that more or less exactly replicated the setup of the Danish design, other than rewiring the LED light table so that it could be controlled with the other lights rather than requiring manual intervention.
Standardisation is key to ensuring that biodiversity observations are as comparable as possible across time and space. I have been keen not to modify the Danish system unnecessarily. However, I would like to solve some challenges now rather than leaving them until after I have been running my system for a while.
My most significant concern has been around the use of a 15W fluorescent tube for the main light that attracts the moths. These work and attract moths, but the electronics to run these well on DC are complicated and the tubes tend to blacken at one end over time and lose brightness, which inevitably introduces variation and difficulty in comparing the resulting data. It therefore seems appropriate to replace the tube with an array of high-power LEDs. I have decided to build a trap with 9 such LEDs. This significantly changes the power requirements for the trap and is probably only appropriate for use with mains power, but I want to experiment with the capabilities of the LEDs before attempting to construct a battery-powered version.
Secondly, I wanted to collect some basic environmental measurements as the images are collected, so I have added a basic temperature and humidity sensor to be read by the Raspberry Pi.
Additionally, the first version I built lacked some basic control features:
- Shutting down the system safely (rather than simply cutting power) required an ssh connection to the Raspberry Pi. I wanted to add at least a tactile switch to trigger a safe shutdown and have modified this Pi Power Button example.
- The Raspberry Pi fan was wired straight to the 5V pin and continued to run, even when the Raspberry Pi was shut down. I wanted it only to run while the system was active (and potentially to disable it below some temperature) and have used this approach from the Raspberry Pi Forum.
- The only way to be certain that the system was running was to listen for the fan (or to use ssh or some other access protocol). I wanted to add an multicoloured LED so I could show operational status. I considered using a full-RGB LED (four pins) but only require a bicolour LED (red/green, two pins).
- On Twitter, Hernán L. Pereira pointed out the need for a flyback diode on the resistor, so this has also been added to the circuit.
- I’ve also added a second method to turn on the lights for testing purposes, a toggle switch connecting 3.3V power to the same transistor normally activated/deactivated by a cron job on the Raspberry Pi. A tactile switch would have been appropriate, but I wanted to avoid confusion between the power on/off switch and the light testing switch.
The diagram at the top of this post was created using the very friendly tools at https://circuit-diagram.org/, where it can be accessed here. It shows the circuit as currently planned. I have organised the use of the Raspberry Pi pins to keep the circuit clear and uncluttered.