Ultrasonic frequency using arduino at range of 35k-55k Hz

I want to use the clock of the altmega ic. Is it possible to create an ultrasonic frequency by simply using it? Can the tone command could make it possible? Or there is something on the library that I need to add on the command? Please help me just like for example tone(13,35689);. Thanks.

magiVincent: Can the tone command could make it possible?

The documentation seems to indicate that it is possible to generate up to a nominal 65535 Hz tone using the library function. See in particular the "ugly details" section of the second link. That said, I claim no special knowledge other than having checked the readily available documentation.

https://www.arduino.cc/en/Reference/Tone https://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation#Ugly_Details

void setup() { pinMode(13,OUTPUT); /* tone(13, 50132); delay(100); noTone(13); delay(10); tone(13,54621); delay(50); noTone(13); delay(50); tone(13,35689);delay(60);noTone(13);*/ Serial.begin(9600); }

void loop() {

tone(13, 50132); delay(100); noTone(13); delay(10); tone(13,54621); delay(50); noTone(13); delay(50); tone(13,35689);delay(60);noTone(13);}

please help me... i can hear the buzzer tone I used a buzzer. To think that i used a frequency that should not be heared from human ear, How could I heared the ultrasonic frequency that i used?

What are you using to produce the audio signal? Can it even respond to an ultrasonic frequency?

jremington: What are you using to produce the audio signal? Can it even respond to an ultrasonic frequency?

i used BUZZER PIEZO

I'm not so famillar of using a buzzer. Do I need to change it? are my codes can generate the frequency I choose?

Even if your code can generate ultrasonic frequencies, no useful sound will emerge from the "buzzer" if it can't reproduce those frequencies.

You must use an ultrasonic transducer, and you will need an interface to connect it with the Arduino. Here is an example: http://forum.arduino.cc/index.php?topic=198418.0

I played with this a bit last night using a very simple bit of code, a (piezo?) buzzer from one of those 37 in 1 kits with no real documentation, and a clone Uno board.

The sketch performed as expected, that is, the output was a square wave at the defined frequency. I tried different frequencies and it was clear that the volume from the buzzer depended very much on the frequency at which it was driven. For my particular device, 2 kHz was significantly louder than 1 kHz or 4 kHz.

It's not clear what it would do at ultrasonic frequencies, but I wouldn't expect it to work all that well unless I had a device that was specified to be resonant at a desired ultrasonic frequency. You could, perhaps, salvage a transducer from an HC-SR04.

#define audioPin 13
#define freq 2000     // Output frequency in Hz

void setup() {
  pinMode(audioPin,OUTPUT) ;
  tone(audioPin, freq) ;
}

void loop() {
}

Are you sure that you are using a passive buzzer, i.e. none which beeps at a fixed frequency while enabled?