Поръчано в работни дни преди 14:00 ч. = изпратено същия ден и в 98% от случаите пристига на следващия ден. Безплатно връщане 30 дни за размисъл 1 година гаранция

Схема на свързване и примерен код

Ето как да свържеш MAX3232 RS232 към TTL серийна модула към Arduino UNO или ESP32, с примерен sketch, който можеш да качиш веднага.

Серийна връзка MAX3232 от RS232 към TTL

Този проект създава прозрачен сериен мост между Arduino USB Serial Monitor и RS232 устройство чрез модула MAX3232. SoftwareSerial управлява комуникацията на пиновете D2 и D3 при 9600 baud, като оставя хардуерния Serial свободен за монитора на компютъра. Всеки символ, въведен в Serial Monitor, се предава по RS232, а всички входящи RS232 байтове се отпечатват в монитора.

Схема на свързване: MAX3232 RS232 към TTL серийна модула на Arduino UNO
Схема на свързване · Кликни, за да увеличиш
Таблица на свързване: MAX3232 RS232 към TTL серийна модула на Arduino UNO
Таблица на свързване · Кликни, за да увеличиш
MAX3232_RS232_to_TTL_Serial_Bridge.ino · компилирано и тествано
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : MAX3232 RS232 to TTL Serial Bridge
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : MAX3232 RS232 to TTL Serial Converter Module
 *  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>

const uint8_t RX_PIN = 2; // Connect to MAX3232 TXD
const uint8_t TX_PIN = 3; // Connect to MAX3232 RXD

SoftwareSerial rs232Serial(RX_PIN, TX_PIN);

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

  Serial.println(F("--- MAX3232 RS232 Bridge Ready ---"));
  Serial.println(F("Type in the Serial Monitor (115200 baud) to send over RS232 (9600 baud)."));
  Serial.println(F("Any response from the RS232 device will appear here."));
}

void loop() {
  // Forward characters from the USB Serial Monitor to the RS232 module
  while (Serial.available() > 0) {
    char c = Serial.read();
    rs232Serial.write(c);
  }

  // Forward characters from the RS232 module to the USB Serial Monitor
  while (rs232Serial.available() > 0) {
    char c = rs232Serial.read();
    Serial.write(c);
  }
}

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

RS232 комуникация с MAX3232 и ESP32

Този проект свързва ESP32 с модул MAX3232, за да позволи RS232 серийна комуникация. ESP32 използва Hardware Serial2 за изпращане и приемане на RS232 сигнали при 3.3V логически нива. За да проверите работата в рамките на няколко минути, свържете пинове 2 и 3 (RX и TX) на DB9 конектора на модула за loopback тест, който връща изходящите съобщения обратно към Serial Monitor.

Схема на свързване: MAX3232 RS232 към TTL серийна модула на ESP32 DevKit V1
Схема на свързване · Кликни, за да увеличиш
Таблица на свързване: MAX3232 RS232 към TTL серийна модула на ESP32 DevKit V1
Таблица на свързване · Кликни, за да увеличиш
RS232_Communication_with_MAX3232_and_ESP.ino · компилирано и тествано
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : RS232 Communication with MAX3232 and ESP32
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : MAX3232 RS232 to TTL Serial Converter Module
 *  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.
 * ==================================================================
 */

// MAX3232 RS232 Demo for ESP32 DEVKIT V1
// Uses Hardware Serial2: GPIO 16 (RX2) and GPIO 17 (TX2)

const int RX_PIN = 16;
const int TX_PIN = 17;

unsigned long lastSendTime = 0;
const unsigned long sendInterval = 2000; // Send a test string every 2 seconds
int messageCounter = 0;

void setup() {
  // USB Serial Monitor
  Serial.begin(115200);
  while (!Serial && millis() < 2000);

  // RS232 Port on Serial2 (9600 baud, 8N1)
  Serial2.begin(9600, SERIAL_8N1, RX_PIN, TX_PIN);

  Serial.println("--- MAX3232 RS232 Bridge Initialized ---");
  Serial.println("Tip: Short DB9 pins 2 & 3 for an automatic loopback test.");
}

void loop() {
  // Periodically send a message out via RS232
  if (millis() - lastSendTime >= sendInterval) {
    lastSendTime = millis();
    messageCounter++;

    String msg = "RS232 Test Message #" + String(messageCounter);
    Serial2.println(msg);
    Serial.print("[RS232 TX] ");
    Serial.println(msg);
  }

  // Print any incoming data from the RS232 interface
  if (Serial2.available()) {
    Serial.print("[RS232 RX] ");
    while (Serial2.available()) {
      char inChar = (char)Serial2.read();
      Serial.print(inChar);
    }
  }

  // Forward any user input from Serial Monitor to RS232
  if (Serial.available()) {
    char outChar = (char)Serial.read();
    Serial2.write(outChar);
  }
}

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

MAX3232 RS232 към TTL серийна модула

MAX3232 RS232 към TTL сериен порт конверторен модул DB9 конектор

Основните параметри:

Контролен чип: MAX3232
Работно напрежение: 3.3V-5V DC
Работен ток: 6mA
Захранване: външно
Интерфейс: TXD, RXD, GND, VCC
Общи размери: 33 mm x 32 mm x 16 mm

  • MAX3232 чип
  • 3,3-5V DC
  • Външно захранване
  • 33 x 32 x 16 mm

Защо да изберете този продукт?

  • DB9 конектор – За RS232 връзка с DB9.
  • Захранване 3,3-5V – Работи с 3.3V-5V DC.
  • Външно захранване – Свързване към външно захранване.
  • Четири интерфейсни пина – TXD, RXD, GND и VCC.
Спецификации
Размери33 mm x 32 mm x 16 mm
СвързванеDB9 конектор
МоделMAX3232
Захранване6mA

Често купувани заедно

Общо: € 10,55

Отзиви

★★★★★ 5,0/5 5 отзива
  • ★★★★★Jan Siebesma

    Напълно отговаря на очакванията.

  • ★★★★★Gerrit NijhofПотвърдена покупка

    Работи добре, свързан към Esp32 за връзка с хибриден инвертор

  • ★★★★★Michael BeelmanПотвърдена покупка

    Още не е тествано.

Напиши отзив
Твоята оценка

Доставка & връщане

Доставка

  • Пратка с track & trace€ 7,70В рамките на 24 часа
  • Вземане от локация на PostNL€ 7,40В рамките на 24 часа
  • Пратка за пощенската кутия€ 3,70В рамките на 2 работни дни
  • Пратка за пощенска кутия 24 часа€ 4,55В рамките на 24 часа
  • Вземане от магазинаБезплатно
Всичко за доставката

Връщане

Не си доволен? Имаш 30 дни след получаването, за да върнеш продукта.

Всичко за връщането

Наскоро разгледани

HC-05 6pin Bluetooth модул CSR BC417

HC-05 6pin Bluetooth модул CSR BC417

€ 12,95
Тример потенциометър 502 5K

Тример потенциометър 502 5K

€ 0,50
Държач за 4x AA батерии (6V)

Държач за 4x AA батерии (6V)

€ 0,95
Съединител за колело 30 mm / 5 mm

Съединител за колело 30 mm / 5 mm

€ 2,00
Nano V3 Arduino Compatible CH340

Nano V3 Arduino Compatible CH340

€ 6,60