Eco-Friendly Automated Mosquito Trap With Arduino Nano
by galofel in Circuits > Arduino
1304 Views, 9 Favorites, 0 Comments
Eco-Friendly Automated Mosquito Trap With Arduino Nano
Mosquitoes lay their eggs in standing water. A farmer near me taught me a trick: if you let the eggs develop but flush the water before they hatch into adults, you skip the next generation. Repeat every 4 days for a few weeks and the local population drops to almost nothing.
I set up a small garden pool to attract them. The problem? You have to drain and refill every 4 days. Miss a cycle and you're breeding mosquitoes. So I automated it with an Arduino Nano.
No chemicals. No citronella. No bug zappers. Just water and timing. Total cost: ~$35-40.
Supplies
- Arduino Nano V3.0 (or Every)
- 5V Submersible Mini Water Pump
- 12V DC Normally Closed Solenoid Valve (1/2 inch)
- 2-Channel 5V Relay Module (SRD-05VDC-SL-C)
- 2-Wire Liquid Level Float Switch
- 12V 2A DC Power Supply
- DC Barrel Jack Adapter (Female)
- LM2596 Buck Converter Module
- Jumper wires
- Weatherproof enclosure
Tools:
- Soldering iron
- Wire strippers
- Multimeter
- Screwdriver
Prepare the Power Supply
Connect the 12V power supply to the DC barrel jack adapter. Wire the positive and negative outputs to two rails: one goes directly to the relay module's COM2 terminal (for the solenoid valve), the other goes to the LM2596 buck converter input.
Set Up the Buck Converter
Before connecting anything else, power on the 12V supply and adjust the LM2596 potentiometer with a small screwdriver until the output reads 5.0V on a multimeter. This powers everything except the solenoid valve.
Important: Do this BEFORE connecting the Arduino. Sending 12V to the Nano will fry it.
Connect the Arduino Nano
Wire the 5V output from the buck converter to the Nano's 5V pin (not VIN). Connect GND to GND.
Wire the Relay Module
- Connect 5V and GND from the buck converter to the relay module's VCC and GND
- Arduino digital pin → Relay IN1 (pump control)
- Arduino digital pin → Relay IN2 (valve control)
- Relay 1 COM → 5V, Relay 1 NO → pump positive wire
- Relay 2 COM → 12V, Relay 2 NO → solenoid valve positive wire
Wire the Float Switch
Connect one wire to an Arduino digital pin (enable internal pull-up in code), the other wire to GND. When water is high, the switch closes the circuit.
Connect the Pump and Valve
- Pump negative wire → GND (5V rail)
- Solenoid valve negative wire → GND (12V rail)
- Position the pump at the bottom of the pool
- Connect the solenoid valve to your water supply line
Upload the Code and Test
Upload the code to the Arduino Nano, open Serial Monitor, and manually trigger a test cycle. Verify the pump drains fully and the valve refills to the correct level.
Start with a shorter test cycle (every few hours) before setting it to the full 4-day interval.
Set Up the Pool
- Any small container works: a bucket, a plant pot saucer, an old basin
- Place it in a shaded area near where you spend time outdoors (mosquitoes prefer shade)
- Recycled house water works great - mosquitoes aren't picky
- Put the electronics in a weatherproof enclosure nearby
Tips and Results
Tips:
- Waterproof your electronics. The pump and float switch can get wet, everything else should stay dry.
- Secure the float switch. If it shifts, it reads the wrong level.
- If your water supply runs out or the valve fails, the pool stays empty and mosquitoes just go elsewhere.
After about 3 weeks of running, the mosquito situation in our yard went from unbearable to barely noticeable. We can sit outside in the evening again.
I used Make-it to plan this project. It generated the initial parts list, wiring, and code which I then tweaked for my setup.