Introduction
This is a 16-bit high-resolution DAC module with a full-scale error of only ±0.2%. It supports I2C or PWM signal control and can be flexibly configured to output 0-5V, 0-10V voltage signals, or 4-20mA current signals, meeting diverse control requirements.
Compatible with Arduino programming, the module works seamlessly with popular controllers such as ESP32, and Raspberry Pi, , enabling direct control of devices like lights, pumps, and servo motors that rely on the above signal types—simple and user-friendly.
As part of the DAC module series, this product—along with others in the series—can be controlled via I2C or PWM to output voltage or current signals. The series offers a wide range of options: resolutions from 8-bit, 12-bit, 15-bit to 16-bit, single or dual-channel variants, and support for multi-module cascading to create flexible multi-channel output solutions.
Features
- Supports 3.3V-5V power supply, with standard Gravity interface.
- Compatible with I2C/PWM signal input, offering broad adaptability.
- 16-bit resolution, with a full-scale error of 0.2%.
- Supports output of 0-5V and 0-10V analog voltage signals.
- Supports output of 4-20mA analog current signals.
- Supports 1.2× over-range voltage signal output.
- Compatible with Arduino programming and works with controllers such as ESP32 and Arduino.
- Features 8 configurable I2C addresses, allowing simultaneous control of up to 8 devices.
Applications
- Motor Control
- Light Dimming Control
- Valve and Pump Control
- Signal Generator
- Automation Upgrades for Small Equipment
Specifications
Basic Parameters
- Chip Model: GP8600
- Operating Voltage: 3.3V-5V
- Power/Communication Interface: PH2.0-4Pin/3Pin
- Input Signal: I2C / PWM
- Output Signal:
- Current Output Range: 0-20mA
- Voltage Output Range: 0-6V / 0-12V
- Number of Channels: 1 channel
- Resolution:
- 16-bit (I2C mode)
- 8-bit, 10-bit (PWM mode, selectable based on controller)
- Full-Scale Error: ±0.2% (measured after fitting calibration)
- Value Range:
- I2C Mode: 0-65535 corresponds to 0-6V, 0-12V, or 0-20mA
- PWM Mode:
- 0-255 corresponds to 0-6V, 0-12V, or 0-20mA
- 0-1023 corresponds to 0-6V, 0-12V, or 0-20mA
Physical Dimensions
- PCB Dimensions: 38 × 32 × 12.39 mm
- Mounting Hole Spacing: 25mm
- Mounting Hole Diameter: 3.0 mm
Functional Schematic Diagram

Hardware Interface Description
The module interfaces are categorized into three types: I2C input interface, PWM input interface, and output interface. The functional definitions of each pin are presented in the following table:
| Interface Type | Pin Silkscreen | Functional Description |
|---|---|---|
| I2C Input Interface | + | Positive power supply (input voltage: 3.3V-5V) |
| - | Negative power supply (ground) | |
| SCL | I2C clock line (SCL) | |
| SDA | I2C data line (SDA) | |
| PWM Input Interface | - | Negative power supply (ground) |
| + | Positive power supply (input voltage: 3.3V-5V) | |
| D | PWM signal input pin | |
| Output Interface | OUT | Positive output signal (voltage/current) ranges: 0-5V, 0-6V, 0-10V, 0-12V, 0-20mA, 4-20mA |
| GND | Negative output signal (ground) |
DIP Switch Configuration Logic
The DIP switches (A0, A1, A2) are used to switch the I2C address and PWM output range. Corresponding configurations should be selected based on the control mode, and mixed use is not allowed.
I2C Mode: Configure Module I2C Address
The I2C communication address of the module is defined by the combination of "0 (disconnected)/1 (closed)" for A0, A1, and A2. The default address is 0x58 (A0/A1/A2 are all 0).
| A2 | A1 | A0 | ADDR |
|---|---|---|---|
| 0 | 0 | 0 | 0x58 |
| 0 | 0 | 1 | 0x59 |
| 0 | 1 | 0 | 0x5A |
| 0 | 1 | 1 | 0x5B |
| 1 | 0 | 0 | 0x5C |
| 1 | 0 | 1 | 0x5D |
| 1 | 1 | 0 | 0x5E |
| 1 | 1 | 1 | 0x5F |
PWM Mode: Configure Output Signal Range
The output type (voltage/current) and range under PWM control can be defined by focusing on specific combinations of A0, A1, and A2.
Note: In PWM mode, A0 must not be set to 1; otherwise, the device may be damaged.
| A2 | A1 | A0 | OUT |
|---|---|---|---|
| 1 | 1 | 0 | 0-20mA |
| 0 | 0 | 0 | 0-6V |
| 0 | 1 | 0 | 0-12V |
Arduino IDE User Guide
- Hardware Preparation
- DFR1229 GP8600: I2C&PWM to 0-5V&0-10V&4-20mA ×1
- DFR0654 FireBeetle 2 ESP32-E ×1
- Multimeter ×1
- Several jumper wires
- Software Preparation
- Download and install Arduino IDE: [Download Link]
- Download dependent libraries:
- DFRobot_GP8XXX Library: [Download Link]
- DFRobot_RTU Library: [Download Link]
- Library Installation Guide: [View Installation Tutorial]
Example 1: Output 5V in 0-5V Range (I2C Mode)
Objective
Communicate with the GP8600 module via the I2C interface on the ESP32-E main controller to control the module to output 5V within the 0-5V range, and verify the result using a multimeter.
Step 1: Wiring Configuration

Connect the GP8600 module to the ESP32-E as shown in the diagram. The core corresponding relationships are as follows:
- Module I2C pin "+" → ESP32-E 3.3V
- Module I2C pin "-" → ESP32-E GND
- Module I2C pin "SCL" → ESP32-E SCL (default GPIO22)
- Module I2C pin "SDA" → ESP32-E SDA (default GPIO21)
- DIP switch configuration: A0=0, A1=0, A2=0 (I2C address = 0x58)
Step 2: Code Upload
Open Arduino IDE, copy the following code, and upload it to the ESP32-E:
#include <DFRobot_GP8XXX.h>
// Enable I2C communication mode
#define I2C_COMMUNICATION
// I2C address (modify according to the settings on the back of the module, default: 0x58)
#define MODULE_I2C_ADDRESS 0x58
DFRobot_GP8600_I2C GP8600(&Wire, MODULE_I2C_ADDRESS);
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Initialize the sensor; retry continuously if initialization fails
while (GP8600.begin() != 0) {
Serial.println("Communication with the device failed. Please check if the connection is normal or if the device address is set correctly.");
delay(1000);
}
Serial.println("Successful connection!");
// Set the DAC output range to 0-5V
GP8600.setDACOutRange(GP8600.eOutputRange5V);
// Set output data (0-65535 corresponds to 0-5V)
uint16_t data = 65535;
GP8600.setDACOutData(data);
}
void loop() {
// No operations required in the loop
}
Step 3: Result Verification
- Set the multimeter to the "DC V" range;
- Connect the red probe to the module's "OUT" terminal and the black probe to the module's "GND" terminal;
- Under normal conditions, the measured voltage should be close to 5V. In this example, the actual measured output voltage is 5.009V.

Example 2: Output 20mA in 4-20mA Range (PWM Mode)
Objective
Communicate with the GP8600 module via the PWM interface on the ESP32-E main controller to control the module to output 20mA within the 4-20mA range, and verify the result using a multimeter.
Step 1: Wiring Configuration

Connect the module to the ESP32-E as shown in the diagram. The core corresponding relationships are as follows:
- Module PWM pin "+" → ESP32-E 3.3V
- Module PWM pin "-" → ESP32-E GND
- Module PWM pin "D" → ESP32-E GPIO13 (PWM output pin)
- DIP switch configuration: A0=0, A1=1, A2=1 (output range = 4-20mA)
Step 2: Code Upload
Open Arduino IDE, copy the following code, and upload it to the ESP32-E:
#include <DFRobot_GP8XXX.h>
// Define the PWM pin as 13 (applicable to ESP32)
const int pwmPin = 13;
DFRobot_GP8600_PWM GP8600(pwmPin);
void setup() {
// Initialize the sensor
GP8600.begin();
// Set output data (PWM range for ESP32 is 0-1023)
double data = 1023; // Maximum output value
GP8600.setDACOutData(max(data, 42.5));
}
void loop() {
// No operations required in the loop
}
Step 3: Result Verification
- Set the multimeter to the "DC A" range;
- Connect the red probe to the module's "OUT" terminal and the black probe to the module's "GND" terminal;
- Under normal conditions, the measured current should be close to 20mA. In this example, the actual measured output current is 20.12mA.

API Functions
/**************************************************************************
I2C & PWM Series
**************************************************************************/
/**
* @fn begin
* @brief Initialization function
* @return Returns 0 for success; other values indicate failure
*/
int begin(void);
/**
* @fn setDACOutRange
* @brief Set the DAC output range (only valid in I2C mode)
* @param range DAC output range
* @n eOutputRange5V (0-5V)
* @n eOutputRange6V (0-6V) GP8630N, GP8600
* @n eOutputRange10V (0-10V)
* @n eOutputRange_10V (-10-0V) GP8630N
* @n eOutputRange_12V (-12-0V) GP8630N
* @n eOutputRange12V (0-12V) GP8630N, GP8600
* @n eOutputRange20MA (0-20mA)
* @n eOutputRange24MA (0-24mA) GP8630N, GP210
* @return NONE
*/
void setDACOutRange(eOutPutRange_t range);
/**
* @fn setDACOutData
* @brief Set the DAC output value for a single-channel module
* @param data DAC value
* @note In PWM mode, the current/voltage output is determined by the PWM duty cycle. Select the current/voltage output range via DIP switches according to the silkscreen on the back of the module.
* @note In I2C mode, the current/voltage output is determined by the output range set via setDACOutRange().
* @return NONE
*/
void setDACOutData(uint16_t data);
DAC Accuracy and Calibration Tutorial
Overview of DAC Accuracy and Calibration
The accuracy of a DAC (Digital-to-Analog Converter) refers to the proximity between its actual output value and the ideal output value. Higher accuracy indicates smaller deviation.
Purpose of Calibration:
Due to differences in internal components or environmental influences during use, DAC modules may have "offset" and "gain" errors. The core of fitting calibration is to correct the original output deviation through mathematical fitting algorithms, establishing an accurate mapping relationship between "program control parameters" and "actual output values" to significantly improve accuracy.
Practical DAC Calibration Tutorial (PWM Mode · 0-6V Range)
Taking the "0-6V range (program parameter range: 0-1023)" in PWM mode as an example, this tutorial adopts a linear fitting algorithm to quickly calculate calibration parameters using Excel spreadsheets. The steps are simple and easy to understand, requiring no complex programming.
Calibration Prerequisites
Hardware Preparation:
- DFR1229 GP8600: I2C&PWM to 0-5V&0-10V&4-20mA ×1
- DFR0654 FireBeetle 2 ESP32-E ×1
- Multimeter
Software Preparation:
- Excel spreadsheet (for calculating calibration parameters)
- DAC control program
Environmental Requirements:
- Stable ambient temperature (to avoid the impact of temperature drift on measurements)
- No obvious fluctuations in power supply voltage
Data Collection and Preparation
Collection Requirements
- Select 5 or more intermediate program parameters (do not select range endpoints 0 or 1023): Endpoint data is easily affected by the extreme characteristics of hardware, which may cause the fitting curve to deviate from the actual working range. Intermediate values can ensure fitting accuracy;
- Uniform distribution of program parameters: Cover the entire 0-1023 range (e.g., 171, 341, 512, 682, 853 in the example, corresponding to theoretical outputs of 1-5V) to ensure the fitting curve covers the entire range.
Step 1: Record Raw Data
Configure the DAC according to the selected program parameters, measure the actual output voltage with a multimeter, and record it in the following table (example data):
| Program Parameter (x) | Theoretical Output Voltage (V) | Actual Output Voltage (V) | Absolute Error (V) | Full-Scale Error |
|---|---|---|---|---|
| 0 | 0 | 0.0014 | 0.0014 | 0.0233% |
| 171 | 1 | 0.9928 | -0.0072 | -0.1200% |
| 341 | 2 | 1.9923 | -0.0077 | -0.1283% |
| 512 | 3 | 2.9867 | -0.0133 | -0.2217% |
| 682 | 4 | 3.9882 | -0.0118 | -0.1967% |
| 853 | 5 | 4.9848 | -0.0152 | -0.2533% |
| 1023 | 6 | 5.9942 | -0.0058 | -0.0967% |
Note: 0 and 1023 in the table are only for displaying full-scale errors. When performing fitting calculations, exclude endpoint data and only use the 5 intermediate groups (171, 341, 512, 682, 853).
Calculation of Calibration Parameters (Excel Tool)
Use the linear fitting functions in Excel to calculate the conversion coefficient c and conversion offset o required for calibration. The core logic is to correct the linear deviation between the original "program parameters and actual output".
Step 2: Input Data into Excel
Enter the 5 intermediate groups of data in Excel in the following format (example cell range):
| Cell | Content (Program Parameter x) | Cell | Content (Actual Output Voltage y) |
|---|---|---|---|
| B11 | 171 | D11 | 0.9928 |
| B12 | 341 | D12 | 1.9923 |
| B13 | 512 | D13 | 2.9867 |
| B14 | 682 | D14 | 3.9882 |
| B15 | 853 | D15 | 4.9848 |
Step 3: Calculate Original Slope k
The slope k represents the linear relationship between "changes in program parameters" and "changes in actual output" in the original state. The Excel formula is as follows:
=SLOPE(D11:D15, B11:B15)
- Meaning: D11:D15 is the range of actual output voltages, and B11:B15 is the range of corresponding program parameters. This formula calculates the linear slope between the two.
Step 4: Calculate Original Intercept b
The intercept b represents the actual output offset when the program parameter is 0. The Excel formula is as follows:
=INTERCEPT(D11:D15, B11:B15)
- Meaning: Calculate the intercept b based on the linear equation y = k*x + b.
Step 5: Calculate Conversion Coefficient c
The coefficient c is used to correct the original slope deviation so that the output conforms to the theoretical range. The Excel formula is as follows:
=(Theoretical Maximum Voltage / Maximum Program Parameter) / k
- Example substitution: Theoretical maximum voltage = 6V, Maximum program parameter = 1023. Therefore, the Excel formula is:
=(6/1023)/k
- Meaning: Correct the original slope k to the ideal slope that meets the theoretical range.
Step 6: Calculate Conversion Offset o
The offset o is used to offset the original intercept deviation. The Excel formula is:
=-b/k
- Meaning: Eliminate the inherent output offset when the program parameter is 0 through offset compensation.
Step 7: Code Integration and Activation
Substitute the c (conversion coefficient) and o (conversion offset) calculated in Excel into the DAC control program, and real-time correct the program parameters using the calibration formula to ensure the actual output is close to the theoretical value.
Calibration Formula:
y = c * x0 + o
- Explanation: y = Calibrated program parameter (final control value written to the DAC); x0 = Original target program parameter (uncalibrated, calculated from the theoretical output voltage).
- The complete calibration formula obtained by substituting the above-calculated conversion coefficient and offset is: y = 1.0020 * x0 + 1.1550
Code Example
Fill in the obtained c (conversion coefficient) and o (conversion offset) values into the following code:

Then, you can obtain more accurate data using the fitting calibration algorithm. The complete code is as follows:
#include <DFRobot_GP8XXX.h>
// Fix the PWM pin to 13 for the ESP32 platform, no need for multi-platform adaptation
const int pwmPin = 13;
DFRobot_GP8600_PWM GP8600(pwmPin);
/**
* @brief Calibration function (ESP32-specific, matching 0-6V range)
* @param data Uncalibrated original program parameter (0-1023)
* @param coefficient Fitting calibration coefficient c (calculated in Excel)
* @param offset Fitting calibration offset o (calculated in Excel)
* @return Calibrated PWM control parameter (0-1023)
*/
uint16_t calibrationFun(uint16_t data, double coefficient, double offset)
{
double tempdata = data * coefficient + offset;
// The PWM parameter range for the ESP32 platform is fixed at 0-1023 (corresponding to 0-6V), directly clamp the value
if (tempdata > 1023) tempdata = 1023;
if (tempdata < 0) tempdata = 0;
Serial.print("Calibrated PWM parameter: ");
Serial.println((uint16_t)tempdata);
return (uint16_t)tempdata;
}
void setup() {
// Initialize the serial port (for debugging and viewing calibration parameters)
Serial.begin(115200);
// Initialize the GP8600 module (PWM mode)
GP8600.begin();
/**
* @brief 0-6V range output configuration (ESP32-specific)
* @note 1. The module's DIP switches must be configured for 0-6V output (refer to the instructions on the back of the module)
* @note 2. The PWM parameter range for the ESP32 platform is 0-1023, corresponding to an output of 0-6V
* @note 3. To enable calibration, pass the data below into calibrationFun
*/
uint16_t data = 1023; // Uncalibrated original target program parameter (calculated from the theoretical output voltage)
// Enable calibration (replace with the actually calculated coefficient and offset)
GP8600.setDACOutData(calibrationFun(data, caliCoeff, caliOffset));
}
void loop() {
// No operations required in the loop
}
