SKU_DFR1037_2_Channel_PWM_to_0-VCC_DAC WIKI

INTRODUCTION

DAC series modules are a range of products that can be controlled through I2C or PWM signals to generate voltage or current output signals. They possess the capability to produce a variety of analog voltage or current signals, including 0-5V, 0-10V, 0-2.5V, 0-VCC, and 0-25mA.

An analog quantity refers to the continuous variation of voltage magnitude (or current magnitude) within a specific range. Due to its stability, long transmission distance, and ease of use, it has found widespread application in the field of industrial automation control, including:

This series of DAC products not only offers a variety of output signal ranges, but also provides three selectable resolutions: 8-bit, 12-bit, and 15-bit. It allows for the choice of either single-channel or dual-channel configurations, and multiple modules can be cascaded to form a multi-channel output. When coupled with Arduino controllers, Raspberry Pi, STM32, and similar controllers, it finds application in various automation control scenarios, including:

The following table presents the functional parameters of each DAC product for reference in the selection process.

DFR1037 GP8501 (2-Channel PWM to 0-2.5V/VCC DAC Module)

FUNCTIONS

This is a 2-channel analog voltage output DAC module with PWM communication, 8-bit resolution, and 0.1% output voltage linearity error. It is well-suited for control projects operating within the 3.3V range, such as ESP32, Raspberry Pi, STM32, and other microcontrollers that require analog signal output.

PWM signal drive allows the module to be controlled by MCU digital ports, providing a simple and convenient usage. The design with two channels also enables effective cost reduction for the project.

FEATURES

DIMENSION

FUNCTIONAL DIAGRAM

Name Description Remarks
PWM Interface VCC Positive terminal of the power supply (3.3V-5V)
GND Negative terminal of the power supply
D0 PWM Input Port 0
D1 PWM Input Port 1
0-2.5V/0-VCC Switching Switch 0-VCC Switch output voltage to 0V-VCC
0-2.5V Switch output voltage to 0V-2.5V
Voltage Signal Output Port VOUT0 Positive terminal of output voltage signal 0
VOUT1 Positive terminal of output voltage signal 1
GND Negative terminal of the output voltage signal

SPECIFICATIONS

TUTORIAL

In this example, We will demonstrate the varying voltage values output by two channels in two different states.

Input signal value range: 0-255

In the state of 0-2.5V:

In the state of 0-VCC:

SOFTWARE REQUIREMENTS

HARDWARE CONNECTION

SAMPLE CODE

#include <DFRobot_GP8XXX.h>

//#define SINGLE_CHANNEL
#ifdef SINGLE_CHANNEL
//Single-channel output IO port
int pwmPin0 = 9;
DFRobot_GP8501 GP8501(pwmPin0);
#else
//Dual-channel output IO port
int pwmPin0 = 9;
int pwmPin1 = 10;
DFRobot_GP8501 GP8501(pwmPin0,pwmPin1);
#endif

void setup() {

  GP8501.begin();

  /**
   * @brief. Configuring different channel outputs for DAC values
   * @param data pwm 
   * @n. Optional parameters (0-255) correspond to voltage ranges of (0-2.5V) or (0-VCC), and the specific voltage range is determined by the fluctuation switch selected based on the module voltage. 
   * @param channel. Output channel
   * @n  0:Channel 0  (effective when configuring PWM0 output.)
   * @n  1:Channel 1  (effective when configuring PWM1 output.)
   * @n  2:All Channels (effective when configuring Dual-channel output.)
   */
  GP8501.setDACOutVoltage(176,0);//At 0-2.5V voltage range, Channel 0 outputs 1.725V, whereas at 0-VCC voltage range, Channel 0 outputs 3.29V.
  GP8501.setDACOutVoltage(103,1);//At 0-2.5V voltage range, Channel 1 outputs 1.009V, whereas at 0-VCC voltage range, Channel 1 outputs 1.926V.

}

void loop() {

}

RESULT

After downloading the program, the measured output voltage of channel 0 under the 0-2.5V state is 1.725V, and the output voltage of channel 1 is 1.009V. Under the 0-VCC state, the actual output voltage of channel 0 is 3.29V, and the output voltage of channel 1 is 1.926V.

More Documents

DFR1037 Documents:

DFR1037-Schematics.pdf

DFR1037_Dimensions.pdf

DFR1037_3D File.rar

DFR1037_2D_CAD File.rar

DFR1037_GP8501 Datasheet.pdf

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.