Shop OBEX P1 Docs P2 Docs Learn Events
Simple circuit using audio to light LED — Parallax Forums

Simple circuit using audio to light LED

RavenkallenRavenkallen Posts: 1,057
edited 2010-09-16 17:21 in General Discussion
Hey guys. Sorry i am posting this in the Prop forum, but i seem to get the best answers here....I had a audio out cord on my laptop hooked up to a multimeter. Even at the highest volume level it only outputs about 0.20 volts. This is not even enough to turn on a average transistor. So how does somebody boost the voltage of a audio line to a higher voltage? Do you need to convert it to a AC signal, boost the voltage and then turn it back into DC? Or is it already AC? AND is there some kind of simple circuit that uses a couple of easily found components?
«1

Comments

  • w8anw8an Posts: 176
    edited 2010-09-10 15:07
    You might try something like this. The output can then be rectified, or maybe put a bi-color LED on it...
  • anhingusanhingus Posts: 10
    edited 2010-09-10 15:34
    LM386 should do it - or be a good start. radio shack still sells them.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2010-09-10 17:24
    LM386? Do you have a simple schematic?
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2010-09-10 19:13
    Can't rememb where I got this...
    800 x 349 - 19K
  • T ChapT Chap Posts: 4,198
    edited 2010-09-10 19:25
    If you just want to light up an LED to follow the audio voltage level, you could also try using the very simple Prop ADC, write a loop of code that takes the value from the ADC and translates that to a range of values on a counter to output a PWM or psuedo pwm signal to the LED.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-09-10 21:21
    See, T_Chap pulls your bacon out of the fire. The rest are rubbish.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2010-09-10 21:33
    Huh, the LM386 circuit looks easy/ cheap. I will try that, in fact, i might even have the part laying around somewhere. You can get them at radio shack, right?.....THANKS GUYS
  • T ChapT Chap Posts: 4,198
    edited 2010-09-10 22:43
    The ADC method takes a 3 caps and a 100k feedback resistor for the ADC, and an LED + 470ish resistor.

    See the schematic at the top of the ADC spin file, but for AC/Audio inputs substitute a small cap ( .01, .1 etc) for the 150k R. Connect an LED and watch it blink when the program sees audio.

    You will likely want to use a 10k or so pot as voltage divider on the front end to drop the signal.

    The test code below works very well, and could be tweaked very easily to suit your own needs.

    BTW, the beauty of the Prop is that you don't need much else to do a whole lot of stuff.
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2010-09-10 22:51
    a MOSFET I have found works well to switch a LED from sound with a Op Amp like the LM386
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-09-10 22:58
    Ravenkallen, this is a very interesting project. Let us know your results!

    Humanoido
  • Beau SchwabeBeau Schwabe Posts: 6,547
    edited 2010-09-11 00:09
    Ravenkallen,

    Since your not driving any audio, hence the amplification quality does not need to be that great, you can use a couple NPN transistors and a few resistors to get the job done.

    The trick in amplifying signals that low, is to bias the transistor so it operates in it's linear region or that it's very close to being turned 'on' with a DC voltage usually set by a voltage reference or a voltage divider. Then your audio signal can influence the transistor very easily.

    I could have probably done this with one transistor, but it was less of a balancing act to use two.
    800 x 526 - 63K
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-09-11 04:15
    Thanks for not steering this on-topic, Beau; the Propeller Forum must become an incestuous, moribund echo chamber of insanity.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-09-11 06:01
    PJ Allen wrote: »
    See, T_Chap pulls your bacon out of the fire. The rest are rubbish.

    I think what PJ Allen is commenting on here is that this topic probably should have been put into the Sandbox but since T_Chap made a reference to the Propeller, this thread (bacon) gets saved from the Sandbox (fire).

    PJ, at the risk of inciting more riotous moribund off-topictude, I must say I like your new avatar a lot. :)
  • RavenkallenRavenkallen Posts: 1,057
    edited 2010-09-11 07:32
    @PJ.... Uh, i said at the top that the only reason i posted it here was because i would get better/ more results. I think everybody will understand.



    @Beau.... I kinda like your idea. I never thought of that. Just add an external voltage to the transistor until it is almost turned on, then the tiny audio signal should have no problem turning it on seeing as it is almost on anyway. I will try your circuit first.....You said that you could get away with using only one transistor?

    @T. Chap... I will try your idea if the transistor one does not work. It sounds pretty easy to setup....


    @all... Thanks for the help.
  • Beau SchwabeBeau Schwabe Posts: 6,547
    edited 2010-09-11 08:47
    PJ Allen,

    "Thanks for not steering this on-topic, Beau"

    - Well, honestly there are just some times you can have way too much overkill. Yes, throwing an Op amp, or an Audio Amp, or even the Sigma Delta ADC capabilities of the Propeller at it will most likely work in all of the suggested circumstances. - Even here a Sigma delta ADC would be too much.

    - The suggestion that I posted, is actually closer in principle to the Propellers Sigma Delta ADC than you might think, just an analog version. In fact with a similar approach of just biasing the Propeller IO pin with a DC offset voltage you'd have a very similar effect as my analog circuit I previously posted.

    Below is an example of using a single Propeller I/O. simply look at the IO with ina or inb and direct the internal program logic to do whatever you want it to do.
    800 x 583 - 64K
  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-11 09:03
    @Ravenkallen,
    Please do not start threads in a forum "because I seem to get the best answers here". It's against the forum rules and it's a disservice to others looking in a particular forum for ideas on that subject (and either finding something unrelated or not finding what they're looking for).

    @PJ Allen,
    It sounds like you're very frustrated. Maybe you need to take a few deep breaths or take a walk outside or something like that. In the past, some of your sarcasm has been positively brilliant. Don't waste it.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2010-09-11 10:35
    @ALL....I am sorry if i was brash and i will not post out of order again, BUT that PJ guy's sarcasm is really getting on my nerves..
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2010-09-11 10:48
    This looks like the exact question I posted in the Sandbox just before the UPENE:

    http://forums.parallax.com/showthread.php?t=124943

    I wired up a simple one with an LM386 which seems to be working well. I like the simple examples that Beau just added and will have to try that out.

    Robert
  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-11 10:56
    @Ravenkallen,
    Yes, PJ can be very sarcastic at times. He also can be very helpful. That's the nature of a community or a family.
  • T ChapT Chap Posts: 4,198
    edited 2010-09-11 11:48
    The problem that could exist with those analogue only methods is that depending on the audio info, you may miss transients on the LED that could be informative to the viewer. With code, you can retain the LED duration to see transients, as well as maintain more of an averaging effect.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2010-09-12 09:21
    I am going to try Beau's idea soon, but i can't find my audio output cord....My lab is so unorganized that i can't find stuff when it is organized, haha
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2010-09-13 07:37
    I found some good ideas on this page. It has a circuit using the LM386 which can drive an LED instead:

    http://wolfstone.halloweenhost.com/ColorOrgans/clofix_DebuggingColorOrgans.html#OptocouplerBasedColorOrgans

    I suppose it should have a cap on the input but I built the first half of it on the breadboard and it worked ok.

    Robert
  • RavenkallenRavenkallen Posts: 1,057
    edited 2010-09-13 09:54
    Okay, i found the cord!!! I might try a experiment today.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2010-09-16 08:21
    Well, i tried the transistor method and the propeller pin method and neither worked. I did another measurement with my multimeter and it seems like the audio output voltage only goes up to 0.03 of a volt. Is that possible? How can that small of a voltage drive a speaker?
    I guess i will try to make plans to use the LM386...The transistor idea should have worked(even though i didn't use the exact values specified)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-16 09:13
    Did you have your multimeter set for AC?

    -Phil
  • logan996logan996 Posts: 281
    edited 2010-09-16 12:30
    yea i used to think PJ was a jerk (no offence) but after a while i realized he can be really nice and really helpful, even though his sarcasm can be... offensive at first, you get used to it and i really don't think he means it
  • RavenkallenRavenkallen Posts: 1,057
    edited 2010-09-16 16:00
    @Logan996... I think PJ and I are still under a cease fire. I don't want to cause any trouble, but i(Or others) will not be a doormat either...There is no place for that on a professional forum...

    @Phil....Uh, no. I am guessing that is the problem? If is a AC signal i will need to convert it to DC right?
  • T ChapT Chap Posts: 4,198
    edited 2010-09-16 16:08
    What is the reason you can't just use the software version already posted and be done with it?

    3 - .01 caps
    1 - 100k resistor.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-16 16:14
    Here's a circuit that I know works, because I tried it:

    attachment.php?attachmentid=73280&stc=1&d=1284678580

    If the LED comes on with no audio, just swap the + and - leads on the LM339 comparator. This behavior is dependent on the comparator's input offset voltage and can vary from part to part. For higher input levels than those from a microphone, you can bias the positive lead further away from the threshold with a pullup resistor to +5V. A value between 1M and 10M should do the trick.

    The open collector output of the LM339 is sufficient to drive the LED, but you may want to add the 47uF cap shown to smooth out the audio peaks, so the LED response appears more proportional to the audio level.

    -Phil
    334 x 313 - 3K
  • RavenkallenRavenkallen Posts: 1,057
    edited 2010-09-16 16:55
    I found a LM386 in my ic drawer. I am going to try hooking it up now....

    @T chap...sometimes i don't want to find a "easy" way to do something. I want to find a hardware solution. But by no means am i saying that your idea is not good, i just want a slight bit of a challenge. I want to know why it works, just not how it works.


    @Phil. I don't think i even have any comparators. I need to go through my drawer sometime and take an inventory.
Sign In or Register to comment.