SmartPestSense

A pest monitoring device using 3D printing and coding to track activities of house mice and other sets that enter or trespass houses. Experiments will happen with 3D printed mice, meaning that no real organisms are involved.
Sophia Lee
STEM Innovation Academy Jr. High SW
Grade 9

Problem

Personal Motivation and Local Context

In my own home, this has been a major problem as mice were digging and damaging our backyard, leaving uneven surfaces that posed safety risks and caused extensive damage before we even realized an active infestation existed.

Image

Biological Characteristics and Classification

The house mouse (Mus musculus) is a warm-blooded, vertebrate mammal. It belongs to theKingdomAnimalia, PhylumChordata, ClassMammalia, OrderRodentia, andFamily Muridae. On average, an adult house mouse measures between 2.5 to 4 inches from its nose to the start of its tail, with the tail itself extending an additional 5 to 8 inches. As nocturnal animals, they are highly active at night. Furthermore, they heavily rely on a highly advanced olfaction system (sensory system for smell). This system includes a special organ called the vomeronasal organ, which is crucial for both their overall survival and communication.

Behavior and Habitat Preferences

When seeking shelter, house mice are instinctively drawn to warm, dark places, quiet areas, soft materials for nesting, and easily accessible sweet foods. To navigate their environments safely, they exhibit a survival behavior known as thigmotaxis, which means they prefer to move along walls and edges rather than risking exposure in open spaces.

Health and Property Risks

Rodent infestations introduce severe hazards to residential environments. Their presence creates severe health risks, including the spread of viral diseases, bacterial diseases, parasite diseases, food contamination, physical injuries, and the exacerbation of allergies.

Local Impact and Technological Interventions

Managing rodent populations is an ongoing struggle for many municipalities. For example, homeowners in Calgary have recently dealt with significant property and back- yard damage driven by sudden booms in local rodent populations, particularly voles. Effectively managing these modern infestations requires more than traditional or un- proven deterrents, such as ultrasonic pest repellers. As a result, the integration of modern technology, such as open-source rodent activity detectors, is playing a vital role in monitoring movement, understanding behavioral paradigms, and executing targeted pest control without unnecessarily disturbing the environment.

The Threat of Rodent Infestations

Rodent infestation, especially involving mice, is a common issue affecting many homes. Mice often enter houses searching for food, shelter, and warmth particularly during cold weathers. Once inside, they can cause significant damage by chewing on walls, insulation, wires, and even outdoor areas such as gardens and backyards. This not only creates structural and safety hazards, but also increases the risk of spreading diseases through contaminated food or surfaces.

Method

Experimental Design and Safety

The overarching purpose of this experiment is to create an innovative device that detects rodents’ activity, specifically validating a small, non-invasive, weatherproof sensor device that detects the presence and activity patterns of wild rodents (e.g., mice, voles, rats) in residential backyard settings. To keep wildlife and people safe and to minimize disturbance, the physical testing phase utilizes 3D printed rodent models, ensuring that no living organisms are involved in the experiment.

Enclosure Design and Hardware/Software

The monitoring device, named SmartPestSense, utilizes a tiny programmable computer known as the Micro:bit v2, alongside an ESP32-S3 Wi-Fi module to handle wireless communications. The physical dome structure was 3D modeled using Fusion 360, a cloud-based, integrated software platform. The design was then physically printed using a Bambu Lab A1 3D printer with PLA filament, a material known for its glossy surface finish and ideal suitability for detailed models. The structural design features four distinct entrances, allowing the system to track the cardinal directions (North, South, East, West) of incoming objects. Furthermore, the device is intentionally designed to be bottomless, which saves printing filament and allows users to place food items directly on the ground to attract rodents into the sensor pathways.

Enclosure Design

The enclosure components were fabricated using the Bambu Lab A1, a high-speed FDM (Fused Deposition Modeling) 3D printer known for its precision and reliability. The printer provides automatic bed leveling and vibration compensation, which ensured consistent layer adhesion and dimensional accuracy for the dome structure. PLA filament was selected due to its ease of printing, low warping characteristics, and environmentally friendly composition. A layer height of 0.2mm was used to balance surface quality and print time. The final printed enclosure achieved smooth surface finishing and precise alignment of the four entrance channels, ensuring proper sensor positioning and structural stability.

Image Initial design

Image Initial design (6 gates)

Image

Image Image Final Design

Circuit Hardware

The system uses the Micro:bit v2 as the primary microcontroller responsible for sensor data acquisition and basic control logic. The Micro:bit features a built-in ARM Cortex-M4 processor, digital input/output pins, analog sensing capabilities, and integrated Bluetooth functionality. In SmartPestSense, four IR sensors are connected to the digital GPIO pins of the Micro:bit. The board continuously monitors signal changes from each sensor to determine object presence and direction of entry. When a detection event occurs, the Micro:bit processes the input and transmits structured data through its UART (Universal Asynchronous Receiver-Transmitter) interface to the ESP32-S3 module. The Micro:bit was programmed using MicroPython, allowing efficient event-driven programming and easy integration without hardware interruptions. The ESP32-S3 module is responsible for wireless communication and web-based monitoring. It features a dual-core processor, integrated Wi-Fi capability, and multiple communication interfaces including UART, SPI, and I2C. In this system, the ESP32-S3 receives serial data from the Micro:bit through its RX pin and processes detection information in real time. Once data is received, the ESP32-S3 updates a locally hosted web server, allowing users to view detection events via a browser on the same network. Additionally, the ESP32-S3 controls a servo motor connected to one of its PWM-capable GPIO pins. When triggered, the servo lifts a small flag to provide a physical visual alert. This dual functionality—data communication and actuator control—makes the ESP32-S3 a central component in bridging hardware sensing and user interaction.

Image Figure 3.1: Circuit Diagram

Sensor Array and Detection Mechanism

For 24/7 monitoring, detection relies on four Infrared (IR) sensors that consist of an IR LED emitter and an IR receiver. These sensors send out IR light and check the reflection to handle obstacle detection, distance measurement, and object counting.

How IR sensor works

An Infrared (IR) obstacle detection sensor consists of two primary components: an IR LED emitter and a photodiode or phototransistor receiver. The emitter continuously projects infrared light, which is invisible to the human eye. When no object is present, most of the emitted light dissipates into the environment. However, when an object enters the sensing range, the IR light reflects back toward the receiver. The receiver measures the intensity of the reflected IR signal. If the reflected signal exceeds a predefined threshold, the sensor outputs a digital HIGH or LOW signal depending on its configuration. This binary output allows the microcontroller to determine whether an object is present within the detection zone. In SmartPestSense, four IR sensors are strategically positioned at the four entrances. By analyzing which sensor is triggered, the system determines the direction from which the object entered. Continuous polling enables 24/7 monitoring while maintaining low power consumption and rapid response time.

Servo motor for flagging up/down

A micro servo motor is integrated into the SmartPestSense system to provide a clear physical indication when a detection event occurs. The servo is controlled by the ESP32-S3 using a PWM (Pulse Width Modulation) signal generated from a PWM-capable GPIO pin. Standard hobby servo motors operate with a pulse frequency of approximately 50Hz, where the duty cycle determines the angular position of the servo shaft. In this design, two primary angular positions are defined: a default “down” position (e.g., 0◦) and an “up” position (e.g., 90◦). When the ESP32 receives a detection signal from the Micro:bit via UART, it immediately adjusts the PWM duty cycle to rotate the servo arm to the raised position. This lifts a small mechanical flag mounted on the servo horn, providing a visible alert to nearby users. After a short programmable delay, the ESP32 resets the PWM signal to return the servo to its original position, lowering the flag. This mechanism ensures that each detection event produces a brief but noticeable visual response without keeping the servo under constant load, which helps reduce power consumption and mechanical wear. The servo motor is powered by an external 5V supply to ensure stable operation and sufficient torque, while the control signal line is connected directly to the ESP32 GPIO pin. Proper grounding between the ESP32 and the external power source is maintained to ensure reliable PWM signal transmission. This simple yet effective actuator design bridges digital detection with tangible, real-world feedback.

Software Integration and Alert System

The software, programmed using open-source platforms like MicroCode and MicroPython, coordinates the hardware. The ESP32 does two jobs at the same time: it runs a small web server to show a simple web page, and it listens to data coming from the Micro:bit through the UART RX pin. If an object enters the device, the IR sensors detect it, notify the SmartPestSense website, and engage a servo motor to lift a flag as a visual indication that something has been detected.

Image Figure 3.2: IR Sensors attached to Micro:bit

Image Figure 3.3: IR Sensor to detect mouse

Software of Micro:bit

The Micro:bit v2 was programmed using MicroPython to implement real-time sensor monitoring and event-based communication. The software continuously polls the four IR sensors connected to its GPIO pins and applies a simple debounce logic to avoid false triggering caused by noise or rapid signal fluctuation. Each sensor corresponds to one cardinal direction (North, South, East, West), allowing the program to identify the direction of entry. When a sensor detects an object, the Micro:bit formats a short UART message string indicating the triggered direction(for example, “N”,“S”,etc.). This message is transmitted through the UART TX pin at a fixed baud rate to the ESP32-S3 module. The program structure follows an infinite loop design with lightweight delays to ensure low CPU usage while maintaining continuous 24/7 monitoring. In addition to detection, the firmware includes a simple state-control mechanism to prevent repeated transmissions while the object remains in the sensing range. A new transmission occurs only after the sensor state returns to idle and is triggered again. This ensures accurate counting and prevents duplicated alerts.

Software of ESP32 (MicroPython)

The ESP32-S3 was programmed using MicroPython to handle wireless communication, web hosting, and actuator control. The firmware performs two concurrent tasks: (1) listening to UART data from the Micro:bit and (2) operating a lightweight HTTP web server over Wi-Fi. Upon startup, the ESP32 connects to a predefined Wi-Fi network using stored credentials. Once connected, it initializes a simple socket-based web server that serves a minimal HTML page displaying detection status and event logs. When a UART message is received from the Micro:bit, the ESP32 parses the incoming direction code and updates the internal event counter. Simultaneously, the ESP32 controls a servo motor through a PWM-enabled GPIO pin. When a valid detection event is received, the software generates an appropriate PWM signal to rotate the servo arm and raise a visual flag. After a short delay, the servo returns to its default position. To maintain responsiveness, the main program loop is structured using non-blocking socket handling and periodic polling of the UART buffer. This ensures that the ESP32 can manage both network communication and hardware control efficiently without re- quiring a full real-time operating system. The use of MicroPython simplifies development while still leveraging the ESP32-S3’s dual-core processing capability and integrated Wi-Fi functionality.

Image Figure 3.4: ESP32 connection to Micro:Bit

(Materials are listed in my logbook).

Analysis

Testing Phase and Data Collection

The mouse monitoring device was rigorously tested in a span of a month to track its accuracy and data collection. During this time, many different tools with diverse surface areas and appearances were used to trigger the sensors, and all instances were successful. Using the Wi-Fi module, the system was able to accurately collect data of activity with IR sensors, alongside environmental metrics like temperature, an accelerometer for motion, and a mic for sound level. We have also 3D printed a mouse figure and tested it multiple times on my device. We can see that the testings have beens successful using the two images below.

System Performance and Reliability

This data was safely collected and transmitted to the custom-coded web page, which displays a simple interface of gates and counters that can be accessed using a phone or computer browser. The device successfully alerted the user to every detected movement, confirming its reliability in identifying an object’s presence. There may be some delays in displaying the information as the data is persistently getting collected.

The image below is the webpage that I have coded. It stores all data information for rodent detections, displaying each individual gate, temperature, light level, accelerometer strength, and sound level.

ImageFigure 1: SmartPestSense webpage testing #1

Figure 2: SmartPestSense webpage testing #2 Image

Identified Limitations + Future Improvements

Despite these successes, the analysis revealed specific operational limitations. Currently, the device requires a direct power line, causing it to be less portable in outdoor settings. Additionally, the PLA filament used for the physical housing is not suitable for high-stress applications due to its very low heat resistance, as it softens at approximately 60◦C.

1. Battery + Power line + Micro:bit The battery, power line, and Micro:bit is currently exposed and located outside of the shell. This can cause damage to the software and other components of the device in extreme weather or external objects. In my future work, I am planning on purchasing a smaller battery and redesign the hardware to have a higher ceiling for the wires and Micro:bit to be fitted inside and protected.

2. Eco-friendly Design/Material As I've mentioned, the filament I used for the hardware is PLA (polylactic acid). It's amazing for small details, fast print, and is biodegradable. Although it requires industrial composting facilities in order to break down and special conditions. It may not be the best for our environment. So, I have discovered a filament called PHA (polyhydroxyalkanoates). This filament is highly biodegradable in natural environments without leaving microplastics. Yes, it is an issue that the filament will break down in a shorter period of time that PLA, but I believe protecting our ecosystem is as important; we do not want any microplastics lingering around in our backyards.

Conclusion

Project Summary and Hypothesis Validation

Overall, the data and testing shows that the SmartPestSense device can monitor activ- ity effectively and provide accurate alerts for early detection. The results validate the project’s core hypothesis: if we can collect pest activity data, then we can narrow down areas with the highest pest activity, allowing us to target pest control efforts and prevent further infestation or damage.

Future Hardware and Software Enhancements

Future work will focus on addressing the current limitations and expanding the device’s capabilities. In the future, I am planning on adding a battery to power my device in order for more convenience and outdoor portability. I also hope to create a more advanced website or app integrated with AI that could be easily accessible. To enhance accuracy, a tiny camera will be added for AI to detect the object and properly track its intentional target. Implementing graphs will also immensely help when looking at progressive data over time.

Sustainable Material Alternatives

Finally, to improve the eco-friendly design and materials, I am hoping to transition to PHA, which are bioplastic synthesized filaments that are fully biodegradable and com- postable at home.

Citations

Acknowledgement

I would like to thank my science fair coordinators, Ms. Perez and Mr. Joseph, for their guidance, constructive feedback, and support throughout the completion of my project.

Also, I would like to acknowledge my parents for their support throughout my journey of building an innovative project despite the expenses and challenges I've went through. They have given me so much inspiration along with advices to improve my project.