ESP32 serial communication error with Kq-330 Power line communication module

Guys i am trying to use an esp32 with KQ-330 power line communication mode to send a signal over the power lines of he house to turn on and off a bulb continuiusly.
my circuit is really simple:-
Esp32 --> Kq-330(transmit)-----Power line-----Kq-330(receive)-->arduino uno-->relay-->bulb(on/off)
The problem:-
I unable to establish a successful serial communication with the Kq-330 module with the esp32 on the transmission side.
To check whether the Kq-330 module was working fine i used a simple usb to ttl converter with a serial terminal emulator(tera term)
to send serial data to the KQ-330 module and it worked like a charm.
But serial communication doesn't seem to work with esp32, i followed all the specification given in the specs sheet(9600bps, 8bit 1 stop bit).The datasheet for KQ-330 is attached
As for the connection:

  1. the 5v of KQ-330 is connected to Vin of ESP-32 ,
  2. gnd of KQ-330 to gnd of ESP-32
    3.RX of KQ-330 to TX of ESP 32

Since the project works with serial terminal and usb converter i guess there is no problem on the arduino (reveiving) side. And the esp32 is also fine, as i checked it by sending and receiving the data between the usart1 and usart2 of esp32 and it was working

The code of both the ends is given below

HardwareSerial Sender(1);   // Define a Serial port instance called 'Sender' using serial port 1
void setup() {
  Serial.begin(9600);                                             // Define and start serial monitor
  Sender.begin(9600, SERIAL_8N1, 13, 12); // Define and start Sender serial port
void loop() {
      Sender.write('t');                            // command to turn bulb on
  Sender.write('o');                                // command to turn bulb off

ARDUINO UNO CODE RECEIVING END(ignore the lcd code):-

#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
LiquidCrystal lcd(13, 12, 11, 10, 9, 8); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7)
int ADC1_PIN = A4;
int ADC1_VAL;
int ADC2_PIN = A2;
int ADC2_VAL;
int ADC3_PIN = A3;
int ADC3_VAL;
int ADC4_PIN = A1;
int ADC4_VAL;
int ADC5_PIN = A0;
int ADC5_VAL;
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("  WELCOME  ");
  lcd.setCursor(0, 0);
  lcd.print("  POWER LINE   ");
  lcd.setCursor(0, 1);
  lcd.print(" COMMUNICATION ");
void loop() {
  String readString;
String Q;
 while (Serial.available()){
  char c =;
   if (isControl(c)){
  readString += c;    
Q = readString;
  lcd.setCursor(0, 0);
  lcd.print(" HOME ");
  lcd.setCursor(0, 1);
  lcd.print(" AUTOMATION ");
if (Q=="o"){
if (Q=="t"){

20140619104969976997.zh-CN.en.pdf (557 KB)

Note: pin 13 of esp32 is txn and is connected to rx of kq300

Do you have a second arduino UNO you can replace your ESP32 with, as the sender, and do this test again? The spec sheet says TTL level so it's 0/5V but ESP32 is 0/3.3V so it may not be enough. If UNO sends data and gets received by the other UNO on receiver, you know you have to level shift from 3.3V to 5V. There are plenty of circuits and breakout boards that can do that.

This was the first assumption that i had but i didn't have any extra uno with which i could try. i am going to buy one tomorrow , will let you know.
My main reason to use the esp32 was to use it's inbuilt wifi so i could send signal to it using an app and esp2 will transfer it serially to the Kq-330. Which i guess its not possible with uno as u can only connect one external uart device at a time. But i will still try it with uno to check the 3.3-5v issue.

Oi! Hooking 5V to an ESP32 GPIO is a good way to burn things up.

[Sender.begin(9600, SERIAL_8N1, 13, 12); // Define and start Sender serial port]

Why not use the natural hardware serial pins for (1)?

You have taken the precautions, besides using level shifters, to use GPIO_NUM_12 and GPUI_NUM_13, right?

The natural TX pin of serial (1) on the ESP32 is GPIO_NUM_17.
The natural RX pin of serial (1) on the ESP32 is GPIO_NUM_16.

The ESP32 is NOT 5V tolerant.

I tried pin 16 and 17 also i tried powering the KQ-330 modem with external 5v supply instead of using esp32 vin.
Still didn't work

Can you have the sender and receiver side by side and hook them both to your only UNO? Then build a voltage divider for ESP32 to receive and have it on the receiver end to confirm your ESP32 is receiving. Do you have a level shifter?

Yep, tried it with 5/3.3v logic converter it worked!!

Thanks for closing the loop. Could you change title to solved for whomever will encounter this thread in the future?

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