instructables CN5711 Driving LED with Arduino or Potentiometer Instructions
- June 9, 2024
- instructables
Table of Contents
- CN5711 Driving LED with Arduino or Potentiometer
- Step 1: Datasheet
- Step 2: Drive the Led With the Built in Potentiometer
- Step 3: Drive the Led With a Microcontroller
- define pinLed 3
- define led Off 0
- define led On 250 //255 is the maximum pwm value
- Step 4: Diy Version
- Step 5: See You Soon!
- References
- Read User Manual Online (PDF format)
- Download This Manual (PDF format)
CN5711 Driving LED with Arduino or Potentiometer
Instructions
CN5711 Driving LED with Arduino or Potentiometer
How to Drive a Led With Arduino or Potentiometer (CN5711)
by dariocose
I like LEDs, especially for personal projects, like making torches and lights
for my bike.
In this tutorial I will explain the operation of a simple into drive leds that
meets my needs:
- Vin < 5V to use a single lithium battery or USB
- possibility to vary the current with a potentiometer or with a microcontroller
- simple circuit, few components and small footprint
I hope this little guide will be useful to other users!
Supplies:
Components
- Led driver module
- Any power led (I used 1 watt red led with 60° lens)
- Battery or power supply
- Breadboard
- Components
For the diy version:
- CN5711 IC
- Potentiometer
- Prototype Board
- SOP8 to DIP8 pcb or SOP8 to DIP8 adapter
Tools
- Soldering iron
- Screwdriver
Step 1: Datasheet
A few months ago I found on Aliexpress a led driver module composed of a
CN5711 IC, a resistor and a variable resistor.
From the CN5711 datasheet:
General Description:
General Description: The CN5711 is a current regulation integrated circuit
operating from an input voltage of 2.8V to 6V, the constant output current can
be set up to 1.5A with an external resistor. The CN5711 is ideal for driving
LEDs. […] The CN5711 adopts the temperature regulation instead of temperature
protection function, the temperature regulation can make the LED being turned
on continuously in case of high ambient temperature or high voltage drop. […]
Applications: Flashlight, High-brightness LED driver, LED headlights,
Emergency lights and lighting […] Features: Operating Voltage Range: 2.8V
to 6V, On-chip Power MOSFET, Low Dropout Voltage: 0.37V @ 1.5A, LED Current up
to 1.5A, Output Current Accuracy: ± 5%, Chip Temperature Regulation, Over LED
Current Protection […] There are 3 modes of operation for this IC:
- With a PWM signal directly applied to the CE pin, the frequency of the PWM signal should be less than 2KHz
- With a logic signal applied to the gate of an NMOS (Figure 4)
- With a potentiometer (Figure 5)
Using the PWM signal it is very easy to drive the IC with a microcontroller like Arduino, Esp32 and AtTiny85.
General Description
The CN571 I is a current regulation integrated circuit operating from an input voltage of 2.8V to 6V, the constant output current can be set up to I.5A with an external resistor. The CN5711 is ideal for driving LED. The on-chip power MOSFET and current sense block greatly reduce the number of external component count. The CN5711 adopts the temperature regulation instead of temperature protection function, the temperature regulation can make the LED being turned on continuously in case of high ambient temperature or high voltage drop. Other features include chip enable, etc. CN5711 is available in thermally- enhanced 8-pin small outline package (SOPS).
Features
- Operating Voltage Range: 2.8V to 6V
- On-chip Power MOSFET
- Low Dropout Voltage: 0.37V @ 1.5A
- LED Current up to 1.5A
- Output Current Accuracy: * 5%
- Chip Temperature Regulation
- Over LED Current Protection
- Operating Temperature Range: – 40 V to +85
- Available in SOPS Package
- Pb-free, Rohs Compliant, Halogen Free
Applications
- Flashlight
- High-brightness LED driver
- LED headlights
- Emergency lights and lighting
Pin Assignment
Figure 3. CN5711 drives LEDs in Parallel
Figure 4 A logic signal to Dim LED
Method 3: A potentiometer is used to dim the LED as shown in Figure
5.
Figure 5 A Potentiometer to Dim the LED
Step 2: Drive the Led With the Built in Potentiometer
I hope the wiring is clear i n the photos and video.
V1 >> blue >> power supply +
CE >>blue >> power supply +
G >> gray >> ground
LED >> brown >> led +
To power the circuit I used a cheap power supply (made with an old atx power
supply and a ZK-4KX buck boost converter) . I set the voltage to 4.2v to
simulate a single cell lithium battery.
As we can see from the video, the circuit powers from 30mA to more than 200mA
https://youtu.be/kLZUsOy_Opg
Adjustable current through adjustable resistor.
Please use a suitable screwdriver to gently and slowly
rotate
Step 3: Drive the Led With a Microcontroller
To control the circuit with a microcontroller just connect the CE pin to the
PWM pin o f the microcontroller.
V1 >>blue >> power supply +
CE >> purple >> pwm pin
G >>gray >> ground
LED >> brown >> led +
Setting the duty cycle to 0 (0%) the LED will turn off. Setting the duty cycle
to 255 (100%) the LED will light up at maximum power. With a few lines of code
we can adjust the brightness o f the LED.
In this section you can download a test code for Arduino, Esp32 and AtTiny85.
Arduino test code:
define pinLed 3
define led Off 0
define led On 250 //255 is the maximum pwm value
int value = 0 ; //pwm value
void setup() {
pinMode(pinLed, OUTPUT); //setto i l pin pwm come uscita
}
void l o o p ( ) {
//blink
analog Write(pinLed, led Off); // Turn off led
delay(1000);
// Wait a second
analog Write(pinLed, led On); / / Turn on led
delay(1000);
// Wait a second
analog Write(pinLed, led Off); //…
delay(1000);
analog Write(pinLed, led On);
delay(1000);
//dimm
for (value = ledOn; value > ledOff; value –) { //decrease the light by
decreasing “value”
analog Write(pinLed, value);
delay(20);
}
for (value = ledOff; value < ledOn; value ++) { //increase the light by
increasing “value”
analog Write(pinLed, value);
delay(20);
}
}
https://youtu.be/_6SwgEA3cuJg![instructables CN5711 Driving LED with Arduino or Potentiometer
- Figure 6](https://manuals.plus/wp-content/uploads/2023/03/instructables- CN5711-Driving-LED-with-Arduino-or-Potentiometer-Figure-6.jpg)
https://www.instructables.com/FJV/WYFF/LDSTSONV/FJVWYFFLDSTSSNV.ino
https://www.instructables.com/F4F/GUYU/LDSTS9NW/F4FGUYULDSTS9SNW.ino
https://www.instructables.com/FXD/ZBY3/LDSTS9NX/FXDZBY3LDSTS9NX.ino
Download
Download
Download
Step 4: Diy Version
I made a diy version of the module following the standard datasheet circuit.
I used a 50k potentiometer even though the datasheet says the “R-ISET’s
maximum value is 30K ohm”.
As you can see the circuit is not very clean…
I should have used SOP8 to DIP8 pcb or SOP8 to DIP8 adapter for a more elegant
circuit!
I hope to share a gerber file soon that you can use.
Step 5: See You Soon!
Please leave me your impressions with a comment and report technical and
grammatical errors!
Support me and my projects at this link https://allmylinks.com/dariocose
Nice work!
I did see one technical grammar error that could cause some confusion. At the
end of step 2 you say:
“As we can see from the video, the circuit powers from 30mAh t o more than
200mAh”
That should say “30 mA t o 200 mA.”
The term mAh means “milliamps times hours and is an energy measurement, not a
current measurement. Fifteen milliamps for 2 hours or 5 milliamps for 6 hours
are both 30 mAh.
Nicely written instruct able!
Thanks!
You are right! Thanks for your advice!
I correct immediately!
References
- Yours for the making - Instructables
- How to Drive a Led With Arduino or Potentiometer (CN5711) : 5 Steps (with Pictures) - Instructables
- Dariocose's Profile - Instructables
- Dario Cose (@dariocose) | AllMyLinks
- content.instructables.com/F4F/GUYU/LDSTS9NW/F4FGUYULDSTS9NW.ino
- content.instructables.com/FJV/WYFF/LDSTS9NV/FJVWYFFLDSTS9NV.ino
- content.instructables.com/FXD/ZBY3/LDSTS9NX/FXDZBY3LDSTS9NX.ino
- s.click.aliexpress.com/e/_Dem7d77
- s.click.aliexpress.com/e/_DFI8pE1
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>