Here's an update of the work we are doing building the cheap open source mothbox for @Hubertszcz

Cheap Automated Mothbox | WILDLABS
Hi everyone! @Hubertszcz has a biodiversity monitoring project in Panama, and we have been working on quick and dirty, ultra low cost high quality insect monitoring. We built a model last year that we tested out and has been getting decent data from! I'm crossposting from the GOSH forums where we are also developing and discussing it. There's more example images there! Mothbox v2 - Design and Thoughts? Hi folks! a project @Hubertszcz and i started up last year got some more funding thanks to the experiment.com thing. We got about 4-5K we are putting towards designing a new version of the device What is it? an automated device that lights up a sheet and documents the insects that visit it. We originally made it for reforestation groups that will use it to monitor changes in biodiversity (this is what @Hubertszcz is up to). This is how scientists usually use this technique for studying... GOSH Community Forum We got a tiny bit of funding for a couple weeks of design work and are gonna make a new version, and i'm checkin with you all to see if there's any extra things i should consider in the next design! Here’s some design targets for it:be weatherproof and self-contained and functioning while left outside in the rainforest for a month at a timeautomatically turn itself on for 4 random nights during that monthget high quality images of the insect visitors (for instance moths that are only 5mm long) that can be processed laterbe reliably usable by non-expertscost less than $400 in partsthe attractive/ photographable area should be at least the size of an A4 piece of paper (210x297mm)adaptable to use different types of lights (We have a weatherproofed USB attachment)Be carry-able by foot by a person to deploy deep into the field. Ideally a person could carry 2-3 of these at a time.Be robust to survive travel into difficult places to reachour current version has been built and tested over the past couple months. I was just about to do some testing with exactly these cameras, and @tom_august and @albags saved me the trouble with the testing they did in their very similar project Testing Raspberry Pi cameras: Results | WILDLABS So, we (mainly @albags ) have done some tests to compare the camera we currently use in the AMI-trap with the range of cameras that are available for the Pi. I said in a thread somewhere that I would share our results, I can't find that thread, so here are the results.First, the cameras we tested were:And the Hawkeye could not run at the full potential of 64MP because the Raspberry Pi we were using was not powerful enough, so it is at 32MP in the below.Here is the standard image that we took with each of the camera, though in the results I'm just going to show you a small part of each image so you can really get an idea of the variation in quality. The board had a 'test card' print out on it with a few moth wings attached for good measure.In the comparison you can see that all the Pi cameras are better than the webcam and are also much smaller and cheaper. There is not a big difference between the two mid-range cameras but the hawkeye is better quality, even running at half the resolution it can do. The Hawkeye is picking up individual scales on the butterfly's wing. That might be overkill for many applications, and generates bit image files, but if you need that kind of resolution its pretty good! wildlabsnet I was thinking about possibly testing out the 5MP arducam SPI cameras i could control with a microcontroller for ULTRA low energy use, but i think that that would be too low resolution for our purposes. It looks like the 16mp RPI cam would be fine, but i think we will stay with the hawkeye now that we got it working and getting better images. One of our main concerns right now is POWER. the whole thing can run on our battery for a night or two right now, but we want LONGER and i think we can get there with possibly better power management. @tom_august what system do you use to cycle your pi into lower power modes.Let me know any other thoughts on our design!these are some example cropped images
External design
In a lot of wilderness tool development, one finds a lot of the design work actually goes into making the project simpler and simpler.
In this overhaul of the mothbox, I started with fun lightweight system of telescoping rods that would be useful for potential future drone-deployable devices. Once built, though many of the potential failure points became obvious. So i worked towards a new design that would be heavier, but instead just fold out. This seemed great and moved us away from external metal parts that could corrode and fail. As I was putting together yhis prototype though, it helped me see some ways i could simplify manufacturing. A big reason i have seen many open science hardware projects not get used is because
- they have too many hard to find materials
- they are really difficult to build
- they are difficult to use
Or
- when they are in the field some parts break and it's difficult to repair them
So trying to make a effective tool that is aware of these concerns takes some iterations. Now for the outermost design i have arrived at what i hope is a super dead simple design.

No moving parts. The arms simply bolt on by hand with stainless steel ¼ bolts (with wingnuts) and the target locks on to the plastic arms.

Then when it needs to be transported, the entire thing pops apart and locks together in a folded position which protects the lens from damage.


Also the entire assembly attaches to the tripod mount which can then be attached to any type of box in the future.

We do re-introduce some metal parts, but im using some stainless steel ¼ in bolts which i have already personally tested on a sign i left out in the rain in the rainforest for 2+ years which still work. They should also be cheap and easy to source:)
Internal Design
In the meantime, i have been working on the internal design of the mothbox and how to securely hold all the parts together.

Everything Laser-Cutterable
Throughout This process i have been trying to make the final device use a minimal amount of manufacturing technologies. Everything is made to be laser-cutterable for a couple reasons:
- laser cutting can help us mass produce these devices much quicker (5 minute cuts instead of 10 hour prints) and with sturdier materials (extruded plexiglass instead of layered plastic)
- if we can laser cut it we can always still 3d print it if need be, but 3d printable designs cannot always be laser cut
- worse case scenario laser cut designs can be printed on paper and used as stencils for cutting pieces out with handtools like a jigsaw
A nice thing so far is that i seemed to have modelled the box good enough that the holes on the interior and exterior parts line up! Huge win!

As always, we are prototyping with Garbage as much as possible. These are all cardboard bits we use from the recycling (pizza boxes are perfectly 3mm sometimes!)
It's great to work like this because I can rapidly go through tests of different orientations and discover things that would have wasted a ton more precious plastic.
For instance I found that because of how we moved the camera to the center in V3 (as opposed to off-center in v2), the battery no longer fits in its previous orientation (just barely!)

Also the top lid of the box wasn't precisely modeled, and so the little lip was ignored which gets in the way of some of the internal harnesses. But with our cardboard prototypes we can quickly and easily identify annoying problems like these :)

Electronics design
The goal of the device is to be something we can leave unattended for at least a month which can turn itself on and off. Being power efficient and able to use very little energy when "off" while able to output large amounts of power when "on" is key. The raspberry pi doesn't come with the ability to go into ultra low power modes itself though several add-ons seemed promising.
Geekworm X728
The first i tried was the Geekworm X728. It is a UPS with built in backup batteries that has a real-time clock and advertises its ultra low power consumption when off and it's "auto-power on" ability. I was getting it set up and the drivers installed for the pi, however when I found out that "auto-power on" just meant it would turn on when plugged into a power source. This was annoying because it seems trivial to have designed this product with the ability to turn itself on. Instead i confirmed with the company there is no way to schedule a startup of the raspberry pi.
(Boooo!)
Waveshare Power Management Hat (B)
So next i tried the Waveshare Power Management Hat (B)
It also has a JST connector to Hook up a backup lipo battery to the device and a real-time clock. I also confirmed that there are existing scripts that show the device can turn itself off and turn itself on according to a schedule.
The main challenge with this board though is that they seemed to have hard coded some of their example software and firmware to specific user names (pi@raspberry pi), so to run their tutorials has run into errors in the cmake lists. I contacted the company and am waiting for them to help me get this device turning itself on and off. But I'm optimistic!
Also if anyone has any other tried and true solutions for power management, let me know.
One thing i was hopeful for about the Waveshare power Management hat is that I also have a Waveshare relay board that was quick and easy to get working, and it stacks right on top of the power management board.
Unfortunately Waveshare didn't make their boards compatible and i confirmed a GPIO conflict between the power management hat and the 3 gpio pins of the relay board. That would have been wayyy too easy and convenient!
24 October 2023 9:05am
Hi Andrew,
thanks for sharing your development process so openly, that's really cool and boosts creative thinking also for the readers! :)
Regarding a solution for Raspberry Pi power management: we are using the PiJuice Zero pHAT in combination with a Raspberry Pi Zero 2 W in our insect camera trap. There are also other versions available, e.g. for RPi 4 (more info: PiJuice GitHub). From my experience the PiJuice works mostly great and is super easy to install and set up. Downsides are the price and the lack of further software updates/development. It would be really interesting if you could compare one of their HATs to the products from Waveshare. Another possible solution would be a product from UUGear. I have the Witty Pi 4 L3V7 lying around, but couldn't really test and compare it to the PiJuice HAT yet.
Is there a reason why you are using the Raspberry Pi 4? From what I understand about your use case, the RPi Zero 2 W or even RPi Zero should give enough computing power and require a lot less power. Also they are smaller and would be easier to integrate in your box (and generate less heat).
I'm excited for the next updates to see in which direction you will be moving forward with your Mothbox!
Best,
Max
27 October 2023 6:44am
Thanks a lot for this detailed update on your project! It looks great!
Maximilian Sittinger