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 LM2596S Justerbar Step-Down 4-40V -> 1.25-37V med inbyggd voltmeterdisplay till en Arduino UNO eller ESP32, med ett exempel­sketch som du kan ladda upp direkt.

LM2596 Step-Down Voltage Monitor

This project measures the output voltage of an LM2596 buck converter module using the Arduino's analog input pin A0. Power the module's input from the Arduino 5V rail (or external power up to 40V) and turn the onboard potentiometer to watch the measured output voltage change in the Serial Monitor.

Kopplingsschema: LM2596S Justerbar Step-Down 4-40V -> 1.25-37V med inbyggd voltmeterdisplay på en Arduino UNO
Kopplingsschema · Klicka för att förstora
Kopplingstabell: LM2596S Justerbar Step-Down 4-40V -> 1.25-37V med inbyggd voltmeterdisplay på en Arduino UNO
Kopplingstabell · Klicka för att förstora
LM2596_Step_Down_Voltage_Monitor.ino · kompilerad och testad
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : LM2596 Step-Down Voltage Monitor
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : Adjustable Step-down Module 3-40VDC 1.5-35VDC LM2596
 *  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.
 * ==================================================================
 */

const int voltagePin = A0;

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ; // Wait for serial port to connect
  }
  Serial.println(F("LM2596 Step-Down Module Monitor"));
  Serial.println(F("Turn the onboard brass potentiometer to adjust output voltage."));
  Serial.println(F("-----------------------------------------------------------"));
}

void loop() {
  // Read the analog voltage (0 to 1023 corresponds to 0V to 5V)
  int rawValue = analogRead(voltagePin);
  float voltage = (rawValue * 5.0) / 1023.0;

  Serial.print(F("Raw ADC: "));
  Serial.print(rawValue);
  Serial.print(F(" | Output Voltage: "));
  Serial.print(voltage, 2);
  Serial.println(F(" V"));

  delay(500);
}

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

Powering ESP32 with LM2596 Buck Converter

This circuit uses an LM2596 step-down module to regulate a 12V DC input down to a steady 5V for the ESP32's VIN pin. Before connecting the ESP32, adjust the onboard trimmer until the output voltage measures exactly 5.0V with a multimeter. Once connected, the ESP32 blinks its onboard LED and outputs a heartbeat message to the Serial Monitor.

Kopplingsschema: LM2596S Justerbar Step-Down 4-40V -> 1.25-37V med inbyggd voltmeterdisplay på en ESP32 DevKit V1
Kopplingsschema · Klicka för att förstora
Kopplingstabell: LM2596S Justerbar Step-Down 4-40V -> 1.25-37V med inbyggd voltmeterdisplay på en ESP32 DevKit V1
Kopplingstabell · Klicka för att förstora
Powering_ESP32_with_LM2596_Buck_Converte.ino · kompilerad och testad
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : Powering ESP32 with LM2596 Buck Converter
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : Adjustable Step-down Module 3-40VDC 1.5-35VDC LM2596
 *  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.
 * ==================================================================
 */

const int LED_PIN = 2;
unsigned long counter = 0;

void setup() {
  Serial.begin(115200);
  pinMode(LED_PIN, OUTPUT);
  
  Serial.println("LM2596 Step-Down Powered ESP32 Started!");
  Serial.println("Ensure LM2596 output was calibrated to 5.0V before connecting to VIN.");
}

void loop() {
  digitalWrite(LED_PIN, HIGH);
  delay(500);
  digitalWrite(LED_PIN, LOW);
  delay(500);

  counter++;
  Serial.print("ESP32 running stably on buck regulator. Heartbeat count: ");
  Serial.println(counter);
}

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

Tidigare visade

5mm Super Flux Piranha 4pin LED - Gul

5mm Super Flux Piranha 4pin LED - Gul

€ 0,60
AC C13-strömuttag med säkringshållare och strömbrytare

AC C13-strömuttag med säkringshållare och strömbrytare

€ 1,95
5mm Super Flux Piranha 4pin LED - Röd

5mm Super Flux Piranha 4pin LED - Röd

€ 0,60
2.8inch TFT-pekskärm 320x240 ILI9341 SPI

2.8inch TFT-pekskärm 320x240 ILI9341 SPI

€ 15,05
DB9 hona D-SUB-adapter RS232 seriell till skruvterminal

DB9 hona D-SUB-adapter RS232 seriell till skruvterminal

€ 2,60
Kylfläns/ kylblock för 1W och 3W högpresterande LED

Kylfläns/ kylblock för 1W och 3W högpresterande LED

€ 0,50
1-kanals relämodul, trigger-tidsfördröjning, justerbar 6–30V

1-kanals relämodul, trigger-tidsfördröjning, justerbar 6–30V

€ 7,95
PWM till spänningsomvandlarmodul 0-10V

PWM till spänningsomvandlarmodul 0-10V

€ 2,60
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