Driving a 32Khz ultrasonic transducer with the Prop...
denno
Posts: 223
in Propeller 1
The discussion title says it all...can the prop produce the AC signal to drive the above transducer. I just need a little education on this...never messed with ultrasonic transducers before...I simply just want to turn it on to generate the 32Khz frequency. Not going to be using it for range detection....thank you..
DennO
DennO
Comments
http://obex.parallax.com/object/620
It may be a bit louder if you put a small inductor in series with the piezo, something like 5 or 10 mH.
My next question is, is it possible to translate the above SPIN to Propbasic. I am sure that it has something to do with COUNTERA and COUNTERB in Propbasic.
DennO
Good reading on counters and sample programs:
https://www.parallax.com/downloads/an001-propeller-p8x23a-counters
COUNTERA 40, MY_APIN, MY_BPIN, 1759219
The "40" is simply a mode value from the PropBASIC documentation, to set NCO differential. The frqx number, 1759219, is calculated on the basis of 32768 Hz, but if you really want 32000 Hz, it should be 1717987.
Here is the formula to calculate that number, based on your target Hertz and the Prop clock frequency.
frqx = 2^32 * targetHz / clkfreq . round off to integer value.
Thanks again..DennO
Thanks DennO
Or, if you want to measure the Hz on the prop, there is
PropBasic : http://forums.parallax.com/discussion/123170/propbasic-reciprocal-frequency-counter-0-5hz-to-40mhz-40mhz-now
and that has been ported to another BASIC
https://forums.parallax.com/discussion/comment/1446189/#Comment_1446189
So, in Spin
In PropBASIC, add something like this,
Then you should be able to see it on the oscilloscope, but remember when you hook up the 'scope that neither side of the piezo is at ground, so the power supply for the Prop has to be isolated from the ground on the oscilloscope. If not that could be bad for the output pins!
If you want to hear the sound on an audio piezo speaker, just compile it with a lower audible frequency.
The program does need something like a DO:LOOP to keep the cog alive. In the Spin version, the final repeat statement does that, it sits there doing nothing. The counter modules run autonomously. Your Spin or PropBASIC program can continue to do other things without disturbing the NCO waveform. Of course the code can modify the waveform as it goes along, such as keying it on and off or modulating the frequency.
The cog counter modules are a real boon. As jmg pointed out, a cog counter can also measure frequency, so you can have one cog measuring the frequency produced by another cog.
Good advice!
Also, some scopes and PCs connect earth ground to logic ground. So, even if your power supply is isolated, having your prop connected to the PC at the same time as the scope is, isolation will be lost. If this is the case, and if your scope has two channels, you can also connect each signal wire to an output pin, leaving the ground leads disconnected. Then set the scope for difference input on the two pins.
Simplest of all with a dual channel scope is just to display both channels, one above the other, and witness that they're 180 degrees out of phase.
-Phil
Now, for what I am building...called the "Garden Defender", from deer. Running now on the Prop, are 8 low power lasers, 650mW, pointing out at 45 degrees angles, up in hopes that they will bounce off old DVD's and old CD's hanging in an "X" configuration from corner to corner of the garden. (They really do reflect light) Also, I have four strobes at 90 degree angles, which are very bright. All of this is triggered by 4 PIR's, also at 90 degree angles. When ever a movement..aka..heat source...is detected by the PIR's, certain events start to take place. The strobes..all four...start flashing, the lasers, start to "shoot" out reflecting off the CD's and DVD's and all this continues on until the heat source, (deer, racoons, possiums), leaves.
I was hoping to use...drive...4 ultrasonic devices, as deer, like dogs can hear higher then us humans...but I am having a little trouble finding a ultrasonic tranducer that works...bought some cheap ones from All Electronics...and tested them on my dog, but he did not blink an eye...or ear.
Actually, the hardest part of the above device, is making it waterproof for the elements....
dennO
Was that thought proven in the field ?
http://www.prowave.com.tw/english/products/ut/enclosed/250e250.htm
I don't see it listed on the Farnell or Element14 web sites at present, but that is where we sourced a lot of other ProWave transducers. I'm not positive we bought those 25kHz/25mm ones there. We might have found some from one of the surplus dealers. You can find lots of 40kHz 25mm sealed transducers on ebay, so it might be worth writing to one of those suppliers to see if they also have a 25kHz version. I'd say, try it with a readily available open version first to see if it works for your purpose.
About jmg's question, about the attraction of rabid bats to the sound. I wasn't directly involved in the research. It is notoriously difficult to establish a solid control group in this kind of study. They did catch rabid bats and fewer normal bats. The numbers were small, like 3 to 5 in a deployment, and I recall being told that most of the catch was in a bunch, one night, not successive nights. So you could say that all of the rabid bats were captured, or they became habituated, or ???. So it remains anecdotal. The thought started when road crews working with jackhammers reported that they had been swooped by angry bats. The researcher then tried hanging smoke detectors set to alarm test mode out in the field, and found that he could capture rabid bats that way. But that was highly annoying to the peace of nature.
But, I believe I will need more power, in wattage, to to effectively scare away critters, aka...deer. I will keep looking around..
DennO
thank you..and Tracy I did follow the link you gave me, but it seems I need a amplifier of sorts to drive it...which I can build. Have looked at a Google search, but nothing strikes me as something that would work. Has anyone made an amplifier that will drive the above transducer....
DenO
Those small transducers can take only about 15–20V rms drive The Micrel mosFET drivers are basically H-Bridges with an output A and output B that can push enough current to drive a 2nF piezo through the full voltage swing in about 20ns.
60W transducers are an entirely different category and require a bigger amplifier. Hey--I suspect the critters would be plenty annoyed by the lower power!
Thanks...DennO
You could alternatively use the MIC4426 (dual inverting) or the MIC4428 (dual, one inverting one noninverting). A possible advantage of the MIC4428 is that the propeller could drive it from a NCO/single pin instead of NCO/differential. In that case the A and B inputs of the MIC4428 would both be connected to one Prop pin. The A and B outputs would be at opposite polarity to drive the piezo in H-bridge differential fashion. On the other hand, using two Prop pins gives you flexibility to decouple the A and B channels.
I am very careful with my wiring on the breadboard, and I am connecting the two MIC's to Vs and ground in parallel, to 12 volts. But the respective inputs and outputs are not tied together. So, to recap, if I simply lift one or the other MIC's off the breadboard, the overheat condition goes away. And, yes, both will overheat until I remove one or the other...very strange...but I would be willing to bet you have an answer....I hope the above is understandable...
Thank...lots....DennO
Perhaps your setup is suffering from a Transition Dissipation problem (MIC4427's datasheet, page 7).
Due to the way CounterA and CounterB are being used, the second counter-commanded pins would switch its own output pin states, soon after the first pair; just in time to worsen (due to noise coupling thru shared GND or V+ connections, or even both) the noise caused when both outputs of each MIC4427 are switching states, simultaneously (due to the fact that each pair is being controlled by the same counter ( A or B ).
This could lead to the noise induced at the GND/Power rails, caused by the first switching pair, to be coupled to the inputs of the second, making them start their own cycle (switching), earlier than expected/predicted.
Them, when the second MIC4427 starts conducting, it would influence the first one, as in a ringing effect, which would in turn, worsen the whole effect of noise coupling between them.
If a condition as depicted above is the main cause of circuit failure, perhaps it could be rulled out by creating a break-before-make mechanism (thus, not entirelly relying on a single counter transition, commanding one pin and its inverted copy, to switch both control inputs of the same MIC4427).
Separing the twin MIC4427s in two breadboards, apparted from the one that holds the Propeller itself,, following the best high-gauge wiring and heavy decoupling practices could help avoid any negative coupling-effects between them, without further concerns.
Providing non-overlaping clocks for both control inputs of each MIC4427 could also help, but them you'll need to rely on oscilloscope measurements, in order to be sure there is no propagation of negative effects, from one pair of switching outputs to the control inputs of the second circuit, and vice-versa.
Hope it helps a bit
Henrique
It is true, on the breadboard, I have not decoupled the 4427's and I will play with that next. And, here is the code...or a part of it. This is running in COG 0, I wonder if I ran the other MIC4427 in a different COG it would make a difference..and I will read page 7 that you referenced to me..DennO
Post Scrip...the ultra_1, ultra_2, ultra_3 and ultra_4, are PIN assignments.
Since you haven't published your present setup schematics, I'll try to progress solely relying on my tactile abilities (given my actual sight capabilities, it'll be just some kind of training-in-advance method).
If the destructive warm-up starts soon after the frequency output ends, sure the outputs of each counter are being left in a "0 - 1" or "1 - 0" situation, which, considering that the ultrasonic transducers tend to present an almost pure capacitive load to the MICs outputs, should have mean that no current would flow thru the output pair of each MIC4427.
Unless you had resorted to the insertion of series capacitors between the Prop output pins and the MICs inputs, it'll suffice to ensure each Propeller output pin pair to be set to "0" (both), after disconnecting them from the counters.
If there are series capacitors between the Prop outputs and MIC4427 input pins, you'll need four pull-down resistors (~10 KOhm) to GND, directly connected to MICs input pins, to ensure there would be no activity at their output stages.
Hope it helps
Henrique
It should not be necessary to start another cog.
As to the power, I estimated dynamic load dissapation based on 25kHz, the highest in the programmed frequency scan...
PL = f*CL*Vs^2 = 25000 * 2.2E-9 * 12^2 = 0.008 watt . for a 2.2nF piezo (typical)
And the transition dissipation (charging 4427 internal capacitances)
Pt = 2*f*Vs*Q = 2 * 25000 * 12 * 5E-9 = 0.003 watt. where 5E-9 is crossover energy loss per transition.
So combined, 0.011 watt, which should not feel hot. No heat sink.
Please reword what you said about the point in the program when it gets hot. I was left confused about that.
Those parts look to have no pullup/pulldown, so you could try pull downs on the board.
Their only mechanism for heat really looks to be switching, as in oscillating > 1MHz.
What does the scope show in that heating condition, on IP and OP of driver ?
Does it confirm the counter is stopped and driving the pin ?
COUNTERA 40, ultra_1,ultra_2, 128 'logic never, counter off (but not disabled?)
COUNTERB 40, ultra_3,ultra_4, 128
Or add program lines to turn the Prop pins definitively into LOW outputs when not counting:
LOW ultra_1
LOW ultra_2
LOW ultra_3
LOW ultra_4
Crossed out mistaken PropBASIC syntax and logic.
Or as others have suggested, add pulldown resistors to the MIC4427 inputs.
Having messed alot with MOSFET..I feel that I was an issue with "shoot through", where the N channel and the P channel in the 4427 were conducting at the same time...hard to tell if it was A or B...
Here is the code..of the COG that runs the ultrasonics..I may change the frequency spread, but for know, I wanted to be able to hear a part of it (around 10Khz) as well as see it on the scope and thanks to all you that added your help...