how can picaxe recognise different sounds?

tarantulataramasalata

Senior Member
If I made noises of a specific frequencies at a picaxe chip, I could probably hook a mic to an analogue input and get a different output for each different frequencies.

If that is the case (please correct me if I'm wrong!) could one then just miss out the speaker/mic bit and send the output from the headphone socket straight to the picaxe? would it need an opamp, or praps just a transistor? what about the darlington pair BCX28B?
 

Dippy

Moderator
Any signal going to the PICAXE would have to be at a LEVEL or TYPE that it can understand.

Lets say TONE rather than NOISE. A NOISE is a whole mish-mash of frequencies which may upset things.

The 2 easiest options would be to convert the TONE (frequency) to a voltage and ADC it (i.e. F-V then ADC).
Or within a certain F range you could square-up the sine into a square-wave and the COUNT or Pulsin I reckon. You may have to set the gain before you do this depending on your source.

Edited by - dippy on 27/03/2006 22:24:30
 

tarantulataramasalata

Senior Member
thanks dippy, that's helpful.
could these tones be, say, DTMF tones?
would these tones work if they were stored as mp3 files?
can one do frequency to voltage conversion in the PICaxe or can you recommend a component for this?

thanks again
 

hippy

Ex-Staff (retired)
If you are specifically looking to decode DTMF the best solution would probably be a dedicated DTMF decoding chip.

If you were looking to do Sound-to-Light disco style light flashing, the easiest way is to amplify the audio, run through the appropriate number of band-pass filters and RC them to give an 'average level' for how much audio is in which frequency band.

The more band-pass filters you have, the narrower the frequency and sharper the cut-off the more finely you can determine when individual tomes have occured. A DTMF decoder chip effectively puts all those filters required into a single package and does other clever tricks to let you know what 'key' was pressed to generate that tone.

There's no reason I can think of why DTMF couldn't be replayed from MP3 or even WAV, providing the sampling rate isn't too low.
 

Michael 2727

Senior Member
Use Count, " Count, pin, period, variable"

e.g. - count 3,500, b1
will count pulses on pin3 over 1/2 sec,
result into b1.
Pure tones may work well but other complex
sounds may need signal conditioning -
Schmitt processed to square up the signal.

I thought about DTMF and trying to get a
picaxe to recognise the tones but I am 99.999%
sure it cannot be done successfully.

Using the notes from 08M chips you could
reliably catch and decode/implement each
note to a different task quite easily.
You could even use pure tones at say 10-50 Hz
intervals, use the band 1khz to 5khz and
set the count peroid to 100m/sec or so.

You can do quite a lot with tones, but as
was said if you want to play with DTMF you
will have to use a dedicated chip unfortunately.

That's my 5¢ cents wotrh anyway... ~ ;o)


 

Dippy

Moderator
F to V: have a look at the chip recently mentioned on the motorbike ignition thread i.e. the LM3907. Data sheet:-
http://www.national.com/ds/LM/LM2907.pdf

DTMF: as described by the two contributors above.

MP3: I assume you mean a TONE stored as MP3 and played back through a player? Yes, why not.

But whatever you do, you must get the TONE into a state/format which PICAXE can understand (Voltages/Pulse stream). So you will almost certainly have to process it as described above. If you want to use Count then yes a Schmitt logic chip or monostable would do to square it up. Perhaps even a Voltage Comparator / Op amp. Choice would depend on your expected frequency range. And your tones would have to be pure.

Beg/steal/borrow a sillyscope. Personally speaking, I don't know how people can do certain projects without one.

Sorry, shouldn't have said 'steal'; it may encourage inappropriate behaviour.

Edited by - dippy on 28/03/2006 09:45:03
 

whizzer

Senior Member
A little more on the subject of DTMF Tones..

DTMF stands for Dual Tone Multi-Frequency.

That means that each time a DTMF keyboard is operated, two tones are produced simultaneously for a single keypress. This explains how, when you hear the DTMF sound (eg when you are dial a phone) it sounds a little unusual. i.e. it is not a pure sinewave of a single frequency.

I believe that the two tones used for each button were carefully chosen at the time this sytem was designed so that they are not harmonically related. The intention being that the DTMF signal can undergo significant distortion on its travels through a phone network & still be reliably decodable at the other end.

While dedicated hardware chips decode the DTMF signal effortlessly, Picaxe's limited speed & memory means that it is not a propositionn to do DSP (Digital Signal Processing) of DTMF on a Picaxe.
 

tarantulataramasalata

Senior Member
thanks again everyone.

more questions, if you'd be so kind as to give your opinions:

page 9 of the LM2907 pdf shows a circuit for f2v conversion; I think this looks good.

I want to create a graphic user interface on a computer that generates a tone (not necessarily dtmf, perhaps one that is created by the TUNE command) when a screen button is clicked. The tone goes down the cable from the headphone socket (one wire to pin1, the other to earth) and is converted to a voltage which is measured by the PICaxe. So I could have 255 different tones, in theory...?

Will the LM2907 -8 run off 6v, so it could share the picaxe power supply?

Thanks again

Edited by - tarantulataramasalata on 29/03/2006 00:13:28
 

Dippy

Moderator
The page after shows an example running from 6V...

PLEASE read and inwardly digest the Data Sheet. They always make handy lavvy reading.

Just remember to have a rock-steady smooth power supply as your Vout is prop to Vcc (supply).
And Fmax is inv prop to Vcc. Fmax?

Read 'Application Information' and DO the CALCS rather than use any old components gathering dust on your bench. (I know its heaps easier to get on the Forum, but it may be heaps quicker to get the calculator/spreadsheet out.)
 

tarantulataramasalata

Senior Member
Thanks.

Honest I did read the spreadsheet, but they are invariably seem to be made for electronic engineers, which (as you might tell) I am not. I am trying, though :)

Those of you who can do this sort of thing with eyes closed get the satisfaction of helping us poor souls, and are heaped with piles of eternal gratitude. If that fails I'll give you some money?
 

Dippy

Moderator
Sorry, didn't mean to sound sarccy. I wasn't being - honest.

I think my first project was a car tacho using that ancient F-V chip. I remember the problems. That was in the year BPA 10.
Data sheets can be horrible, but wrestle with it.

Make your own notes as well. I got a notebook and 'translated' data-sheet-ese into English on many occasions.
Be patient.. and these things will suddenly click. Just like programming.

Money? Pah. The day you post a message saying you got it to work is worth more than money.

Then after that, get a good CAD to make PCBs. Store all your working projects as macros and circuits in future just become cut'n'paste.


Good luck. And keep trying; it'll work.
 
Top