SoundJuicer - UNIHIKER

0 197 Easy

Introduction:

The primary purpose of this project was to develop a device capable of detecting dangerous insects by using a microphone and Fourier analysis. Initially, my goal was to implement an AI model for this task, as AI seemed like a promising approach. However, throughout the testing phase, I decided that a purely mathematical method would be a better solution. This choice was made after realizing that mathematical analysis, particularly through Fourier transforms, could provide more precise and reliable results for this specific application.

After all, AI is just statistics :)

The theory

The device operates on the principle that different insects produce unique sound frequencies based on their wingbeats. As insects fly, their wings create vibrations that emit distinct buzzing sounds, measured in Hertz (Hz). These frequencies vary between species, allowing for identification:

Mosquitoes: Typically have a wingbeat frequency between 500 and 800 Hz, producing a high-pitched buzz.

Bees: Honeybees have a lower frequency range of 250 to 300 Hz, resulting in a deeper buzzing sound.

Wasps: Wasps, including common types like yellowjackets, produce buzzing in the range of 150 to 200 Hz, sitting between bees and mosquitoes.

How does it work?

The device captures audio chunks using an onboard microphone, which continuously monitors the surrounding environment. Each audio chunk is then analyzed using Fourier analysis, a mathematical method that breaks down complex sounds into their individual frequency components. This allows the device to identify the specific frequencies present in the audio. The analyzed data is plotted on a screen, providing a visual representation of the sound spectrum.

Based on the user’s settings, certain frequency ranges can be selected as indicators of potentially dangerous insect activity. If the detected frequencies reach the predefined thresholds set by the user, an alarm is triggered. That can trigger anything user wants, for example some buzzer, light, close some doors etc. 

CODE
# change for diffrent sensitivity or type of insects to detect
# the main code is in the zip file :)
threshold = 30 #0-100
freq_down = 500 #must be higher than min_f
freq_up = 800 #must be lower than max_freq
continual_plot = True #set to false for faster responce time 

##############################################################################
#honeybees have a frequency range of 250-300 Hz
#bumblebees typically buzz at around 200-250 Hz
#wasp 150-200 Hz
#mosquitoes 500-800 Hz
#flies 300-400 Hz
##############################################################################
screen_width, screen_height = 320, 240
plot_start_x, plot_start_y = 10, 70
plot_width, plot_height = screen_width, screen_height  
line_thickness = 3
record_duration = 1  
downsample_factor = 2  
min_f = 50
min_freq_gap = 10
max_amplitude_global = 1
max_freq = 8000 #max 8000 for onboard mic
file_name = 'buffer.wav'
HARDWARE LIST
1x Unihiker
optional 3D printer for a case

Overall, I am quite happy with how this project turned out. It can serve as a starting point for various applications and projects, such as detecting wasps in baby wagons, inside cars, in the vicinity of allergic individuals, or even in bedrooms to ensure a peaceful sleep.

My inspiration for this project came from a personal experience—one night, I was awakened by a painful wasp sting on my finger, after it had flown into my room while I was sleeping. I wanted to create a solution that would help avoid such situations in the future, ensuring that others don't have to go through a similar experience :)

 

video: https://youtube.com/shorts/driK7m2Q1eI?feature=share

icon sound_juicer.zip 11KB Download(3)
icon 3D_printed_case.zip 17KB Download(0)
License
All Rights
Reserved
licensBg
0