Introduction: DIY Rechargeable Electronic Mosquito Repeller

About: Tanmay Bhonsale a.k.a enceladus2000

Hey everyone! In this Instructable I'll be showing you how to make your own rechargeable electronic mosquito repeller!

An electronic mosquito repeller is quite handy, especially those living in hot and humid climates, where mosquitoes are very common. As it is compact and rechargeable (lasts 30+ hours! ), it is also very useful for picnics, camps, and outdoor areas.

If scaled down a bit, after some experimentation, this project can cost as less as $4-$5. This is ideal for poor people living in rural areas tropics, where medical facilities may not be adequate. In such places, prevention, not cure, is essential for a long lifespan, and a cheap device like this can make things much better.

This sub-$15 device emits ultrasonic sound waves, that irritate mosquitoes and many other insects. It also gives a green light, that also helps repelling mosquitoes...

Features of the Electronic Mosquito Repeller:

  • Rechargeable - The entire project is powered by a 2600mAh USB powerbank, that's usually used to charge phones.
  • Long Life - Lasts for more than 30 hours on a single charge, thanks to the powerbank.
  • Experimentable - As it uses a microcontroller, this project is very hackable. Program it not just to repel mosquitoes, but other animals like dogs, cats, lizards etc., or add more sophisticated features...See the last step...
  • Effective - Uses 4 piezo elements, so its loud enough for a medium sized room, or your verandah.
  • No side effects - Unlike vapourizers and coils, it does NOT release harmful chemicals. Also the sound emitted by the repeller cannot be heard by humans (and domestic pets, provided you program it with the correct frequency), so it doesn't disturb anyone...
  • Cheap and Easy to make - If you want you can scale the project down, the whole thing will cost perhaps less than $5 :-).

Step 1: About Electronic Mosquito Repellers...

Why use Electronic Mosquito Repellers?

In addition to being pesky bloodsuckers, mosquitoes are also carriers of various diseases, like dengue, malaria etc. These diseases can even prove to be fatal for the poor, who have little access to medical care.

Methods of repelling mosquitoes have been around for a long time. Most of us are familiar with mosquito repellent creams, wristbands, clothes and plug in devices. Out of these, mosquito repellent wall plug vaporiser devices are the most effective. However, they vaporize chemicals that are not only harmful to mosquitoes, but to humans as well. See this article for more information on how vaporizers and coils are harmful...

Electronic mosquito repellers, on the other hand, are as effective, but require no toxic chemicals to work. They are much more safer, and require less energy than vaporizers. Here is a Wikipedia article on "Electronic Pest Control".

Stuff covered this Instructable:

  • Learn about electronic pest control
  • Assemble an Arduino on a breadboard.
  • Program an atMega328 microcontroller with an Arduino
  • Use a USB powerbank to power your microcontroller
  • Use piezos or speakers to repel mosquitoes

About Electronic Mosquito Repellers:

How does the Electronic Mosquito Repeller work?

An Electronic Mosquito Repeller repels moquitoes by using a small speaker or piezoelectric disk to generate ultrasound.Ultrasound - Sound that has a frequency of more than 20kHz is called Ultrasound. It usually cannot be perceived by the human ear.

The frequency of these sound waves is in the order of 20kHz to 100kHz. These sound waves cannot be heard by humans, however they can be heard by some animals, usually those that are small.

What is the relation between (US) Ultrasound and animals?

Even though human ear cannot sense US, many animals can produce and hear US. Many insects, rodents, bats and small mammals communicate through US. Insects have sensory structures to produce and detect ultrasound. Cockroaches have “Sensory hairs” to sense US. Spiders, Wasps, Beetles, Flies etc have a “Tympanic membrane” to detect US. Fleas communicate using high frequency US . Male Mosquitoes produce US to attract females. Female mosquitoes have sensory structures to receive US. Spiders, lizards also have ability to sense US.

How does US affect animals?

The US sensors are present in the antennae of Mosquitoes and genetalia of Cockroaches. US emitted by the Repeller will scare away the pests and confuse them. Ultrasonic sound will create stress on the nervous system of insects and jam their own US frequency. This will immobilize the insects and they escape from the source of US.

How does Ultrasound repel Mosquitoes?

Male mosquito is the natural enemy of female mosquito after breeding. Both male and female mosquitoes use plant juice as food. But female mosquito requires human blood protein for the maturation of their eggs. Male mosquitoes will not bite human beings. On the first day of emergence, the female mosquito will not bite but after mating with male it starts to bite human beings to get blood. Female mosquito will not allow males to mate again and they avoid the presence of males. Females detect the presence of males by sensing the US produced by the males. If an US generator is used, it will imitate male mosquito by producing 38 kHz US . This will repel Female mosquitoes. Moreover the US will create stress on the US sensillae present on the antenna of female mosquitoes, so the move away from the source of US .

How does this circuit (in my Instructable) work?

In my Electronic Mosquito Repeller, I have used an atMega328 with an Arduino bootloader as the the heart of the project. It is programmed (with the easy-to-use Arduino software) to generate a high pitched tone, that is converted to ultrasound by piezoelectric disks or a small speaker.

Of course, I could have used a simple 2 transistor oscillator, but I chose a microcontroller so that I could program it with a specific frequency after a little experimenting. I can also add more features a later.

More FAQs on Electronic Mosquito Repellers...

Does the US pass through walls?

No. Ultrasound will not pass through walls like the ordinary sound waves. When the US hits an object,it bends and round the object and spreads.

Is it safe for human beings?
US Pest Repellers are widely used in Homes, Gardens, Farm yards etc. to repel various kinds of pests. Commercial US Pest Repellers are designed to emit US in the frequency range 20 kHz to 100 kHz. US above 20 kHz is inaudible to man but children can hear the US to a certain level up to 30 kHz. Many house hold appliances like Telephone, Computer, Vacuum cleaner etc emit US, but we cannot hear it because it is inaudible. US is considered as the safest method for scanning pregnancy. US scanning is widely used in hospitals. Echocardiogram also uses US to image the heart’s functions. As per the scientific information, US will not cause any health problems.

Is there any safety recommendations?
US is biologically safe to human beings as per scientific information. But US frequency close to 30 kHz can be sensed by children to a certain level. So it is recommended not to use such devices continuously near the children below 5 years.

Can we make one without any microcontroller?

Sure you can - check out this awesome Instructable. However it won't be as easy to use and experiment with as a micrcontroller. Changing the frequency would require you to change the capacitors and resistors with accurate values, which isn't really practical for this situation...

Step 2: Materials...

Time: ~6 hours

Cost: ~$10 - $18 (excluding an Arduino board)

Difficulty: Medium


To make an Arduino on a breadboard:

To make the mosquito repeller circuit:


  • Piezoelectric disks * 4 (Sparkfun)
  • More jumper wire

For the power source:

  • Any cheap USB powerbank (eBay)
  • Schottky diode - 1N5819
  • DC sockets- male and female
  • USB mini cable * 2
  • More wire

Step 3: Assemble the Arduino on the Breadboard...

Basically an Arduino (Uno) is based on the atMega328 microcontroller. Hence we will assemble this microcontroller on a breadboard with the required components, except the USB interface. Follow the pictures, diagram and its tags shown above for assembling the Arduino on a breadboard.

I recommend that you too stick a sticker like mine on the ATmega328 chip. Below is a download. Download and then print it. Then apply some glue stick and stick it to the chip...

Step 4: Prepare the Arduino Board and Your ATmega328 for Programming...

For Arduino UNO users:

The process of programming another ATmega328 is very easy for those who have an Arduino UNO. All you need to do is, take out the existing chip, replace it with the chip (that has been bootloaded) you want to program, then upload sketches like you would normally do. For more information (and how to bootload an ATmega328) see this tutorial.

For other Arduino board users:

This process isn't very simple for those using other Arduino boards with non-replaceable chips, like the Leonardo, Mega and Lilypad. To prepare to program the ATmega, follow these instructions:

  1. Upload the ArduinoISP sketch to your existing Arduino Board.
  2. Disconnect the Arduino from power.
  3. Make the connections between your Arduino board and the ATmega328, as shown in the Fritzing diagrams above (for Mega and non-Mega boards also).

Now go on to the next step to see how to program your ATmega...

Step 5: Program Your ATmega328...

*Arduino UNO users taking the easy way way skip this step*

Follow these instructions to upload sketches to a bootloaded ATmega328 via an Arduino Board

  1. Select Arduino UNO from Tools < Boards in the Arduino Software.
  2. Select Arduino ISP from Tools < Programmer.
  3. Copy the sketch from below.
  4. Then click - File < Upload Using Programmer.

Pictures shown above will help. It probably wont happen the first time you do it, but it will definitely happen the second time. The code uses the "tone" function to generate a square wave pulse at a specified frequency on a specified pin. For more see this tutorial and this reference...

Here's the code;

int speaker = 9;
int frequency = 31000; // 31kHz !!!

void setup(){
  pinMode(speaker, OUTPUT);

void loop(){
  tone(speaker, frequency, 1000);

Step 6: Make the Mosquito Repeller Circuit...

The mosquito repeller circuit consists of a transistor that amplifies the current from the AtMega328's output to run the piezos.

Step 7: Prepare the Power Source...

I will be using a 2600mAh Li-ion USB powerbank as the batter for the project. Its advantages are:

  • Enables fully enclosed project enclosure, as there is no need to change batteries.
  • Convenient.
  • No need of adding a voltage regulator for the circuit.
  • Can be hooked up to solar panels or something like that later on...

Follow the pictures, diagram and their tags above to complete the power circuit...

Step 8: Prepare the Powerbank...

Please see the pictures and their tags above to prepare the connectors for the USB power bank. The mini USB is inside the project enclosure, for charging the powerbank. The standard USB is connected to a 5V phone charger to charge the powerbank from the outside via the DC sockets...

Step 9: Prepare the Enclosure...

I got a clear plastic box from a Ferrero Rocher box. The Breadboard fits in well, with plenty of space to spare.

Cut out a piece of firm white cardboard (mountboard) the size and shape of the mouth of the enclosure. Make holes for the female DC charging socket and the switch. As of now, glue down only the DC socket to the mountboard. We will glue the switch while doing the final assembly...

Step 10: Prepare the Piezoelectric Disks...

Solder wires to the 4 piezoelectric disks. Make holes on the mountboard for each of them, as shown above. Then pass the piezos' wires through each hole. Connect all the positive terminal (gold plate) wires to each other and join another extending wire to them, as shown above. Do the same to the negative terminal (silver plate wires).

Step 11: Assemble Everything!

Now's the time to put everything together! Put a glue drop at the base of the enclosure, and stick the breadboard. Then pop in the powerbank, and using its USB output wire (shown in the last picture of step6), connect it to the power circuit via the switch.

Step 12: Finish!

Your Electronic Mosquito repeller is ready! You may notice from the pictures above, that I used a bright green LED. Green is a colour that mosquitoes are least attracted to, so its quite a good idea.

How to use your Electronic Mosquito Repeller:

  1. Make sure your powerbank is charged.
  2. Switch on the Mosquito Repeller.
  3. Place it in a room, without anything in front of it. Make it face away from the wall, as ultrasound can be weakened significantly after reflecting of surfaces.
  4. Don't let the piezo disks come in contact with anything.

That's it!!! You can use your repeller anywhere: Your room, verandah, a camp, or just anywhere you want to shoo away those bloodsucking devils :-)...

Step 13: Customizing the Electronic Mosquito Repeller...

Different insects respond to different sound frequencies. Hence, by adjusting the frequency as required, we may not just repel mosquitoes, but many other pests as well...

Response of Animals to Ultrasound

  • 22-25 kHz: Dogs, Cats (*They may not be pests, but it can be handy to keep away stray dogs and cats, just in case)
  • 31-44 kHz: Mosquitoes, Fleas, House Fly, Spiders, Cockroaches
  • 52-60 kHz: Lizards
  • 60-72 kHz: Rats

This Electronic Repeller isn't perfect. Before making one I referred to the following points, but to verify some much more experimentation is required...

What are the important aspects of ultrasound pest chasers?

Most ultrasonic pest Repellers do not give better results due to one of the following reasons.

  • Power output of the Transducer. If the power output is low, pests will ignore the sound - This is taken care of with the four piezoelectric transducers...
  • Direction and angle of sound. Usually ultrasound travels at an angle of 45 degree from the source. If there is an obstacle in the path, some of the sound waves will reflect and bend. This reduces the coverage area. - Hence keep the Repeller without anything blocking the path of the sound waves.
  • Response to animals. Usually small animals respond to US. These devices are used to repel pests from houses, farm yards, garden etc. The response depends on the number of pests in the population and the number of US waves reaching in their vicinity.
  • Some animals will ignore the US initially but later they avoid it (good :-) ). Some other animals, first show response and later learn to adjust with it (not good :-( ) - to solve this problem I made the microcontroller emit sound at alternating frequencies, that change every 20 seconds. But more research is required to prove the results....
  • Mosquito population is very large when compared to other animals. So the number of mosquitoes showing response is a matter of observation.

Over the past few days I have used this, the number of mosquitoes in the lobby (where I've kept it) seems to have decreased. However, its still too soon to say.

I will also program the ATmega328 to generate different ultrasonic frequencies, to see which is the most effective. Will keep updating this I'ble....

Formlabs Contest

Finalist in the
Formlabs Contest

Tech Contest

Runner Up in the
Tech Contest

Microcontroller Contest

Runner Up in the
Microcontroller Contest

Make it Glow!

Participated in the
Make it Glow!