Stufin
Home Quick Cart Profile

HC-12

Buy Now on Stufin

Component Name

HC-12

Description

The HC-12 is a low-cost, low-power, and high-performance wireless serial communication module that operates at a frequency of 433.92 MHz. It is a popular and widely used IoT component for wireless communication between microcontrollers, computers, or other devices.

Functionality

The HC-12 module is designed to provide wireless serial communication between devices. It can be used to transmit and receive data wirelessly between two devices, allowing for wireless communication over distances of up to 1000 meters (3280 feet) in open areas. The module operates in half-duplex mode, meaning it can either transmit or receive data at a time, but not both simultaneously.

Key Features

  • Frequency: 433.92 MHz
  • Transmission Distance: Up to 1000 meters (3280 feet) in open areas, 300-400 meters (984-1312 feet) in urban areas, and 100-200 meters (328-656 feet) in indoor environments.
  • Bit Rate: 500 Kbps to 1 Mbps
  • Operating Voltage: 3.2 V to 5.5 V
  • Current Consumption: Less than 100 mA in transmitting mode and less than 20 mA in receiving mode
  • Operating Temperature: -20C to +75C
  • Transmit Power: Less than 20 dBm
  • Receiver Sensitivity: -117 dBm
  • Data Format: 8-N-1 (8 data bits, no parity bit, and 1 stop bit)
  • Protocol: Customizable, supports multiple protocols including APRS, AM, and ASK

Physical Characteristics

  • Dimensions: 27.5 mm x 14.5 mm x 4 mm (1.08 in x 0.57 in x 0.16 in)
  • Weight: Approximately 5 grams
  • Interface: 5-pin header (VCC, GND, TX, RX, and ANT)
  • Antenna: External antenna required (not included)

Applications

  • Wireless Sensor Networks: For collecting and transmitting sensor data wirelessly.
  • IoT Projects: For remote monitoring, control, and automation of devices.
  • Robotics: For wireless communication between robots and controllers.
  • Home Automation: For wireless control and monitoring of home appliances.
  • Industrial Automation: For wireless monitoring and control of industrial equipment.

Notes

  • The HC-12 module requires an external antenna for optimal performance.
  • The module's operating frequency may vary depending on the local regulations and laws.
  • The module's range and performance may be affected by environmental factors such as obstacles, interference, and multipath fading.

By providing a detailed description of the HC-12 module's functionality and key features, developers can effectively integrate this component into their IoT projects, ensuring reliable and efficient wireless communication between devices.

Pin Configuration

  • HC-12 Wireless Serial Communication Module
  • The HC-12 is a popular wireless serial communication module used in IoT applications. It is a transceiver module that operates at a frequency of 433.92 MHz and has a range of up to 1 km in open space. The module has 4 pins, which are explained below:
  • HC-12 Pinout:
  • 1. VCC (Pin 1):
  • Function: Power supply pin
  • Description: This pin is used to power the HC-12 module. A voltage range of 3.2V to 5.5V is recommended.
  • Connection: Connect to a power source (e.g., a battery or a voltage regulator output) that supplies the required voltage.
  • 2. TX (Pin 2):
  • Function: Transmission pin
  • Description: This pin is used to transmit data from the microcontroller to the HC-12 module.
  • Connection: Connect to the TX pin of the microcontroller (e.g., Arduino, Raspberry Pi).
  • 3. RX (Pin 3):
  • Function: Reception pin
  • Description: This pin is used to receive data from the HC-12 module and send it to the microcontroller.
  • Connection: Connect to the RX pin of the microcontroller (e.g., Arduino, Raspberry Pi).
  • 4. GND (Pin 4):
  • Function: Ground pin
  • Description: This pin is used as a common ground connection for the module.
  • Connection: Connect to the GND pin of the microcontroller and the power source.
  • Connection Structure:
  • To connect the HC-12 module to a microcontroller (e.g., Arduino Uno), follow this structure:
  • Connect VCC (Pin 1) to the 5V output of the Arduino board.
  • Connect TX (Pin 2) to the TX pin of the Arduino board (usually Digital Pin 1).
  • Connect RX (Pin 3) to the RX pin of the Arduino board (usually Digital Pin 0).
  • Connect GND (Pin 4) to the GND pin of the Arduino board.
  • Note:
  • Ensure that the power supply voltage is within the recommended range to avoid damaging the HC-12 module.
  • Use a voltage regulator or a level shifter if the microcontroller operates at a different voltage level than the HC-12 module.
  • Apply proper antennas to the HC-12 module to ensure reliable wireless communication.
  • Consult the datasheet and application notes for specific configuration and usage guidelines for the HC-12 module.

Code Examples

HC-12 Wireless Serial Communication Module Documentation
Overview
The HC-12 is a popular and cost-effective wireless serial communication module, widely used in IoT projects, robotics, and wireless communication systems. It offers a reliable and efficient way to transmit data wirelessly between two devices. This documentation provides a comprehensive overview of the HC-12 module, including its features, pinout, and code examples for various contexts.
Features
Wireless serial communication module
 Operating frequency: 433.4-473.0 MHz
Transmission distance: up to 1000 meters (line of sight)
 Baud rate: 1200-115200 bps
 Power consumption: 3.3V - 5V DC
 Small size: 27x13x3 mm
Pinout
| Pin | Function |
| --- | --- |
| VCC | Power supply (3.3V - 5V) |
| GND | Ground |
| TXD | Transmit data |
| RXD | Receive data |
| SET | Module setup (high: setup mode, low: normal mode) |
Code Examples
### Example 1: Basic Wireless Communication using Arduino
In this example, we will demonstrate how to use two HC-12 modules to establish wireless communication between two Arduino boards.
Transmitter Code (Arduino Board 1)
```c
#include <SoftwareSerial.h>
SoftwareSerial HC12(2, 3); // TX, RX pins
void setup() {
  HC12.begin(9600); // Initialize HC12 module at 9600 bps
}
void loop() {
  HC12.print("Hello, World!"); // Send data to receiver
  delay(1000);
}
```
Receiver Code (Arduino Board 2)
```c
#include <SoftwareSerial.h>
SoftwareSerial HC12(2, 3); // TX, RX pins
void setup() {
  HC12.begin(9600); // Initialize HC12 module at 9600 bps
  Serial.begin(9600); // Initialize serial monitor
}
void loop() {
  if (HC12.available()) {
    String receivedData = HC12.readStringUntil('
');
    Serial.println(receivedData); // Print received data to serial monitor
  }
}
```
### Example 2: Wireless Sensor Node using ESP8266 and HC-12
In this example, we will demonstrate how to use the HC-12 module with an ESP8266 board to create a wireless sensor node.
ESP8266 Code
```c
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
SoftwareSerial HC12(D1, D2); // TX, RX pins
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
void setup() {
  Serial.begin(115200);
  HC12.begin(9600); // Initialize HC12 module at 9600 bps
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  Serial.println("Connected to WiFi");
}
void loop() {
  int sensorValue = analogRead(A0); // Read sensor value
  HC12.print("Sensor Value: ");
  HC12.println(sensorValue); // Send sensor data to receiver
  delay(1000);
}
```
In this example, the ESP8266 board reads sensor data from an analog input and transmits it wirelessly to a receiver using the HC-12 module.
Note: These code examples are just a starting point, and you may need to modify them based on your specific use case and requirements.