Making an RGB led drive another led system

Hi, I'm trying to figure out how to make a variable voltage supply from the arduino. Basically I need to output a voltage between 0 - 12 volt to drive 100 mA worth of leds. Starting from knowing a number (voltage) inside the arduino program. I don't know how to do this and I couldn't find any similar thing for some reason on google.

I guess you need to connect a mosfet to the arduino "switch" for your non arduino 12v supply but I don't know how to make it output a + - accurate voltage starting from a number 0 - 12 And i don't know which mosfet is the correct one the use for this sort of thing.

Full story:
I got adviced to use an arduino to make individual leds work at the same intensity +- as a 4 wire RGB led strip or be off when led strip is off.

Basically measure the voltage over R and ground B and ground G and ground (using a voltage divider to 5v of course ! )

Then it needs to output the same voltage to my indivudal leds (where i'm stuck at !), so that if the led strip is on in whatever color the individual non rgb led strip is on too.

Thank you for the advice or links you guys sent me on this subject.

(EDIT: I have figured it out. I can make an non RGB system slave to a RGB strip, even dimming. (thanks to some arduino discord help!) See my last reply for the schematic and code.)

Tried to make a circuit of where i'm at at the moment.

Imgur

The forum guidelines will let you know how to post pictures properly

NO.
All grounds are connected together.

If you want us to help, you need to provide a lot more detail. Starting with what LED strip you are using. A link to the specifications would be best.

Also, what is it that you are trying to do?
Complete sentences would help.

testkill:
make individual leds work at the same intensity +- as a 4 wire RGB led strip or be off when led strip is off.

So you are trying to match the color of an RGB strip using separate Red, Green, and Blue LEDs?
I would connect the individual LEDs to whatever is driving the RGB strip. By selecting the right current limiting resistor you should get a close match to the strip color.
My guess is that the RGB strip is driven with a PWM signal and not a variable voltage. If so, one of your design assumptions is wrong. If the signal is PWM you could use pulseIn() to measure the duty cycle and use analogWrite() to light the output LEDs at the right intensity.

I am simply trying to measure the voltage flowing trough each of the R G B wires, so that I power a seperate system with similar voltage.

I have bought components and started experimenting and doing more research.

I have since then realised, yes each wire needs a voltage divider and there's no arduino ground needed (probably needed for mosfet right?)
(I made one and tested that so far, didn't buy enough resistors) , (Wondering if i can make R2 the same for each of the dividers? probably not.)

So, updated sheme of where i am right now:

I have programmed the thing to find the voltage of each of the wires, and take the max from it. So i'm left with a number right now, I need to output somehow. I guess using different levels would be easier, like between 0 - 3 volt OFF between 4 - 8 medium and 8 - 12 mosfet completly open (don't now how to program/set that right, does the mosfet even need a resistor on the gate?)

The MOSFET I bought to make the output, to the seperate system is : IRF530. I haven't found any guides or posts how I could do this last part.

I am new to this, never used an arduino on my own, really trying.

It looks to me like you're completely lost. I suspect there are more connections in that which are wrong, that are right.

Your best chance at this, is to post complete specs and clear images of all the parts and let us figure out what goes where. Judging by the schematic, it will take much too long pretending that we can discuss it and let you do the work. Especially because you aren't doing a good job of explaining yourself.

The only other way, is for you to do a lot of research, produce a proper and at least half workable schematic, and go from there...

aarg:
It looks to me like you're completely lost. I suspect there are more connections in that which are wrong, that are right.

Your best chance at this, is to post complete specs and clear images of all the parts and let us figure out what goes where. Judging by the schematic, it will take much too long pretending that we can discuss it and let you do the work. Especially because you aren't doing a good job of explaining yourself.

The only other way, is for you to do a lot of research, produce a proper and at least half workable schematic, and go from there...

Completly lost sound harsh ^^ I Tought/think i'm on a 'right' path, i'm able to retrieve a voltage from the RGB wires.

Trying to explain again what i'm trying to do:

the stuff i have:
led strip
arduino nano
IRF530 mosfet
resistors for voltage dividers
Seperate 12V led system (Just needs to be powered)

What i'm trying to do:

the seperate led system needs to be on when the rgb strip is on, and if rgb strip is dimmed it needs to be dimmed. But whatever color the rgb strip leds are, it needs to be on. (except if rgb strip is off)

This is why I measure voltages across every wire, my code takes the highest voltage and then needs to do something with the seperate led system.

testkill:
Seperate 12V led system (Just needs to be powered)

There are dozens, possibly hundreds of different LED strips. WHICH ONE?

testkill:
...the seperate led system needs to be on when the rgb strip is on, and if rgb strip is dimmed it needs to be dimmed. But whatever color the rgb strip leds are, it needs to be on. (except if rgb strip is off)

This is remarkably vague, especially when your crude schematic doesn't show a separate LED. I don't mind crudely drawn schematics, but label EVERYTHING.

I have no clue what you are trying to do with a voltage divider, but I can be pretty certain that a voltage divider is not the correct solution to whatever you are trying to do.

Are we harsh? Or are we simply frustrated with vague information? We're engineers and hobbyists- not mind readers.

First: a voltage is measured between two points; often X and ground. So your arduino ground MUST be connected to your 12V ground. Which I'm guessing is marked 12v Gound on your diagram.

(You cant have two different "grounds" we only have one EARTH)

You are using a divider 47k:33k which if "R" is at 12V will give 12 * 33/47+33 = 4.95V to A1.

Thats a bit tight - doesnt allow for variation in the 12V supply, nor the "5v" to the nano - which is often much less than 5V.; so I'd recommend using say 68k:33k giving 4V max approx.

The diagram doesnt show the same dividers for A2, A3 but maybe thats what the tiny writing says. And yes you need them.

Your intention is I beilieve to run another led strip controlled from the HIGHEST of the three input voltages.

While you CAN control the brightness of the strip with a variable voltage its tricky. Better to use a FET like the IRF530 you have.

On THIS PAGE you will find a diagram showing how its connected to power a motor. Just ignore the motor and connect your LED strip.
Note R1=330 ohms, R2=10k

Then use analogWrite from a PWM pin to control the brightness of your LEDs.

Hi,
Can you please get pen/pencil and paper out and draw a circuit diagram please.
Reverse engineer what you have and post a picture of your diagram.

Your attempt with Paint is admirable, but hand drawing and labeling will be more readable.

Thanks.. Tom.. :slight_smile:

johnerrington:
First: a voltage is measured between two points; often X and ground. So your arduino ground MUST be connected to your 12V ground. Which I'm guessing is marked 12v Gound on your diagram.

(You cant have two different "grounds" we only have one EARTH)

You are using a divider 47k:33k which if "R" is at 12V will give 12 * 33/47+33 = 4.95V to A1.

Thats a bit tight - doesnt allow for variation in the 12V supply, nor the "5v" to the nano - which is often much less than 5V.; so I'd recommend using say 68k:33k giving 4V max approx.

The diagram doesnt show the same dividers for A2, A3 but maybe thats what the tiny writing says. And yes you need them.

Your intention is I beilieve to run another led strip controlled from the HIGHEST of the three input voltages.

While you CAN control the brightness of the strip with a variable voltage its tricky. Better to use a FET like the IRF530 you have.

On THIS PAGE you will find a diagram showing how its connected to power a motor. Just ignore the motor and connect your LED strip.
Note R1=330 ohms, R2=10k

Then use analogWrite from a PWM pin to control the brightness of your LEDs.

Hi that's exactly what i'm trying to do! (it's not a led strip i'm powering tho, but doesn't matter.)

I've added a ground wire like you said, in the drawning Tom requested.

There can't be 2 grounds but that ground feels different than the arduino ground, since rgb controller, but, if it's like that fine.

Here the schema where i'm at, the red stuff is untested, I've added the ground wire from arduino to the thing i'm measuring

TomGeorge:
Hi,
Can you please get pen/pencil and paper out and draw a circuit diagram please.
Reverse engineer what you have and post a picture of your diagram.

Your attempt with Paint is admirable, but hand drawing and labeling will be more readable.

Thanks.. Tom.. :slight_smile:

here you go :

EDIT: the rgb controller is this btw :rgb controller

hope this helps somehow

Hi,
Do not connect 12V to the USB port...

Tom.... :slight_smile:

OK, now as it appears, you have an RGB LED strip controlled by a "LED controller" which use either Bluetooth or an IR remote.

Unfortunately, you are indeed "completely lost" because you it appears have no idea whatsoever about how LEDs operate or are controlled! :astonished:

Harsh or not, this is the problem.

OK, let's get down to it.

RGB LED strips are not controlled by voltage.

They are controlled by PWM, You will need to read that page to understand how that works.

What you are looking for is what is called a LED strip repeater. Here is an example.

You connect it to the four wires of the first LED strip and it duplicates the control signals to its output wires using power provided by a second 12 V power supply. (The one shown actually has an extra, fourth channel.)

This is not in any way whatsoever a task for an Arduino, it is straight digital logic. While you could build it yourself, the ready availability of them on the Internet (and much cheaper than the one I have referenced) makes it a foolish waste of time. :roll_eyes:

TomGeorge:
Hi,
Do not connect 12V to the USB port...

Tom.... :slight_smile:

Hi, read the bolt text?
That drawing is wrong I have no clue why aarg reposted it. Look my previous reply for the final working schematic and code. I posted it not to get more help but for anyone ever stumbling on this post and wanting the solution.

Paul__B:
OK, now as it appears, you have an RGB LED strip controlled by a "LED controller" which use either Bluetooth or an IR remote.

Unfortunately, you are indeed "completely lost" because you it appears have no idea whatsoever about how LEDs operate or are controlled! :astonished:

Harsh or not, this is the problem.

OK, let's get down to it.

RGB LED strips are not controlled by voltage.

They are controlled by PWM, You will need to read that page to understand how that works.

What you are looking for is what is called a LED strip repeater. Here is an example.

You connect it to the four wires of the first LED strip and it duplicates the control signals to its output wires using power provided by a second 12 V power supply. (The one shown actually has an extra, fourth channel.)

This is not in any way whatsoever a task for an Arduino, it is straight digital logic. While you could build it yourself, the ready availability of them on the Internet (and much cheaper than the one I have referenced) makes it a foolish waste of time. :roll_eyes:

Hi, like I said above I have found something that works (and posted it for others).

And I didn't want to repeat the led signal for another rgb led strip, I needed to drive non RGB LEDS and be able to dim and turn them off witouth color mattering with a "master" led strip. Which is what the solution reply I posted does. I know it's PWM and the voltage between ground and 12v+ detects that because it's a no delay loop thus it's detecting the on off on off when the led strip is on, thus outputing PWM power to the mosfet.

Found a few problems with the previous system I made, It starts blinking when you dim it too much. Wrote a fix, and made the output non manual PWM, so just one pin change. This makes it work with no hiccups, perfect smooth dimming across RGB and non RGB and no delay, so flickering mode works.

V2.0

led system.png

float pwm_value;
float R1 = 47000.0;
float R2 = 33000.0;
int af;
int tel = 0;
int vo  = 0;
void setup(){
  Serial.begin(9600);
  pinMode(3, INPUT);
  pinMode(10, OUTPUT);
}

void loop(){

  for ( int x = 0; x < 100; x++ ){
    pwm_value = analogRead(A0) * (5.0/1024)*((R1 + R2)/R2);
    if (pwm_value >= 12.10){
      tel = ++tel;
     }
   }  
  af = 255 - 2.55*tel;
  tel = 0; 
  if ((af >= vo -20 ) && (af<= vo + 20)){
    af = vo;
  }

 Serial.println(af);
 analogWrite(10, af);
 vo = af;
    
}

Code expl:

Basically pulseln didn't work, my voltages when dimmer were more and more often 12,11 volt like being off, making total sense, lower duty cycle. So the code counts how many times and uses this to measure the dimming. The numbers varied a bit each cycle like +-10 so it blinked a bit, so that's where the vo is for, if it's close enough don't change the number, which makes it completly stable.

This is what I made from it !

led system.png