Ultrasound with PIC12F629


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by ewandeur View Post
    Hi !

    I'm using a PIC12F629 with internal oscilator (4Mhz) a LM386 as amplifier, and a piezo to emmit ultrasound wave (from 28Khz to 60Khz).
    All I can achieve is an annoying sound but no ultrasound at all.

    I'm actually using the suroutine below, obtained from Melanie in this forum:

    MakeSound:
    For CounterA=1 to 1000
    High gpio.0
    PauseUS 10
    Low gpio.0
    PauseUS 10
    Next CounterA
    Return

    Can anyone help me?

    Tks in advance.
    From memory I think the bandwidth of the LM386 is inversely proportional to the gain. More gain = less bandwidth. Open loop gain of the LM386 is something like 200, this will place a huge tax on the useable bandwidth. Generally above 15KHz or so, at very low output it's out of our hearing range. All told, Hi-Fi is 20Hz to 20KHz. I believe that the LM386 can go as high as about 100KHz with full feedback. i.e. No gain at all. In this configuration it's deemed a 'buffer' only.

    Best Regards,
    Trent Jackson

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Also, further to Trent's fine comments...

    A piezo transducer has a resonant frequency, the further away from that frequency (or it's harmonics), and the piezo is rubbish. Use an Ultrasonic transducer (old style burglar alarm, antique TV remote, car parking sensors type), but even then, most don't go much beyond 40kHz. A pipistrelle Bat should be a quite good emitter... wire one up to a spare PIC I/O and you're in business (not checked a pipistrelle's Datasheet to see if it's 5v triggered)... trouble is you'll then have to budget for a conformal coating over the PCB to protect it from the Bat guano!

  3. #3
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post

    And, Melanie’s right. You're only generating ultrasound for 20mS, 1,000 cycles of 20uS, 1 / 20mS = 50Hz. And the more I think about it with what I just wrote, if you were out of bounds with bandwidth you wouldn't hear anything at all. Completely attenuated.

    Best Regards,

    Trent Jackson

  4. #4
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Exclamation Don't have much gain.

    Keep in mind that you're applying close to 5V to the input of the LM386.
    IO ports on PIC’s are CMOS with a guaranteed minimum of 73% of VCC when set high. (You'll lose a bit because of the coupling cap) With this in mind, assuming a supply rail for the LM386 at around 9V, you really don't want a gain of much more than about 1.5 Of course, I am assuming that you don't have a volume control set in place enforcing a limitation on volume.

    Best Regards,

    Trent Jackson

Similar Threads

  1. semaphore pic12f629
    By Leonardo in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 7th November 2008, 13:55
  2. pic12f629 EEPROM problem in MPLABSIM
    By nicholastyc in forum General
    Replies: 1
    Last Post: - 16th May 2008, 18:10
  3. How do you interface a 74hc165 to a pic12f629
    By orion1137 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 6th February 2005, 04:10
  4. PIC12F629, useing all I/O pins
    By Jcee324 in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 7th December 2004, 11:05
  5. PIC12F629 or 8pin
    By andyf in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 27th October 2004, 18:11

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts