Introduction: Arduino Mosquito Repeller

Picture of Arduino Mosquito Repeller

In this instructable I'm going to show you how to build a mosquito repeller using an Arduino. The repeller is in the form of a shield that plugs into the Arduino board and the frequency of the repeller can be changed easily.

This project is ideal if you are going camping or hiking outdoors, this device produces a sound of 31KHz Frequency which acts as a mosquito repellent. The frequency of this device can be adjusted and at 23kHZ to 54 kHz it also acts as a dog whistle. Human ears are not sensitive to these frequency ranges.

You can also view the video below on how to build this project.

Step 1: Tools and Components

Picture of Tools and Components

Here is a list of the components and tools required, the list is simple and all you need is

  • Arduino Uno
  • PCB
  • Piezoelectric Disk
  • Header Pins
  • A breadboard (optional)
  • Wires
  • Soldering Iron
  • Soldering Lead

Step 2: Measuring

Picture of Measuring

For this project we will be using digital pins 9 and 11, you could use any other pin with PWM support. So we will need to cut the header pins to our requirement. Then plug the headers into the PCB and mark the layout of the shield. Solder the header pins on to the Arduino, to solder the pins move the black connectors up a little bit and then solder it.

After soldering place the PCB on the Arduino to see if everything fits fine.

Step 3: Cutting

Picture of Cutting

After soldering the headers lets cut the excess PCB out, to do this I used a rotary tool, you can also use a PCB cutter. After cutting the PCB you should have a shield, like the one in the picture. You can sand out uneven edges to get a cleaner look.

Plug the board on the Arduino to make sure it fits right.

Step 4: Circuit

Picture of Circuit

The circuit is very simple, one of the piezoelectric disk is connected to digital pin 9 and the other to digital pin 11. The left over terminal of both the disks is connected together and soldered to the ground terminal of the Arduino. I am using two digital pins because I want to generate two different frequencies. You could connect both the disks in parallel if you like to use only one frequency.

Setting both the disks to the same frequency will cause the board to resonate and will give you more range.

Step 5: Code

Picture of Code

The code for this circuit can be found below the code is really simple and is self explanatory, you can change the frequency by altering the frequency range in the code. 31KHz is the frequency that repels mosquito's and 23kHZ to 54 kHz to act as a dog whistle.

int speaker = 9;
int frequency = 31000;
int speaker2 = 11;
int frequency2 = 31000;

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

void loop(){ tone(speaker, frequency, 1000); tone(speaker2, frequency2, 1000); }


JunezRiyaz (author)2016-10-06

Great Work dude.

ronj56 (author)2016-07-09

I enjoyed tinkering with the piezoelectric disk and the tone function in Arduino. However as a repellent, seem the science is not there. Might give it a try on my front porch though. Thanks.

Cyberchipz (author)ronj562016-07-10

By the mouth of two or three. Here is another link to establish the word!

jonTW (author)2016-06-25

What frequency would I need to scare squirrels? I'm fighting a losing battle in my backyard..

Cyberchipz (author)jonTW2016-07-10

I was thinking about this and came up with two thoughts. 1:) You could come up with a frequency, and if irritating enough possibly it would push the squirrel away and do what you want. On the other hand, it could simply act as an alarm telling squirrels, "Hey, food here!" much like a dog whistle calls a dog.

On a third note, I was thinking that two dissonant frequencies, as there are two emitters, just might be discouraging enough to repel them, if would me if I could hear them; I think it's worth a try; but, I don't have a squirrel problem; so, good luck.

JAK101 (author)jonTW2016-06-29

I recommend you look up essential oils that squirrels don't like. Then simply dilute this essential oil into water or a natural cheap oil (perhaps vegetable oil) or sorts and spray on your yard and areas where squirrels are bothersome. If you look at the ingredients on products sold at your local store for squirrel deterrents majority of the time you'll find they are using essential oils.

JAK101 (author)JAK1012016-06-29

Make sure you reapply after any rain fall as the essential oils are washed away.

LanceM25 (author)jonTW2016-06-25

when you get that answer i too would like to know.

gobocop (author)2016-06-23

Great project!!!

Let me ask you two questions.

Can I send data using this desing (kind of a ultrasound modem)?

And if so....would the same desing able to listen? (changing speaker for micro)


Orngrimm (author)gobocop2016-06-28

sure, why not. the transmit medium doesn't matter as long as your sensor and emitter speak the same "language".
the simplest solution would be to use 50-305 kHz as a representation of the 256 values a byte can have: 0 = 50khz, 1= 51khz, ... 255= 305khz.
maybe the bytes have to be separated by a 30khz-pulse or something along the line... otherwise you may run into problems with consecutive same values...

gobocop (author)Orngrimm2016-06-29

Ok Thank You!!

Raphango (author)2016-06-26

Does it work?

CazRaX (author)Raphango2016-06-28

It probably does work as a sound emitter but as a repellant I doubt it since many tests have been done on mosquitoes and sound and none have been found to be effective.

Benadski (author)2016-06-23

Does this work by resonating the body of the mosquito so it explodes in mid air? That would be amazing. Else, I'll stick with this:

MikeD11 (author)Benadski2016-06-23

The video doesn't work in the US. You probably have copyrighted material...

AlexF84 (author)MikeD112016-06-24

This version works in the US:

RafaelH4 (author)AlexF842016-06-28


Benadski (author)MikeD112016-06-24

Maybe because they have used the word Starwars... The rest seems to be original.

diy_bloke (author)Benadski2016-06-24

that one is funny

JoeB95 (author)2016-06-26

The trouble is that sound has been proven to NOT repel mosquitoes, it has no effect at all. Other than that slight deficiency, nice description.

TangentT (author)2016-06-25

Can you provide the circuit diagram of this project

TangentT (author)2016-06-25

Can you provide the circuit diagram of this project

J.R.F (author)2016-06-24

Interesting to try. Where did you buy the discs?

diy_bloke (author)2016-06-24

It looks great, but for all I know the high pitch musquito repellant is pseudoscience. That doesnt change the fact that I think your shield looks awesome

ohoilett (author)2016-06-23

I like how you positioned the piezos. They look like wings. Lol. I assume that was intentional.

leprasmurf (author)2016-06-23

Ultrasonic has been shown to have no effect on mosquitos as a repellant:

mickeypop (author)leprasmurf2016-06-23

Actually these studies have a flaw.

20 + years ago i was involved in the design of such a chaser and they "Can" work.

almost all of the commercial ones out there oscillate at 1 frequency and they do work some ONLY when you start them up "before" the first hatching of the season, but the best are multi-frequency.

Let me clarify;

The first hatch-lings of the season have been thru the winter and are in a unique state that makes the far more susceptible to the high frequency.

The chasers basically shake their exoskeleton, annoying the devil out of them to the point of moving them elsewhere. The move depending on the output of the speakers can be as much as 100 ft. and cover 10,000sq/ft though most are around 1800sq/ft or ~40ft. If the breeding ground is moved the next several generations will not be there either because mosquito's normally live and die within 20ft of their birthplace.

That said; Around 1985 we started 1 chaser (multi-frequency ) on the Black River in Marshals Creek, PA. "before" the first hatch of the season, leaving it on for the whole summer and and it left an area ~65 around with no sign of mosquito's for the entire season. Note; the neighboring area was full of mosquito.

We also started one about a mile down river "after" the mosquito's were out in mass, about 3 weeks later. That one only reduced the mosquito count by about 20-25%


2 key factors were in play here.

1.) we were generating a broad frequency range from 23Khz to 80Khz.

2.) we started before the hatching and it stayed on all summer


Notes on this instructable;

Both speakers are pointed in the same direction. Ultrasonic is quite directional, if they were pointed 90 degrees from each other it would cover a greater area.

if the frequency were to step though a range it should have somewhat better overall performance.

WildB (author)leprasmurf2016-06-23

I was just going to post that. With the amount of dangerous mosquito born illnesses showing up worldwide, we don't need people thinking this will protect them.
Still good project - just wouldn't have listed it as a mosquito repellent.

leprasmurf (author)WildB2016-06-23

I agree that the project is cool. Could be fun for messing with dogs (dog whistle) or making an annoy-a-tron for kids (kid whistle).

HeatherScott (author)2016-06-23

Thanking you from west central Florida coast

jose antonios6 (author)2016-06-23

I try to do this with attiny85, is more economy.

GreenMoon (author)2016-06-23

Worth a try! If nothing else, I can amuse the neighbors' dogs.

rafununu (author)2016-06-23

In fact only females bite, they need blood for their eggs. The frequency
is supposed to be the same as the male's wings sound, which repels
already pregnant females that don't like coits that much, once is
enough. I don't think this is so simple, I mean a unique frequency
without any kind of modulation could fit for any mosquito ?

nemob (author)2016-06-22

sounds great but does it work?

(btw you don't have to define frequency and frequency2 separately because they both have the same value.)

Victor805 (author)nemob2016-06-22

Sorry, but studies seem to indicate that it doesn't works.

I for one will keep using my trusty racket of death.

AutogyroGuy (author)2016-06-22

What is its range. Example: If I put it in a tent would it protect my tent?

About This Instructable




More by webgeeks:DIY Wireless Charging Power BankChocolate Cookies Dessert Kheer -  an Indian Dessert
Add instructable to: