receiving data using light/audio?

Mikymike

New Member
I think straight serin/serout onto a tape would work ... Tape recorders can handle that fine.
I don't use tape in the project. To make a long story short, an mp3 player is connected to a picaxe, each mp3 files are different, right audio channel have the usual sound track, left one will contain the commands to send to the picaxe. The picaxe receive them, analyse them and control other devices base on each commands. each mp3 files with be generate first in an audio editor, something like goldwave, and will contains the commands in different orders, so each mp3 files have his own set of commands. Like a talking robot that will move with the commands.

... you send a group of 6-12 'U's at the beginning of a packet to bias things to half volts. Then a header like 'ABC'. Then the data packet. Then a checksum byte at the end. Those little packets are very short - you could have many per second, and each one could instruct the picaxe to do something different. A packet might be UUUUUUUUABC1236 where ABC is the header, 1 2 and 3 are the data bytes, and 6 is the sum of 1,2 and 3.
hehehe.. audio to serial converter, hehehe. This sound like really easy, arghh I envy you all to know so much about electronic, hehehe. The more I read an the more I see that it is above my electronic knowledge.

The audio stages might need some tweaking an an oscilloscope would be very helpful. But the output for instance would be a matter of biasing the signal to a virtual earth of 2.5V via a blocking cap and then a couple of 10k resistors. Then through a voltage follower. Then maybe a gain stage so the signal is going +/- 1V. Then a comparator. This could all be done with one LM324 chip costing 30c, but would require a bit of op amp theory.
Oh oh!!! I have a LM324!!! ... humm.. now I need an oscilloscope, biasing something, then gain stage (and not weight), voltage follower, comparator and op amp theory.

Look like I'm about to faint again.. heheh.

Well, I see that this idea look at first easier than it would be. Atleast My knowledge of electronic is too small to get something working. I'm sorry that I made you loose your time everyone. You really tried to help, but I see that I unfortunately don't have enough knowledge and experience to achieve it at this time.
 

gbrusseau

Senior Member
MikyMike,
To answer your question about the S8870 DTMF decoder chip. It will respond to a new tone every 40ms. That is several times a second. Remember, the recorded DTMF tones will output from the MP3 player headphone jack directly to the S8870 chip. No signal conditioning needed. The S8870 then outputs a four bit byte directly to your PICAXE for decision analysis. Thats 16 decoded tones. Seems fairly simple to me.

Don't give up and good luck on your project!
 

moxhamj

New Member
If you have a 324 and you have a protoboard, and some components eg a selection of resistors and capacitors, it should be possible to get this working. I think it might only end up being one chip and about 10 components.

But first, a bit more information is needed.

Specificially, first we need to know the amplitude of the audio output of the mp3 player. I'm guessing 100mV but sometimes it is 1V. You need to know that so you can set the gain of the amplifier stage. Set it too low and you will get spurious results. Set it too high and you will get clipping.

You can do level translation with one capacitor - a bipolar electrolytic eg 2.2uF. You might be able to use a polarised one if you know what the DC voltages are.

Once you know the amplitude of the output, the next test is to work out what to feed into the input. The input might be a microphone. It might be from an audio lead. If the latter, 100mV might be the right value. But if you fed 5V/0V into the input stage, you could well get clipping. So you might need a voltage divider on the input. A "volume knob" is the simplest divider - eg a 10k pot. But where do you set the volume?

To do this properly, you need a sine wave. Square won't work as you won't be able to detect clipping. Feed in a sine wave, adjust the volume pot on the input to the MP3 and record. Now play it back and look at it on a cro. You want a nice looking sine wave on the output.

But there are ways to do this if you don't have a cro or a sine wave generator. You could record a tone at different volumes and see if the volume was about the same as music volume. That will set the input pot.

But the output might be tricky without a cro. It still might be possible to use the PC soundcard as a cro.
 

boriz

Senior Member
Sorry MM. I gave you the ‘lazy’ circuit coz I was in a hurry. On reflection, it’s not difficult to see why it won’t work very well. So here’s a better version drawn and simulated using Circuitmaker 2000. Using a BC549 and the components shown, you should get comparable results to those in the simulated output.

Circuit 1:


Circuit 2:


The only difference between the two circuits is the amplitude of the input signal. Both have a 1kHz sinewave input, Circuit 1 is 20mV peak (40mV pp), and Circuit 2 is 200mV peak (400mV pp). The simulation has been tested with frequencies as low as 100Hz and as high as 100kHz with similar results.

Notice that, although the input is a nice symmetrical sine wave, the output is not. This distortion is due to the cutdown biasing method and clipping due to over-amplification. However, for this app, the only information you need to convey to the Picaxe is frequency, so distortion like this will have little effect on the results. In fact the clipping is somewhat beneficial since it turns analogue ‘waves’ into something more like squarewaves.

When you build this, make sure to observe capacitor polarity. And don’t forget to provide a simulated load for the audio signal as indicated in the previous post (100R for headphone). Without the proper loading, you will likely have noise issues.
 
Last edited:

boriz

Senior Member
When testing. The best volume level is the lowest that gets consistent results (plus a little bit).
 

Mikymike

New Member
Hi Boriz, Thank-you for the circuit. I've used it as is without success, it seem that if I use these resistors, I don't get enough volt to the output. I tried to lowered the resistor, and with some trial and error, got some result. It seem to work on a long wave file. I mean I have mostly constant result if I play a long tone over several seconds, but if i use beeps (shorter tone), the results are never the same.

Do you suggest a specific way to handle the frequency, or a special way to do my audio file?

I wonder If the use of LM567 could be use to detect and filter tone. something like using two LM567, both set to "detect" two different frequencies (one for 0, one for 1), then the LM567 would trigger 2 pins of the picaxe.

Maybe the S8870 DTMF decoder as suggested by gbrusseau would be easier to "tweak". What do you think?
 

manuka

Senior Member
MM: I'm just speed reading these posts, & haven't noted distances (or their nature) that you'd in mind. But for ~10m the inbuilt PICAXE-08M IR features can't be beaten-but they're only line of sight of course. Even a coin shop IR remote will do as the sender! Is this cheap & reliable approach suitable?

Audio tones- if other nearby sounds- WILL become corrupted. Hence DTMF is recommended, as it has legendary robustness. Simply hence grab a classic DTMF encoding tx & decoding rx IC, but as DTMF ICs are now rather elusive I can't recommend any specific ones. Stan
 

Mikymike

New Member
manuka, There's no distance. the headphone of a mp3 player is connected to a picaxe (in some way, that is what we try to do here). One track (left) of the audio file contain commands to send to the picaxe. The picaxe will control motors and so on, base on these commands.
 

Mikymike

New Member
Aha -do you mean a wired connection is being used? The postings impled thru' air...
yes, a wired connection is use. Never implied through air. You may have read some misleading replies but a connection between the audio source (through headphone) and device (picaxe) will be use.
 
Last edited:

Mikymike

New Member
gbrusseau, Do you have a link to a circuit that could be use to detect DTMF tones from audio source (like through a headphone output)
 

boriz

Senior Member
“… I've used it as is without success … it seem that if I use these resistors, I don't get enough volt to the output …”

The circuit as shown should have a gain of around 70-100. Any input signals greater than 20mV will almost certainly produce sufficient output swing for a Picaxe to register HIGH/LOW transitions (all that is required for the COUNT command).

I cannot imagine why you might be getting spurious results, other than some miscommunication or physical mistake in construction. Without a better picture of your setup, I can’t make any useful suggestions.

There are lot’s of ways to do what you need, DTFM is certainly one way. But for me, that’s like using an anvil to crack a nut.

Your problem is not that you are trying to build an analogue signal buffer. It’s that you are trying to do it without an oscilloscope. All you need is adequate buffering and the Picaxe can easily do the rest. A single transistor is sufficient for this purpose!
 
Top