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 Spänning till PWM-omvandlarmodul 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 circuit generates a varying PWM signal on pin 9, which the converter module transforms into a proportional DC analog output voltage (0-10V). Open the Serial Monitor to observe the current PWM duty cycle as it ramps smoothly up and down. Measure the VOUT terminal with a multimeter to verify the changing analog voltage.

Kopplingsschema: Spänning till PWM-omvandlarmodul 0-10V på en Arduino UNO
Kopplingsschema · Klicka för att förstora
Kopplingstabell: Spänning till PWM-omvandlarmodul 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 Module Demo
// Sweeps PWM duty cycle on pin 9 from 0% to 100% and back

const int pwmPin = 9;

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

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

  delay(500);

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

  delay(500);
}

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

ESP32 0-10V PWM Voltage Converter Demo

This project demonstrates generating a 0-10V analog control voltage using an ESP32 and a PWM-to-voltage converter module. The ESP32 sends a 0-100% PWM signal from GPIO 4 to the module, which converts it into a proportional 0-10V DC output suitable for PLCs, VFDs, and dimmers. An external 12V power supply powers the converter module.

Kopplingsschema: Spänning till PWM-omvandlarmodul 0-10V på en ESP32 DevKit V1
Kopplingsschema · Klicka för att förstora
Kopplingstabell: Spänning till PWM-omvandlarmodul 0-10V på en ESP32 DevKit V1
Kopplingstabell · Klicka för att förstora
ESP32_0_10V_PWM_Voltage_Converter_Demo.ino · kompilerad och testad
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : ESP32 0-10V PWM 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 Voltage Converter Demo
 * Board: ESP32 DevKit V1
 * 
 * Ramps output voltage from 0V to 10V and back down.
 */

const int PWM_PIN = 4; // GPIO 4 connected to PWM input

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

void loop() {
  // Ramp up from 0V to 10V
  for (int duty = 0; duty <= 255; duty += 5) {
    analogWrite(PWM_PIN, duty);
    float expectedVoltage = (duty / 255.0) * 10.0;
    
    Serial.print("Duty: ");
    Serial.print(duty);
    Serial.print("/255 | Output Voltage: ~");
    Serial.print(expectedVoltage, 2);
    Serial.println(" V");
    
    delay(50);
  }
  
  delay(500);

  // Ramp down from 10V to 0V
  for (int duty = 255; duty >= 0; duty -= 5) {
    analogWrite(PWM_PIN, duty);
    float expectedVoltage = (duty / 255.0) * 10.0;
    
    Serial.print("Duty: ");
    Serial.print(duty);
    Serial.print("/255 | Output Voltage: ~");
    Serial.print(expectedVoltage, 2);
    Serial.println(" V");
    
    delay(50);
  }
  
  delay(500);
}

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

Tidigare visade

Strömförsörjning 5V 3A adapter 5.5mm x 2.5mm jack

Strömförsörjning 5V 3A adapter 5.5mm x 2.5mm jack

€ 6,99
3296W 500K (W504) Trimpot Trimmer Potentiometer

3296W 500K (W504) Trimpot Trimmer Potentiometer

€ 0,65
Lös fjärrkontroll med 2 knappar 433Mhz

Lös fjärrkontroll med 2 knappar 433Mhz

€ 4,00
Arduino Uno R4 WiFi Kompatibel

Arduino Uno R4 WiFi Kompatibel

€ 26,80