Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked — Edited

Led Spotlight With Brightness Control Via Ezb Advice?

Hi all, I could use some advice from more knowledgeable folks (and more knowledgeable than me’ in this case likely includes: everybody who could possibly be reading this post, ha)

Goal: I would like 2 warm-light spot-lights with brightness control via EZB (presumably via PWM object or the equivalent script command).

Purpose: these lights will be mounted/fixed in position (ie not on a mobile robot) to illuminate a target (~ 5 inch diameter) from a distance of ~ 8 inches.
The cable distance from the EZB to the LED will be 4 or 5 feet. The EZB is powered via a fixed 7.4V power supply.

I found these threads
Connecting Leds To The Ez-b V4:
Running A Led Of Port D6:
And these are helpful, but to be honest I don’t understand the tradeoffs between what LEDs I choose, the current they use, how bright they are, which pin (or supply?) they draw power from, whether I need multiple LEDs in series (or parallel?) etc.

As a datapoint I did buy these 2 Jorunhe LED spotlights: https://www.amazon.com/gp/product/B01DP874KC
User-inserted image

These are 1W LEDs that have a (detachable) AC driver. I hooked them up via an AC power cord and they are certainly bright enough (my primary criteria) and the light is warm in color. These have a substantial housing with a rotational pivot, but that is not a requirement. These have a lens that creates a spotlight but the lens is not a requirement (Edit: I removed the lens and housing, and am happy with how the 'bare' Jorunhe LEDs look).
(One solution that I considered is using a opto isolated relay like this: https://www.amazon.com/gp/product/B00TGTX23I -- {tho i’ve never hooked up anything like that, it sounds straightforward} with these Jorunhe LED spotlighs connected via EZB, but ideally I would like to have PWM brightness control.
I also considered disconnecting the AC driver from these LEDs and connecting the LEDs directly to the EZB and experimenting to see how bright they can be, but I decided I was likely to either ruin a port on the EZB or burn out the LED. Seeking advice seemed best instead.)
I would be happy to use these Jorunhe LEDs if possible, and/or happy to buy a different solution off the shelf (especially if it is under $40) or as parts. I am semi-capable enough to solder an LED to a cable with some heat shrink, but would prefer (is lazy the word I’m looking for? ha) to pay a little extra not to worry about whether I got the short is minus long is plus' thing correct in all cases, ha

Is anybody willing to help point me in the right direction as to which 'warm light' LEDs (and other parts?) to use and how to connect it to the EZB? Thank a bunch for any advice and ideas.

-Richard Twitch’ R


Upgrade to ARC Pro

Synthiam ARC Pro is a cool new tool that will help unleash your creativity with programming robots in just seconds!

Can you post a picture of the AC/DC (info side) converter (white box) ?
Hi ptp, yes here you go and thanks

User-inserted image

User-inserted image

User-inserted image

User-inserted image

Can you confirm the following information (white label):
Model: (1-3) x 1W
Input (AC): 85-265V 50/60Hz
Output (DC): 2-12V
300 mA +- 3%


(One solution that I considered is using a opto isolated relay like this:

You can use a Relay to control On/Off but not with a PWM. Mechanical Relays are slow, generate noise and (cheap versions) will be destroyed with PWM cycles.

You need a Mosfet (Digital Switch transistor). There are a few options you need one that can be driven using a 3.3v logic.

I found this (IRF520):

Vin - Red (from the AC/DC converter)
GND - Black (from the AC/DC converter)
V+ - Led Red cable
V- - Black Red cable

Logic (3 pin):
SIG - White PIn / EZB digital pin
VCC - Red Pin / EZB digital pin
GNN - Black Pin /EZB digital pin

Basically the Mosfet PCB sits between the led and AC/DC converter output.

1) Red/Black cables is the DC side, if you have a multi-meter double check the DC voltage
2) If the circuit works, keep the led on for a few hours or days and use a digital temperature thermometer (you can use one for the meat) and check the Mosfet Temperature (metallic part) the limit is 155 C, but if is higher than 80 C you will need to add a heat sink.
Hi ptp,
> Model: (1-3) x 1W
> Input (AC): 85-265V 50/60Hz

But below are 2 corrections
Output (DC): 3-12V
300 mA +- 5%

ok i ordered the sixpack of mosfets,
and i think i understand the wiring, thank you

(This is probably a dumb question but... ) I would prefer to avoid the AC (and AC driver box) entirely and have a direct connection to the EZB (so that the EZB is providing the power for the LED with maybe a pull down resistor or something?), but i guess that a bright light like this will draw more current than the EZB can provide, is that right?

thank you very much for your help!


I would prefer to avoid the AC (and AC driver box) entirely and have a direct connection to the EZB

You need to keep the AC/DC converter, the circuit converts the correct ratio between Volts / Amps.


but i guess that a bright light like this will draw more current than the EZB can provide, is that right?

Correct you can drive a few mA directly from EZB, not enough for a big led.

To drive a led you need to limit the current, and it's not easy to create a circuit (a transistor and a few resistors) without knowing the led specs.
Since the LED uses DC voltage and draws 300ma the simplest way is to use an H-bridge to drive it. Use PWM to control brightness... Connect one of the H-bridge outputs directly to the LED (you don't need the the ac/dc converter)... Use it as if you are driving a DC motor... PWM will control the brightness...

*note* LEDs require the correct polarity so be aware of this...

Come to think of it an ESC would work too... Using the servo command in place of PWM... servo command is basically PWM anyway with I believe higher resolution...
@Richard R


Output (DC): 3-12V
300 mA +- 5%

Those are the AC/DC output specs. A led per se does not limit the current.

The most important detail when connecting a Led is to limit the current below the Led's max forward current otherwise will damage the led.

You can use a H-bridge to control and separate the load voltage (motor, led, lights) but i still think is important to provide the correct current to the H-Bridge's load.

Some H-bridges e.g. (L298 well know and used here and with arduinos) are inefficient they drop the voltage while driving the load (https://www.rugged-circuits.com/the-motor-driver-myth/) so is another detail.

L298 is an old and affordable chip so it's still ok, keep in mind there are more efficient H-Bridges ICs.

Returning to the Led subject... Maybe there are some exceptions e.g. (Leds with built-in circuits) without more specs and more investigation is difficult to suggest a different power source.
I have a 12V super bright LED (with current limiting resister) that draws approx 300ma (@12V)... I just tried driving it using a Vex (ESC) speed motor controller.... Worked fine including brightness control... So perhaps adding the appropriate current limiting resister to the OPs led might do the trick...
Richard R,

Correct with the correct voltage and current limiting resister. Yes!

Regarding the OP's Led specs:

What i don't understand is the:


Output (DC): 3-12V

DC provides a variable voltage ? Is it proportional to the AC voltage ?


Model: (1-3) x 1W

What is the meaning of 1-3 and 1 Watt.


300 mA +- 5%

So P(W) = I(A) x V(V) => 0.3 A x 3 V = 0.9 W

but still confused with a variable interval (3-12)V...

I asked to measure the DC voltage:


1) Red/Black cables is the DC side, if you have a multi-meter double check the DC voltage
Hi ptp and RichardR, thank you for all this information, I really appreciate it.

I have ordered the MOSFETs and I plan to implement that solution using AC power for the Johunre LEDs, sounds great (tho I am worried about the heat sink and overheating, but I will do my best). I will let you know my result and take some photos for anyone else who might benefit.

But I would also be interested in exploring the EZB-powered connection, if you or anybody is willing to spell it out for me?

(I am admittedly slow on the uptake, but) it seems like if I start with an LED with known specs, then it is possible to avoid the AC power, so I searched Amazon for super bright led diode warm and found this:
User-inserted image

(this price is fine, but I only need maybe 10 anyway (not 100))
I have no idea whether this is appropriate, or whether this will be bright enough (roughly as bright as the 300mA Johunre would be great, but looking at the 20mA current draw, should i infer that these will not be nearly as bright?), so please suggest another if you have an idea for me.

Given my setup, my goal would be to figure out what is the most straightforward way to get brightness control and power direct from the EZB.
(By straightforward I mean: least chance that a soldering mistake on my part will lead to a prolonged period of head-scratching as to why smoke is coming from my setup, ha.)

>Come to think of it an ESC would work too

I did not know what an ESC was, but i see it is and Electrical Speed Controller (haven’t used one before but am certainly willing)
I gather that an H-bridge control is a standard type of ESC (allowing both forward and backward I think, but in this case with the LED I only need forward’ I guess?)
(note I took a look at the https://www.ez-robot.com/Tutorials/Help.aspx?id=70 HBridge tutorial and I see the 2.5 Amp Motor Controller for $14.99 https://www.ez-robot.com/Shop/AccessoriesDetails.aspx?prevCat=9&productNumber=14 and would be happy to buy that if I need to.)

Looks like I would need 4 ports on the EZB to control 2 LEDs (behaving as left and right motors’ ) independently for brightness?
All of the above info is my attempt to understand /regurgitate the alternative approach being suggested by RichardR, please correct me or suggest anything different as seems appropriate.

Thanks again for your advice!
Hi ptp


I asked to measure the DC voltage:
1) Red/Black cables is the DC side, if you have a multi-meter double check the DC voltage

I measured the voltage across red and black where they emerge from the box
- with the Johunre LED detached: 17.2V
- with the Johunre LED attached/energized: 3V
Solution 1
User-inserted image
Solution 2
User-inserted image

You mentioned before:
EZB VIN = 7.4V

Resistor R value calculation:

R(Ohm) = V(V) / I(A) =>
R = (7.4 V - 3.0V ) / 0.3 A =>
R = 4.4 V / 0.3 A =>
R = 14.66 (Ohm)

Resistor R power dissipation:

P(W) = V(V) x I(A) =>
P = 4.4 V x 0.3 A =>
P = 1.32 Watts

something like:
15 ohm 2 W resistor will work.

Can someone validate both solutions ?
Hi ptp,
This is great, i really appreciate your spelling-out these 2 solutions for me.
Solution 2 seems preferable to me as it is simpler and avoids the AC power connection. (I like these Johunre LEDs and now that i think i can control the brightness, i will likely buy some more of them.)
I think i understand the ohm's law (that's my level of sophistication, ha) calculation and i ordered the 15ohm resistors (i found some on ebay and think they are the same: https://www.ebay.com/itm/15-Ohm-2w-2-Watt-5-Tolerance-Metal-Oxide-Film-Resistor-10-Pieces/272507518919).

Question for Solution 2: Do i still need to worry about heat measurement and possibly adding a heat sink?

-thanks again so much for helping out!

-Richard 'Twitch' R
LED work great with PWM now, here's some follow up photos
User-inserted image

User-inserted image

User-inserted image

User-inserted image

-thanks for the advice ptp!

-Richard 'Twitch' R