+ Reply to Thread
Results 1 to 29 of 29

Thread: PIC Audio

  1. #1
    Join Date
    Jun 2006
    Posts
    15

    Default PIC Audio

    Hi all,
    I was wondering if anyone had any experience with using a PIC in an audio amplifier circuit where you speak into a microphone and the Audio amp boosts the audio and distorts it a little (to sound like it's coming out of a radio) and then when the audio is finished the PIC plays a small sound or one of two or three sounds after the audio is done. I am currently trying to buy a prefabbed board which wil do this... BUT the production on the boards is limited and the next batch won't be out for several months. I need it to add the finishing touches on my Stormtrooper Armor Suit. The unit basically amplifies the audio and then when you get done talking it plays a short static burst.. like white noise or squelch on a radio... Would be nice to build a home brew of this. Anyone have any ideas they would be willing to share?

    Cheers,
    -Dave

  2. #2
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by toofastdave View Post
    Hi all,
    I was wondering if anyone had any experience with using a PIC in an audio amplifier circuit where you speak into a microphone and the Audio amp boosts the audio and distorts it a little (to sound like it's coming out of a radio) and then when the audio is finished the PIC plays a small sound or one of two or three sounds after the audio is done. I am currently trying to buy a prefabbed board which wil do this... BUT the production on the boards is limited and the next batch won't be out for several months. I need it to add the finishing touches on my Stormtrooper Armor Suit. The unit basically amplifies the audio and then when you get done talking it plays a short static burst.. like white noise or squelch on a radio... Would be nice to build a home brew of this. Anyone have any ideas they would be willing to share?
    Cheers,
    -Dave
    Is there a push-to-talk button anywhere that you could hack into to trigger a PIC into making the sound for you? The 'push' would arm the PIC to make the sound, and after the 'push' has been held for X seconds, it would actually be armed, then the 'release' would trigger the PIC to make white noise for X ms.

  3. #3

    Default

    OK. I have a couple of ideas. Give me a few days to try this one for you. We use the ISD5008 voice recorder IC all the time. I have never tried this but I will check to see if I can modify a program to output the incoming audio directly to the speaker. If so, it's a piece of cake. Releasing the activate button will have the PIC set the ISD chip into playback mode and jump to a memory location that has a prerecorded sound effect (of your choice). If the ISD won't allow this, there is another route to go but at this point I have very limited experience with a new ISD chip the ISD1700 series. With this chip, the incoming audio automatically outputs through the speaker during record indicating you have reached the end of the memory array. In theory, the chip could be addressed purposely to the end of the array. Incoming audio outputs through the speaker. When the button is released, the PIC puts it into playback mode and jumps to a location with your prerecorded sound effect. Again, I just began dabbling with this device and, being a different animal than a '5008, may take LOTS of time figuring out this one. Again, give me a few days to try the '5008 way.

  4. #4
    Join Date
    Jun 2006
    Posts
    15

    Default

    Quote Originally Posted by skimask View Post
    Is there a push-to-talk button anywhere that you could hack into to trigger a PIC into making the sound for you? The 'push' would arm the PIC to make the sound, and after the 'push' has been held for X seconds, it would actually be armed, then the 'release' would trigger the PIC to make white noise for X ms.
    Naaw, it's all hands free. The unit has to be in the helmet and there is no way to constantly keep pushing a button...especially when you are talking, holding stuff (blasters) and moving around. The armor is pretty complicated and you can't have any wires showing anywhere. You have to interact with the people around you so it would be very distracting to have to keep pushing the button everytime.

    Quote Originally Posted by peterdeco1 View Post
    OK. I have a couple of ideas. Give me a few days to try this one for you. We use the ISD5008 voice recorder IC all the time. I have never tried this but I will check to see if I can modify a program to output the incoming audio directly to the speaker. If so, it's a piece of cake. Releasing the activate button will have the PIC set the ISD chip into playback mode and jump to a memory location that has a prerecorded sound effect (of your choice). If the ISD won't allow this, there is another route to go but at this point I have very limited experience with a new ISD chip the ISD1700 series. With this chip, the incoming audio automatically outputs through the speaker during record indicating you have reached the end of the memory array. In theory, the chip could be addressed purposely to the end of the array. Incoming audio outputs through the speaker. When the button is released, the PIC puts it into playback mode and jumps to a location with your prerecorded sound effect. Again, I just began dabbling with this device and, being a different animal than a '5008, may take LOTS of time figuring out this one. Again, give me a few days to try the '5008 way.
    Does this chip have a logic pin that indicates when it is receiving audio? If so, you could eliminate the switch and have the PIC monitor the login state instead of having a switch. The unit I am looking at doesn't have any switches except to program it... I'm not really asking anyone to build this for me but I don't have ANY experience with audio so a little help would be great! Maybe suggest a chip that could do something like this or a combination of chips. I know you mentioned the ISD series. I could DL some of the data sheets to look them over.

    Thanks!
    Dave

  5. #5
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298

    Smile Interesting project

    Hi Dave,

    Do you have a substitute amplifier board that will amplify your voice? That part may be a little tough, to get a PIC to amplify audio.

    If you have an amplifier board or could build / buy one, the PIC may be able to do the rest.
    Instead of a mechanical push-button switch, the A/D input or the comparator input could be used to “trigger” on a preset level. Some times called “VOX” (voiced operated transmission), this is used for hands free transmitter control.

    You could tap into the audio and allow an adjustable threshold (voice) level to tell the PIC to be ready to playback your sounds. When the level drops below the threshold for a programmed period of time that would tell the PIC to play the sound now.
    In other words; the PIC senses you are talking and then, that you have stopped talking. So it plays the sound, into the audio amplifier.

    You have to figure out how to get the sound you want out of the PIC.

    Interesting project
    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  6. #6
    Join Date
    Jun 2006
    Posts
    15

    Default

    Quote Originally Posted by Pic_User View Post
    Hi Dave,

    Do you have a substitute amplifier board that will amplify your voice? That part may be a little tough, to get a PIC to amplify audio.

    If you have an amplifier board or could build / buy one, the PIC may be able to do the rest.
    Instead of a mechanical push-button switch, the A/D input or the comparator input could be used to “trigger” on a preset level. Some times called “VOX” (voiced operated transmission), this is used for hands free transmitter control.

    You could tap into the audio and allow an adjustable threshold (voice) level to tell the PIC to be ready to playback your sounds. When the level drops below the threshold for a programmed period of time that would tell the PIC to play the sound now.
    In other words; the PIC senses you are talking and then, that you have stopped talking. So it plays the sound, into the audio amplifier.

    You have to figure out how to get the sound you want out of the PIC.

    Interesting project
    -Adam-
    Adam,
    Yes I was planning on using an external amp..not sure which one yet but using the A/D comparator sounds like a great idea! The noise I want the PIC to simulate is just static or the short squelch sound that you hear when you unkey a transmitter... Forgot to mention that the board I am trying to emulate is driving 8 ohm speakers... I think it's pushing like 8 watts at 12vdc.. It's actually pretty loud in the video that I watched.

    I figured since I have PBP and Proton Plus that I should be able to beat the 105 pound sterling ($210.00us) price for the board if I build it myself. Like everyone else though, I just lack the time.. I'd buy the dang board if he had them available just to save myself the trouble.

    -Dave

  7. #7
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298

    Lightbulb rectify the audio

    Hey Dave,

    Do you have a link to the board you are looking at?

    You may want to make a band pass filter to get the restricted radio voice type sound.
    The PIC could add the rushing radio sound (squelch tail) at the end of your “transmission”.

    If you have the schematic of the amplifier that would be handy.
    You could add a rectifier stage to rectify the voice audio. Use this audio voltage to charge a capacitor. Monitor the capacitor voltage with the comparator or A/D of a PIC. Let the PIC decide you have been talking and now you have stopped (for a certain length of time).
    Have the PIC produce a “burst” of white noise.

    We all know about lack of time (seems to be universal), do what fits.
    If you do find time to make your own, you could add stuff. Like color LEDs. Green most of the time, red to show you are talking, blue to show “end of transmission”......
    Maybe the red LEDs could be a line of LEDs that travels back and fourth while you are speaking?

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  8. #8
    Join Date
    Jun 2006
    Posts
    15

    Default

    Quote Originally Posted by Pic_User View Post
    Hey Dave,

    Do you have a link to the board you are looking at?

    You may want to make a band pass filter to get the restricted radio voice type sound.
    The PIC could add the rushing radio sound (squelch tail) at the end of your “transmission”.

    If you have the schematic of the amplifier that would be handy.
    You could add a rectifier stage to rectify the voice audio. Use this audio voltage to charge a capacitor. Monitor the capacitor voltage with the comparator or A/D of a PIC. Let the PIC decide you have been talking and now you have stopped (for a certain length of time).
    Have the PIC produce a “burst” of white noise.

    We all know about lack of time (seems to be universal), do what fits.
    If you do find time to make your own, you could add stuff. Like color LEDs. Green most of the time, red to show you are talking, blue to show “end of transmission”......
    Maybe the red LEDs could be a line of LEDs that travels back and fourth while you are speaking?

    -Adam-
    Adam,
    Sorry for the late response, I've been on the go all weekend. I like your ideas and can probably incorporate them into the design initially to help with the design. The link to the board I am trying to emulate is

    http://www.romfx.com/

    Check it out and go to the Audio / Video page and you can listen to what the board actually does. I know the PIC will play tones.. but do you actually think you can produce an un-squelch sound?

    -Dave

  9. #9
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298

    Smile SOUND Generates tone and/or white noise

    Hi Dave,
    There are two things that you may want to try.
    Find a way to band-pass or “restrict” the audio going through your amplifier.
    This will make your voice sound like it is coming over the radio (like a telephone voice sound).

    I have never made white noise with a PIC.

    The PICBASIC Pro manual says it is possible with the sound command.
    See PBP manual: 5.78. SOUND
    SOUND Generates tone and/or white noise on the specified Pin.

    You may have to make a filter similar to the one in the DTMFOUT section.
    See PBP manual: 5.17. DTMFOUT
    Maybe leaving the signal as a white noise square wave would enhance the “radio” sound. This will be a low level volume. It will have to be injected into the amplifier at a low level stage. Hope someone that has used the white noise jumps in here.

    If you are set-up to breadboard the PIC SOUND command, you should try it to see (or hear) for yourself. It should sound like the burst of broken squelch a radio makes when turning back to receive.

    This sounds like a do-able project but it may take you a little more time that you might expect. The fun of doing it would be the reason, not the money saved.

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  10. #10
    Join Date
    Feb 2006
    Posts
    20

    Smile

    I recomend using an lm386 audio op amp to handle the amplification. If you boost the gain up by connecting a 20uf capacitor accross pins 1 and 8 you may get some distortion at the ouput to make your voice sound like it is coming over an rf link. You could also use a different op amp (lm741 ect) and wire it up with a very high gain to increase distortion. This could be achived by conecting a low value feedback resistor from the inverting input to the output. After you amplify the signal, you should feed it into a comparator chip. An lm393 would work well for this application. Set the + threshhold voltage with a two resistor divider. Conect the output from the audio amp to the - input of the comparator and pull the output of the comparator up with about 3k. The ouput can then be fed directly into the PIC. Your program will simply need to wait for the output of the comparator to go high and then fall low again indicating that you have finished speaking. It can then be programed to output white noise with the sound command. PIC generated white noise sounds very steady. If you want a more realistic sound you could try to set up a very simple radio reciever built around another 386 op amp. This is simpler then it sounds and would produce a good sound. You would simply wire up the lm386 as usual and then conect a tuned circuit (capacitor and inductor) accross the input. You could easily wind a simple coil and use a small value capacitor to make this circuit produce the desired sound.

  11. #11
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    76

    Default

    I recommend the element of surprise...

    Do you see how careless those storm troopers were! It would be easy to conseal a light saber in the crowd. Just at the right moment... POW! BAM!
    BLING! Cut them right in half!

    Just don't hit the HELMETS!

    Ross
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  12. #12
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    76

    Default

    Dave,

    It seems like there is an answer in using several of the ideas mentioned. Using the PIC as your control device to since when you are speaking, a simple lm386 sound distortion circuit for your voice, and I would use a small cheap digital mp3 player for your sound(s). There are so many awsome sound effects free for the download... and the storage, sorting and interface platform is already built into the mp3 players.

    Pop one apart, tie in a couple of wires and let the pic toggle through to the sound of your choice.

    I did this with a CD player once. I programmed the pic to choose different wav files to play. It worked great.

    And you can create your own sounds ... sans all the circuit hardware.

    Ross
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  13. #13
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    76

    Default

    ...You could even pre-program the chip to call an mp3 file that sounds like the base commander is calling you on your headset. HA! It could add to the realism.

    The processor need not be bigger than a 12f675. You just need the analog input, and three or four outputs to trigger and toggle the mp3 player.

    I like that the mp3 player leaves the sound end completely open to quick and easy modifications.

    Quick wav file sample attached:

    Ross
    Attached Files Attached Files
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  14. #14
    Join Date
    Jun 2006
    Posts
    15

    Default

    Quote Originally Posted by rossfree View Post
    ...You could even pre-program the chip to call an mp3 file that sounds like the base commander is calling you on your headset. HA! It could add to the realism.

    The processor need not be bigger than a 12f675. You just need the analog input, and three or four outputs to trigger and toggle the mp3 player.

    I like that the mp3 player leaves the sound end completely open to quick and easy modifications.

    Quick wav file sample attached:

    Ross
    Wow, I've been so busy building my armor that I didn't see the topic reply to this post... I've got to sit down and analyze all of the suggestions but DANG you guys ave some great ideas. Not sure about the MP3 player though but I am pretty sure the original board has a way to hook it to your computer to upload MP3s or WAV files to it to play bleeps or whatever... It would be cool like you said to have another voice come over the headset like home base or whatever..

    I have attached a pic of my helmet (Bucket) progress so far. I'm still waiting on some green lenses so it's not 100% done yet. I've been staying up till like 5am every morning trying to get this done!!
    Attached Images Attached Images  

  15. #15
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298

    Smile VOX circuits

    Hey Dave,

    That helmet looks great! Very impressive work.

    Good ideas about the MP3s and audio effects.

    If you have time:
    peterdeco1 had a good idea about a recorder playback chip.
    Even one like in a greeting card.
    It does not have to have loud audio, just tap it into the same amplifier for your voice.

    Alfred had some good ideas too, may need a little more power than a LM386. But there are other audio amplifier ICs that might be as simple to use.

    Ross is right about all the sound effects available in MP3 format. It would be handy to just tap into a cheap one and feed the low level (headphone) audio into you voice amp.
    He is right about “Just at the right moment... POW! BAM! BLING! Cut them right in half!” too!

    Can someone try the white noise output of a PIC and let us know if it sounds like radio static “rush” (before squelch mutes it). Maybe post a sound clip?

    Have you looked for any voice operate circuits (VOX)? Here is one example schematic. I like the voltage doubler part.
    http://www.electronickits.com/kit/co.../elec/k126.pdf
    You would not need all the amplifiers / comparators and relay.
    Your amplifier produces the level and the PIC senses voice voltage and switches your effects....

    Great ideas guys, who else?
    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  16. #16
    Join Date
    Oct 2004
    Location
    New Hampshire
    Posts
    76

    Talking

    It may be a little late to point this out but...

    STARWARS ISN'T REAL!...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    It's only a movie.
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .

    Somebody catch him!

    .
    .
    .
    .
    .
    .
    .
    I love wierd people! :-)

    The helmet looks awsome!

    Ross
    Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!

    I like that! :-)

  17. #17
    Join Date
    Jun 2006
    Posts
    15

    Default

    Well, I've been looking at Audio amps... The LM383 would have been perfect but it's obsolete. There is a replacement for it though and I found a few others that I like. Almost finished with my armor so I'll start working on the PIC circuit as soon as I get finished with that... And yes, I know Star Wars isn't real

    BUT neither were microwaves and color TV not so long ago... he he

    Have a great evening!
    Dave

  18. #18
    Join Date
    Jun 2006
    Posts
    15

    Default

    Ok, done with my armor...now on to the audio... I've been playing with the PIC but most of the noise that I can get to come out of it are too "digital sounding"...when using the SOUND command. Reading on the site for the original board I found that the board has 5 different modes as well... One that adjusts the amount of distortion that your voice changes from "Normal" to "Distorted" 1-5 depending on where you set the level. You can also upload wav files to the thing using his software and a computer... Delays from when you finish talking to when the static burst comes out, turning the static sounds on and off...Geez!!

    My questions:

    1. How do you adjust the real time audio distortion if the PIC isn't sampling the audio or do you think it is?
    2. Do you think it is using the 1 bit audio, I.e. the Roman Black 1 bit wav file audio?
    3. Do you think it is using a pre-recorded wav file for the static or generating it using the PIC?

    I'm kinda lost here...None of the white noises that I get from the PIC sound anywhere near what I hear on his site..and there is a click before the rush of white noise... the simulated button release of the radio.

    I've found examples of MMC uses, ISD voice recorder uses and a couple other instances where PICs are being used with other devices to produce audio but I can't really settle on which would be best.

    -Dave

  19. #19
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    562

    Default It may be possible

    Hi,

    Excuse me if I am quoting something already mentioned by somebody. I have quickly browsed the thread a may have skipped something. Its sunday and I am back after a long tour. So I am worried about the "Wife" bug to be active any moment!!

    If you sample the audio at 8Khz and continuosly throw the sample out through Hardware PWM you would actually be reducing the bandwidth of the input audio. Sort of a low-pass filter. Couple that with dirty (cheap) filtering and the free quantitizing noise. This may be the sound you are actually looking for.

    You can have a routine detecting when the ADC is receiving no/low signals. Treat them as end of audio and thus trigger your sound fx routine- handsfree.

    Needs some ASM stuff to utilize the conversion and/or acquisition time to update the hardware PWM.

    Just a thought.
    Regards

    Sougata

  20. #20
    Join Date
    Jun 2006
    Posts
    15

    Default

    Quote Originally Posted by sougata View Post
    Hi,

    Excuse me if I am quoting something already mentioned by somebody. I have quickly browsed the thread a may have skipped something. Its sunday and I am back after a long tour. So I am worried about the "Wife" bug to be active any moment!!

    If you sample the audio at 8Khz and continuosly throw the sample out through Hardware PWM you would actually be reducing the bandwidth of the input audio. Sort of a low-pass filter. Couple that with dirty (cheap) filtering and the free quantitizing noise. This may be the sound you are actually looking for.

    You can have a routine detecting when the ADC is receiving no/low signals. Treat them as end of audio and thus trigger your sound fx routine- handsfree.

    Needs some ASM stuff to utilize the conversion and/or acquisition time to update the hardware PWM.

    Just a thought.
    Great suggestions. I was thinking about using a digital pot to bias the amplifier...maybe go from a normal bias to overbias to get the distortion... Dunno if that will work as planned or if it's even a good idea but I am going to play around with it. I'm not quite up to speed on sampling the audio and using PWM to distort it but it sounds doable. Working on trying to find info on SPI now... Seems the manuals don't cover SPI (or I couldn't find anything in the manual about SPI)... I found some stuff in a few forum on the web. I thought it was a standard command but I can't find any of the includes or Defines listed anywhere in the book... Not even in the Proton Plus manual... Hmmmm

  21. #21
    Join Date
    Oct 2004
    Posts
    440

    Default

    Quote Originally Posted by toofastdave
    Seems the manuals don't cover SPI (or I couldn't find anything in the manual about SPI)... I found some stuff in a few forum on the web. I thought it was a standard command but I can't find any of the includes or Defines listed anywhere in the book... Not even in the Proton Plus manual... Hmmmm
    See M25P32 PIC Audio **warning, other compiler**
    Includes hardware SPI routines.

    Norm

  22. #22
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    562

    Default All you need is an ASM interrupt.

    Hi,

    If you use an 8 MHz crystal as your oscillator and let your timer0 run free it would interrupt @ 7.8Khz (Thanks to MisterE for the PIC multicalc utility). Enable timer0 interrupt. In the interrupt routine you don't need to reload timer0 as it already rolls over. This assures a solid timebase interrupting at fixed intervals. On the interrupt set the Go/Done bit of your ADC. Use the ADC in 8 bit mode. When the conversion is done. Simply dump the ADRESH value to the PWM duty register. All this happens in the interrupt routine. Let the AD module run continuosly so that sampling (acquisition) actually occurs when you are outside the interrupt. This should be quite simple to achieve. You get enough time outside the ISR to decide whether the ADC is sampling 0 or say 127 (when you are DC offsetting the Audio that gives you a 0 for the most negative peak, and 255 for most positive sort of pseudo signed ADC you loose resolution again, distort more).
    Regards

    Sougata

  23. #23
    Join Date
    Jun 2006
    Posts
    15

    Default

    Quote Originally Posted by sougata View Post
    Hi,

    If you use an 8 MHz crystal as your oscillator and let your timer0 run free it would interrupt @ 7.8Khz (Thanks to MisterE for the PIC multicalc utility). Enable timer0 interrupt. In the interrupt routine you don't need to reload timer0 as it already rolls over. This assures a solid timebase interrupting at fixed intervals. On the interrupt set the Go/Done bit of your ADC. Use the ADC in 8 bit mode. When the conversion is done. Simply dump the ADRESH value to the PWM duty register. All this happens in the interrupt routine. Let the AD module run continuosly so that sampling (acquisition) actually occurs when you are outside the interrupt. This should be quite simple to achieve. You get enough time outside the ISR to decide whether the ADC is sampling 0 or say 127 (when you are DC offsetting the Audio that gives you a 0 for the most negative peak, and 255 for most positive sort of pseudo signed ADC you loose resolution again, distort more).
    I'll have to look into this..it sounds interesting but it may keep my PIC busy for longer than I'd want it to be at any given time, especially if I have to monitor the start and end of the audio to communicate via SPI to another device. I'll play around with it though... Thanks for the great suggestion!

  24. #24
    Join Date
    Jun 2006
    Posts
    15

    Default

    Quote Originally Posted by Normnet View Post
    See M25P32 PIC Audio **warning, other compiler**
    Includes hardware SPI routines.

    Norm
    Norm,
    Great project. I think I read about it last week when I was searching for PIC Audio Projects. Thanks for the link and the additional info. Where did you originally get the info for the SPI harware routines if they aren't in the PBP or Proton Manual?? Does RealBasic cover it in their manual?

  25. #25
    Join Date
    Oct 2004
    Posts
    440

    Default

    Learn hardware SPI routines:

    1.Read data sheet timing diagrams.

    2.Test with working SHIFTOUT and SHIFTIN program. (SHIFTOUT pbp & SHOUT proton are almost identical)

    3.Bitbang above program, something like:
    low CS pin
    pause
    low clock pin
    pause
    high dataout pin (bit 7 = 1)
    pause
    high clock pin
    pause
    low clock pin
    pause
    low dataout pin (bit 6 = 0)
    etc.

    Watch on scope or if you don't have a scope make a led driver with pin > N channel FET > pullup & P channel FET > LED.

    4.Now timing known. Read PIC 452 data sheet page 130 for your SPI configuration of
    SSPSTAT = %01000000
    SSPCON1 = %00100010

    See SPI clk speed adjustment post 13.
    Hardware SPI extremely fast compared to SHOUT.
    Sends and receives in 3line instruction.

    Norm

  26. #26
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130

    Default Simpler?

    Dave,
    For something simple, take a look at Radio Shack catalog #277-1008, a little 9 volt powered audio amplifier, it runs about $14.00 US, and is in most of the stores. Then add part #276-1323, it's a little digital sound recorder. It holds up to twenty seconds of low fidelity audio. Record your squelch sound from a walkie talkie, or whatever onto the recorder board. Put a little microphone inside your helmet, wire a cord down to the PIC. Let the audio from the microphone go into the amplifier, now your voice will be 'distorted' by the little speaker in the amp. When you finish speaking, let the PIC trigger the little recorder board to play the recording. The recorder runs on 9volts too, and costs about $11.00.

    I've used both of these items to put together a quick demonstration for a client, I fed the audio from the amp to a bigger speaker for better fidelity, and it worked great. The hardest part was soldering my PIC driver circuit onto the recorder printed circuit board to parallel the PLAY pushbutton, (it's a little button, and my eyes are old!)

    Hope this helps,

    Jerry.
    If your oscilloscope costs more than your car...

  27. #27
    Join Date
    Jun 2006
    Posts
    15

    Default

    Norm,
    Thanks for the advice on the SPI setups...I'm back home from a long trip and will be sitting down to look at this in detail.

    Jerry,
    I am way past the point where I can say I'd be limited to that dollar amount... holy cow. I got an evaluation system for one of the ISD systems so I can play around with storage devices... and pics, caps, resistors.. the whole shebang... I am waaay above where I should be in the $$$$ department but if it works then it would be worth it for me. I am not one to try to save money when I am building something so...I end up spending way more than I should. I'll keep you guys posted on progress.

    Thanks again!
    Dave

  28. #28
    Join Date
    Jun 2006
    Posts
    15

    Default

    Quote Originally Posted by sougata View Post
    Hi,

    If you use an 8 MHz crystal as your oscillator and let your timer0 run free it would interrupt @ 7.8Khz (Thanks to MisterE for the PIC multicalc utility). Enable timer0 interrupt. In the interrupt routine you don't need to reload timer0 as it already rolls over. This assures a solid timebase interrupting at fixed intervals. On the interrupt set the Go/Done bit of your ADC. Use the ADC in 8 bit mode. When the conversion is done. Simply dump the ADRESH value to the PWM duty register. All this happens in the interrupt routine. Let the AD module run continuosly so that sampling (acquisition) actually occurs when you are outside the interrupt. This should be quite simple to achieve. You get enough time outside the ISR to decide whether the ADC is sampling 0 or say 127 (when you are DC offsetting the Audio that gives you a 0 for the most negative peak, and 255 for most positive sort of pseudo signed ADC you loose resolution again, distort more).
    sougata,
    Do you have any example code of this application? It sounds like something I would like to try but ASM interrupts are over my head...I haven't gotten the whole interrupt concept down just yet...I'd appreciate anything you had to share to help me understand this idea.

    Thanks!
    Dave

  29. #29
    Join Date
    Jan 2007
    Posts
    24

    Default

    Try a precision full wave rectifier feeding a comparator with a reference set by a pot. This will give a logic level output you can poll using the PIC. When it's high, enable the amplifier, when it falls low activate your white noise burst. Try generating random numbers (8 bit) and feeding them to a 2R2 DAC, you could even just switch a diode noise source output into the amp input.

    I did somethineg VERY similar for a company as a water leak detector. A microphone listened for a noise in the pipes then activated an alarm if the noise was of a certain type and exceeded a certain duration.

    Hope this helps

Similar Threads

  1. Replies: 33
    Last Post: - 8th September 2010, 11:28
  2. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  3. Pic driven digital audio delay
    By skimask in forum Off Topic
    Replies: 12
    Last Post: - 19th April 2007, 20:42
  4. Audio Encoding and playback in a PIC
    By Rob in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 24th March 2005, 08:56
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

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