receiving data using light/audio?

Mikymike

New Member
Hi,

I'm new to picaxe, and don't know a lot about electronic. I can play with simple circuits.

I want to send about 15 different commands (like flash light 1, flash light 2, rotate motor, etc...) to a picaxe using light flash or maybe audio "beep". If I use an audio source, it will be a MP3 player, the left audio track would be connected to (some circuit like peak detector) to the picaxe. I can do a kind of morse or on/off beep code and the picaxe will react to the command.

If I use a light source, it would be from a portable dvd player, I can encode some colors or white/black spots at the bottom of the video, and these flash change of color or luminosity would tell to the picaxe witch command to execute.

Using the light source, I tried to point a photoresistor at the video spot that turn on and off, but the changing of the value from dark to light from the sensor is not fast enough. It take one to two second to react.

Using the audio, I build a peak detector using a LM324, to trigger the picaxe input pin on and off.

My problem at this point is the speed. The audio method is faster but I don't know how to enhance the circuit or my code, so I can have all the possible commands needed on a single pin (or maybe two).

Right now I try to send some beep and count them, so if for exemple the picaxe receive 3 beep in x delay, it's a command, if the picaxe receive 4 beep in the x delay, it's an other command. But I'm afraid that at some point I will get some error (like missing a beep and so on).

The video solution could be better because If I find a way to speed it up.

The purpose of all this is to have a robot that interact with an audio or video source.

Using an audio source the robot would "listen" to the audio source, the right channel is output throw a speaker, the left channel is use to control the mouth movement following the speech, open eyes, close eyes, blink, move arm, turn hand, and so on.

Using a video source (90% of the screen for the video, the bottom 10% for the flashes commands), the robot mouth would simulate the narator in the video, the other commands would be to open eyes, close eyes, blink, move arm, turn hand, and so on.

My problem is to control the picaxe, all the other parts is done. any suggestion? Would it be possible to simulate a kind of IR command using flash in the video, and a IR diode against the screen?
 

jodicalhon

New Member
Can you post the circuit you used for light detection?

A phototransistor will give a faster response time than a photoresistor. Perhaps give that a try. One to two seconds does sound like a very slow response time, even for a photoresistor.
 

westaust55

Moderator
Welcome to the PICAXE Forum!

This a volunteer group from all over the globe that is eager to answer your question and help you solve a problem. This forum has many members ranging from new comers to very experienced engineers. It is the most active forum for PICAXE microcontrollers.
Some members give quite brief answers while others give extensive details. But, remember all answer to the best of their knowledge.

Topics range form assistance with specific PICAXE programming/hardware problems through to suggestions on possible hardware to use and the occasional non PICAXE discussion.

Please read the "READ Me First!", then check the FAQ, and do a forum search as solution to your problem may already have been posted.
For example, not being able to download a program from your PC to a PICAXE has been covered many times.

For students, we do not do your homework nor school project, and we do expect a willingness on your part to first solve the problem.
We will help you over specific hardware and/or programming problems or give you some general guidance, but we will not design your entire project.

For commercial requests -- remember that you get what you pay for and should follow the Rev_Ed technical staff's response.
There are some unpaid members who are prepared to help you over specific hardware and/or programming problems or give you some general guidance, but use this information at your own risk, and we will not design your entire project/module.

Unfortunately the forum cannot afford a crystal ball, so the more information you give us, the better we can respond.
"My PICAXE doesn't work!" is not very helpful.
A description of what you are trying to achieve, what is going wrong together with your program code, schematics and clear photos are very helpful.

Note that PICAXE chips have different commands so, for example
telling us exactly which PICAXE you have means we can better recommend the best program command to use.

To get a better response we suggest that you please cut and paste the following text to start your response and then remove unwanted options and/or fill in the blanks. While this may take a few minutes it can save several posts back and forth to get to the bottom of the problem. The more information that you provide the quicker your problem may be solved.

These include:
Describe the symptoms and describe clearly what checks you have already done to try and solve the problem.

Post the entire program code or a major section, not just the few lines where you think is where the problem is.
This will help us better look for possible errors such as duplicate use of variables, missing subroutine RETURN commands,
and similar “hiccups”. Please put your code in the main body of the post and enclose it within program start [code ] and end [/code ] tags.
We suggest that you read the sticky README FIRST thread at the top of the forum for more details if this is not clear.

Please upload your circuit diagram. This in conjunction with knowing the board for your PICAXE chip will help us check if your circuit
has any problem or to remove that from consideration.

You indicate that "all the other parts are done".
Sketch you circuit in MSPaint or in a PCB cad program and save as a .jpg file tpe or possibly even in Excel and save as a pdf file
if you have pdf creator software (this is available free on the internet).

If possible, please upload a photograph clearly showing your project.
Even a good photo from a mobile phone can help.
The photo needs to be clear enough that we can identify component and exactly were each wire terminates.
This will help us cross check your wiring against the circuit diagram.

Please give us an internet link to the datasheet for any special chips or non Rev Ed parts so that we can study
these to help you better.

Remember that being polite and a few thank you's to those who helped will get you further with additional/subsequent information.

Please cut and paste the following and fill in as much information as possible:


***********************************************************************************

Project Purpose (Describe what your project is intended to do):

Project Type: (school / commercial / hobby):

PICAXE experience level (new / a bit / intermediate / expert / guru):

General Electronics experience level (new / a bit / intermediate / expert / guru):

The type of PICAXE chip you are using (08M / 14M / 18X, etc):

Type of board (breadboard / AXE20 / AXE21 / AXE022 / AXE023 / CHI030 / CHI035 / CHI040 / by PH Anderson / Homemade / Other):

Program cable (Serial / USB / AXE26 / AXE27 / homemade):

The problem(s) I am having is:

My program code:

Photographs:

Datasheet links:

***********************************************************************************
 
Last edited:

Mikymike

New Member
Thank-you for your reply westaust55.

Well I sincerly hope that your reply is a generic reply for new members.

I've done many searches in the forum, without succes, but I may not have used the right words in the search to find an answer, if any.

My picaxe doesn't work, I can program it. I've already used a 08M, 18, 28X.

I think I have tried to describe the problem, describe the different method I have tried, what I want to achieve with it. Maybe I forgot some informations, my english is not that good to describes such problem, and since I don't know a lot about electronic, it's a problem too. I'm more the "see a simple circuit on internet, by the components, build it, understand what it do and try to change some parts to see what happen" type of guy.

At this point, I didn't choose the picaxe model to use, since I don't know exactly which method I will use to communicate with the picaxe. I may use a simple 08M picaxe to receive the on/off signals, the picaxe will "translate" them to maybe a serial command, that will be send to an other, bigger picaxe. This way, the small picaxe will not be overload with other code that may interfere the capture of the input signals. For exemple, the 08M picaxe may receive the on/off signal that mean "for the elbow stepper motor", the next signal will be something like "do 200 step toward the right". Then the 08M picaxe will use serial communication with an other picaxe and will tell to it: " elbow-200-right". during the second picaxe will execute the movement, the 08M piace will still wait for new commands. Everything here can be achieve without problem, I know what to do from picaxe #1 to picaxe #2 to motors, leds, and so on. That's what i ment when I said: "all the other parts are done". communication from picaxe #1 to #2 to motors, leds are working and I don't need help about these sections. Sorry if my sentence was not enough clear.

**************************************************

Project Purpose:
Create an automated robot with arm, mouth and eyes who lip-synch on audio. But again, to avoig any confusion, I don't need help about controlling stepper or servo motor and so on. This is not the part where I need help or suggestion.

Project Type: hobby, for myself.

PICAXE experience level: I may say a bit, but I'm a software programmer, so I understand the picaxe commands (maybe a bit less some of the commands related directly to electronic components control)

General Electronics experience level: between "new" and "a bit"

Type of PICAXE chip I will use, can be any.

Type of board: breadboard and Homemade

Program cable: Serial
 

westaust55

Moderator
Hi Mikymike,

Yes, it is a generic sort of introduction for when some specific data is not given (eg which PICAXE) but the welcome is genuine.

The queries were based on your initial sentence that stated " I'm new to picaxe, and don't know a lot about electronic. I can play with simple circuits."

Your English seems very good, so no problem there.

So aim was to feel out your experience more, which is apparently good, and better understand the physical configuration.

Not clear in my mind is:
are you trying to detect the video or audio from the robot or from a PICAXE near the source and then passing the "command/information onto the robot. If the second, assume the robot also has a PICAXE onboard.
Is the robot mobile or permanently pointed towards the source of informaiton/commands?
 
Last edited:

Mikymike

New Member
Can you post the circuit you used for light detection?

A phototransistor will give a faster response time than a photoresistor. Perhaps give that a try. One to two seconds does sound like a very slow response time, even for a photoresistor.
Thanks Jo C.

Do you have any phototransistor you recommend, or maybe a specific way of wiring it to have a fast response?

The circuit I used with the photoresistor is something like this:

http://www.reconnsworld.com/ir_ultrasonic_basicirdetectemit.html

I used the part of the circuit without the led.

I used a 10K resistor connected to +5v, the other end connected to the photoresistor, the other end of the photoresistor to ground. then the pin #2 of a 08M picaxe connected for input between the resistor and photoresistor.

the code I use to test is this:

main:
readadc 2,b1
debug b1
if b1 > 50 then isover
if b1 < 50 then isunder

isover:
high 1
goto main

isunder:
low 1
goto main

----------------

If I quickly put my hand to hide the photoresistor, the led connected on pin 1 go on/off about 1 to two second after my movement is done. If I look at what happen in b1, the debug window show me for exemple a value of 30, then 35, 38, 47, 50, 53, 58 and about 60. The value go down the same way when I remove my hand to cast light on the photoresistor. It's a gradual increment on a second or two, and not a on/off switching.

I unfortunately don't have phototransistor at the moment, but i could use the same circuit and see how fast it goes with it.
 

Mikymike

New Member
Thank-you westaust55 for your fast reply, hehehe.

Ok, I tried to not give to much information to not confuse everyone. sometime when we give too much informations, the problem get vague and peoples no longer know exactly what we want.

I'm building a fortune teller automate. The fortune teller will lip-synch some pre-recorded sentences from a mp3 player or portable dvd player. At the same time, the fortune teller will move the arm, turn hand, reveal cards, move head, blink eyes.

If I put the music and voice in the right channel (connected to a speaker), and the control commands in the left channel using some beep, something like "sonore bits", I would be able to add my commands embended in the audio files, and do different movement for each audio file. Since audio is sin wave, it's a bit complicate.

I thought to use a video source because I can some videos of different cards set, like animate card revealing themselve when the automate pass her hand over the card. and keep something like 1/8" at the bottom to flash white or color square. this part will be hidden to the viewer, but some sensors would be on the screen, and see the flashes. theses flashes will give the commands to the automate, and at the same time synchronize her with the video/audio.

This is my dilemna, which method I may use to communicate from the video or audio to the picaxe.

If the automate was connected to a computer, It wouldn't be a problem because I would made a program that play the videos and send the commands (using serial) to the picaxe controlling the automate at the proper time, giving me unlimited possibility.

Since the automate is not controlled by any computer, the way I have thought to send the commands to the automate was using audio files or video files. This way the movement are not embeded into the picaxe, but controlled from the audio/video source. Therefor I can simply add more fortune sentence/video, the video/audio player simply play one at random at a press of a button.

I hope this is less confusing now, and I didn't discouraged the members to help me when they will see this long post, heheheh. I know, this project look a bit scary, I know I can do it using a computer, but I'm really enthousiasm right now, I just discovered the picaxes, since I'm a programmer, a new world just open in front of me. I'm afraid there will be a picaxe to control every little thing in the house soon, hehehe.
 
Last edited:

westaust55

Moderator
See my prior post where I had added some links to IR devices including photo transistor. Think you replied after I added the links. Jaycar are AUstralian and European but you should be able to source the same things in Canada/US.

With respect to the audio option, years ago many home computers used audio cassettes as a means of data storage. Most operated at 300 Baud for reliability but with some work, the baudrate could be increase to around 1200 baud (bits per second). With a start, 8 x data and a stop bit that means around 120 bytes per second. We used RS232 data type devices although only at around 5V level to get stable squareware signals. With a byte, you have 255 permutations (with say 0 = do nothing). You could have bursts (say 15 or so times) of the same byte value to give a circuit time to lock in and act upon the command.

That way instead of a sine wave you have a square wave.

Not used myself, but have a look at the SERIN command in manual 2 page 147 as a possible means of input to the PICAXE
Baud rates up to 4800 with a 4MHz PICAXE speed are possible.
 

westaust55

Moderator
Forum Searches

Agreed that searching this and some other forums can be difficult.
While I have not been a member for any considerable time, I can generally recall past posts in my time as a member and it then certainly helps if you have an idea who the poster was.

I generally go straight for the advanced search mode (selected from the bottom of the small search window).

Adding an asterisk (*) at the end can help, particularly for short words.

Putting a phase in quote marks ( "...") can help but will still sometimes find instances of each word as well as the entire phrase.

Thinking of alternative words that other members may have used can also help. For example what I call a "free wheeling" diode across a relay coil many call a "flyback" diode.

But if all else fails, certainly post your questions.
 

jodicalhon

New Member
I'd wire the detector just as you have done.

(Interesting that the circuit you linked to actually shows a phototransistor, but labels it a photoresistor.)

I've just done a quick comparison with a couple of p-transistors and p-resistors I have and, while the p-transistors are a bit faster, the p-resistors do not show the very slow response time you are getting.

Perhaps try removing the 'debug' from your code and see if that improves things.

Do you have any capacitance on the sensor, or the input, that would slow things down?
 
Last edited:

Mikymike

New Member
Thanks westaust55 for the information. Oh my god, heheheh that remember me when I had an Amiga. Someone made a video backup system. A software and circuit was used to send files to backup to a VCR. the signal was like black and white flashing mosaic when watch on tv. It was slow, but really efficient hehehe.

I don't know how to do a sound to data converter.
 

Mikymike

New Member
(Interesting that the circuit you linked to actually shows a phototransistor, but labels it a photoresistor.)
Yup, I was not sure if it would confuse you. hehe.

Perhaps try removing the 'debug' from your code and see if that improves things.
Ok, you nail it, I removed the debug command, and if I wave my hand really quickly over the photoresistor, the output led flash on and off really quickly.

Do you have any capacitance on the sensor, or the input, that would slow things down?
no capacitor in the circuit.

Now that the photoresistor seem to be fast enough, Do you have any suggestion for the "language" to use to communicate between the video and the photoresistor? Maybe I can simulate some kind of infrared protocol. In the video editor, I can switch the patern at the bottom of the video every frame, so 30 switch per second.
 

jodicalhon

New Member
No real insights on possible protocols to use. The Sony protocol, recognised by a number of picaxes, needs data bits of 1.2ms or 0.6ms, so that's out.

Using one start bit, 8 data bits, and one stop bit, you could send 3 bytes of data per frame. Perhaps using 'pulsin' to read the data.

Glad you got the slow response sorted. G'night, I'm off to bed!
 

boriz

Senior Member
“Would it be possible to simulate a kind of IR command using flash in the video, and a IR diode against the screen?”

That’s a dammed interesting question. The internal Picaxe IR protocols require a 38kHz TX ‘flashing’ IR LED. 38kHz sounds a lot to me, with respect to video frame rates, so without any experimental data I would guess that you would likely need to create your own comms protocol using a lower frequency. This is just guesswork though.

This method of communication is called ‘bit-banging’ and you will find many references throughout this forums archives.

I take it your portable DVD player has an LCD screen?

Try this: Connect up you phototransistor as in the diagram. Connect an LED to a Picaxe output and have it mirror the phototransistor input changes. Something like this:
Code:
(pseudocode)
Do
	LEDoutput=PTinput
Loop
Create a small flashing box at the bottom corner of the screen and blue-tac the PT to the flashing area. Also connect a Piezo speaker to the LED output. This is so you can hear the signals that are too fast to see.

Using this test rig, you should be able to determine the two most important factors. 1 – Is the phototransistor current sufficient, under these conditions, to constitute a good logic HIGH and LOW. 2 – How fast can you go before you get errors.

The first problem is a simple hardware problem with fairly easy solutions, the second will be effected by what additional processing you are doing in your main loop. The Picaxe program is likely to be the limiting factor for speed.

As far as sound is concerned…

Should be even easier. Find the COUNT command in the manuals. A suitably buffered audio signal can be connected to a Picaxe digital input and the COUNT command can determine it’s frequency easily. One frequency = ‘wait for command’. Other frequencies can be the commands. If you need more commands than you can stuff into the frequency range, then use two tones, one after the other.

Can’t help thinking that another option might be easier though…

How about using an 18x and an external I2C EEPROM. All the instructions are stored in the EEPROM and are time-synchronised with your AV media. All the 18x needs to know Is when to start.

An oscilloscope would be handy.
 

hippy

Ex-Staff (retired)
I recall someone manufactured a watch which was programmed by holding it against an area of a PC monitor, doing similar from a TV should be the same in principle.

Whether one could get up to a data bit per frame is questionable but you should be able to convey data even if at a lower speed. After all, for the area being monitored, it's no different to watching if a light is on or off. Like sending morse code by torch, the easiest way is to use a short flash on to mean a zero and a long flash to mean a one ( or vice-versa ).

You could also do it by brigtness ( READADC ? ); black=0, grey=ignore, white=1. If you can set five levels of brightness on the screen and detect each of them you can send two bits of data in each 'data bit' ... this is where the concept of baud diverges from bits per second.
 
Last edited:

papaof2

Senior Member
Sadly, the Timex data watch only worked with CRT monitors, not LCD screens.

It came along about the time I was considering using a laptop - which made the decision not to buy the watch much easier ;-)

John
 

westaust55

Moderator
For the audio option, again some guessing here as not something I have attempted with the PICAXE. Conceptual, but here goes:

How were you envisaging to add the sinewave signals to one of the stereo channels? Maybe you could you use the PICAXE with the SEROUT command to send commands to the audio channel. Have a 16 key keypad wired to a PICAXE and press a different key each time you need to record a different command to the audio track.

For the return audio signal for actions, it will depend if you want to do other actions between commands. 28X1 and 40X1 PICAXE chips have a timeout on the SERIN command. Smaller PICAXE chips do not.

Possibly you could use a signal detector to sense the start of each command and cause an interrupt when receipt of a command signal is started. The interrupt routine could then use SERIN to "fetch" the command for the next action.

Audio at "Line" level is usually 1V peak to peak so within the capability of the PICAXE for output. Likely will need an op-amp to bring it up to 5V for PICAXE input level.

At page 31 of this link is how it was achieve many years ago. http://users.telenet.be/kim1-6502/6502/usrman.html#25
I had an OSI C2-4P in those days which would have been something similar for data to tape interface.
I recall having a special chip to clock the data at the right baud rate for 200 and 1200 baud but doubt that is still available.
 
Last edited:

Mikymike

New Member
I recall someone manufactured a watch which was programmed by holding it against an area of a PC monitor, doing similar from a TV should be the same in principle.
hehehhe... well atleast I know this method would work, no bench test to do, lol.

You could also do it by brigtness ( READADC ? ); black=0, grey=ignore, white=1.
I tried this method, and right now it seem I can detect white, light grey, dark grey, and black. I will try to change the value of my resistor to see if I can make the variation range larger, to avoid any overlapping and error.

If you can set five levels of brightness on the screen and detect each of them you can send two bits of data in each 'data bit' ... this is where the concept of baud diverges from bits per second.
I'm not sure of what you mean: "two bits of data in each 'data bit'". Do you mean on and off info for levels of brightness 1 and 2, level 3 is ignore, level 4 and 5 is the second on and off info? If so, I still can have only one final on or off info per flash, so it's one info, but 4 possible values in this info. Is it what you mean, or I did not understand it properly.
 

Mikymike

New Member
westaust55: for the sine wave signal using a piacexe to generate it with a keypad, your idea is not bad at all, heheheh.

The link you sent is really interesting, unfortunately the value of components are not show, I'm not enough good in electronic to find it myself (well, maybe after starting a couple of fires, blow up three houses, heheheh)

Right now my attempt at decoding commands from audio signal is not really good. Probably because of my poor knowledge of electronic.

I think I will use the "video" method to control the motors, and so on, and simply use a on/off peak detector in one of the audio channel to control the lip-synch.

The lip-synch synchronisation is already done, that was my first idea. A simple automate who lip-synch to audio source. Then next I discovered the microcontroller, so here we go, started with a simple thing and now endup rebuilding the house, hehehehe.
 

Mikymike

New Member
I take it your portable DVD player has an LCD screen?
That is exact.

How about using an 18x and an external I2C EEPROM. All the instructions are stored in the EEPROM and are time-synchronised with your AV media. All the 18x needs to know Is when to start.
Embeding the commands in the video audio is easier for me to synch them. For exemple, I can easily align the start of the command of "open mouth" with the start of the voice in a sound/video editor. Of course I could build a program myself to upload the on/off command to an EEPROM after that, or something like that. Never used EEPROM before, so that is a word that sound scary for me, heheheh. For the oscilloscope, yeah it would be handy, but I don't have one unfortunately.
 

hippy

Ex-Staff (retired)
@ Mikymike : "I still can have only one final on or off info per flash, so it's one info, but 4 possible values in this info. Is it what you mean, or I did not understand it properly" Yes, that's what I meant.

If you were sending byte data with four possible values per info flash you'd only need to issue four flashes to get eight bits of data.
 
Last edited:

westaust55

Moderator
@Jo C,

MikyMike was also interested in possible audio options.

. . . . . to a picaxe using light flash or maybe audio "beep".
and

The audio method is faster but I don't know how to enhance the circuit or my code
As others were discussing the visible/light options, I looked at the possible audio option.
 
Last edited by a moderator:

InvaderZim

Senior Member
I kind of like the audio concept myself.

I think you could make an INFRAIN/INFRAIN2 compatable method of signaling using audio. I believe the way the infra commands work is they hook to an IR transceiver; it just filters incoming light so that it is only sensitive to infrared light that's blinking at a specific frequency (38kHz); whenever it senses blinking, it outputs a low to the picaxe, and if there is no blinking it sends a high.

The picaxe will then look for negative pulses; a short pulse is input as a 0 and a long pulse is a 1 (at least with Sony's standard).

With audio, you could build your own transceiver to mimic the infra model: listen for a certain "note" and while you hear it, send a low to the picaxe. As long as your pulse lengths corrospond to the Sony standard (with start bits and such) then the picaxe won't know the difference.

You could use 20kHz "notes" as your pulses. First, filter your audio track so that anything over ~17kHz was filtered out; you can't hardly hear that stuff anyway, so you don't need it. If you don't filter it though, some leftover noise might mess up your pulses.

Next, mix in some pulses (or "beeps") to the audio track: each pulse is a 20kHz sin wave lasting either 0.6 or 1.2us, according to the Sony standard. Try repeating any given message several (10+) times (this makes it more robust). CD quality sound (and DVD) should allow you to record "notes" up to 22kHz, so it should work just fine. Be sure to make the pulses loud (but not saturated).

Your receiver should have a microphone and an amp with a bandpass filter. You then just level detect the 20kHz notes, and determine the pulses. Most microphones aren't too sensitive at 20kHz, but with some luck and loud volume you should pick them up.

You can probably lower the frequency a bit too; most adults can't hear 17kHz very well, so a few quick beeps in the background of your audio probably wouldn't be noticed at all (except maybe by young kids, dogs, or your pet dolphin).

For a neat test of your hearing, see this.
 

Mikymike

New Member
About the audio concept, do you have a suggestion for the circuit (maybe a web link of something somewhere). My electronic knowledge is not that big, and every attempt I have made until now was not really succesfull. I'm pretty sure it's the circuit between the headphone output and the picaxe that doesn't work as requiered. I've generated some squarewave using an audio software, save them and played them through headphone, but the picaxe seem to not be able to see the same numbers of pulse on every tests.
 

boriz

Senior Member
...Find the COUNT command in the manuals. A suitably buffered audio signal can be connected to a Picaxe digital input and the COUNT command can determine it’s frequency easily. One frequency = ‘wait for command’. Other frequencies can be the commands. If you need more commands than you can stuff into the frequency range, then use two tones, one after the other...An oscilloscope would be handy...
By “suitably buffered” I mean something like this:

Audio (AC) signals move above and below ground. You need to convert this to DC (All of the signal is above ground). A simple single diode will suffice in this case.

You also need to convert it to something like a square wave. The easy way to do this is to just amplify it a lot and rely on clipping to square off the tops. A single NPN transistor will do. Because the NPN base-emitter junction functions very much like a diode, you can do without a separate diode. Try something like this:



Q1 can be any medium power NPN transistor (BC549 would be good). Rb can be about 1k and Rl about 10k. Connect your signal ground to 0v (Make sure that this is THE ONLY ground connection from the signal source). Connect your signal to the input and the output (from the collector) goes to a Picaxe digital input. If you are using a headphone output as your audio input, you will probably need a dummy load between the signal and ground (to simulate the resistance of the headphone coil). 100R should be ok. But if you are using an audio-out socket (AV) then the dummy load should be something like 2k2.

This little circuit should convert your audio signal into digital. Then experiment with detecting specific frequencies using COUNT.
 

gbrusseau

Senior Member
Mikymike, there is an IC S8870, which is a DTMF receiver chip you may be interested in. It will decode the 16 telephone tones and present the decoded value on 4 I/O lines.

http://www.clare.com/home/pdfs.nsf/www/M8870-R3.pdf/$file/M8870-R3.pdf
 
Last edited:

westaust55

Moderator
westaust55: for the sine wave signal using a piacexe to generate it with a keypad, your idea is not bad at all, heheheh.

The link you sent is really interesting, unfortunately the value of components are not show, I'm not enough good in electronic to find it myself (well, maybe after starting a couple of fires, blow up three houses, heheheh)

The component values were given in the document at the link I provided. See Appendix A of the docuemnt.

Sure some components such as the Op-Amp may find better devices these days. It was intended as a starting point to show the simplicity.
 

hippy

Ex-Staff (retired)
Deleted Posts

Key to etiquette is civility, tolerance and respect for other people's views and opinions.

What people write may not always be as others perceive it to mean and offence can be caused though none was intended. When in doubt about what someone says or means it is always best to ask for clarification than assuming the worst or a situation can quickly escalate with noses being put out of joint on all sides with more people finding themselves dragged into the fray inadvertently antagonising one side or the other. Ultimately it is of little benefit to anyone and not least the thread itself which is taken wildly off-topic.

In order to maintain decorum and order, some of the posts in this thread have been deleted or edited. There is a Forum Etiquette thread which already exists which is more appropriate for discussion of the matters which arise where debate can be had without it side-tracking the thread.

This is not an attempt to stifle debate which is welcome, however such debate should be carried out in the apropriate place and in an appropriate manner.
 

westaust55

Moderator
(vintage) Kansas Standard computer to audio circuits

found the old circuits for computer to audio cassette and audio cassette back to computer from the old (1977 vintage) PC.

see top half of page 4 and bottom half of page 5


But basically with the use of the PICAXE and the SERIN and SEROUT commands I think (untried) that you can pump that data from the PICAXE almost straight thru to the audio cassette.

EDIT:
skip the idae of a simpler schematic - back to the audio cassette interface still attached as still need the frequency shift keying approach to get two tones onto the tape. Straight ones and zeros will not work as it will not record to the tape. :rolleyes: (must be bed time here)
 

Attachments

Last edited:

hippy

Ex-Staff (retired)
That's a good idea using the old cassette interface. SEROUT/SERIN should work with it. Another possibility might be to use DTMF generators and decoders, same principle.
 

InvaderZim

Senior Member
Quick question: for audio input, does the device get a wired connection, or must it go through a speaker and get picked up by a microphone? It'd be easiest without relying on the weak signal of the mic, but it could work either way. With a wired connection, you also don't have to worry about ambient noise.

I don't have a circuit handy, but I've attached a guide to quick filters; check out the "narrow band pass" with single-sided supply. Start with a 1000pF capacitor for C1 and C2 and figure your resistors based on a 20,000Hz tone. You might need a pot or two to fine tune it so that a 20kHz tone passes freely.

After you filter the signal, you'll be left with a signal that will either be a 20kHz tone or nothing, depending on the input. So you'll still need to rectify and average the result. Finally, run it to a schmitt trigger inverter. Remember, the goal is to get a negative 0.6 ms digital pulse out when a 0.6ms long, 20kHz sine wave comes in.

If you can do all that with an op amp, an inverter, a diode, and some resistors/capacitors, then you are well on your way!

Note that with my idea (see previous post) you will NOT use the "count" command. You just need the infra command to interpret the pulses.

For information on how the Sony code works, check this link; note that you should ignore all references to "40kHz carrier frequency" since you are making your filter for 20kHz, and the picaxe does not care about the carrier (only the length of the pulses).
 

Attachments

Last edited:

gbrusseau

Senior Member
As far as the audio option, it seems to me that just recording the tones from a phone as you press the phone keys and playing them back to the S8870 DTMF decoder chip is a lot easier than using op amps, band pass filters, signal conditioners and tone mixers and tone generators. The code on the PICAXE will be easier as well. The speaker output or headphone output from the cassette recorder will interface directly to the S8870 DTMF decoder chip thru a coupling capacitor.
 

gbrusseau

Senior Member
The original audio option mentioned a two channel stereo cassette recorder. One channel for the voice audio and the other channel for tone commands.
 

westaust55

Moderator
receiving data using light/audio

The method of using a stereo system with a sound track on one channel and signals on the second was used in the past for applications like those home slide nights where the tones would advance the slide projector to to next photo. Electronics magaziness had projects for that type of circuit.
 

moxhamj

New Member
I think straight serin/serout onto a tape would work - I don't think you need FSK or DTMF. The reason I say that is that radio links work with straight serin/serout. Consider a 1200 baud serial transmission. If your character was a 'U', eg 01010101 then apart from the start and stop bits, to the ear this will sound pretty much like a tone of 1200hz. Tape recorders can handle that fine.

Of course, the principles would work with MP3 recorders as well. Just record data on the left side and audio on the right. Or whatever.

I think the principles Manuka worked out for radio would also apply to tape - eg 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.

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.

But I'm sure those sorts of circuits are out there on the net as westaust55 says.
 
Last edited:

Mikymike

New Member
Your receiver should have a microphone and an amp with a bandpass filter. You then just level detect the 20kHz notes, and determine the pulses. Most microphones aren't too sensitive at 20kHz, but with some luck and loud volume you should pick them up.
The "device" is connected to the audio player, like an mp3 and so on. I'm afraid that using a kind of infrared imitation may not work, because of the audio compression of mp3 and so on. And I must said that at this point, I'm a bit lost.

By “suitably buffered” I mean something like this...

...
...
This little circuit should convert your audio signal into digital. Then experiment with detecting specific frequencies using COUNT.
I've tried the circuit you sent, I have on hand some BC547. I use a 1K and 2K resistor, it seem that with something bigger, the little circuit didn't trigger anything. I tried the count command, remeber the count command count the pulse during a period of time. If I play a long wav at some frequency, and have the count command count the pulse in a second or more, it return mostly the same thing (+-1 or +-2) for each execution of the count command, but below 1 second, it look like really erratic and vary a lot. It's like the count command is stable only if it have time to read and read many pulse. I'm not sure of what I'm doing wrong.

... which is a DTMF receiver chip ...
Yeah, I'm starting to think of trying a DTMF decoder. I don't know if a DTMF decoder can be triggered quickly, many time per second.

The component values were given ... See Appendix A of the docuemnt.
Sorry WestAust55, I did not look so far in the document :)
 

Mikymike

New Member
Quick question: for audio input, does the device get a wired connection, or must it go through a speaker and get picked up by a microphone?
The device got a wired connection to the audio player (something like an mp3 player). general audio on the right channel, the commands on the left channel.

... check out the "narrow band pass" with single-sided supply. Start with a 1000pF capacitor for C1 and C2 and figure your resistors based on a 20,000Hz tone. You might need a pot or two to fine tune it so that a 20kHz tone passes freely.

After you filter the signal, you'll be left with a signal that will either be a 20kHz tone or nothing, depending on the input. So you'll still need to rectify and average the result. Finally, run it to a schmitt trigger inverter. Remember, the goal is to get a negative 0.6 ms digital pulse out when a 0.6ms long, 20kHz sine wave comes in.

If you can do all that with an op amp, an inverter, a diode, and some resistors/capacitors, then you are well on your way!
Woahhhhh!!! (Faint here) If I can do it at all, I will be genius! hehehe Remember I'm a newbie about electronic.

Right now I have the brain like a LED connected to a 50v without resistor.
I did not tought this part of the project would have been so complicate.
 

moxhamj

New Member
Whether you go for straight serin/serout or pulse width or tones or DTMF, the audio to digital stage is going to end up the same. It needs to take an AC waveform - biased around a nominal value (either 0V or 2.5V or some other voltage), with an amplitude that might only be millivolts, and turn that into a 0V/5V suitable for input into a digital chip like a picaxe.

Your signal might be 0V plus or minus 100mV. And you want 0V to 5V. The transistor circuit is only part of the solution - you might need level translation as well. Do you have a CRO?
 
Top