Go Down

Topic: Power line Communication Project Guidance (Read 686 times) previous topic - next topic


"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


its at the bottom of the data sheet.I thought instead of that program i had a chance to get it right,if i post the code with arduinojson


Once more, the json doesn't have anything to do with the powerline communication. I'd best if you get it to work with basic datatypes. Then you can serialize/deserialize this to/from json later.



I am doing a smart meter project using power line communication.For that i use kq-130f module as plcc module.It has tx and rx pin to which we send serial data and recieve it at other end.But when i send my data through basic serial.println() function it didnt work.When i looked into data sheet,they prefer using UART,MOBUS protocols,which i dont have any idea about.
Arduio mega-------->kq130f--------------->powerline--------->kq130f------->arduino uno

i want to sent serial data(sensor values) from mega to uno like this.
I am attaching datasheet along my topic.I want to know how to make this module work.There is somekind of program for another microcontroller at the end of datasheet which i have no idea about.So help is appreciated.


that looks like a neat device, can you listen in on power line transmission messages, like wireshark for high voltage power?
the 7 pin looks to need a data carrier
"7P-TX: TTL level, a data carrier, then the microcontroller RXD"

the above line makes me think you need a transport protocol in between the output and your microcontroller. rs-485, rs-232, something similar, below i found the key point, the microcontroller is a RS232 interface, the screenshots are a chinese version of 'Putty' connecting to the device and reading the output.

"KQ-130F power line carrier data transceiver module after the
microcomputer of FIG. 9 pin RS232 serial debugging assistant connection
test pattern: "

"This module interface baud 9600bps, please use the user module 9600BPS
asynchronous communication, the format of a start bit, 8 data bits, 1 stop bit


okke. Pardon me ,I am not good enough to understand protocols.And is it necessary to add a Rs232 interface bw arduino and KQ130F module.
So if i have to transmit data b/w the two arduino modules using kq130f how should i program it.


My project is PLCC for smart meter networks.Project works like this.I have designed a energy meter using arduino and i am transmitting that data through powerline using powerline carrier module to another arduino uno and display it on computer.I have developed everything but failed to make my plcc module work.So i thought about purchasing a plcc module online and bought kq130f.(datasheet attached).But the thing is that this doesnt detect basic serial communication like println() functions.So i am not able to transmit data through the module. I cant understand how to make the module work from the data sheet.I just need to transmit a serial string data containg my sensor values through
 arduino------>kq130f--------->power line--------->kq130f---------->arduino.
So how can i sent data through this module??Help is much appreciated.
androidwifi.ino is the program i developed till now.But the serial.println(text) method is not working.


Take a look at https://www.arduino.cc/en/Reference/softwareSerial, it could help..
Also the following could help:
  • Share wiring diagram
  • You can't use 1 pin for serial communication you need Tx and Rx
  • Take a look at Serial.read() and Serial.write()


Module says it supports asynchronous transmission with start bit and stop bit.How can i do that


Asynchronous transmission with (one) start bit and (one) stop bit (and no parity) is the way Arduino Serial works, so no problem with that.

In your KQ-130F module datasheet, you can see that the pin MODE (pin 8  ) sets the mode of operation.

If MODE is HIGH or unconnected, the mode of operation is Transparent.
If MODE is LOW, the mode of operation is Custom.

In the Transparent mode (MODE = HIGH or unconnected) the module simply echoes on TX pin (pin 7) the bytes received on RX pin (pin 6), but the datasheet warns that in this mode the noise on AC line can generate random bytes at receiving end.

For example, if you transmit the bytes 

   5A 5A 5A 34 56 78 12 45 67,

the receiving module can receive

   FE FD EF     5A 5A 5A 34 56 78 12 45 67 85     DE EF
where the bytes

at the start and

   DE EF
at the end are random bytes generated by noise.

If you use this mode of operation, you need some protocol to skip random bytes.

The Custom mode of operation (MODE = LOW) uses the first byte as data length.

So, in this mode, if you want to transmit the 2 bytes
   34 52
you must write the sequence

   02 34 52
where the first byte (02) is the length of data bytes.

To summarize, if you use Transparent mode to send a string, very likely the receiving end will read a different string due to random bytes generated by AC line.

On the other hand, if you use Custom mode, you need to send the length of the string before sending the actual string, and in the receiving end you must read the first byte as string length, and then read the string bytes.

Here my tentative blocking routines for writing and reading strings in Custom mode

Code: [Select]
// you can change MAX_LEN to any value < 250
#define MAX_LEN 80
#define IO_FAILURE 0 // write or read operation failure
#define IO_SUCCESS 1 // write or read operation success

int writeStringCustomMode(String &txt)
  int len = txt.length();
  if (len > MAX_LEN)
    return IO_FAILURE;
  return IO_SUCCESS;

char bufString[MAX_LEN + 1];

// read from Serial1 and save the string in the bufString buffer

int readByte()
    while(Serial1.available() < 1)

    return Serial1.read();

int readStringCustomMode()
  int len, ch;
  len = Serial1.read();
  bool discardInput = len > MAX_LEN;
  for(int i=0; i<len; i++)
    ch = readByte();
    if (!discardInput)
      bufString[i] = ch;   
  if (!discardInput) 
    bufString[len] = 0;
    bufString[0] = 0;
  return discardInput ? IO_FAILURE : IO_SUCCESS;       

before using readStringCustomMode() check if Serial1.available() > 0      


okke,I will attach my program with out including the kq-130f module part at transmitter and receiver end of arduino.Can u please explain to me how i should change that inorder to get correct output.
i used serial.println() to print string,but it didnt work.


I attach your code modified by me, try it.


1) Check that none of the pins assigned to LCD is assigned to Serial1 too.
2) Connect to ground the MODE pin of transmitting and receiving KQ-130F modules, to select Custom mode of operation.
3) The module KQ-130F needs approx. 1 second to transmit 10 bytes; if your string is for example 40 bytes
   long, you must wait at least 4 seconds before sending another string, otherwise transmitting buffer will
4) If you modify MAX_LEN, set the same value in receiving and transmitting code.


Apr 20, 2019, 01:38 am Last Edit: Apr 20, 2019, 01:45 am by jremington
The device appears to use perfectly standard, TTL level RS232 protocol. Connect as shown in the posted manual. Leave the MODE pin open, and initialize the Arduino serial interface with
Code: [Select]

To continue using the serial port on an Uno for program upload, you will need to use a software serial library to communicate with the device (altSoftSerial, neoSWserial, or softwareSerial).


Apr 20, 2019, 06:55 am Last Edit: Apr 20, 2019, 04:00 pm by GolamMostafa
1.  Your connection between UNO and KQ130f could be like this:

2.  The Codes
Code: [Select]
SoftwareSerial SUART(2, 3);  //SRX= DPin-2, STX = DPin-3

void setup()


void loop()
    //send commands from the InputBox of Serial Monitor as needed as per KQ's Manual
    //To receive data from KQ, execute codes like --
        byte n = SUART.available();
        if (n !=0)
             //data has come from KQ; receive, store, and process as needed

Go Up