Pages: [1]   Go Down
Author Topic: Mixing and splitting signals: PWM RGB led  (Read 1107 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I really need help: I am drowning in information on summing amplifiers, current sinks, OpAmps, transistors etc.

I have:
- 1V AC signal in 10kHz range.
- 3 low-frequency PWM (500Hz range) channels (from arduino) that drive a rgb LED

What I need is:
- splitting the 1V ac signal over the 3 leds.
- If (and only if) a led channel is high (from the PWM), then the current should be 'modulated' by the 1V ac signal. (so that the luminosity varies with 10kHz)
- current thought LED should be 0 when PWM is low

The rgb LED module has built-in resistors (set for 5v supply) and has common ground.
that is why I thought something like this could work.

I tried something like this in circuitlab but don't see good results


Any tips appreciated!
Many thanks in advance
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 49
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you are looking for a transistor switch between PWM and Vin of your amplifier.
So this switch allows or blocks the signal from a second source.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you just looking for on/off modulation of the LED current at the input frequency? If so, just pass the input signal to a comparator to amplify and square it, then use an and-gate to combine it and the PWM signal into a drive signal for a mosfet switch.

If you are looking for linear modulation at the input frequency, then one option is to include a diode gate between the output of your op amp and the mosfet gate. Connect the cathode of a small signal diode such as 1N4148 to the op amp output, and connect the anode to the mosfet gate. Connect another diode, cathode to PWM output and anode to mosfet gate. Add a 1K resistor from mosfet gate to +5V.

If your mosfet has a particularly low gate threshold voltage then you may need to use Schottky diodes such as BAT43 or BAT85 instead of 1N4148.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Montreal
Offline Offline
Faraday Member
**
Karma: 27
Posts: 2556
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What I need is:
- splitting the 1V ac signal over the 3 leds.
Based on what properties?
Quote
- If (and only if) a led channel is high (from the PWM), then the current should be 'modulated' by the 1V ac signal. (so that the luminosity varies with 10kHz)
- current thought LED should be 0 when PWM is low
Led could blink with 10 kHz speed, but you would not notice any difference, if it 10 k or 500 Hz. 
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2863
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As Magician pointed human persistence of vision will blend any light blinking faster than about 25 Hz into a steady light stream. a 10 KHz signal would only mask any PWM control signal that is present.

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you very much for the replies!

@dc42: I do not understand your description of the diode gate circuit. Simulation doesn't give expected results. I will research it later though.

The PWM part is for visual purposes,
The analog/linear signal part is for information transfer.

The PWM is kept at 500hz so that the high-time can carry several wavelengths of signal.
The picture below is not correct because the signal's relevant portion has shorten wavelength, but the principle stays the same

I have added a sketch that includes the elements I want to mix.
I thought that the ground connection of the 3 combined leds would be the best location to do the linear modulation; that way i don't have to use 3 times the components.

I have managed to understand the Opening Post circuit, and got it to work.

I also understand that when i replace the the constant voltage supply of the leds with PWM, something terrible happens in the low-time of the PWM. Loosely speaking: The OpAmp tries to keep the + and - at the same voltage, so it drives the MOSFET to infinity/maximum because no current can be drawn from the 0 volt PWM low-time.


* PWM'd-signal.png (295.98 KB, 300x250 - viewed 16 times.)

* circuit sketch.png (34.98 KB, 582x548 - viewed 19 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've researched a lot since the last post, but i still have no solution.

What i like to know is: how can i switch on and off a current sink?

Or can someone give me a simple circuit that will do a precision current sink on a 3 channel PWM'd RGB led?

Last idea is as follows:
- simple current sink
- current drawn through mosfet is between 10 and 20 mA
- above the mosfet the 3 lines of the 3 RGB led channels come together
- the 3 channel are supplied by 3 PWM channels
- the 3 PWM channels are also tapped to go to a 3 channel diode gate
- When all 3 channels are low, the current sink is shut off; 0 mA is drawn through the mosfet

But that last line seems to be hard. Have tried a lot, googled a lot, no real success thusfar.


Many thanks in advance!
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1. Can you confirm that your RGB LEDs are common anode, so what you want is 3 current sinks?

2. How precise do you want the LED current to be? Using comparators driving mosfets is certainly a possible way of doing it, but for LEDs the current is not very critical. It's more usual and simpler to use a 2-transistor or a 1 transistor + 1 mosfet circuit, although the current regulation will be slightly sensitive to the transistor temperature. Or you can use just a transistor and a series resistor.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

RGB led is common cathode
(COM port on multimeter is common, or GND is common)
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OK so you need current sources, not current sinks. How precise do you want the current regulation to be?
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your answer.
From your answer i distill that i would need 3 current sources (1 current sink for all 3 channels seems to be out of the window).

Precision should be as high as possible. (A trade-off between precision and complexity) Around 0.5% but preferably more like 0.05%

Before continuing with 3 current sources of discrete components, wouldn't it be better, in your estimation, to look for some multichannel IC to do the work?
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2863
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would personally use 3 linear drivers and sequentially strobe them. You have a linear voltage that must be by definition less than the maximum current of the LED's and a window in which to process it. So separate the two and do each in it's own time. Provide the amplitude modulated information to an LED driver and strobe/enable the driver in it's time (data position) slot.
trying to PWM data at that level of precision would be quite an undertaking both in generation and detection...   Assuming the modulation (voltage) is within the dynamic range of the LED. A 0 to 10 V signal would require "Some" processing first.

Bob
« Last Edit: February 17, 2013, 10:41:51 pm by Docedison » Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Pages: [1]   Go Up
Jump to: