Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:24 27 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MM Read Audio Frequencies?

Author Message
Nixie
Regular Member

Joined: 19/02/2013
Location: Australia
Posts: 66
Posted: 05:39pm 11 Mar 2013
Copy link to clipboard 
Print this post

I am trying to get my MM B/W (ver 4.3) to read the frequency of an audio signal applied to pin 11

SETPIN 11,3
PRINT PIN(11)

And all I get is '0'
The sine wave frequency is about 2 KHz

I wonder if it has to be a square wave?

Or perhaps there is a particular hardware setup with the pin?
I've tried it with the input going to a 100k to ground and then a 4.7k to the input pin;
and I've also tried a small audio input directly on to the input pin.

Assistance Greatly appreciated


Thanks, Nic C VK3COW
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 06:27pm 11 Mar 2013
Copy link to clipboard 
Print this post

Nic
What voltage is the signal and is it all a positive voltage relative to ground?
Bob
 
Nixie
Regular Member

Joined: 19/02/2013
Location: Australia
Posts: 66
Posted: 07:04pm 11 Mar 2013
Copy link to clipboard 
Print this post

Hi Bob
I have borrowed a "BWD SINE & SQUARE WAVE GENERATOR" which has switched outputs for both sine and square waves at .02, .2, 2, and 20v peak to peak. There is also a pot to vary the output for each of the P-P ranges.

Not sure on you next question - the output on a scope indiicates the sine wave swings between positive and negative.i presume that it is NOT all positive with respect to ground?

I am concerned about feeding too much into the MM so I have only tried it on the .02 and .2 v P-P ranges.

Actually, as an aside, you have brought to mind an idea. I wonder if it is possible to use the TONE command to generate a tone, and then to feed back into the MM to be able to read the frequency?

(I'm now very cautious as I had some dodgy connectors and have already inadvertently let some smoke out of a previous MM)
Chees, Nic.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6099
Posted: 07:28pm 11 Mar 2013
Copy link to clipboard 
Print this post

Nic,
The pins 11 to 20 are 5V tolerant.
The preferred input for counting and frequency measurement would be a square wave swinging from zero to +3.3V. A signal of +0.3 to +3.0 should be OK.

If the sig generator has a DC offset control, you could do a bit of experimenting to find the threshold voltages.

I would always put a resistor in series with the input "just in case". Your 4.7k would be suitable.

If you use the tone command, you will need to get the signal from the CPU terminal and not after the filtering R/C.

Jim


VK7JH
MMedit   MMBasic Help
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 07:34pm 11 Mar 2013
Copy link to clipboard 
Print this post

Nic
I'm not sure about the polarity of the signal but I suspect that it would only read a positive signal. I have no experience here, maybe someone else has. Pin 11 can tolerate voltages up to +5 volts. Refer the manual for the setpin command.

Using the tone command like that was one of the ideas that I had too. You can kick off the tone command with a seriously long duration such as 1000*60*60 (1 hour in milliseconds) with a frequency of 2KHz and try and read that on any of pins 11 to 14. Note you must specify both channels even on a monochrome MM. You could also try the SOUND command (manual P42). It generates square waves.

You could try running your audio signal through a diode to block any negative voltages.
Bob
 
Nixie
Regular Member

Joined: 19/02/2013
Location: Australia
Posts: 66
Posted: 09:28pm 11 Mar 2013
Copy link to clipboard 
Print this post

WOOHOO! Great results!

I guess I just wasn't game to arc the input up enough, but I als found an intermittent with the sig gen GRRRR! Anyway, first thank you to Bob and Jim for your replies.

Using the setup above with pin 11 and the resistors, I found that it took 0.827 volts peak to peak of pure sine wave on 1023Hz (0.652v on load I.e. connected to pin 11) to get a reading from the MM. Great at 1v p-p.
I also checked with a square wave and got the same results. Great!

But for me, of greater interest was the ability to use the MM to generate a TONE and feed it back into itself to read the frequency. Jim, I have an LM386 amp on a breadboard, so I thought I'd try the output from that rather than bypass the RC network. So, the TONE 900 was coming out of the LM386 speaker; and I turned up the volume till I got a frequency reading on the MM (1.101v) it was 899hz, so good enough for me!

Thanks again for your assistance, Nic
PS this has implications for two programs I'm writing, one reads morse code (and quite well!); and the other is a program to tune guitars!
 
Nixie
Regular Member

Joined: 19/02/2013
Location: Australia
Posts: 66
Posted: 09:44pm 11 Mar 2013
Copy link to clipboard 
Print this post

Oh I meant to add that without the protection resistors, the MM was reading "50", which I suspect is the 50Hz mains hum!

It does seem that an input of 1v peak to peak is ideal.

N
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3802
Posted: 10:00pm 11 Mar 2013
Copy link to clipboard 
Print this post

I'd be very wary about any -ve volts!! See data sheet...

DC offset / diode, good ideas.

John
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024