Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use HC12: Examples, Pinouts, and Specs

Image of HC12
Cirkit Designer LogoDesign with HC12 in Cirkit Designer

Introduction

The HC12 is a low-cost, low-power, 12-bit microcontroller with integrated RF communication capabilities. It is widely used for wireless data transmission in applications such as remote monitoring, home automation, industrial control, and IoT (Internet of Things) devices. The HC12 operates in the 433 MHz frequency band and supports a variety of communication modes, making it a versatile choice for short- to medium-range wireless communication.

Its compact design, low power consumption, and ease of integration make it a popular choice for developers and hobbyists alike. The HC12 is particularly well-suited for projects requiring reliable, long-distance communication with minimal interference.

Explore Projects Built with HC12

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
STM32H7-Based Multi-Sensor Monitoring System with GSM Alert and LCD Display
Image of medical: A project utilizing HC12 in a practical application
This circuit is centered around an STM32H7 microcontroller, which interfaces with a variety of sensors including a DHT11 temperature and humidity sensor, a DS3231 real-time clock, an MQ-2 smoke detector, an IR sensor, a MAX30102 pulse oximeter, and a body temperature sensor. It also includes a GSM module for communication, an LCD display for output, multiple pushbuttons for input, a buzzer, and a speaker for audio signaling. The microcontroller's embedded code suggests that it is programmed to periodically read from the sensors, handle button inputs, update the LCD display, and potentially send alerts via the GSM module.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO-Based Smart Irrigation System with Motion Detection and Bluetooth Connectivity
Image of Copy of wiring TA: A project utilizing HC12 in a practical application
This circuit is a microcontroller-based control and monitoring system. It uses an Arduino UNO to read from a DHT22 temperature and humidity sensor and an HC-SR501 motion sensor, display data on an LCD, and control a water pump and an LED through a relay. The HC-05 Bluetooth module allows for wireless communication.
Cirkit Designer LogoOpen Project in Cirkit Designer
Raspberry Pi Pico-Based Navigation Assistant with Bluetooth and GPS
Image of sat_dish: compass example: A project utilizing HC12 in a practical application
This circuit features a Raspberry Pi Pico microcontroller interfaced with an HC-05 Bluetooth module for wireless communication, an HMC5883L compass module for magnetic field measurement, and a GPS NEO 6M module for location tracking. The Pico is configured to communicate with the HC-05 via serial connection (TX/RX), with the compass module via I2C (SCL/SDA), and with the GPS module via serial (TX/RX). Common power (VCC) and ground (GND) lines are shared among all modules, indicating a unified power system.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32C3 Supermini-Based Smart Environment Monitor and Lighting Control System
Image of Bedside RGB and Lamp: A project utilizing HC12 in a practical application
This is a smart control system featuring an ESP32C3 Supermini microcontroller for interfacing with various sensors and actuators. It includes temperature and humidity sensing, RGB LED strip control, user input via a pushbutton and rotary encoder, and AC power control through a two-channel relay. The system is powered by an AC source converted to DC by the HLK-PM12 module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with HC12

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of medical: A project utilizing HC12 in a practical application
STM32H7-Based Multi-Sensor Monitoring System with GSM Alert and LCD Display
This circuit is centered around an STM32H7 microcontroller, which interfaces with a variety of sensors including a DHT11 temperature and humidity sensor, a DS3231 real-time clock, an MQ-2 smoke detector, an IR sensor, a MAX30102 pulse oximeter, and a body temperature sensor. It also includes a GSM module for communication, an LCD display for output, multiple pushbuttons for input, a buzzer, and a speaker for audio signaling. The microcontroller's embedded code suggests that it is programmed to periodically read from the sensors, handle button inputs, update the LCD display, and potentially send alerts via the GSM module.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Copy of wiring TA: A project utilizing HC12 in a practical application
Arduino UNO-Based Smart Irrigation System with Motion Detection and Bluetooth Connectivity
This circuit is a microcontroller-based control and monitoring system. It uses an Arduino UNO to read from a DHT22 temperature and humidity sensor and an HC-SR501 motion sensor, display data on an LCD, and control a water pump and an LED through a relay. The HC-05 Bluetooth module allows for wireless communication.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of sat_dish: compass example: A project utilizing HC12 in a practical application
Raspberry Pi Pico-Based Navigation Assistant with Bluetooth and GPS
This circuit features a Raspberry Pi Pico microcontroller interfaced with an HC-05 Bluetooth module for wireless communication, an HMC5883L compass module for magnetic field measurement, and a GPS NEO 6M module for location tracking. The Pico is configured to communicate with the HC-05 via serial connection (TX/RX), with the compass module via I2C (SCL/SDA), and with the GPS module via serial (TX/RX). Common power (VCC) and ground (GND) lines are shared among all modules, indicating a unified power system.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Bedside RGB and Lamp: A project utilizing HC12 in a practical application
ESP32C3 Supermini-Based Smart Environment Monitor and Lighting Control System
This is a smart control system featuring an ESP32C3 Supermini microcontroller for interfacing with various sensors and actuators. It includes temperature and humidity sensing, RGB LED strip control, user input via a pushbutton and rotary encoder, and AC power control through a two-channel relay. The system is powered by an AC source converted to DC by the HLK-PM12 module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Technical Specifications

Below are the key technical details of the HC12 module:

  • Operating Voltage: 3.2V to 5.5V
  • Operating Current: 16 mA (transmitting), 3.6 mA (receiving)
  • Communication Range: Up to 1,000 meters (line of sight, with proper antenna)
  • Frequency Band: 433.4 MHz to 473.0 MHz
  • Modulation: GFSK (Gaussian Frequency Shift Keying)
  • Baud Rate: 1,200 bps to 115,200 bps
  • Output Power: Up to 100 mW (20 dBm)
  • Antenna Interface: Standard IPEX or soldered wire antenna
  • Dimensions: 27.8 mm x 14.4 mm x 4 mm

Pin Configuration and Descriptions

The HC12 module has 4 main pins for interfacing. The table below describes each pin:

Pin Name Pin Number Description
VCC 1 Power supply input (3.2V to 5.5V).
GND 2 Ground connection.
TXD 3 Transmit data pin. Connect to the RX pin of the microcontroller.
RXD 4 Receive data pin. Connect to the TX pin of the microcontroller.
SET 5 Configuration pin. Pull LOW to enter AT command mode; leave HIGH for normal use.

Usage Instructions

How to Use the HC12 in a Circuit

  1. Power Supply: Connect the VCC pin to a 3.3V or 5V power source and the GND pin to ground.
  2. Data Communication: Connect the TXD pin of the HC12 to the RX pin of your microcontroller and the RXD pin of the HC12 to the TX pin of your microcontroller.
  3. Antenna: Attach an appropriate antenna to the HC12 module for optimal communication range.
  4. Configuration (Optional): To configure the HC12, pull the SET pin LOW and send AT commands via a serial interface. Once configured, return the SET pin to HIGH for normal operation.

Important Considerations and Best Practices

  • Power Supply: Ensure a stable power supply to avoid communication errors. Use decoupling capacitors if necessary.
  • Antenna Placement: Place the antenna away from metal objects and other sources of interference for maximum range.
  • Baud Rate Matching: Ensure the baud rate of the HC12 matches the baud rate of the microcontroller for proper communication.
  • AT Command Mode: Use AT commands to configure parameters such as baud rate, channel, and transmission power. Refer to the HC12 datasheet for a complete list of AT commands.

Example: Connecting HC12 to Arduino UNO

Below is an example of how to use the HC12 with an Arduino UNO for basic communication:

Circuit Connections

  • HC12 VCCArduino 5V
  • HC12 GNDArduino GND
  • HC12 TXDArduino Pin 10 (SoftwareSerial RX)
  • HC12 RXDArduino Pin 11 (SoftwareSerial TX)
  • HC12 SETArduino GND (for AT command mode) or leave unconnected for normal operation.

Arduino Code

#include <SoftwareSerial.h>

// Define SoftwareSerial pins for HC12 communication
SoftwareSerial HC12(10, 11); // RX = Pin 10, TX = Pin 11

void setup() {
  Serial.begin(9600);       // Start serial communication with PC
  HC12.begin(9600);         // Start serial communication with HC12
  Serial.println("HC12 Test");
}

void loop() {
  // Check if data is available from the HC12
  if (HC12.available()) {
    String received = HC12.readString(); // Read data from HC12
    Serial.print("Received: ");
    Serial.println(received);           // Print received data to Serial Monitor
  }

  // Check if data is available from the Serial Monitor
  if (Serial.available()) {
    String toSend = Serial.readString(); // Read data from Serial Monitor
    HC12.print(toSend);                  // Send data to HC12
  }
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Communication Between Devices:

    • Ensure the TX and RX pins are correctly connected (crossed).
    • Verify that the baud rate of the HC12 matches the microcontroller's baud rate.
    • Check the power supply voltage and ensure it is within the specified range.
  2. Short Communication Range:

    • Ensure the antenna is properly connected and positioned.
    • Avoid obstructions and interference from other RF devices.
  3. Unable to Enter AT Command Mode:

    • Ensure the SET pin is pulled LOW before powering the module.
    • Use a serial terminal to send AT commands and verify the response.
  4. Data Corruption:

    • Check for noise or interference in the power supply.
    • Use shielded cables for long-distance connections.

FAQs

Q: Can the HC12 communicate with other RF modules?
A: The HC12 can only communicate with other HC12 modules configured to the same channel and baud rate.

Q: What is the maximum range of the HC12?
A: The HC12 can achieve up to 1,000 meters of range in line-of-sight conditions with a proper antenna.

Q: How do I reset the HC12 to factory settings?
A: Enter AT command mode and send the AT+DEFAULT command to reset the module to its default settings.

Q: Can I use the HC12 with a 3.3V microcontroller?
A: Yes, the HC12 is compatible with both 3.3V and 5V logic levels. Ensure the power supply voltage is within the specified range.