Useing audio files for analog led output - Page 1
Forum section: electronics / projects

author: Noobster
author_rank: Contributor
timestamp: July 15, 2022, 01:26:42 pm
content: Hi,i need to remotely dimm some small leds (<0.1 W) remotely and in a very small package. To avoid messing around with designing and ordering small circuits i thought about using a bluetooth earbud (as they have all the charging, battery and connectivity sorted out already). My idea is to use the output to the speaker, then (if necessary bjt inbetweeen) to led. Then play a audio file on my smartphone with the desired "dimming signal".1. Is this a good or bad idea and might it work ?2. Can you play an analog positive voltage signal (it would be high frequency pwm from the dac i guess) from an audio file? And do you know of tools to create an audio file like this ?3. I guess if 2 doesn´t work i could use a square wave generator with varying amplitude (max. brightness would be reduced to 50%) ?

author: tooki
author_rank: Super Contributor
timestamp: July 15, 2022, 04:15:02 pm
content: Oof, sounds like all kinds of trouble to me.1. I doubt it.2. Not likely. In fact, a DC signal (even if it’s varying in amplitude) might trigger fault detection in the amplifier: many amps detect DC offset as an error condition and shut down to prevent speaker damage. It’s also common for analog audio signals to be AC-coupled through a capacitor. As for it being high-frequency PWM: well, yes, it’s likely (but not guaranteed) to be a class-D amp, but don’t think that means it’s PWM. Most class-D amps use clever, complex variations on PWM to increase efficiency, reduce noise, eliminate external components, etc. so it won’t be doing what you expect.Rather than fighting to turn a nail into a screw, just either a) buy something, or b) make something sensible.

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: July 15, 2022, 04:29:28 pm
content: Yeah. Have you ever opened an earbud? 0201 components look like boulders compared to what's in there.

author: Uunoctium
author_rank: Frequent Contributor
timestamp: July 15, 2022, 04:30:49 pm
content: I've done that with success through one intercom audio channel of a professional broadcastcamera.Converted DMX to LF PWM (approx 200..400Hz). On camera side we had an LED headlight only driven via Mosfet with this PWM.

author: Noobster
author_rank: Contributor
timestamp: July 15, 2022, 05:32:02 pm
content: Thanks for the replies,@tooki i do agree that it is not the cleanest approach but developing a circuit board with bluetooth functionality in a size comparable to the earbuds seems at least as hard as making it work.@uunoctium good to hear.As far as audio files, is it actually possible to "play" dc with voltage variation ? I don´t know much about audio compression.Let´s say it is coupled with a capacitor and i can only play Square Wave (worst case), is there a way to drive a led with it ? (i am a mechanical engineer and my electronics knowledge is surpassed here)

author: Noobster
author_rank: Contributor
timestamp: July 15, 2022, 05:35:37 pm
content: I will probably experiment a bit anyway, but in my experience it´s good to ask the smarter people first

author: ajb
author_rank: Super Contributor
timestamp: July 15, 2022, 10:33:55 pm
content: You might have better success starting with a bluetooth receiver that is designed to feed line input or external headphones. The larger physical size will at least make it easier to work with, and some have integrated rechargeable batteries. I'm not familiar with the details of the chipsets used as far as what they'll tolerate happening on their outputs, but I would imagine they'd be fine with tapping the output prior to the AC coupling cap to a high impedance input. You wouldn't be able to directly connect it to an LED--even with a transistor it's hard to say what the output would end up looking like, it depends on the modulation scheme as well as the output level. With a bit of filtering you could use that signal to control a simple op-amp constant current driver, or feed it into an analog input on an MCU to then PWM the LED which would give more controllable relationship between audio level and brightness. That's getting a bit more complicated, though, and at that point you'd probably be better off directly loading the dimming sequence into the MCU, I guess.Audio (or at least wav files) don't intrinsically have a concept of AC or DC, they're simply a sequence of samples between some min and max. You can absolutely use them to represent samples of a DC voltage, or PWM duty cycle, or whatever. Some professional audio interfaces even have DC-coupled outputs, and you could directly use those outputs as DC-coupled control voltages for whatever. If you need those voltages to be only positive, then you can certainly create an audio file with only positive samples.

author: Noobster
author_rank: Contributor
timestamp: July 16, 2022, 04:25:22 pm
content: Thanks, that sounds good. So if i understand correctly ether Lp filter the signal and continue as analog (needs a chip that can run on the battery voltage and drive the led current, any suggenstions highly appreciated) i guess that would be called a voltage follower (?). Or find a logic level mosfet that can keep up with the modulation frequency.Sadly i don´t have an oscilloscope and trashing a 4 Euro bluetooth bud by experimenting seems more viable than buying one.

author: Noobster
author_rank: Contributor
timestamp: July 16, 2022, 04:28:37 pm
content: PS: The small size doesn´t scare me too much, i have done some challenging soldering over the years under the stereo microscope (famous last words)

author: NiHaoMike
author_rank: Super Contributor
timestamp: July 16, 2022, 05:00:51 pm
content: It would be easier to get a Bluetooth to UART module and a microcontroller to go with it.

author: Noobster
author_rank: Contributor
timestamp: July 16, 2022, 07:12:10 pm
content: I can order AD 8532 Op Amp here, might be fitting? Supply voltage fits, output current up to 250mA, even rail to rail.@ NiHaoMike Not sure if easier but definitely bigger build volume.