MechatronicsforU.com

Lets make machines

Complete Overview: HC-12 Wireless Module and GUI Visualization

✨ Overview of HC-12

The HC-12 is a wireless serial communication module based on the Si4463 RF transceiver IC. It allows wireless communication at distances up to 1 km (line of sight) and is commonly used in embedded systems, IoT, and wireless sensor networks.

πŸ”Œ Key Features:

  • Frequency: 433 MHz
  • Range: Up to 1000 m (line of sight)
  • Modulation: FSK
  • Interface: UART (TTL Level)
  • Voltage: 3.2V to 5.5V
  • Baud Rate: Configurable (1200 to 115200 bps)

🌐 AT Commands and Power Check

To enter Command Mode, pull the SET pin LOW before power-on or reset.

βœ‰ΓΎ Example Commands:

  • AT βž” Check if module responds
  • AT+RX βž” Query all parameters
  • AT+Bxxxx βž” Set baud rate (e.g., AT+B9600)
  • AT+RP βž” Get transmitting power
  • AT+FUx βž” Set working mode (FU1 to FU4)

πŸ“Š Sample Response from Module:

OK+B9600
OK+RC001
OK+RP:+20dBm
OK+FU3


πŸ”Ή Transmission Modes (FU1, FU2, FU3, FU4)

ModeDescriptionLatencyPower Use
FU1Balanced mode (default)MediumMedium
FU2Fast transmission, high powerLowHigh
FU3Power saving, low speedHighLow
FU4Fixed baud rate 1200, long rangeHighLow

🧱 Connection with USB to Serial Module

Wiring HC-12 to USB Serial Adapter:

HC-12 PinConnects To
VCC3.3V / 5V
GNDGND
TXDRXD
RXDTXD
SETGND (for AT mode) or Floating (for normal)

πŸ“Š GUI Visualization of HC-12 Serial Data

Creating a GUI to visualize HC-12 communication is helpful for monitoring sensor data, logs, and module status.Recommended Tools:

ToolLanguageBest For
PyQt6 / PySide6PythonAdvanced desktop apps
TkinterPythonSimple interfaces
ProcessingJavaReal-time graphics
Node-REDJSWeb-based dashboards
MIT App InventorDrag-n-dropAndroid GUI (via Bluetooth)

Python GUI Example Using PyQt6:

pip install pyqt6 pyserial pyqtgraph

Python Sample Code Snippet:

import serial
import pyqtgraph as pg
from PyQt6.QtWidgets import *
from PyQt6.QtCore import QTimer

ser = serial.Serial(‘COM5’, 9600)  # Update COM port

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setWindowTitle(“HC-12 Viewer”)
        self.graph = pg.PlotWidget()
        self.data = []

        self.label = QLabel(“Last Msg: –“)
        layout = QVBoxLayout()
        layout.addWidget(self.graph)
        layout.addWidget(self.label)

        central = QWidget()
        central.setLayout(layout)
        self.setCentralWidget(central)

        self.timer = QTimer()
        self.timer.timeout.connect(self.read_serial)
        self.timer.start(200)

    def read_serial(self):
        if ser.in_waiting:
            raw = ser.readline().decode().strip()
            self.label.setText(f”Last Msg: {raw}”)
            try:
                val = float(raw)
                self.data.append(val)
                if len(self.data) > 100:
                    self.data.pop(0)
                self.graph.plot(self.data, clear=True)
            except:
                pass


πŸ” Visualizing:

DataVisualization
Sensor ValueLine Chart
Signal PowerBar Graph
Mode / BaudLabel
LogsScrollable Text

🀝 Summary

The HC-12 is a powerful tool for wireless serial communication. With proper setup and GUI integration, you can build an effective real-time monitoring system for IoT or sensor-based projects.

Let me know if you want a downloadable .exe or .py version of the GUI to share on your website.



✨ Overview of HC-12

The HC-12 is a wireless serial communication module based on the Si4463 RF transceiver IC. It allows wireless communication at distances up to 1 km (line of sight) and is commonly used in embedded systems, IoT, and wireless sensor networks.

πŸ”Œ Key Features:

  • Frequency: 433 MHz
  • Range: Up to 1000 m (line of sight)
  • Modulation: FSK
  • Interface: UART (TTL Level)
  • Voltage: 3.2V to 5.5V
  • Baud Rate: Configurable (1200 to 115200 bps)
  • Transceiver IC: Silicon Labs Si4463
  • Current Consumption:
    • Transmission: ~100 mA @ max power
    • Idle: ~16 mA
    • Sleep: ~22 Β΅A

πŸ”Œ Connection with USB to Serial Module

Wiring HC-12 to USB Serial Adapter:

HC-12 PinConnects To
VCC3.3V / 5V
GNDGND
TXDRXD (of USB to Serial)
RXDTXD (of USB to Serial)
SETGND (for AT mode) or Floating (for normal)

To enter Command Mode, pull the SET pin LOW before powering on or resetting the module.


βš™οΈ Entering Command Mode

  • Pull SET pin to GND before powering up the module.
  • Keep SET pin LOW to remain in command mode.
  • Use a terminal tool (like TeraTerm, PuTTY, or Arduino Serial Monitor) set at Baud: 9600, NL+CR.

πŸ“‹ AT Commands Overview

CommandDescriptionExampleResponse
ATTest connectionATOK
AT+RXShow all parametersAT+RXSee below
AT+BxxxxSet baud rateAT+B9600OK+B9600
AT+CxxxSet channel (001–127)AT+C021OK+C021
AT+FUxSet transmission mode (1–4)AT+FU3OK+FU3
AT+PxSet power level (1–8)AT+P8OK+P8
AT+RPRead power levelAT+RPOK+P8
AT+SLEEPEnter sleep modeAT+SLEEPOK+SLEEP
AT+VRead firmware versionAT+VHC-12_V2.5

Sample Response from AT+RX:

OK+B9600

OK+C021

OK+FU3

OK+P8


πŸ” Transmission Modes (FU1–FU4)

ModeDescriptionLatencyPower UseNotes
FU1Balanced mode (default)MediumMediumGeneral-purpose
FU2Fast, high powerLowHighLow-latency applications
FU3Low power, low speedHighLowPower-constrained systems
FU41200 bps fixed, ultra-long rangeHighVery LowFixed speed, long-range

you must set the same FU mode (e.g., FU1, FU2, etc.) on both HC-12 modules if you want them to communicate successfully.

ο‚·  The FU mode defines how data is transmitted and received (speed, latency, power-saving behavior).

ο‚·  If one module is in FU3 (low power, slow), and the other is in FU2 (high speed), they won’t understand each other’s data, and communication will fail.

Leave a Reply

Your email address will not be published. Required fields are marked *