Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Can I use BP2857 constant current LED driver IC with a PWM-controlled MOSFET for dimming and turning the lights on or off with an ESP8266/Arduino?

ISHRAQ

New Member
I am trying to build a remotely controllable aquarium LED light. I live in a country where DigiKey and Mouser are not a thing. Electronic components are hard or impossible to find in this country. So I'm limited to the parts shown in the schematic. And my skills are not yet adequate for designing something more complex.

Here I want to control the LEDs with a PWM signal from an Arduino or ESP8266. I need this functionality to dim the LEDs and to also control when they turn on and off during the day. The constant current source I want to use is a commercially available mains voltage LED driver module. So, my questions are:

1. I think the LED driver module gets to its maximum voltage (≈311VDC) whenever the PWM signal is at its low stage and the MOSFET is off. Is this gonna create any problem with the PWM dimming function?

2. Should I separate the 12V (MOSFET gate driver) and High-voltage grounds?

3. Is it a good idea to use an optocoupler between the Arduino/ESP and the MOSFET gate driver IC?

4. Is this work or something's gonna explode as soon as I connect the power?!


Here is the schematic:
View attachment Schematic_Aquarium-Light-Example-Circuit_2024-02-12.png
View attachment Schematic_Aquarium-Light-THT_2024-02-11-01-01.png

This is the constant current driver:
20796193902091436204.jpg
 

Attachments

  • Schematic_Aquarium-Light-Example-Circuit_2024-02-12.png
    537.9 KB · Views: 66
  • Schematic_Aquarium-Light-Example-Circuit_2024-02-12 (1).pdf
    139.8 KB · Views: 65
Your circuits are not isolated, so everything has to be considered to be at dangerous voltages. The circuit for the BP2857D shows an earth symbol, but that's very misleading. The symbol just says where the reference voltage for the circuit is.

There is no isolation in your drive circuit so the whole of the Arduino will be at mains voltage, so an opto isolator is needed.

The MOSFET isn't isolated, so it's gate has to be referenced to the source voltage.

If you are going to use the BP2857D circuit, I suggest you use one bridge rectifier for however many BP2857D circuits you have. On a similar note, I'm not sure how two of those the pre-built circuits will work on separate bridge rectifiers. I suggest that you bypass the rectifiers and run from just one rectifier.

For isolation, you could use an isolation transformer, and then you can just earth the -ve line.

Both the driver circuits that you are looking at are constant current circuits. I don't know how they will react to being shut off using PWM. The capacitor on the output of the BP2857D will charge to a large voltage during the off phase of the PWM, and when the MOSFET turns on, that capacitor will be discharged into the LEDs. At best that will make the control rather non-linear and at worst it will not work or damage stuff.

I suggest you find an LED driver on which you can alter the current. That could be analogue or it could be with PWM, but it will need a control input that can be referenced to a known voltage.
 
Last edited:
How about using some very safe and simple 12v LED strips that you can connect to some very safe, UL and CE listed power supplies that are short-circuit and overload protected mains to 12VDC supplies with proper cord restraints, housings and safe mains cords incase something becomes detached?

I don't understand the need to build from scratch, using a diy high voltage string of LEDs in series near water or where an unsuspecting, visitor, cleaning person or pet may touch is asking for trouble. And, you can design it and have it up and running in a few minutes. Just my opinion.

Also, why use 10000k "white" LEDs? Just by a strip of blue LEDs if you need more blue light.

Note that a resistor in series with a constant voltage supplies a constant current (more-or-less).
 
If you have this CC module, has anyone considered an opto-isolated linear-control method of the CS resistor in the module.

The LED current is 1/2 of the IPK current. Thus for LED current of 300~350 mA, e.g. Rcs= 2* 400mV/333mA = 2.4 Ohms. Thus by separating this Rcs resistor from Gnd and inserting an opto-isolated transistor and buffer transistor you can create a linear control of CC.
1707865564357.png

Since the CC uses PWM, you cannot use PWM easily again to dim this circuit without an AC to DC filter.

You can choose a minimum current Imin.
Now you have a design spec to convert 0 to Vmax for Imin to Imax. = Rcs (max to min)


1707866309171.png
 
If you have this CC module, has anyone considered an opto-isolated linear-control method of the CS resistor in the module.

The LED current is 1/2 of the IPK current. Thus for LED current of 300~350 mA, e.g. Rcs= 2* 400mV/333mA = 2.4 Ohms. Thus by separating this Rcs resistor from Gnd and inserting an opto-isolated transistor and buffer transistor you can create a linear control of CC.
View attachment 144504
Since the CC uses PWM, you cannot use PWM easily again to dim this circuit without an AC to DC filter.

You can choose a minimum current Imin.
Now you have a design spec to convert 0 to Vmax for Imin to Imax. = Rcs (max to min)


View attachment 144505
Was just thinking of it. Have no doubts now that a much smarter guy than me is saying that it is an option.
Thank you very much for your effort.
 
Rough design with high CTR isotransistor with the 54 to 394 mV out to IN giving a nonlinear transfer function for dim to full brightness. using Vcc on chip with cut to CS resistor and Gnd. (existing Rcs will be near 12 ohms.) I test it with a sawtooth 0 to 5V. You may only need 0.8 to 3V

1707949487962.png

1707949769820.png
 
Last edited:

Latest threads

New Articles From Microcontroller Tips

Back
Top