UV-Light Bug Trap 🦟🦟

 UV-Light Bug Trap🦟🦟


So, what's that one annoying, noisy and practically quite invisible thing that disturbs you at night? You must have guessed it. MOSQUITOS 🦟🦟- the no. 1 thing that I feel the most irritated by ever 😫😭. Whenever I try to work, they either keep hovering right beside my ear or keep stinging me on my leg. This situation was worsening as the monsoon arrived, and I couldn't handle it anymore. We'd tried using the Hit spray, a simple agarbatti coil, etc. But nothing worked. That's when I decided to take the matter into my hands. 

So, when I was browsing for solutions that would be innovative and creative, I came across a man who had developed a project to reduce the number of mosquitoes near his sheep. I clicked on it and started analysing it. This is the link to the original project-Link to the original project. I loved it and I decided to make it. It was a unique project that was definitely going to take a long time. 

At first, I had to 3D print the whole body with its parts that contained the components like a fan, the electronics, and the solar panels, etc. So, I 3d printed them, which took a long time. There were four parts of the whole structure. It took 8 hours to finish.

Then, the electronics and all were to be ordered, which took 7-9 days to arrive. I even changed some components according to my preference and convenience. Then, after they arrived, I analysed the circuit, which was a little complex. But after taking help, I understood it and started making the basic circuit to see if it works, first. After it was working, I took the next step towards making the whole thing. 

The whole process with steps is given below:

Electronic components:
  • Seeed Studio XIAO SAMD21
  • 4* 70x70 6v solar panels (Use these if they're available, I've used bigger ones)
  • 12v 120mm DC Fan (I've used the smaller version, but same voltage)
  • 12* 365nm UV LED 5mm (These are good, but I've reused these from an old UV LED torch)
  • Slide Switch
  • 4* 9.5 mm OD X 6.5mm ID aluminium tube 60mm (You can use these, I've made a different support structure)
  • Solar Lipo Charger (3.7V)
  • Mini 360 DC-DC Buck Converter Step Down Module
  • DC-DC Boost 2A - MT3608
  • LDR
  • 1S2P Li-ion Rechargeable Battery Pack (I've used two separate batteries with a battery holder)
  • 2* IRLZ44N MOSFET (These are not commonly available; you'd need to do some intense searching)
  • 3* 10k Resister
  • 1* 500R Resistor (These were not available, so I used 2x 220R and 1x 100R resistor)
  • Connecting wires (Not jumper wires)
  • 4x double screw connectors
  • 8x 3mm small screws
  • Big zero PCB
  • 4x M2 screws
  • M-seal
Tools:
  • 3D printer
  • Soldering gun and accessories 
  • Glue gun
  • Drill machine with 2mm, 4.5mm and 5mm bits.
  • Screw drivers
  • Grinder (Optional)

Steps:

1. 3D print all the parts of the structure with the given files from the Google Drive link below-





2. Take your zero PCB and all your electronic components. Using some wires, make the circuit as shown in the diagram below, except for a few changes, such as the change in resistors and some connections are made using screw connectors for convenience. 


3. At the beginning of making the circuit, we need to calibrate both DC-to-DC models. For MT3608, we should provide 4.2V at the input and adjust the potentiometer until we receive 12V at the output. For the Mini 360, provide 12V at the input and turn the potentiometer until we get 5V at the output.

4. To connect the solar panels, first apply glue to the back of each solar panel and attach them to the top cap, which serves as the upper lid of the entire structure. Make sure the solar pins are visible through the back of the top cap. 

Next, connect all the solar cells in parallel. Use paper tape to secure the wiring in place. Then, solder a long wire to connect the solar panels to the solar charger. Finally, connect the solar power output from the panels to the solar power input of the charger controller, which is the solar LiPo charger.



5. Make your own PCB using all the electronic components except for the fans, LEDs, LDR, batteries, solar panels, switch and the LiPO charger. I've made the PCB as shown below with the components from above and from below, with the soldering connections, etc.






6. Take all the components and connect them to the PCB according to the circuit using the screw connectors. 




After that, take your XIAO board and upload the code given below.

// Pin definitions
const int ldrPin = D0;       // D0 (LDR input)
const int uvLedPin = D1;      // D1 (UV LED)
const int fanPin   = D2;      // D2 (Fan)

// LDR setup
const float vRef = 3.3;
const int adcMax = 1023;
const float dayThreshold = 2.9;  // ≤ 2V = Bright (Day)

// Timing
const unsigned long uvOnlyDuration = 60000;  // 1 minute
const unsigned long fanOnDuration  = 30000;  // 30 sec

void setup() {
  pinMode(uvLedPin, OUTPUT);
  pinMode(fanPin, OUTPUT);
  digitalWrite(uvLedPin, LOW);
  digitalWrite(fanPin, LOW);

  analogReadResolution(10);  // 10-bit ADC
  Serial.begin(9600);
}

void loop() {
  float voltage = readLdrVoltage();
  Serial.print("LDR Voltage: ");
  Serial.print(voltage, 2);
  Serial.print(" V - ");

  if (voltage > dayThreshold) {
    Serial.println("Dark - Start cycle");

    // Turn on UV LED only
    digitalWrite(uvLedPin, HIGH);
    digitalWrite(fanPin, LOW);

    if (!waitWhileDark(uvOnlyDuration)) return;

    // Now turn on the fan
    digitalWrite(fanPin, HIGH);
    if (!waitWhileDark(fanOnDuration)) return;

    // Turn off fan (UV LED stays ON)
    digitalWrite(fanPin, LOW);
  } else {
    Serial.println("Bright - Powering off");
    digitalWrite(uvLedPin, LOW);
    digitalWrite(fanPin, LOW);
    delay(500);
  }
}

// Helper: read voltage from LDR
float readLdrVoltage() {
  int raw = analogRead(ldrPin);
  return (raw / (float)adcMax) * vRef;
}

// Helper: wait during dark period, exit early if it gets bright
bool waitWhileDark(unsigned long duration) {
  unsigned long start = millis();
  while (millis() - start < duration) {
    float voltage = readLdrVoltage();
    if (voltage <= dayThreshold) {
      Serial.println("Daylight detected - exiting early");
      digitalWrite(uvLedPin, LOW);
      digitalWrite(fanPin, LOW);
      return false;
    }
    delay(100);
  }
  return true;
}

Note: The Xiao board that you're using is not available on the Arduino IDE software, so you'll have to follow the steps given in this video link at 5:33 minutes- Link to YouTube video

7. After uploading the code, test it. The LDR should detect darkness and automatically switch the LEDs on for 1 minute, and after 1 minute, the fan would turn on for half a minute. If this works correctly, then move on to the next step.






8. Now, it's time to assemble the structure and join the parts together. 

 

First, you'll notice that there is a compartment designed for the PCB. In the centre, there is a larger hole where the LEDs will fit; I've provided designs for both integrated and separate LEDs. Additionally, on one side of the box, two spaced holes will accommodate the wires from the fan. 

 

Inside the box, you will find four small pillars where you can secure your LiPo charger using four M2 screws. There is also a hole for the slide switch, with two additional holes nearby for the LDR (Light Dependent Resistor) wires to exit. Finally, place the battery holder in the empty space opposite the PCB. Use double-sided tape for stability.

 

Arrange all the components as described, and then you can proceed with the next steps.







9. After arranging all the components, fix the fan with hot glue to its respective box. After that, take the M-seal and take small pieces of M-seal and put them in the 4 pillars on the solar panel lid. Then, take 4x 5mm screws. Cut their heads off using the grinder and put them in the 4 pillars, and don't forget to keep them straight to dry. 


After drying, take their corresponding nuts, keep them aside.



10. This step is important but can be quite challenging. Begin by taking the four support structures and their corresponding discs. Use eight 2mm screws to attach the support structures and discs to the fan box through their designated holes. This task can be difficult and time-consuming due to the limited space for the screwdriver to rotate. 


Next, take four 3mm long bolts and their nuts. Insert the bolts through the bottom of the support structure and into the components box, then secure them using the nuts.


11. This is the final assembly part. Secure the solar panel lid to the components box using the nuts kept aside before. 




12. Take the insect collection tray and slide it under the fan box. Our assembly is done. Now, test the trap. If it is working, then... YOUR UV-LIGHT BUG TRAP IS READY!!!






This is my final working model:





And this is my first mosquito after keeping it on for the whole night.








Comments

Popular posts from this blog

Creating a Home Automation Project Using Xiao board and Wi-Fi

Making a Neon LED Sign Board

Creating a Home Automation Project Using MIT App Inventor