Example Code for Arduino-LED Strip Brightness

Last revision 2025/12/27

The article guides on controlling LED strip brightness using Arduino with FireBeetle 2 ESP32-E and DAC module, including hardware and software setup, wiring instructions, and code example.

Hardware Preparation

Software Preparation

Wiring Diagram

DFR0971-Wiring diagram

Wring Description

FireBeetle 2: 3V3 to DAC module: +

FireBeetle 2: GND to DAC module: -

FireBeetle 2: SCL to DAC module: SCL

FireBeetle 2: SDA to DAC module: SDA

The DAC module: VOUT0 to LED dimmer (0-10V): V+

The DAC module: GND to LED dimmer (0-10V): V-

The LED dimmer (LOAD): V+ to 5V LED Strip: +

The LED dimmer (LOAD): V- to 5V LED Strip: -

The LED dimmer (POWER): V+ to 5V-24V power input: 5V +

The LED dimmer (POWER): V- to 5V-24V power input: 5V -

Sample Code

Initialize GP8403 DAC, set OUT0 to 3.5V and save.

#include "DFRobot_GP8403.h"
DFRobot_GP8403 dac(&Wire,0x58);

void setup() {
  Serial.begin(115200);
  while(dac.begin()!=0){
    Serial.println("init error");
    delay(1000);
   }
  Serial.println("init succeed");
  dac.setDACOutRange(dac.eOutputRange10V);//Set the output range as 0-10V
  dac.setDACOutVoltage(1433,0);//The DAC value for 3.5V output in OUT0 channel
  delay(1000);
  dac.store(); //Save the set 3.5V voltage inside the chip
}

void loop(){

}

Result

After downloading the code, the strip was lit, and at this time, the output voltage of channel 0 measured by a multimeter is 3.5V.

Was this article helpful?

TOP