Arduino UNO Q RS232

Use RS232 serial communication with the Arduino UNO Q and a TTL-to-RS232 module. The MCU communicates over SoftwareSerial, the module converts TTL signals to RS232 voltage levels for long-distance serial communication. With Bridge and Telegram, you can send and receive RS232 data remotely from Python or your phone.

In this tutorial, you will learn:

Arduino UNO Q RS232

Hardware Preparation

1×Arduino UNO Q
1×USB Cable for Arduino Uno Q
1×TTL to RS232 Module
1×Jumper Wires
1×Optionally, USB to RS232 Cable
1×Optionally, USB to RS232 Converter
1×Optionally, RS232 Gender Changer
1×Recommended: Screw Terminal Block Shield for Arduino Uno
1×Recommended: Sensors/Servo Expansion Shield for Arduino Uno
1×Recommended: Breadboard Shield for Arduino Uno
1×Recommended: Enclosure for Arduino Uno
1×Recommended: Prototyping Base Plate & Breadboard Kit for Arduino UNO

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of the TTL to RS232 Module

The Arduino UNO Q MCU communicates over UART using TTL logic levels (3.3V). TTL signals travel only short distances. To communicate over longer distances with RS232-compatible devices (PLCs, older computers, industrial equipment), you need to convert the TTL signal to RS232 voltage levels (typically ±12V). The TTL-to-RS232 module performs this conversion in both directions.

RS232 Module Pinout

Pinout

  • TTL interface (connects to Arduino UNO Q MCU):
    • VCC: Power input — connect to 3.3V
    • GND: Ground
    • RXD: Data input — connect to MCU TX pin (D6)
    • TXD: Data output — connect to MCU RX pin (D7)
  • RS232 interface: DB9 female D-Sub connector — connect to your RS232 device

Wiring Diagram

The wiring diagram between Arduino UNO Q TTL to RS232 Module

This image is created using Fritzing. Click to enlarge image

TTL-to-RS232 Module Pin Arduino UNO Q MCU Pin Note
VCC 3.3V
GND GND
RXD D6 (MCU TX)
TXD D7 (MCU RX)

Connect the DB9 connector to your RS232 device or RS232-to-USB cable.

How To Program For RS232

  • Include SoftwareSerial and create an RS232 serial object:
#include <SoftwareSerial.h> SoftwareSerial rs232(7, 6); // RX: D7, TX: D6
  • Read incoming RS232 data:
if (rs232.available()) { char data = rs232.read(); }
  • Send data over RS232:
rs232.print("Hello from Arduino UNO Q"); rs232.println("With newline");

Arduino UNO Q Code

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-rs232 */ // COPYRIGHT newbiely.com // AUTHOR: newbiely // This code is made available for public use without restriction. // For complete instructions, tutorials, and further information, visit: // https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-rs232 #include <SoftwareSerial.h> SoftwareSerial rs232(7, 6); // RX: D7, TX: D6 void setup() { Monitor.begin(9600); // USB serial for debug output rs232.begin(9600); // RS232 module serial delay(100); } void loop() { // Forward data from RS232 to Monitor if (rs232.available()) { char data = rs232.read(); Monitor.print(data); rs232.print(data); // echo back to sender } // Forward data from Monitor to RS232 if (Monitor.available()) { char data = Monitor.read(); rs232.print(data); } }

Detailed Instructions

First time with Arduino UNO Q? Follow the Getting Started with Arduino UNO Q tutorial before proceeding.

  • Connect: Wire the TTL-to-RS232 module to the Arduino UNO Q MCU as shown in the wiring diagram.
  • Open Arduino App Lab: Launch Arduino App Lab and wait until it detects your Arduino UNO Q.
  • Create a new App: Click the Create New App button.
Create New App in Arduino App Lab on Arduino UNO Q
  • Give the App a name, for example: RS232
  • Click Create to confirm.
Arduino App Lab App folders and files on Arduino UNO Q
  • Paste the sketch: Copy the MCU code above and paste it into sketch/sketch.ino.
  • Upload: Click the Run button in Arduino App Lab.
Click Run button in Arduino App Lab on Arduino UNO Q

Testing

To test RS232 communication:

  • Connect the DB9 port of the module to your PC using an RS232-to-USB cable:
Arduino UNO Q RS232 to PC communication
  • Open a Serial Terminal (such as Tera Term or PuTTY) on your PC.
  • Set the baud rate to 9600, select the correct COM port.
  • Type any text and send it. The Arduino UNO Q will echo it back — you should see the echoed data in the terminal.

Bridge: Linux + MCU

This section shows how to send and receive RS232 data from the Linux side (Python) via Bridge:

  • The TTL-to-RS232 module is connected to the MCU via SoftwareSerial — the MCU handles all serial I/O
  • The MPU cannot use SoftwareSerial directly — it calls Bridge functions to send/receive RS232 data
  • The MPU has Wi-Fi — running full Debian Linux, it can relay RS232 data to Telegram or web services
  • Arduino_RouterBridge enables RPC communication between the two processors
  • ⚠️ /dev/ttyHS1 (Linux) and Serial1 (MCU) are RESERVED by the router — never open them in user code

MCU Code (Bridge)

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-rs232 */ // COPYRIGHT newbiely.com // AUTHOR: newbiely // This code is made available for public use without restriction. // For complete instructions, tutorials, and further information, visit: // https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-rs232 #include "Arduino_RouterBridge.h" #include <SoftwareSerial.h> SoftwareSerial rs232(7, 6); // RX: D7, TX: D6 String received_data = ""; String send_rs232(String arg) { rs232.println(arg); Monitor.print("Sent via RS232: "); Monitor.println(arg); return "ok:sent"; } String get_received(String arg) { String result = received_data; received_data = ""; return result; } void setup() { Bridge.begin(); Monitor.begin(); rs232.begin(9600); delay(100); Bridge.provide_safe("send_rs232", send_rs232); Bridge.provide("get_received", get_received); Monitor.println("Arduino UNO Q RS232 Bridge ready"); } void loop() { // Accumulate incoming RS232 data between Bridge calls while (rs232.available()) { char c = rs232.read(); received_data += c; } }

Python Code (Bridge)

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-rs232 */ # COPYRIGHT newbiely.com # AUTHOR: newbiely # This code is made available for public use without restriction. # For complete instructions, tutorials, and further information, visit: # https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-rs232 from arduino.app_utils import * import time def loop(): print("Sending message via RS232...") result = Bridge.call("send_rs232", "Hello from Arduino UNO Q!") print(f"Result: {result}") time.sleep(1) data = Bridge.call("get_received") if data: print(f"Received via RS232: {data}") else: print("No data received") time.sleep(2) App.run(user_loop=loop)

Detailed Instructions

  • Connect: Wire the TTL-to-RS232 module to the Arduino UNO Q as shown above.
  • Open Arduino App Lab and create a new App named RS232Bridge.
  • Paste the MCU sketch into sketch/sketch.ino.
  • Paste the Python code into the Python file.
  • Install the library: Click the Add sketch library button (the open book icon with a + sign) in the left sidebar.
Add sketch library in Arduino App Lab on Arduino UNO Q
  • Search for Arduino_RouterBridge created by Arduino and click the Install button.
My Apps / DIYables Apps
Run
Bricks
No bricks added...
Sketch Libraries
No sketch libra...
Files
python
sketch
.gitignore
README.md
app.yaml
sketch.ino
Add sketch library
Arduino_RouterBridge Arduino

This library provides a simple RPC bridge for Arduino UNO Q boards, allowing communication between the board and other devices using MsgPack serialization.

0.4.1
Install
More Info
  • Upload: Click the Run button. Python will send a message via RS232 and read back any echoed data.
Click Run button in Arduino App Lab on Arduino UNO Q

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
Message (Enter to send a message to "Newbiely" on usb(2820070321))
New Line
9600 baud
[2026-04-29 09:00:01] Arduino UNO Q RS232 Bridge ready [2026-04-29 09:00:06] Sent via RS232: Hello from Arduino UNO Q!
DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-04-29 09:00:06] Sending message via RS232... [2026-04-29 09:00:06] Result: ok:sent [2026-04-29 09:00:07] Received via RS232: Hello from Arduino UNO Q!

Telegram

Send and receive RS232 data through Telegram — forward messages from industrial devices to your phone or send commands from Telegram to an RS232 device.

MCU sketch: Keep the same MCU sketch from the previous Bridge section.

Python Code (Telegram)

/* * This Arduino UNO Q code was developed by newbiely.com * * This Arduino UNO Q code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-rs232 */ # COPYRIGHT newbiely.com # AUTHOR: newbiely # This code is made available for public use without restriction. # For complete instructions, tutorials, and further information, visit: # https://newbiely.com/tutorials/arduino-uno-q/arduino-uno-q-rs232 from arduino.app_utils import * import requests import time TELEGRAM_BOT_TOKEN = "YOUR_TELEGRAM_BOT_TOKEN" CHAT_ID = "YOUR_CHAT_ID" last_update_id = 0 def get_updates(): global last_update_id url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/getUpdates" params = {"offset": last_update_id + 1, "timeout": 5} try: response = requests.get(url, params=params, timeout=10) data = response.json() if data["ok"]: return data["result"] except Exception as e: print(f"Error getting updates: {e}") return [] def send_message(chat_id, text): url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage" payload = {"chat_id": chat_id, "text": text} try: requests.post(url, data=payload, timeout=10) except Exception as e: print(f"Error sending message: {e}") def loop(): updates = get_updates() for update in updates: last_update_id = update["update_id"] if "message" not in update: continue message = update["message"] chat_id = message["chat"]["id"] text = message.get("text", "").strip() print(f"Received: {text}") if text == "/start": send_message(chat_id, "Arduino UNO Q RS232 Bot\n" "/send <message> - Send a message via RS232\n" "/read - Read data received from RS232") elif text.startswith("/send"): parts = text.split(" ", 1) if len(parts) < 2: send_message(chat_id, "Usage: /send <message>") else: result = Bridge.call("send_rs232", parts[1]) send_message(chat_id, f"Sent via RS232: {parts[1]}") elif text == "/read": data = Bridge.call("get_received") if data: send_message(chat_id, f"Received via RS232:\n{data}") else: send_message(chat_id, "No data received yet.") else: send_message(chat_id, "Unknown command. Send /start for help.") time.sleep(0.3) App.run(user_loop=loop)

Detailed Instructions

  • Replace YOUR_TELEGRAM_BOT_TOKEN with your actual bot token from BotFather.
  • Replace YOUR_CHAT_ID with your Telegram chat ID.
  • Paste the Python code into your App's Python file (keep the same MCU sketch).
  • Click the Run button — send /send Hello in Telegram to transmit data over RS232.

App Lab Console Output

DIYables_Apps
Stop
sketch.ino
1#include "Arduino_RouterBridge.h"
Serial Monitor
Python
[2026-04-29 09:10:05] Received: /send Hello RS232 device! [2026-04-29 09:10:09] Received: /read
Telegram
Telegram 12:45
Welcome to Telegram!
ArduinoBot 10:19
Chatting with Arduino...
telegram-botfather
BotFather Yesterday
Your bot has been created.

ArduinoBot

bot
Today
/send Hello RS232 device!
10:15 AM ✓✓
Sent via RS232: Hello RS232 device!
10:16 AM
/read
10:17 AM ✓✓
Received via RS232: Hello RS232 device!
10:18 AM

OpenClaw

...OPENCLAW

OpenClaw support for Arduino UNO Q RS232 is coming soon.

...OPENCLAW

Project Ideas

You can build many useful projects with RS232 communication and Arduino UNO Q:

  • Industrial PLC Gateway: Connect the Arduino UNO Q to a PLC or industrial controller via RS232; Python forwards received status messages to Telegram so you can monitor factory equipment from your phone
  • Barcode Scanner Integration: Connect an RS232 barcode scanner to the TTL-to-RS232 module; when a barcode is scanned, the MCU reads the data via SoftwareSerial and Python sends it to Telegram for logging
  • Legacy Serial Printer Control: Send print commands from Telegram through Bridge to the MCU, which forwards them over RS232 to a legacy serial printer or display terminal — bridging modern wireless control with older serial hardware
  • GPS with RS232 Output: Connect an RS232-output GPS receiver to the module; the MCU reads NMEA sentences, Python parses the data, and Telegram sends location updates on demand
  • Remote Serial Diagnostics: Forward RS232 debug output from an embedded device to Telegram via Bridge — useful for monitoring remote devices without needing physical access to a serial terminal

Challenge Yourself

Ready to go further with RS232 on Arduino UNO Q? Try these challenges:

  • Easy: Modify the MCU sketch to accumulate received bytes until a newline character is detected, then expose the complete line as a single string via get_received — preventing partial reads when data arrives in chunks.
  • Medium: Build a bidirectional relay: Python reads temperature from a sensor Bridge function and formats a status string, sends it via send_rs232 every 30 seconds, and simultaneously reads any RS232 responses with get_received — forwarding them as Telegram notifications.
  • Advanced: Implement a message queue: Python maintains a list of outgoing RS232 messages, sends them one per second via send_rs232, and collects all responses with get_received; after each batch, it sends a Telegram summary showing how many messages were sent and what responses were received.

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!