Tone frequency reading

pstarckt

New Member
Hello everyone. New here to the forums and the Picaxe as well. I'm working on a RC project that has both sound and visual effects. I have a Vmusic for the sound. My question is this: In order to insure the visual effect is timed with the sound I am thinking of creating a stereo sound track, one channel (right) being the sound effect and the other channel (left), be used with a tone set to turn on and off the visual. Can the Picaxe read various frequency tones to execute different subroutines? Can it treat the pure tone audio signal as a PWM pulsin signal? Would it need to be a sine, square or sawtooth signal?
If so which chips are capable?
 
Last edited:

Michael 2727

Senior Member
You could try using pulsin to measure a PWM input.
@ 4MHz pulsin will bottom out at around 9KHz from
memory. If using a tune capable chip you could use
"tunes" for lower frequencies.
 

pstarckt

New Member
I thought of that since the pulsin is essentially reading a frequency. Can the Pic read a frequency at 20khz and above? I'm looking at frequencies above human hearing. This way I can still use a stereo output and embed the high frequency signal to the Pic in 'plain sight' so to speak.
 

hippy

Ex-Staff (retired)
If you're looking at 20kHz up, how are you going to get it recorded and played-back ?

The usual technique is to choose something mid-range and put it on a separate track as you originally suggested. The PICAXE itself doesn't have to decode the audio; that can be done with some fairly simple electronics. One aproach could be to encode an FSK serial stream although I don't know how well that would work.

You could also use the playing timer ( I think the VMusic delivers that ) or you could simply synchronise to the start of playing and self-time to when the effect should occur.
 

pstarckt

New Member
The playing timer is a thought. I have audio mixing software that can generate tones and then I can overlay them at the appropriate spots. If I can use different tones as on/off switches. I've tried overlaying them on the sound file and did a playback. The track plays as normal but you can see the place on the file where the tone is. I can see a problem with random high frequency tones in regular recording being a problem though. The sound is better as stereo but if I have to run it mono on one track, signal on the other, no big deal.
 

moxhamj

New Member
You won't be able to go above 20Khz (or probably even 3khz on a cheap tape deck) but no matter, mono audio on one track and data on the other track.

The simplest circuit would be tone/no tone to turn something on and off. This would be the easiest to get working and you could probably do this without a CRO. Waveform should be square.

If you do have a CRO there are some quite interesting experiments you could do with serin and serout. Serout at 1200 baud sounds like a tone with a fequency about in the middle of the piano keyboard and sounds like the classic modem dial up sound. If it can be recorded it can be played back. You need to record it with the right volume and most tape decks like 1V peak to peak and a picaxe is going 0V to 5V so you would need to divide by 5. To get the sound back you need to bias the volts at 2.5V (a few resistors and a capacitor) and then feed that signal into a comparator which could be just a 741 op amp. That will reproduce the signal with the proper 0 to 5V swing.

If the above makes sense, I'm sure people here can guide you through the process. If it is all gobbledegook, maybe try the simple tone on/off option.
 

Michael 2727

Senior Member
Just a thought :p dangerous I know :)

What about using an IR LED pulsed with
PWM at say 8KHZ, 10KHz, 12KHz etc.
The code could filter out anything above/below
If you used Pulsin you may have to run the
receiver Picaxe at 8Mhz, or temporarily kick
it up a notch then reset it back to 4MHz.
(unless you intend to use an external 16MHz
Resonator anyway)
You would have to test the reliability of the
MAX IR input frequency ( photo diode as a
sensor etc)
 

tikeda

Member
Amateur radio repeaters often use subaudible tones added to the voice signal to activate the repeater. The tones run from 67 to about 250 Hz. If you mixed the tones with the audio, you wouldn't need a separate channel (For voice retransmission, the audio signal is sent through a high-pass filter to strip the low frequency tones). The downside is that you might need multiple detector circuits is you want to decode more than one tone frequency. In contrast, DTMF tone decoder ICs can normally identify 16 tone combinations.

Some simple tone detector dircuits are based on chips like the NE567 PLL. There are also single-chip ICs specifically made for CTCSS tone decoding (e.g. CML Microcircuits).
 

pstarckt

New Member
Ok, now that I know it can read the tone using the output from the Vmusic to the input reading PWM, do I also have to connect the ground from the Vmusic to the chip ground?
 
Top