Poll
Question: Hi. I just want to know if it is possible to output 25 kHz sine wave using arudino Duemilanove? I will use it to drive my ultrasonic sensor. Thanks! smiley-grin
Do I still need to use Digital-to-Analog converter? - 0 (0%)
Is there other options? maybe the simplest way to generate 25 kHz sine wave using arduino? - 1 (100%)
Total Voters: 1

Pages: 1 2 [3]   Go Down
Author Topic: sine wave generator  (Read 4080 times)
0 Members and 1 Guest are viewing this topic.
Manchester (England England)
Online Online
Brattain Member
*****
Karma: 626
Posts: 34123
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Look at changing the PWM frequency to 40KHz. This is much better than using a loop. Otherwise you can get a NE555 to generate it for you.
Also 25uS is 25 micro seconds 10 -6 where as the delay function gets a number in milli seconds 10 -3.
Logged

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12169
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just to clarify a point touched on earlier:

Ultrasound travels through air.
Ultrasound travels through wood.
Ultrasound does NOT like to travel between air and wood (or any solid/liquid)...  There's a *massive* accoustic mismatch leading to extremely inefficient transfer of energy between the different media.  To a good approximation all the ultrasound is reflected by _any_ surface - which is why its very useful for proximity detection.

You need a transducer as used for ultrasound scanning (used with gel to acoustically contact the surface), not one for use in air.  These usually run at much higher frequencies (> 1MHz) for higher spatial resolution.

Also we've only discussed the transmitter side of things, no mention of the receiver which is the more tricky circuit.

[ for the record speed of sound in wood is about 3600 m/s (ten times faster than in air), so for a resolution of 1cm you need around 360kHz, for 1mm 3.6MHz... ]
« Last Edit: June 25, 2011, 07:37:06 am by MarkT » Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@markT: yes, that's why I i'm going to use direct contact (no air gap), i am going to use a coupling material.

@grumpyMike : I tried the PWM but I cannot change the frequency. I am new to arduino and the PWM (default peroid is short)
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 626
Posts: 34123
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I tried the PWM but I cannot change the frequency.
Why not?
http://www.arduino.cc/playground/Code/PwmFrequency

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1152547089

Logged

Pages: 1 2 [3]   Go Up
Jump to: