HC 12 not working with TX and RX pins

I'm working with a HC-12 module which is used for wireless serial communication. When I implement it with SoftwareSerial and assign any two digital pins as TX and RX it works just fine. But when I use it with the pin 0 and pin 1 which are the actual serial pins of the board it doesn't work. Can anyone help me out to solve this problem?

Difficult to be sure, since you have not revealed which Arduino you are using, but a lot of Arduinos have components attached to pins 0 and 1 for program upload which prevents their use for other purposes.

every one I had lasted just long enough to read the settings, once. even if I ran it through a 3.3 volt level shifter. I believe the 5 VDC burned up the serial RX on the board.

pin 0 and pin 1 which are the actual serial pins of the board

more accurately, the only hardware Serial port on the board. If you switch to a Mega you get 3 more hardware serial ports and many more digital pins.

Your post is nebulous at best but, at a guess, you are using software serial on the hardware serial pins, which is a recipe for disaster. It is quite OK to have a serial device on hardware serial pins 0,1, indeed it is a really good idea and what it was intended for, which goes quite some way to explain their presence and labelling. BUT you do it with hardware serial, not software serial, i.e.Serial.begin(9600);
Note that, if you do this, you need to have HC-12 disconnected while you upload your programme.

Thank you everyone. The issue has been solved!

The arduino I'm using is Pro Mini 328p 5V 16MHz.

And I didn't use software serial on pin 0 and pin 1.

Thank you everyone. The issue has been solved!

Perhaps you could be kind enough to let others know what was the solution to the problem. You are not the only person in Arduino land to use HC12's on hardware serial pins.

cattledog:
Perhaps you could be kind enough to let others know what was the solution to the problem. You are not the only person in Arduino land to use HC12's on hardware serial pins.

I'm sharing my solution. But since I'm a noob I can't explain what had happened.

So when I used SoftwareSerial I had to connect the Tx of the module to the newly defined Tx and same goes to Rx. But when I used it with pin 0 and pin 1 I had connect the Tx to Rx and Rx to Tx.

But when I used it with pin 0 and pin 1 I had connect the Tx to Rx and Rx to Tx.

That is correct.

So when I used SoftwareSerial I had to connect the Tx of the module to the newly defined Tx and same goes to Rx.

That can not be true. Tx goes to Rx and Rx goes to Tx. I would think that you misunderstand the constructor for Software Serial where the pins declared are on the Arduino. As always, Tx module goes to Rx Arduino, and Rx module goes to Tx Arduino.

// set up a new serial object rxPin = rxArduino and  txPin = txArduino
SoftwareSerial mySerial (rxPin, txPin);

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.