Op werkdagen vóór 14:00 uur besteld = dezelfde dag verzonden en in 98% van de gevallen de volgende dag in huis. Gratis retourneren 30 dagen bedenktijd 1 jaar garantie
← Tillbaka till översikten

Kopplingsschema och kodexempel

Så här kopplar du PWM till spänningsomvandlarmodul 0-10V till en Arduino UNO eller ESP32, med ett exempel­sketch som du kan ladda upp direkt.

PWM to 0-10V Voltage Converter Demo

This project demonstrates how to generate an analog control voltage (0-10V) using an Arduino PWM output. The Arduino outputs a varying PWM signal on pin 9, which the module converts into a proportional DC voltage at the VOUT terminal. Open the Serial Monitor to observe the current PWM duty cycle as the output sweeps up and down.

Kopplingsschema: PWM till spänningsomvandlarmodul 0-10V på en Arduino UNO
Kopplingsschema · Klicka för att förstora
Kopplingstabell: PWM till spänningsomvandlarmodul 0-10V på en Arduino UNO
Kopplingstabell · Klicka för att förstora
PWM_to_0_10V_Voltage_Converter_Demo.ino · kompilerad och testad
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : PWM to 0-10V Voltage Converter Demo
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : PWM naar Voltage converter module 0-10V
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

// PWM to 0-10V Voltage Converter Demo

const int pwmPin = 9;

void setup() {
  pinMode(pwmPin, OUTPUT);
  Serial.begin(115200);
  Serial.println(F("PWM to Voltage Converter initialized."));
}

void loop() {
  // Ramp up output voltage (0% to 100% duty cycle)
  Serial.println(F("Ramping voltage up..."));
  for (int duty = 0; duty <= 255; duty += 5) {
    analogWrite(pwmPin, duty);
    Serial.print(F("Duty cycle: "));
    Serial.print((duty * 100) / 255);
    Serial.println(F("%"));
    delay(50);
  }
  
  delay(1000);

  // Ramp down output voltage (100% to 0% duty cycle)
  Serial.println(F("Ramping voltage down..."));
  for (int duty = 255; duty >= 0; duty -= 5) {
    analogWrite(pwmPin, duty);
    Serial.print(F("Duty cycle: "));
    Serial.print((duty * 100) / 255);
    Serial.println(F("%"));
    delay(50);
  }
  
  delay(1000);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

ESP32 PWM to 0-10V Voltage Converter Demo

This project demonstrates converting a digital PWM signal from the ESP32 into an analog 0-10V control voltage using the PWM-to-Voltage converter module. The module is powered by an external 12V DC supply and controlled via GPIO 18. The sketch sweeps the PWM duty cycle from 0% to 100%, generating an analog output ranging from 0V to 10V (ideal for PLCs, VFDs, or industrial dimmers).

Kopplingsschema: PWM till spänningsomvandlarmodul 0-10V på en ESP32 DevKit V1
Kopplingsschema · Klicka för att förstora
Kopplingstabell: PWM till spänningsomvandlarmodul 0-10V på en ESP32 DevKit V1
Kopplingstabell · Klicka för att förstora
ESP32_PWM_to_0_10V_Voltage_Converter_Dem.ino · kompilerad och testad
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : ESP32 PWM to 0-10V Voltage Converter Demo
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : PWM naar Voltage converter module 0-10V
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

// PWM to 0-10V Converter Module Demo with ESP32
// Connect GPIO 18 to PWM input and external 12V DC to module VIN

const int pwmPin = 18;

void setup() {
  Serial.begin(115200);
  pinMode(pwmPin, OUTPUT);
  Serial.println("ESP32 PWM to 0-10V Converter Demo Started");
}

void loop() {
  // Sweep output from 0V up to 10V in steps
  for (int duty = 0; duty <= 255; duty += 25) {
    analogWrite(pwmPin, duty);
    float expectedVoltage = (duty / 255.0) * 10.0;
    
    Serial.print("PWM Duty: ");
    Serial.print(duty);
    Serial.print("/255 | Approx Output: ");
    Serial.print(expectedVoltage, 1);
    Serial.println(" V");
    
    delay(1000);
  }
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Tidigare visade

Micro JST PH 4-stifts pigtail-kontaktsats hane hona

Micro JST PH 4-stifts pigtail-kontaktsats hane hona

€ 1,35
2x 18650 batterihållare med omkopplingsbar klämma

2x 18650 batterihållare med omkopplingsbar klämma

€ 0,65