Power Line Carrier Communication (PLCC) using KQ-130F / KQ-330 and Arduino

Here we have 4 different projects about Power line carrier communication (PLCC) using KQ-130F / KQ-330 module and Arduino.

 

Power line communication using KQ-130F and Arduino

 

Parts list:

Arduino Mega (you can use NANO or UNO)

Power line carrier communication module KQ-130F / KQ-330 (2pcs)

FTDI (USB to TTL serial converter)

LCD 16X2 with I2C

Power Supply 5V 1A 

Capacitor 1000uF 16V (2pcs)

Capacitor 100nF (2pcs)

Capacitor 220nF 400V (4pcs)  

Resistor 1K (5pcs)

RED LED  

Green LED  

Blue LED  

Yellow LED  

White LED   

Buzzer 

Common mode choke (2pcs)

Solid state relay module 5V 1 channel


PLCC Module:

There are 3 different types of this module

KQ-130K: Maximum carrier rate up to 1200 BPS (AC & DC power line)
KQ-130E: Maximum carrier rate up to 400 BPS (AC & DC power line)
KQ-130F: Standard carrier rate is 100 BPS  (only AC power line)

TX goes to RX of the microcontroller 

RX goes to TX of the microcontroller 


Power Line Carrier Communication (PLCC) using KQ-130F and Arduino


Filtering Circuit:

Its better to use this circuit on the input side of the receiver and the transmitter (one circuit for each i.e 2 circuits) for noise reduction. I also used ferrite ring around the power cord cable.

Power line communication using KQ-130F and Arduino

First Project:

This code sending "Hello" to the receiver every 2 seconds. It sound useless but you can use it as a test to make sure your PLCC module is functional. 

 

Receiver Circuit:

Power line communication using KQ-130F and Arduino

Transmitter Circuit:

Power line communication using KQ-130F and Arduino



 Watch this video for more details: 

 


 

 Code:

 

void setup() {
  Serial.begin(9600);  // To Computer
  Serial1.begin(9600); // To KQ-130/330
}

void loop() {
  // Send "Hello" to the power line
  Serial1.println("Hello");

  // If the module receives something from the power line, print it to the screen
  while (Serial1.available()) {
    Serial.write(Serial1.read());
  }

  delay(2000);
}

 

Second Project:

This code control 5 LEDs (Red, green, blue, yellow and white) using serial command.

For example to turn ON the Red LED you have to write " RED ON " in serial monitor then hit Enter.

To turn OFF the Red LED you have to write " RED OFF " in serial monitor then hit Enter. 

The same thing for other colors.

You can also turn ON all LEDs together at the same time using this command " ALL ONthen hit Enter.

 

Transmitter Circuit:

Power line communication using KQ-130F and Arduino

Receiver Circuit:

 

Power Line Carrier Communication (PLCC) using KQ-130F and Arduino
 

Code:

 

const int RED = 2;
const int GREEN = 3;
const int BLUE = 4;
const int WHITE = 5;
const int YELLOW = 6;

void setup() {
  Serial.begin(9600);  
  Serial1.begin(9600);  

  pinMode(RED, OUTPUT);
  pinMode(GREEN, OUTPUT);
  pinMode(BLUE, OUTPUT);
  pinMode(WHITE, OUTPUT);
  pinMode(YELLOW, OUTPUT);
 
  Serial.println("System Ready: Sending ALL-ON / ALL-OFF now supported.");
}

void loop() {
  if (Serial1.available() > 0) {
    String burst = Serial1.readStringUntil('\n');
    burst.toUpperCase();

    // --- MASTER COMMANDS (ALL) ---
    if (burst.indexOf("ALL") != -1) {
      if (burst.indexOf("ON") != -1) {
        digitalWrite(RED, HIGH);
        digitalWrite(GREEN, HIGH);
        digitalWrite(BLUE, HIGH);
        digitalWrite(WHITE, HIGH);
        digitalWrite(YELLOW, HIGH);
      }
      else if (burst.indexOf("OFF") != -1) {
        digitalWrite(RED, LOW);
        digitalWrite(GREEN, LOW);
        digitalWrite(BLUE, LOW);
        digitalWrite(WHITE, LOW);
        digitalWrite(YELLOW, LOW);
      }
    }

    // --- INDIVIDUAL COLORS ---
    // RED
    if (burst.indexOf("RED") != -1) {
      if (burst.indexOf("ON") != -1) digitalWrite(RED, HIGH);
      else if (burst.indexOf("OFF") != -1) digitalWrite(RED, LOW);
    }
    // GREEN
    if (burst.indexOf("GREEN") != -1) {
      if (burst.indexOf("ON") != -1) digitalWrite(GREEN, HIGH);
      else if (burst.indexOf("OFF") != -1) digitalWrite(GREEN, LOW);
    }
    // BLUE
    if (burst.indexOf("BLUE") != -1) {
      if (burst.indexOf("ON") != -1) digitalWrite(BLUE, HIGH);
      else if (burst.indexOf("OFF") != -1) digitalWrite(BLUE, LOW);
    }
    // WHITE
    if (burst.indexOf("WHITE") != -1) {
      if (burst.indexOf("ON") != -1) digitalWrite(WHITE, HIGH);
      else if (burst.indexOf("OFF") != -1) digitalWrite(WHITE, LOW);
    }
    // YELLOW
    if (burst.indexOf("YELLOW") != -1) {
      if (burst.indexOf("ON") != -1) digitalWrite(YELLOW, HIGH);
      else if (burst.indexOf("OFF") != -1) digitalWrite(YELLOW, LOW);
    }

    // Clear buffer for the next burst
    while(Serial1.available() > 0) Serial1.read();
  }
}

 

 

Third Project:

This code is similar to the previous one, but i used a relay instead of white LED and connect it to 220V AC light bulb. 

To turn ON the light bulb you have to write " Lamp ON " in serial monitor then hit enter.

 

Transmitter Circuit:

Power line communication using KQ-130F and Arduino

Receiver Circuit:

Power Line Carrier Communication (PLCC) using KQ-130F and Arduino

Code:

 

const int RED = 2;
const int GREEN = 3;
const int BLUE = 4;
const int LAMP = 5;    // Changed from WHITE to LAMP
const int YELLOW = 6;

void setup() {
  Serial.begin(9600);  
  Serial1.begin(9600);  

  pinMode(RED, OUTPUT);
  pinMode(GREEN, OUTPUT);
  pinMode(BLUE, OUTPUT);
  pinMode(LAMP, OUTPUT);
  pinMode(YELLOW, OUTPUT);

  // Normal situation: All LEDs OFF, Lamp pin HIGH (OFF for active-low)
  digitalWrite(RED, LOW);
  digitalWrite(GREEN, LOW);
  digitalWrite(BLUE, LOW);
  digitalWrite(YELLOW, LOW);
  digitalWrite(LAMP, HIGH); // LAMP starts HIGH (Normal/Off)
 
  Serial.println("System Ready. Lamp is currently HIGH (OFF).");
}

void loop() {
  if (Serial1.available() > 0) {
    String burst = Serial1.readStringUntil('\n');
    burst.toUpperCase();

    // --- MASTER COMMANDS (ALL) ---
    if (burst.indexOf("ALL") != -1) {
      if (burst.indexOf("ON") != -1) {
        digitalWrite(RED, HIGH);
        digitalWrite(GREEN, HIGH);
        digitalWrite(BLUE, HIGH);
        digitalWrite(YELLOW, HIGH);
        digitalWrite(LAMP, LOW);  // Inverse: On = LOW
      }
      else if (burst.indexOf("OFF") != -1) {
        digitalWrite(RED, LOW);
        digitalWrite(GREEN, LOW);
        digitalWrite(BLUE, LOW);
        digitalWrite(YELLOW, LOW);
        digitalWrite(LAMP, HIGH); // Inverse: Off = HIGH
      }
    }

    // --- INDIVIDUAL CONTROL ---
   
    // LAMP (Inverse Logic)
    if (burst.indexOf("LAMP") != -1) {
      if (burst.indexOf("ON") != -1) digitalWrite(LAMP, LOW);
      else if (burst.indexOf("OFF") != -1) digitalWrite(LAMP, HIGH);
    }

    // RED
    if (burst.indexOf("RED") != -1) {
      if (burst.indexOf("ON") != -1) digitalWrite(RED, HIGH);
      else if (burst.indexOf("OFF") != -1) digitalWrite(RED, LOW);
    }
   
    // GREEN
    if (burst.indexOf("GREEN") != -1) {
      if (burst.indexOf("ON") != -1) digitalWrite(GREEN, HIGH);
      else if (burst.indexOf("OFF") != -1) digitalWrite(GREEN, LOW);
    }

    // BLUE
    if (burst.indexOf("BLUE") != -1) {
      if (burst.indexOf("ON") != -1) digitalWrite(BLUE, HIGH);
      else if (burst.indexOf("OFF") != -1) digitalWrite(BLUE, LOW);
    }

    // YELLOW
    if (burst.indexOf("YELLOW") != -1) {
      if (burst.indexOf("ON") != -1) digitalWrite(YELLOW, HIGH);
      else if (burst.indexOf("OFF") != -1) digitalWrite(YELLOW, LOW);
    }

    // Clear buffer
    while(Serial1.available() > 0) Serial1.read();
  }
}

 

 

4th Project:

This is a pager so when you write a message in serial monitor , it appears on the 16x2 LCD.

You need to start and end your message with two brackets like this:

  [[ Your message here ]] .

I used this method to ignore any noise coming from the grid and display only what is inside the brackets. 

 

Transmitter Circuit:

Power line communication using KQ-130F and Arduino

Receiver Circuit:

 

Power Line Carrier Communication (PLCC) using KQ-130F and Arduino
 

Code:


#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

const int buzzerPin = 7;      
String currentMsg = "";      

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
 
  pinMode(buzzerPin, OUTPUT);
  digitalWrite(buzzerPin, LOW);

  lcd.init();
  lcd.backlight();
  lcd.print("Triple Beep Mode");
  delay(1500);
  lcd.clear();
}

void loop() {
  if (Serial1.available() > 0) {
    String raw = Serial1.readStringUntil('\n');
   
    int startIdx = raw.indexOf("[[");
    int endIdx = raw.indexOf("]]");

    if (startIdx != -1 && endIdx != -1 && endIdx > startIdx) {
      String cleanMsg = raw.substring(startIdx + 2, endIdx);
     
      String filteredMsg = "";
      for (int i = 0; i < cleanMsg.length(); i++) {
        if (cleanMsg[i] >= 32 && cleanMsg[i] <= 126) {
          filteredMsg += cleanMsg[i];
        }
      }

      if (filteredMsg.length() > 0 && filteredMsg.length() <= 32) {
        // Only alert if the message is new
        if (filteredMsg != currentMsg) {
          updateLCD(filteredMsg);
          playTripleBeep();
        }
      }
    }
  }
}

void updateLCD(String msg) {
  currentMsg = msg;
  lcd.clear();
 
  if (msg.length() <= 16) {
    lcd.setCursor(0, 0);
    lcd.print(msg);
  } else {
    lcd.setCursor(0, 0);
    lcd.print(msg.substring(0, 16));
    lcd.setCursor(0, 1);
    lcd.print(msg.substring(16, 32));
  }
}

// The new, less annoying notification sound
void playTripleBeep() {
  for (int i = 0; i < 3; i++) {
    digitalWrite(buzzerPin, HIGH);
    delay(150);             // Short beep
    digitalWrite(buzzerPin, LOW);
    delay(100);             // Short silence between beeps
  }
}