Netherlands
Offline
Tesla Member
Karma: 88
Posts: 9392
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #15 on: June 22, 2011, 07:59:19 am » |
@aphy Can you explain why you want to penetrate wood ?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #16 on: June 22, 2011, 08:25:15 am » |
can 555 create nice 40 kHz sine wave? do you have any schematic? thanks
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19016
I don't think you connected the grounds, Dave.
|
 |
« Reply #17 on: June 22, 2011, 08:29:01 am » |
No, a 555 can't generate a nice sine wave at 40kHz, but it has been repeatedly pointed out to you that you don't need a 40kHz sine wave when a 40kHz square wave will do the job just as well. A 555 will produce a 40kHz square wave.
I just guessing here, but one of us first picked up a pair of Murata 40kHz transducers about thirty years ago and happily drove it with a 555, then an 8080, a Z80, a 6809, a 68000, a PIC and then an Arduino, and one of us didn't.
(Edit: oops missed out T450 transputer)
|
|
|
|
« Last Edit: June 22, 2011, 08:35:02 am by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #18 on: June 22, 2011, 08:42:09 am » |
ok thank you very much!!!  i will try the square wave and the 555 as well. sorry i'm just afraid to try the square wave because i'm afraid to break my sensor. but then i guess I'll do it. thanks..
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Online
Brattain Member
Karma: 273
Posts: 25473
Solder is electric glue
|
 |
« Reply #19 on: June 22, 2011, 12:08:19 pm » |
i'm just afraid to try the square wave because i'm afraid to break my sensor. But the data sheet specifies square waves. but one of us first picked up a pair of Murata 40kHz transducers about thirty years ago Make that two of us 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 64
|
 |
« Reply #20 on: June 23, 2011, 05:04:14 am » |
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!  Did you get an answer to your original question? Google DDS (for direct digital synthesis), NCO (numeric controlled oscillator) and read up. These are techniques that let a micro generate programmable sine waves. Here is a link to a good one http://interface.khm.de/index.php/lab/experiments/arduino-dds-sinewave-generator/The link shows a fancy filter on the output, but you can get away with a simple RC if your not too picky on bandwidth and distortion. Try it and let us know how it works.
|
|
|
|
« Last Edit: June 23, 2011, 05:07:31 am by MGeo »
|
Logged
|
|
|
|
|
Manchester (England England)
Online
Brattain Member
Karma: 273
Posts: 25473
Solder is electric glue
|
 |
« Reply #21 on: June 23, 2011, 07:52:11 am » |
Did you get an answer to your original question? We established that he did not want to do this at all. Well that is he did not need to do it as a square wave would do equally as well, and that it would have done him no good even if he had generated one.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #22 on: June 24, 2011, 12:36:39 am » |
@grumpy mike, I've tried the square wave but How can I get 40kHz? I tried the PWM but the frequency is quite low.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #23 on: June 24, 2011, 01:05:55 am » |
int outPin = 8; // digital pin 8
void setup() { pinMode(outPin, OUTPUT); // sets the digital pin as output }
void loop() { digitalWrite(outPin, HIGH); // sets the pin on delayMicroseconds(25); // pauses for 25 microseconds digitalWrite(outPin, LOW); // sets the pin off delayMicroseconds(25); // pauses for 25 microseconds }
>>will this program be ok to drive my ultrasonic transmitter?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19016
I don't think you connected the grounds, Dave.
|
 |
« Reply #24 on: June 24, 2011, 01:25:07 am » |
Yes, but at the wrong frequency. (40kHz == 25us cycle)
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #25 on: June 24, 2011, 01:58:03 am » |
oh yes. that would make it 12.5 thank you very much!!! 
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19016
I don't think you connected the grounds, Dave.
|
 |
« Reply #26 on: June 24, 2011, 02:41:04 am » |
You'll probably find that you need shorter delays than that (you can't have a x.5us delay anyway) to account for the overheads of "digitalWrite".
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 20
|
 |
« Reply #27 on: June 24, 2011, 02:45:05 am » |
then what could be the best way to do? and amplifier for the square wave? thanks
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19016
I don't think you connected the grounds, Dave.
|
 |
« Reply #28 on: June 24, 2011, 02:54:26 am » |
then what could be the best way to do? Get hold of an oscilloscope or a frequency counter, and tweak your loop times until you get closest to 40kHz. and amplifier for the square wave? MAX232 or similar.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 88
Posts: 9392
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #29 on: June 24, 2011, 03:35:19 am » |
to account for the overheads of "digitalWrite". For those frequencies you might also need a look into direct port manipulation: - http://www.arduino.cc/en/Reference/PortManipulation You must know the pin in advance, but thats not the problem I guess
|
|
|
|
|
Logged
|
|
|
|
|
|