Σειριακή μονάδα μετατροπής για σύνδεση RS232 με σήματα TTL.
SKU: OT3678 Αριθμός είδους: NA652 EAN: 8720618690371 Θέση: G09.01
Εναλλακτικό
MAX485 TTL σε RS485 Μονάδα Μετατροπέα
€ 1,15
Δες αυτή την εναλλακτική
Έτσι συνδέεις το MAX3232 RS232 προς TTL σειριακή μονάδα σε ένα Arduino UNO ή ESP32, με ένα παράδειγμα sketch που μπορείς να ανεβάσεις αμέσως.
Αυτό το project στήνει μια διαφανή σειριακή γέφυρα ανάμεσα στο Arduino USB Serial Monitor και σε μια συσκευή RS232 μέσω του module MAX3232. Το SoftwareSerial χειρίζεται την επικοινωνία στα pins D2 και D3 με 9600 baud, αφήνοντας το hardware Serial ελεύθερο για την οθόνη του υπολογιστή. Κάθε χαρακτήρας που πληκτρολογείται στο Serial Monitor μεταδίδεται μέσω RS232, και κάθε εισερχόμενο RS232 byte εμφανίζεται στην οθόνη.
/*
* ==================================================================
* 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
Αυτό το έργο συνδέει ένα ESP32 με ένα module MAX3232 για να επιτρέψει τη σειριακή επικοινωνία RS232. Το ESP32 χρησιμοποιεί το Hardware Serial2 για να στέλνει και να λαμβάνει σήματα RS232 σε λογικά επίπεδα 3.3V. Για να επαληθεύσετε τη λειτουργία μέσα σε λίγα λεπτά, γεφυρώστε τις ακίδες 2 και 3 (RX και TX) στον σύνδεσμο DB9 του module για ένα loopback test που επιστρέφει τα εξερχόμενα μηνύματα στο Serial Monitor.
/*
* ==================================================================
* 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 σειριακή μονάδα μετατροπέα θύρας DB9-connector
Οι βασικές παράμετροι:
Chip ελέγχου: MAX3232
Τάση λειτουργίας: 3.3V-5V DC
Ρεύμα λειτουργίας: 6mA
Τροφοδοσία: εξωτερική
Διεπαφή: TXD, RXD, GND, VCC
Συνολικές διαστάσεις: 33 mm x 32 mm x 16 mm

| Διαστάσεις | 33 mm x 32 mm x 16 mm |
|---|---|
| Σύνδεση | Σύνδεσμος DB9 |
| Μοντέλο | MAX3232 |
| Ρεύμα | 6mA |
Ανταποκρίνεται πλήρως στις προσδοκίες.
Λειτουργεί καλά συνδεδεμένο στο Esp32 για σύνδεση με έναν hybrid inverter
Δεν το έχω δοκιμάσει ακόμα.
Έχω συνδέσει το Rs232 module με ένα Arduino Uno, για μια σύνδεση δεδομένων Rs232 με έναν Anenji Hybrid inverter ώστε να διαβάζω τα τρέχοντα δεδομένα του. Λειτουργεί εξαιρετικά και είμαι πολύ ευχαριστημένος.
πολύ καλά προϊόντα !
Δεν έμεινες ικανοποιημένος; Έχεις 30 ημέρες μετά την παράδοση για να επιστρέψεις το προϊόν.
Όλα για τις επιστροφές
MAX3232 RS232 προς TTL σειριακή μονάδα