Summary of Long Range, 1.8km, Arduino to Arduino Wireless Communication With the HC-12.
This article guides users in establishing long-range wireless communication (up to 1.8km) between two Arduinos using HC-12 modules. It covers wiring, configuring the Arduino IDE for dual instances, and implementing projects like a wireless instant messenger, toggle button LED control, momentary button control, and string manipulation functions. The guide concludes with advanced tips on entering setup mode to adjust baud rates and connecting external antennas.
Parts used in the Long Range Arduino Communication Project:
- 2 x Arduino
- 2 x HC-12 modules
- Wires
- Breadboard
- 10 k resistor
- Push button
- SMA antenna (external)
- Spring antennas

In this instructable you will learn how to communicate between Arduinos over a long distance up to 1.8km in open air.
The HC-12 is a wireless serial port communication module that is very useful, extremely powerful and easy to use.
First you will learn how to make a wireless instant messenger with the least effort possible.
Then we will move on to light up an LED with a push button and then you will learn a few useful string functions and operations for serial communication.
The last part of the instructable is not necessary but you will learn how to use the HC-12 module like a pro.
In this part you will learn how to enter the modules setup mode to change the baud rate, transmission distance and so on.
And finally you will learn how to connect an external SMA antenna.
Follow the rest of this instructable to find out how easy it is to become a pro in wireless serial communication.
Step 1: Parts List

- 2 x Arduino (got my Arduino clones for 3 dollar here)
- 2 x HC-12 modules (got mine here )
- Wires
- Breadboard.
- 10 k resistor
- push button
- Exercise files here
Step 2: Wiring and Setup

First we have to solder the spring antennas to both of the HC-12 chips.
I also soldered some pins on the HC-12 module to make it easy to use on a breadboard.
We will use 2 Arduinos with a HC-12 module connected to each of them as you can see in the image.
For both Arduinos we connect pin 2 to TX and pin 3 to RX. Ground to ground and VCC to 5v.
At one Arduino we will add a push button as you can see in the image.
To work with 2 Arduinos on 1 computer, we have to open 2 instances of the Arduino IDE. This means that we have to open the Arduino software 2 times. This is not the same as “file → New”
Save the one with the push button connected as “HC-12 sender” and the other as “HC-12 receiver”.
Make sure that the right ports are selected for each of the Arduinos.
Step 3: Instant Wireless Messenger, Toggle Button, Momentary Button and a Few Useful Functions

Wireless Messenger
We will start by making an instant wireless messenger.
Copy the content from the file “HC-12 messenger send/receive.txt” in the ZIP archive and paste it to each of the Arduino instances. The code is the same for both Arduinos.
After uploading the code, open the serial monitor for both instances.
Now start typing in both serial monitors to start a chat.
Even your Arduinos are connected to the same computer, the communication is wireless.
Toggle Button
A toggle button is used often in electronics. The principle is very simple. You press a button once to turn on the LED and press the same button again to turn of the LED.
Copy and paste the content of the “HC-12 Toggle Button Send.txt” to the “HC-12 sender” instance and the the “HC-12 Toggle Button Receive.txt” to the “HC-12 receiver” instance and upload.
When you push the button, you should see the LED light up. When you push the button again, the LED turns off.
A few validators like timing and button code are used in order to make sure this example works perfect.
Momentary Button
A momentary button is pretty straightforward. While pushing the button, the LED lights up. When releasing the button, the LED turns off.
Copy and paste the content of the “HC-12 Momentary Button Send.txt” to the “HC-12 sender” instance and the the “HC-12 Momentary Button Receive.txt” to the “HC-12 receiver” instance and upload.
Some useful functions and operators
There are a few useful functions and operators that come in handy when you want to convert or spit a string and convert it to a decimal and so on.
Look at the file “HC-12 Useful Functions and Operators Send.txt” and “ HC-12 Useful Functions and Operators Receive.txt”.
The send sketch sends the string “test123” on button press.
The receive sketch reads the string, split it and convert it to an integer.
Read more: Long Range, 1.8km, Arduino to Arduino Wireless Communication With the HC-12.
- How can I communicate between Arduinos over a long distance?
You can use HC-12 wireless serial port communication modules to achieve distances up to 1.8km in open air. - Can I use two Arduinos connected to the same computer?
Yes, you must open two separate instances of the Arduino IDE software to manage both devices simultaneously. - What is the best way to connect the HC-12 module to the Arduino?
Connect pin 2 to TX, pin 3 to RX, Ground to Ground, and VCC to 5v on both Arduinos. - How do I create an instant wireless messenger?
Upload the same code file to both Arduino instances and open the serial monitor on each to start typing and chatting. - Does a toggle button work by holding it down?
No, a toggle button turns the LED on with one press and off with the next press, unlike a momentary button. - How does a momentary button function in this project?
The LED lights up only while the button is being pushed and turns off immediately when released. - Can I change the transmission distance or baud rate of the HC-12?
Yes, you can enter the module's setup mode to modify settings like baud rate and transmission distance. - Is it possible to extend the range beyond the built-in antenna?
Yes, you can solder pins to the module and connect an external SMA antenna for better performance.
