Beginner hobbyist trying to design a circuit for controlling high power LEDs with Arduino

Thread Starter

puzzled_quiet

Joined Aug 5, 2024
8
This is my first ever shematics and also first time "designin"(lol) a circuit this complicated.
The breadboard circuit also doesn't have any capacitors just like the schematics, I'll add them later, but that probably won't solve the problem.
The XL6009E1 module is an adjustable boost converter similar to this, capable of 4W output. It's set to 22v.
The battery is a 3.7v-4..2v 2200mAh lithium-ion, capable of 8W output(assuming the maximum output current is 1C). Its terminals are connected to the module's input termninals. All of the VCC and GND symbols in the schematics are directly connected to the module's output terminals.
The reasoning behind the LM317's is:
1. LEDs drop around 3v each, and so can't be driven directly by the battery, so I first boost the voltage and then build a constant current source which provides around 200mA, resulting about 2.5v measured for each LED.
2. I want to drive the Arduino with the same battery(will replace it with a bare microcontroller chip later on). Also this page says:
Although 3V3 and 5V pins can be used as power inputs, it is not recommended if no power supply is connected through the USB port, the barrel jack connector, or the VIN pin. 3V3 and 5V pins are connected directly to the onboard voltage regulator's output pin. Suppose the voltage in the voltage regulator output pin becomes higher than the input voltage of the voltage regulator. In that case, a large current may flow into the voltage regulator from its output pin to its input pin. That large current can permanently damage your board's voltage regulator.
.
So I built a constant voltage source of around 12 volts and fed it to the Vin pin which is then regulated by the Arduino's on-board regulator.
My problem is that all of this work and LEDs turn on perfectly only as long as Arduino is not connected to the circuit but as soon as I add it, it loads down everything, although the measured current through the Vin pin is only 60mA. This promblem persists exactly the same way with either of these configurations:
1. MOSFET triggered manually
2. MOSFET is disconnected and LEDs are directly drawing from the LM317 current source.
3. LEDs are directly connected to the output of XL6009 module(I did it by mistake but very briefly)
I've also replaced Arduino with a 100 ohm resistor from the output of the LM317 voltage source to ground and it's still the same issue, but resistors higher than 200 ohm don't have any negative effect on LEDs remaining on with full brightness.
I'm wondering maybe I shouldn't connect a constant current soruce and a constant voltage source to the same power rail(XL6009) in parallel, and what is the proper way to do this.
Also I appreciate any other commentery on the circuit, schematics, etc.Screenshot.png
 

dl324

Joined Mar 30, 2015
18,216
Also I appreciate any other commentery on the circuit, schematics, etc.
It sounds to me like the boost regulator isn't up to the task.

Why are you supplying 12V to the UNO? I thought it would operate at less than that.

You could put the LEDs in parallel, each with its own current limiting resistor, and connect them directly to the battery. Q1 would need to handle a higher current.

Colored schematics with unnecessary wire jogs/whitespace and components in non-preferred directions look childish.
 

Thread Starter

puzzled_quiet

Joined Aug 5, 2024
8
It sounds to me like the boost regulator isn't up to the task.
Yes I guess it's at the edge of its capability but I was hoping it kinda works.
Why are you supplying 12V to the UNO? I thought it would operate at less than that.
The Vin pin is regulated with an onboard voltage regulator to 5v, and accepts 6v to 12v as input I guess.
You could put the LEDs in parallel, each with its own current limiting resistor, and connect them directly to the battery. Q1 would need to handle a higher current.
Yes but I was hoping to do it in a more "proper" way by using a constant current source, also learning about current sources along the way.
Colored schematics with unnecessary wire jogs/whitespace and components in non-preferred directions look childish.
It's the default color of KiCad. Would you tell me what wires are unnecasary? I tried to reduced the whitespace but coudn't fit everything without sacrificing clarity.
 

dl324

Joined Mar 30, 2015
18,216
Yes but I was hoping to do it in a more "proper" way by using a constant current source, also learning about current sources along the way.
A resistor and a relatively stable supply have been used as passable approximation of a current source since the LED was invented.
HPexcerpt.jpg
You can check out the HP Optoelectronics Applications Manual 2nd edition here.

The human eye can't discern subtle brightness changes/mismatches.
It's the default color of KiCad.
You should be able to print to BW PDF. That's what I do with Eagle to avoid embarrassment.
Would you tell me what wires are unnecasary?
Wire jogs.
ScreenshotAnnot.jpg
I tried to reduced the whitespace but coudn't fit everything without sacrificing clarity.
Since you only have 3 connections to the UNO, you could have just referenced the pin connections:
1724515554850.png
 
Last edited:

Thread Starter

puzzled_quiet

Joined Aug 5, 2024
8
Are resistors are used for this purpose even in production? What is the purpose of LED drivers then?
You should be able to print to BW PDF. That's what I do with Eagle to avoid embarrassment.
I didn't know it's that bad lol. Found it in KiCad, thanks.
Wire jogs.
To be honest, except the battery-module connection, I was under the impression that putting things in different vertical levels helps to differentiate between things easier.
Since you only have 3 connections to the UNO, you could have just referenced the pin connections:
Oh... right this is much better. I'll do that from now on. thanks
 

dl324

Joined Mar 30, 2015
18,216
Are resistors are used for this purpose even in production?
Yes.

Using 4V for the battery voltage and 2.5V for the LEDs, you require a 7.5 ohm half watt resistor. 7.5 ohms happens to be a standard 5% value.

When the battery is 4.2V, current will be 224mA. At 3.5V, current will be 133mA. You didn't provide a part number, but I don't think the difference in brightness would be objectionable. All of the LEDs will be the same relative brightness, and the human eye isn't very good at discerning absolute brightness.
What is the purpose of LED drivers then?
There are instances where current sources might be considered better. I don't think your case is one of them.
I didn't know it's that bad lol.
The grid from screen captures is also bad.
To be honest, except the battery-module connection, I was under the impression that putting things in different vertical levels helps to differentiate between things easier.
Too much whitespace, unnecessary wire jogs, unconventional component orientation, and unconventional flow make schematics difficult to read.

Well drawn schematics aren't usually difficult to read. Poorly drawn ones are tedious, and at times impossible, to read. Some members refuse to waste their time trying to read poorly drawn schematics.

You can take "connect by name" to an extreme and make a schematic difficult to read.
 
Last edited:

LowQCab

Joined Nov 6, 2012
5,101
There are certain usual conventions used in creating schematics,
but there are no "hard and fast" rules written-down anywhere.

I think that You did a fine job in "communicating" your Circuitry,
at least far superior to some of the scribbles that get posted here on occasion.

Some people are trying to view these Forums on a Cell-Phone,
I don't know if that is the case here in this Thread,
but I think living-Life staring-down at a Cell-Phone is ridiculous,
there's just not enough "screen-real-estate" for many applications.
I even think that the rather large LapTop that I am currently
limited to is barely adequate for viewing Schematics.

Even many of the "proffesional-level" Schematic-creating-Programs don't follow all of "the-rules",
and create some of their own "funky" rules that can be quite inadequate and confusing when
it comes down to "communicating" how a Circuit is intended to work.
.
.
.
 

eetech00

Joined Jun 8, 2013
4,704
This is my first ever shematics and also first time "designin"(lol) a circuit this complicated.
The breadboard circuit also doesn't have any capacitors just like the schematics, I'll add them later, but that probably won't solve the problem.
The XL6009E1 module is an adjustable boost converter similar to this, capable of 4W output. It's set to 22v.
The battery is a 3.7v-4..2v 2200mAh lithium-ion, capable of 8W output(assuming the maximum output current is 1C). Its terminals are connected to the module's input termninals. All of the VCC and GND symbols in the schematics are directly connected to the module's output terminals.
The reasoning behind the LM317's is:
1. LEDs drop around 3v each, and so can't be driven directly by the battery, so I first boost the voltage and then build a constant current source which provides around 200mA, resulting about 2.5v measured for each LED.
2. I want to drive the Arduino with the same battery(will replace it with a bare microcontroller chip later on). Also this page says:
.
So I built a constant voltage source of around 12 volts and fed it to the Vin pin which is then regulated by the Arduino's on-board regulator.
My problem is that all of this work and LEDs turn on perfectly only as long as Arduino is not connected to the circuit but as soon as I add it, it loads down everything, although the measured current through the Vin pin is only 60mA. This promblem persists exactly the same way with either of these configurations:
1. MOSFET triggered manually
2. MOSFET is disconnected and LEDs are directly drawing from the LM317 current source.
3. LEDs are directly connected to the output of XL6009 module(I did it by mistake but very briefly)
I've also replaced Arduino with a 100 ohm resistor from the output of the LM317 voltage source to ground and it's still the same issue, but resistors higher than 200 ohm don't have any negative effect on LEDs remaining on with full brightness.
I'm wondering maybe I shouldn't connect a constant current soruce and a constant voltage source to the same power rail(XL6009) in parallel, and what is the proper way to do this.
Also I appreciate any other commentery on the circuit, schematics, etc.
Why not configure arduino PWM on the GPIO connected to the mosfet? That way the LM317's are not needed. The arduino PWM will control the dimming using an average current.
 

LowQCab

Joined Nov 6, 2012
5,101
Even with PWM Dimming, the maximum-Peak-Current must be regulated if the available Voltage is
high enough to cause excessive Current to flow.
.
.
.
 

bassbindevil

Joined Jan 23, 2014
918
The way it's commonly done in LED flashlights is with linear constant-current 7135 drivers which are paralleled as necessary to get the desired current. They have a control pin for PWM dimming. The voltage range of a single lithium cell is a fortuitously good match for the voltage needed by a white LED, so the efficiency of a linear CC driver is pretty good.
 

Thread Starter

puzzled_quiet

Joined Aug 5, 2024
8
The way it's commonly done in LED flashlights is with linear constant-current 7135 drivers which are paralleled as necessary to get the desired current. They have a control pin for PWM dimming. The voltage range of a single lithium cell is a fortuitously good match for the voltage needed by a white LED, so the efficiency of a linear CC driver is pretty good.
Thanks, I just looked at the datasheet and it says that its output current is 350mA which means LEDs should be paralleled. So if this is this the common practice, would you mind telling me why it's mentioned everywhere that LEDs are better be connected in series?
 

MisterBill2

Joined Jan 23, 2018
27,159
Welcome to AAC! First, that schematic is among THE BEST I have seen in a while. Providing the entire detail of the processor does provide the context for consideration, and so it is just fine to have it in the drawing.

Next, as for why the LEDs do not light up, the very first thing is to measure the voltages. Start with the voltage at the top of the string. Then at the drain pin of the mosfet. (All measurements referenced against the common bus, aka "ground" My first guess is that the Mosfet is not being switched on adequately, second guess is that the supply voltage is dropping a lot. And one more guess is that one or more LEDs are reversed. It might also be that the connections to the mosfet pins are not right. That does happen.
 

LowQCab

Joined Nov 6, 2012
5,101
It is better to connect LEDs in Series IF You have enough Voltage available.
Connecting them in parallel will waste more power in the form of Heat.

A standard LM317 1.5-Amp-Voltage-Regulator will also do the job just fine,
but requires the addition of an external Resistor to set the the Current to any value You prefer,
whereas the 7135 Chip has a fixed 35mA Output.
.
.
.
 

bassbindevil

Joined Jan 23, 2014
918
Paralleling LEDs is possible because they have significant internal resistance. You can see that clearly on the data sheets; voltage across an LED rises with higher currents. You can't mix different colours, though.
 

Ya’akov

Joined Jan 27, 2019
10,226
Welcome to AAC.

Nice work for an early project. You are on the right track and I expect you will do very well as you learn more. Design is like that, practical experience gives you a bigger toolbox to draw from and things get better and easier. Keep it up.

Two things:

Consider a dedicated LED constant current driver chip. There are very inexpensive chips that are designed to provide constant current with adjustable output. They include programming resistors and an \( \over \mathsf{ENABLE} \) pin that can be used to control the LED (on-off) or as a PWM input to do dimming. They can really simplify things.

And, I‘ll mention—not because it is necessarily something you need to do with this design, but because it could be helpful now, or in the future—that LEDs can be and often are combined in series and parallel in the same way cells are arranged in batteries.

The reason is similar, but for the adjustment of input rather than output voltage-current. So, for example, you would put your LEDs into a 2S3P configuration trading voltage for current and dropping your supply voltage requirements to 6V.

This is commonly done to match supply voltages, particularly to raise them in the case of mains powered LED lamps.
 

mxabeles

Joined Apr 25, 2009
295
Very cool! How is your project advancing? I've been using 7805 regulators but this is first time hearing about LM317. I may have to try these out sometime.
 
Top