Asked — Edited

Need Help Controlling An Led

Hello!

I have a project that I need to create an animation paired with a sound file.

I need to be able to control a single LED and have it randomly flicker when I play a sound file of a Tesla Coil ARC crackel. The LED is on the tip of a fake Welding Arm.

Anybody have any ideas?

Thank you!

Doug


ARC Pro

Upgrade to ARC Pro

Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.

#1  

A simple and crude way is to PWM the led according to the sound volume from you PC speaker and mic or ezb4 speaker. Using the variables $SoundValue or $Soundv4Value to vary the brightness of the led according to sound volume


#if using sound servo Mic control
PWM(D0,$SoundValue) 
#or if using Sound servo EZB control
PWM(D0,$Soundv4Value)

#2  

That's a great idea! So the LED just plugs into D0? I have a resistor on the LED so it won't be cooked over 9 volts.

User-inserted image

#3  

Yes, you use ground and the signal pin (not the red power pin) of any of the ezb's digital ports...You need to be more concerned about the ezb's port than you do about the LED.. So be aware your led will need a resistor (if it doesn't have one, but you mentioned it does) as the signal pin can only provide 10mA @3.3v... Any device drawing more than 10mA on an ezb4 signal pin risks blowing the port...

#4  

Thank you so much! I'll try it tonight.

PRO
Synthiam
#5  

At 3.3v of the ez-b v4's signal pin, a resistor isn't necessary - adding one will dim the led significantly. The ezb i/o drive is quite minimal, i never bother adding resistors. I mean, it's not per spec, but hey, who cares sometimes:D

If you find the led is dim, remove the resistor

#6  

@DJ... Thanks... good to know... I probably got confused since I used resistors with the ezb3 as it had 5v on the signal pin...

PRO
Canada
#7  

The ez-bv4 has in-line 330ohm series resistors with the I/O ports so at 3.3V you can't draw more than ~10mA by hooking an LED directly up to it. It's a built-in safety feature:)