A compact, automated hatch controller for a moth trap, designed for the Seeed Studio XIAO (SAMD21 Cortex-M0+). This project combines simple electronics, robust firmware, and 3D-printed parts to automate the opening and closing of a hatch for insect trapping or similar applications.
- Automated Servo Control: Opens/closes hatch based on trigger input.
- PlatformIO/Arduino: Easy to build and upload.
- 3D Printable Hardware: STL files and Fusion 360 assembly included.
- Microcontroller: Seeed Studio XIAO (SAMD21 Cortex-M0+)
- Servo Motor: Standard SG90 hobby servo
- Trigger: Digital input (e.g., button or sensor)
- 3D Printed Parts:
- Bracket.stl
- Hatch.stl
- PCB cap.stl
- PCB insert.stl
- CAD Source:
hardware/Moth trap assembly.f3z
- PlatformIO
- Seeed Studio XIAO (SAMD21)
- Standard SG90 hobby servo
- Trigger button/sensor
- Clone this repository:
git clone https://github.com/ScionResearch/moth-trap-hatch.git cd moth-trap-hatch - Open in PlatformIO (VSCode recommended).
- Connect your Seeed XIAO board.
- Build and upload:
pio run --target upload
- The servo is attached to
PIN_SERVO(default: pin 10). - The trigger input is on
PIN_TRIGGER(default: pin 9). - When the trigger is pulled LOW, the servo moves to the DOWN position; otherwise, it stays UP.
- Debounce is handled crudely with a 1s delay.
- STL files for all mechanical parts are in
hardware/3MF files/. - The full assembly is in
hardware/Moth trap assembly.f3z(Fusion 360 format).
Pull requests and suggestions are welcome! Please open an issue first to discuss major changes.
This project is licensed under the MIT License. See LICENSE for details.
- PlatformIO community
- Seeed Studio for XIAO platform
- Arduino ecosystem
- All contributors and testers
For questions or support, please open an issue on GitHub.
