Arduino Mosquito Repellent
2026-09-10 | By Ron Cutts
License: GNU Lesser General Public License Bluetooth / BLE Microcontrollers Sound Arduino ESP32
In this tutorial, we will learn how to make a simple mosquito repellent using Arduino and a piezo buzzer. The buzzer will emit the silent (to the human ear) frequency of 31 kHz; this frequency is known to repel mosquitoes, and you can adjust the frequency to your needs as well.
Watch the video!
Learn more about Visuino: What is Visuino
What You Will Need
Arduino UNO (or any other Arduino)
Visuino software: Download here




The Circuit
Connect Piezo buzzer positive pin + (VCC) to Arduino pin +5V
Connect Piezo buzzer negative pin - (GND) to Arduino pin GND
Connect Piezo buzzer signal pin (S) to Arduino digital pin 2

Start Visuino, and Select the Arduino UNO Board Type
The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.
Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2


In Visuino Add & Connect Components
Add "Play Frequency Tone" component
Select "PlayFrequency1" and In the properties window set "Initial Frequency (Hz)" to 31000
Connect "PlayFrequency1" component pin Out to Arduino digital pin 2



Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Play
If you power the Arduino UNO module, the piezo buzzer will start to emit 31kHz frequency that is known to repell the mosquitoes. You can adjust the frequency if you want.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project that I created for this. You can download it and open it in Visuino: https://www.visuino.eu

