Go Down

Topic: sine wave generator (Read 5018 times) previous topic - next topic

Grumpy_Mike

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.

MarkT

#31
Jun 25, 2011, 02:32 pm Last Edit: Jun 25, 2011, 02:37 pm by MarkT Reason: 1
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... ]
[ I won't respond to messages, use the forum please ]

aphy

@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)


Go Up