Labs / Electronic modules

GraftSense - CH340K-based USB to TTL Module (Open Version)

Author: Li Zisheng · Source: FreakStudio open documentation, v1.3 · License: CC BY 4.0 · Driver code (communication/usb_ttl_code): MIT License

Contents
CH340K
CH340K U1 V1.0.0

I. Module Introduction

CH340K-based USB-to-TTL Module Designed based on the CH340K chip, this module integrates the USB-to-TTL level serial port function, is equipped with a sensor interface, indicator lights and filter circuit, supports external USB power supply, and can realize serial communication between USB and devices such as MCUs. It also reduces interference through designs such as decoupling capacitors, making it suitable for serial communication scenarios such as embedded development.

II. Introduction to Major Chips

Adopts CH340K USB-to-TTL chip.

2.1 Chip Overview

CH340 UART/RS232/RS485 2.1

2.2 Pin Definition

CH340K 2.2 SSOP20 ESSOP10 SOP8 CH340R
CH340K 15 16 2 CH340 CH340T CH340G

2.3 Functional Block Diagram

This chip does not have a functional block diagram, but its internal structure can be divided into the following parts:

2.4 Performance Parameters

CH340K 6.1 6.2 5V 25
CH340K 3.3V 25 V3 2.9V 3.6V
CH340K 25 5V 3.3V CH340C/N/K/E/X/B 11.98 12.02 20 50

2.5 Reference Circuit

CH340K RS232 P2 MAX232 C46 C49 9
CH340K CH340B U2 MAX213 U8 C10 C9 C8 2.5
RS232 U4 CH340G U5 MAX232 P5 P6 DB9 CH340C/N/K/E/X/B X4
CH340K RS232 3 CH340 R232 P3 U3 X3 T1 D1
CH340K RS485
CH340R U14 ZHX1810/HSDL3800 R13 R14 C55 C53 C54 C51 C52
CH340K CH340 2.5 U7 P9 U16 X6 C17 C18 C41
CH340K 2.5 P12 U9 Q5 U17
CH340 2K 22K D6 D7 Q5
CH340K 2.5 C38 C39 0.1 C58 P13 5V 3.3V
CH340X BOOT0 0.1uF 4X7 47K
CH340K CH340X 4.7K 3 5.6K BOOT0 4 B40 CH340C

2.6 Chip Configuration

None.

None.

2.8 PCB Routing Precautions

None.

III. Circuit Engineering

3.1 Circuit Source Engineering

To obtain the source project of the circuit, please follow the official account [Freak Embedded]

3.2 Module Usage Instructions

The schematic diagram of this module is shown below:

SCH_USB to TTL Module Based on CH340K_v1.0_2025-09-25.pdf 2.4 MB

CH340K U1 C1 C2 C3 C4 R1 R2 R3 V1.0.0

The MRX (corresponding to the UART RXD pin of the MCU) of this module is actually connected to the CH340K 's TXD pin, and the MTX (corresponding to the UART TX pin of the MCU) is actually connected to the CH340K ' s RXD pin; this is because UART serial communication follows the "cross-transmit-receive" rule — the transmit terminal (TX) of both communication parties needs to be connected to the receive terminal (RX) of the other party, and this design ensures correct bidirectional transmission of UART serial data between the MCU and the CH340K.

Of particular note is that when using this module, MRX is directly connected to the RXD pin of the MCU's serial port, and MTX is directly connected to the TXD pin of the MCU's serial port; be sure not to cross-connect them.

3.3 Application Experiment

Here, we use the GraftPort-RP2040 development board for testing, and the USB-to-TTL module based on CH340K uses the UART interface on it to communicate with the main controller.

Here, we first use the HY2.0-4P cable to connect the module to the GraftPort-RP2040 development board's UART1 interface:

CH340K GraftPort-RP2040 UART1

Meanwhile, use the Mini-USB cable to connect the computer to the USB-to-TTL module based on CH340K via the USB port:

The module connections are shown in the following table:

Development Board Pins

Module Pins

Description

Pin 8

MTX

UART data transmission line, corresponding to the transmit pin of the development board

Pin 9

MRX

UART data transmission line, corresponding to the receiving pin of the development board

Import Serial Port Loopback Test Code - MicroPython Driver Code

Then copy the following test main.py code into our project:

# Python env   : MicroPython v1.23.0
# -*- coding: utf-8 -*-
# @Time    : 2025/09/04 10:00
# @Author  : 侯钧瀚
# @File    : main.py
# @Description : Serial loopback test code

# ======================================== Import Modules =========================================

from machine import UART, Pin
import time

# ======================================== Global Variables ============================================

# Test message counter
count = 1

# ======================================== Functions ============================================

# ======================================== Custom Classes ============================================

# ======================================== Initialization ==========================================

# Power-on delay of 3 s
time.sleep(3)
print("FreakStudio: UART loopback test started. Sending data every 2 seconds...")

# Initialize UART1: TX=Pin8, RX=Pin9, baud rate 9600
uart = UART(0, baudrate=9600, tx=Pin(8), rx=Pin(9))

# ========================================  Main Program  ===========================================

try:
    while True:
        # Build test message with counter
        test_msg = f"Test message {count}: Hello, UART loopback!"
        print(f"\nSent: {test_msg}")

        # Send message
        uart.write(test_msg.encode('utf-8'))

        # Wait a short time to receive data
        time.sleep(0.1)

        # Read and print received data
        if uart.any():
            received = uart.read(uart.any()).decode('utf-8')
            print(f"Received: {received}")
        else:
            print("Received: No data (check connections)")

        # Increment counter and wait 2 seconds before the next send
        count += 1
        time.sleep(2)

except KeyboardInterrupt:
    # Catch keyboard interrupt to end the test
    print("\nTest stopped by user")

Burn the code and open the terminal

After the code runs, it will send serial data through the module, and the content sent from the computer side will be printed to the terminal:

The code for the serial port loopback function has been successfully implemented, and the function verification is normal.

IV. Drivers

usb_ttl_code.zip 1 KB

This module requires the installation of the CH340 driver on the computer. After the driver is installed, the USB-to-TTL module will appear in the operating system as a virtual serial port device. The CH340 driver can be downloaded below:

CH341SER.EXE 643 KB

None.

VI. Revision History

Document Version

Date of Revision

Modifier

Modified Content

v1.0

2025-08-31

Ling Gaoxing

Initialize the document

v1.1

2025-09-25

Li Zisheng

Added 2.8 PCB routing precautions

Revised Section 3, Instructions for Circuit Source Project and Module Usage, and added a secondary heading:

3.1 Circuit Source Engineering, 3.2 Module Usage Instructions, 3.3 Application Experiments

The driver has not been rechecked yet, 3.3 Application Experiment

Not yet specified.

v1.2

2025-12-29

Li Zisheng

Added application experiments and production files

v1.3

2025-12-31

Xin Ruili

Create an open version of the document based on the internal document version v1.2.

VII. Relevant Materials

7.1 Chip Datasheet

USB to TTL Module.pdf 228 KB

7.2 Unique Icons for PCB Silkscreen

7.2