Microphone ADC - how does it work?
kenmac
Posts: 96
I have a small project which monitors the audio output of a smoke detector via a Electec microphone and an amplifier/interface to convert to a logic signal.
I see that the Propeller can accept audio input from a microphone, and wondered how that is achieved.
I've looked at Chip's Microphone_to_Headset.spin, which is some small Assembly code.
I know the basics of "sampling" for audio ADC, but I can't really understand what the Propeller is doing.
My requirement is a bit simpler - it just needs to create data to indicate the presence of loud audio, then convert to a digital alarm state.
If I can achieve this via the Prop, then I can do away with the external interface.
Is it possible to achieve this without using Assembly code, i.e. use Spin?
kenmac
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Perth, Western Australia
Time Zone = GMT + 8
I see that the Propeller can accept audio input from a microphone, and wondered how that is achieved.
I've looked at Chip's Microphone_to_Headset.spin, which is some small Assembly code.
I know the basics of "sampling" for audio ADC, but I can't really understand what the Propeller is doing.
My requirement is a bit simpler - it just needs to create data to indicate the presence of loud audio, then convert to a digital alarm state.
If I can achieve this via the Prop, then I can do away with the external interface.
Is it possible to achieve this without using Assembly code, i.e. use Spin?
kenmac
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Perth, Western Australia
Time Zone = GMT + 8
Comments
There is plenty that I don't completely understand. Chip's code uses counters and self-modifying instructions. The best explanation for the counters is in the PE Kit lab. There have been several posts regarding self-modifying code.
A further example of the technique can be found in microphone_to_vga.spin.
I am in the process of hacking something like this with the partial understanding that I have... I'll post the hack. There is a call to "FASTIO" in the spectrum analyzer... that seems like a good place to hack.
I am looking forward to other responses to your question.
Thanks for posting
Rich
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 8/2/2007 4:33:04 PM GMT
What's the max sampling rate i can achieve with this?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
This is a difficult concept to grasp.
Looking at the example Assembly code, it seems that the accumulated level/number after each sample cycle is read from the PHSA register into a variable.
What happens to the value in the variable, does it continue to grow with each cycle?
Say there is a continuous sine wave input, can you please describe the steps that occur.
I'm more interested in being able to detect a continuous signal over a period of about 5 seconds - the resolution isn't really a factor, just the presence of the signal.
Also, I'd prefer to be able to do it in Spin code.
I just need to understand better what it's doing.
kenmac
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Perth, Western Australia
Time Zone = GMT + 8
i know the propeller is very versatile and can do even ADC
but how about a simple operational amplifier like the LM358
this 8DIP-Chip has 2 OPs inside
build up with some resistors an amplifier for the microphone signal
in the first OP
and the second is build up with some resistors as a comparator with hysteresis
then the output of the second OP is connected to one IO-PIN of the prop and you simple
watch the logic level of this IO-PIN
greetings
Stefan
Thanks for your interest.
I already have a working external interface (amplifier/logic output) but I can eliminate that if I can incorporate the function into the Prop.
So, I just need to work out how to implement the ADC part of the Prop.
It's only 1 function in a Prop. that is nearly fully allocated (pins).
kenmac
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Perth, Western Australia
Time Zone = GMT + 8
i'd say 8bit and something about 100 samples per s is enough.
Nightfly, it is possible to achieve that·sample rate, one thing to note though is that the Sigma·Delta conversion on the propeller is a bit noisy (the lower bits tend to fluctuate), for·your application you may need to use an external ADC to achieve your desired precision, or increase the number of bits the Propeller samples and throw·away the noisy bits.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com