I need ultrasonic sounds at a decent volume for a project (it needs to be able to scare a rabbit, and they dislike ultrasonic frequencies which they can hear up to 42 kHz). It doesn't seem like the buzzer I've been trying to use can get to that high a frequency, and it may also not be loud enough. What would be an easy way to do this?
Assuming UNO you can do this by configurnig timer and let it run for frequency you want.
There is also an app for smartphone which shows you sound level above 18Khz so you can evaluate your harware is OK and the speaker is able to handle such ultrasound.
// assuming 16MHz clock and UNO
// let's try AI generated code to get 40kHz at OC1A pin, it's pin nr.9 on UNO
void setupTimer1_40kHz()
{
// Disable interrupts during configuration
cli();
// Set PORTB1 (OC1A, Pin 9) as output
DDRB |= (1 << PB1);
// Clear Timer1 control registers
TCCR1A = 0;
TCCR1B = 0;
// Set initial timer value to 0
TCNT1 = 0;
// Calculate compare value for 40kHz
// F_CPU = 16MHz
// Target frequency = 40kHz
// Using prescaler of 1
// OCR1A = (F_CPU / (2 * prescaler * target_freq)) - 1
// OCR1A = (16000000 / (2 * 1 * 40000)) - 1 = 199
OCR1A = 199;
// Configure Timer1
TCCR1A |= (1 << COM1A0); // Toggle OC1A on compare match
TCCR1B |= (1 << WGM12); // CTC mode (clear timer on compare)
TCCR1B |= (1 << CS10); // Prescaler = 1 (no prescaling)
// Enable interrupts
sei();
}
void setup()
{
// atmega328 timer1 does the magic
setupTimer1_40kHz();
}
void loop()
{
}
It is easy to have the Arduino generate electrical signals in the ultrasonic audio range, but to convert electronic signals into acoustic ultrasound, you need an ultrasonic transducer, and some sort of electronic signal amplifier, to get useful volume from the transducer.
Most transducers operate efficiently only at certain specific frequencies, and don't produce much volume if driven at a significantly different frequency.
40 kHz is popular, and that is what the HC-SR04 ultrasonic ranger transducers are designed to produce.
By the time you read this there are probably rabbits! I used Naphthalene in the form of Moth Balls, they do not appear to like that.
It's actually for my pets, they keep peeing outside their litterbox so I'm trying to set up a system that will scare them when it detects liquid on the ground.
Assuming this is to make noise to scare the critters I suggest you search for "ultrasonic transducer 5 watt", that will be a start as there are a lot of different transducers available at many different power levels.
This may be the stupidest project talked about on this fora in some very long time.
I advise you to find a different way to deal with your problem.
Do you know anything about animal behaviour?
a7
IF you got it to work, what would you use next week, because your pets will ignore it after a short while.
Cat peeing psychology discussed here: 5 Simple Tips for Using Pee Pads for Cats at Home | Bulldogology
Do you? I've tried all the normal things (move litterbox to where they're peeing, place food in litterbox, put old litter in litterbox, etc) and none of them have worked. Why not try a $20 solution that only takes a couple hours to implement (and only because I suck at circuit design and programming) that could save me hours of mopping up pee?
You need a transducer that will respond in the near ultrasonic range. While you COULD use a common ultrasonic sender these couple better and have a wider frequency range.
I've used them to simulate the sounds made by bats (and also as a high frequency microphone)
To get decent volume you need a big voltage swing - 20 - 30V pk-pk.
I purchased some that seem pretty similar (correct me if I'm wrong) and I'm having some trouble getting it to work. It seems like anything over 20k Hz just makes the buzzer rattle at low frequency. This happens when directly using the output pins on the arduino and using an audio amplifier (it came with a kit and I haven't been able to find specs, but I'll attach a picture). I'm using the tone() function to make the sound.
Audio amplifier:
How do you know? You wouldn't be able to hear the frequencies about 20kHz...
I was using an app that can detect frequencies above normal hearing range. I'm also pretty young, so 20kHz is about the upper end of my range of hearing. However, I think the issue actually was the app; it was saying there weren't high frequency noises when the speaker was on, but my dog reacted to it, so it was probably working.
which is designed to work in the "audio" range?
What app? Using what microphone?
If you want to detect the signal you can use one of the tweeters as a microphone, and look at the output with a simple amplifier - detector circuit.
Since you are only interested in producing near audio - and ultrasonic sounds
you dont need a linear amplifier.
You could possibly use an h bridge such as this - which would give you a 24V pk-pk signal.
To convert electrical to ultrasound you need a resonant transducer + driver. We can recommend a 40 kHz element and provide a matched transformer/drive notes. If you share your amplitude target, I can estimate required Vpp and propose a BOM.
Can you help me, my friend?
I want to build a system that produces high-amplitude, 35-45 kHz ultrasonic sounds. I plan to use an industrial-grade ultrasonic generator as the frequency source.
However, I haven't been able to improve my system because I haven't been able to find an ultrasonic speaker that produces 40 kHz sound. I hope I can achieve this with your help.
Thank you in advance for your answer.
Has the maker of the generator been of any help in selecting a speaker?
I think you are looking for a transducer, not a speaker. Used in plastic welding.
