Zamówienie w dzień roboczy przed 14:00 = wysyłka tego samego dnia 30 dni na odstąpienie od umowy 1 rok gwarancji
← Wróć do przeglądu

Schemat podłączenia i przykład kodu

Tak podłączysz Dwukierunkowy konwerter poziomów logicznych I2C-UART 5V-3.3V, 2-kanałowy do Arduino UNO lub ESP32, z przykładowym szkicem, który możesz od razu wgrać.

4-kanałowy konwerter poziomów logicznych z urządzeniem 3.3V

Ten układ bezpiecznie łączy 5V Arduino Uno z szeregowym urządzeniem 3.3V za pomocą 4-kanałowego dwukierunkowego konwertera poziomów logicznych. Arduino wysyła i odbiera dane szeregowe przez software serial (pins 2 and 3), a konwerter poziomów tłumaczy sygnały między 5V (HV) i 3.3V (LV). Otwórz Serial Monitor z prędkością 115200 baud, aby monitorować komunikację.

Schemat podłączenia: Dwukierunkowy konwerter poziomów logicznych I2C-UART 5V-3.3V, 2-kanałowy na Arduino UNO
Schemat podłączenia · Kliknij, aby powiększyć
Tabela połączeń: Dwukierunkowy konwerter poziomów logicznych I2C-UART 5V-3.3V, 2-kanałowy na Arduino UNO
Tabela połączeń · Kliknij, aby powiększyć
4_Channel_Logic_Level_Shifter_with_3_3V_.ino · skompilowane i przetestowane
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : 4-Channel Logic Level Shifter with 3.3V Device
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : Logic Level Shifter 4-channel
 *  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.
 * ==================================================================
 */

#include <SoftwareSerial.h>

// Arduino Uno pins connected to the HV (5V) side of the level shifter
const int rxPin = 2; // HV2 (receives translated 5V from 3.3V device TX)
const int txPin = 3; // HV1 (transmits 5V to be translated to 3.3V device RX)

SoftwareSerial deviceSerial(rxPin, txPin);

void setup() {
  Serial.begin(115200);
  deviceSerial.begin(9600);

  Serial.println(F("Logic Level Shifter Demo Initialized."));
  Serial.println(F("Forwarding serial data between USB and 3.3V device..."));
}

void loop() {
  // Forward data from USB Serial to 3.3V device
  if (Serial.available()) {
    char c = Serial.read();
    deviceSerial.write(c);
  }

  // Forward data from 3.3V device to USB Serial
  if (deviceSerial.available()) {
    char c = deviceSerial.read();
    Serial.write(c);
  }
}

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

Test pętli zwrotnej 4-kanałowego konwertera poziomów logicznych

Ten projekt демонstruje dwukierunkową konwersję poziomów napięć za pomocą 4-kanałowego konwertera poziomów logicznych. ESP32 wysyła sygnał 3.3V na LV1, który jest podnoszony do 5V na HV1. Jumper łączy HV1 z HV2, obniżając sygnał 5V z powrotem do 3.3V na LV2, aby mógł zostać sprawdzony przez ESP32.

Schemat podłączenia: Dwukierunkowy konwerter poziomów logicznych I2C-UART 5V-3.3V, 2-kanałowy na ESP32 DevKit V1
Schemat podłączenia · Kliknij, aby powiększyć
Tabela połączeń: Dwukierunkowy konwerter poziomów logicznych I2C-UART 5V-3.3V, 2-kanałowy na ESP32 DevKit V1
Tabela połączeń · Kliknij, aby powiększyć
4_Channel_Logic_Level_Shifter_Loopback_T.ino · skompilowane i przetestowane
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : 4-Channel Logic Level Shifter Loopback Test
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : Logic Level Shifter 4-channel
 *  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.
 * ==================================================================
 */

// 4-Channel Logic Level Shifter Loopback Demo
// Sends 3.3V pulses on GPIO 18 (LV1), stepped up to 5V (HV1),
// looped to HV2 (5V), and stepped down to 3.3V on LV2 to read on GPIO 19.

const int TX_PIN = 18; // 3.3V Output to LV1
const int RX_PIN = 19; // 3.3V Input from LV2

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    delay(10);
  }

  pinMode(TX_PIN, OUTPUT);
  pinMode(RX_PIN, INPUT);

  Serial.println("=== Logic Level Shifter Loopback Test ===");
}

void loop() {
  // Test HIGH state
  digitalWrite(TX_PIN, HIGH);
  delay(10);
  int highRead = digitalRead(RX_PIN);

  // Test LOW state
  digitalWrite(TX_PIN, LOW);
  delay(10);
  int lowRead = digitalRead(RX_PIN);

  // Report status
  Serial.print("Sent HIGH -> Read: ");
  Serial.print(highRead == HIGH ? "HIGH [PASS]" : "LOW  [FAIL]");
  Serial.print(" | Sent LOW -> Read: ");
  Serial.println(lowRead == LOW ? "LOW  [PASS]" : "HIGH [FAIL]");

  delay(1000);
}

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

Ostatnio oglądane

Uchwyt na baterię 18650 z punktami lutowniczymi

Uchwyt na baterię 18650 z punktami lutowniczymi

€ 2,45
Velleman Zasilacz laboratoryjny, regulowany, 0-15 VDC/0-3 A. LABPS1503

Velleman Zasilacz laboratoryjny, regulowany, 0-15 VDC/0-3 A. LABPS1503

€ 89,00
Zobacz
Koło Mecanum / Koło omnidirectional - 60MM-K czarne, zestaw 4

Koło Mecanum / Koło omnidirectional - 60MM-K czarne, zestaw 4

€ 16,60
Zobacz
Koło Mecanum / Koło omnidirectional - 60MM-K żółte - zestaw 4

Koło Mecanum / Koło omnidirectional - 60MM-K żółte - zestaw 4

€ 16,60
Zobacz