Handheld Ultrasonic Dog whistle powered by 9V battery.
Press the button in the upper right of the circuit to engage.
Real-world, the 8 Ohm resistor in the diagram is replaced by your speaker...ideally a piezoelectric speaker with a freq response >20KHz. I used this one which has a freq response from 10K-50K Hz:
https://www.amazon.com/ToToT-Ultrasonic-Speaker-Loudspeaker-Piezoelectric/dp/B07RW7ZNB4/ref=sr_1_3?dchild=1&keywords=piezo+speaker&qid=1625400388&sr=8-3
To figure out the frequency you are generating:
Freq(Hz) = 1.44 / ((R1 + (2 x R2)) x C1)
R1 in Ohms
R2 in Ohms
C1 in Farads
R1 = the 1K resistor in the far upper left.
R2 = the sum of the 20k resistor AND the potentiometer.
C1 = the 1nF capacitor in bottom left.
The frequencies that can be generated by adjusting the potentiometer with the circuit in the diagram are roughly 23.7-35.0 Khz. Change R1, R2, and/or C1 to create different frequencies that you'd like.
Rotating the wiper on the Potentiometer changes the frequency.
Works to discourage dog behavior when pressing the switch within about 20ft of a dog.