Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ipod as a (5v peak) pulse generator?

Status
Not open for further replies.

astronomerroyal

New Member
Hi,

I'd like to use my ipod as a simple 5v pulse generator. The idea is to create audio files that are played on the ipod, the analogue output from which is then processed into simple square 5v pulses that can then be feed into a microcontroller. For example, if I play a 100HZ audio tone, it gets turned into a 100Hz stream of square 5v pulses.

My analogue interfacing skills are essentially non-existent, nevertheless I looked at the ipod's audio output signal across a 30 Ohm resistor and saw that the amplitude of the voltage was only +/- 200mV. All I want is a way to get the peaks to generate a 5v signal and the rest 0v, a sort of 1-bit digitization.

Would a comparator with a ~100mV reference voltage be suitable, or should I amplify (and possibly rectify) the audio signal first? I did play around with an LM386 opamp (the only opamp I have) and a LM2903 comparator, but felt that perhaps I was missing the simplest solution.

I'm a bit confused about my ipod's small output amplitude of +/-200mV, since this *iphone* `signal generator' app suggests an output amplitude of a few volts is possible.

**broken link removed**

Here's a pseudo-schematic,
 

Attachments

  • basic_idea.png
    basic_idea.png
    23.5 KB · Views: 174
Have you tried a higher/lower value resistor? 200mv does seem a bit low, I see quotes on the net that Ipod's can put out 30mw per channel, which should equate to between .7 and 1.2 volts for a 16-32 ohm load. But again this depends on your exact device. A comparator will be needed because you're still bellow the minimum switching voltage for cmos logic. The comparator can be driven by a simple voltage divider.

How did you measure your output? I'm assuming you have a scope because a multimeter isn't going to measure frequencies that high properly.
 
A comparator, such as an LM2903 should do what you want. Just set the threshold voltage using a couple of divider resistors to the +5V supply (you could use a pot for one of the resistors to make the threshold adjustable), to give the desired squarewave. You will likely need to use a resistor to add a small amount of positive feedback for hysteresis to eliminate oscillations at the trigger point.
 
Have you tried a higher/lower value resistor? 200mv does seem a bit low. How did you measure your output? I'm assuming you have a scope because a multimeter isn't going to measure frequencies that high properly.

Having never done any audio interfacing like this I chose 30 Ohms based upon the resistance across one of my earbuds. Not even sure why I have a load. Anyway, I measured the signal voltage using an oscilloscope. I just borrowed my girlfriend's iphone and it appears my old ipod is just relatively quiet. The iphone at full blast gave over 1v.

A comparator, such as an LM2903 should do what you want. Just set the threshold voltage using a couple of divider resistors to the +5V supply (you could use a pot for one of the resistors to make the threshold adjustable), to give the desired squarewave. You will likely need to use a resistor to add a small amount of positive feedback for hysteresis to eliminate oscillations at the trigger point.

What I had done previously was amplify the audio signal using an LM386 audio amp (gain of 20, supply of 5v - the only opamp I own) and then fed the output into a LM2903 set to trigger at a bit over 2.5v. This worked, but struck me as a rather elaborate/naive solution to what I assume is a simple problem - one which I haven't understood fully.

I'd like this gadget to be used with various mp3 players etc... So, now that I have seen the wide range of output voltages devices provide, I feel a little more confident about just using a comparator with a low trigger voltage.

Thanks.
 
You must have an earlier generation Ipod, the more modern ones have... generous power output.

You shouldn't need to amplify. Simply rectify it with a diode and use the comparator set to whatever voltage the signal will trigger from a voltage divider. One thing about doing this though is that because you're picking essentially a random voltage point within the signal range for triggering on/off, even if you feed it a perfect sine wave you're not going to get a 50% duty cycle square wave out, so if split duty cycle is required then you have other problems to consider.
 
You must have an earlier generation Ipod, the more modern ones have... generous power output.

You shouldn't need to amplify. Simply rectify it with a diode and use the comparator set to whatever voltage the signal will trigger from a voltage divider. One thing about doing this though is that because you're picking essentially a random voltage point within the signal range for triggering on/off, even if you feed it a perfect sine wave you're not going to get a 50% duty cycle square wave out, so if split duty cycle is required then you have other problems to consider.

I used my ipod today for listening to music and in my drunken haste accidentally discovered the menu option for setting the `volume limit'. I turned that up and it became considerably louder - I have no doubt this was why I could only get 200mV out of it. Laughable really. Duty cycle's not an issue as I'm only after the rising edges. Many thanks, you have sceadwod most generously, as has the curmudgeon.
 
Last edited:
Thanks for the sceadwod, but the common theme for the definitions of sceadwian I've found on the internet recently all lean to it meaning to overshadow/cover with shadow. My original intent for picking the word as a name was MANY years ago, and was for protection not the darkening/shading. The more modern interpretations have far too many leaning towards a simple darkening.

If I enlightened you than thank you, but I did not protect you, nor did I overshadow you =)

Thanks for the IPod mention of the 'volume limit' that was actually a legal hot button issue for a bit that I'd totally forgotten about. Never had an ipod so never occured to me.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top