An Arduino library for controlling the Texas Instruments LP5562 4-channel I2C LED driver.
This library allows you to easily control the brightness (PWM) and maximum current for the four individual LED channels (typically Red, Green, Blue, and White) of the LP5562 chip via I2C communication. It supports basic configuration like setting the dimming curve (linear/logarithmic) and PWM frequency.
- Initialize the LP5562 driver.
- Set brightness (0-255) for individual R, G, B, W channels.
- Set maximum current (0-25.5mA) for individual R, G, B, W channels.
- Configure logarithmic or linear dimming.
- Configure PWM frequency (256Hz or 558Hz).
- Hardware Reset via command.
- Open the Arduino IDE.
- Go to Sketch > Include Library > Manage Libraries...
- Search for "LP5562".
- Click Install.
Alternatively, download the repository as a ZIP file and install it via Sketch > Include Library > Add .ZIP Library...
Connect the LP5562 to your Arduino:
- SDA -> Arduino SDA pin
- SCL -> Arduino SCL pin
- VDD -> 3.3V or 5V (refer to datasheet [cite: 37])
- GND -> Arduino GND
- EN/VCC -> 1.8V to VDD (Logic level reference, e.g., 3.3V for most Arduinos [cite: 37])
- ADDR SEL0/1 -> GND or EN/VCC to set I2C address (GND/GND = 0x30 default) [cite: 317, 319]
- R, G, B, W -> Connect to your LEDs (usually through current-limiting resistors if needed, though the chip provides current control).
Consult the LP5562 datasheet for full details. [cite: 1]
#include <Wire.h>
#include <LP5562.h>
LP5562 ledDriver;
void setup() {
ledDriver.begin()
// Set max current (e.g., 10mA = value 100)
ledDriver.setRGBWCurrent(100, 100, 100, 100);
}
void loop() {
// Set Red
ledDriver.setRGBWBrightness(255, 0, 0, 0);
delay(500);
// Set Green
ledDriver.setRGBWBrightness(0, 255, 0, 0);
delay(500);
// Set Blue
ledDriver.setRGBWBrightness(0, 0, 255, 0);
delay(500);
// Set White
ledDriver.setRGBWBrightness(0, 0, 0, 255);
delay(500);
}