Visit Us On FacebookVisit Us On TwitterVisit Us On Google PlusVisit Us On LinkedinVisit Us On YoutubeCheck Our Feed

Power Line Communication – (Video)


PLC (Power Line Communication) is the technology that allows data transmission over the existing Power Line network. Power Line can be the home power network or the national electricity transmission grid. The data that can be transferred is as diverse as its speed. With speeds of nearly 200Mbps, video transmission, voice, data and any other services can be transmitted successfully.

On this article i'm going to describe in detail my B.Sc Thesis in department of Electronic Computer Systems Engineer at Technological Education Institute of Piraeus, October of 2012 in Greece.

The project includes the design of two modules (transmitter – receiver) implementing a serial communication over the Mains connecting a remote large display to a weighing machine. 

The main idea:

The main idea of the communication process is simple described in the following diagram.  


From right to left, data to be transmitted are first modulated (digital bits are converted to analog frequency/sine wave e.g. bit 1 is converted to a sine wave of 10Khz bit 0 is converted to a sine wave of 20Khz). In order to "clear" the Mains frequency and make the wire available for the transmitter the 50/60Hz signal is filtered. This filter clears any signal of 50Hz to 60Hz. The transmitted data then are free to travel over the Mains. When they find their destination another 50 to 60Hz filter is involved. After the filter pass the remaining signal is the modulated transmitted data. This signal is now demodulated and converted to digital bits. 

Convert data in a transferable form (Modulation):

There are different ways to modulate digital bits to a transferable frequency. I'll describe the most commonly used types.

  • FSK – Frequency Shift Keying


In FSK modulation, digital information is transmitted through discrete frequency changes of a carrier signal. For example bit 0 is modulated to a sine wave of 10Khz and bit 1 to 20Khz.

  • FDM – Frequency Division Multiplexing


FDM is an encoding method of digital data on multiple carrier frequencies. This method allows simultaneous data transfer on the available frequency range. Firstly the information to be transmitted is separated to pieces. Each piece is modulated to a specific frequency in the available frequency range. Then all the modulated signals are multiplexed to a single signal ready for transmission. 

  • UPB – Universal Powerline Bus


UPB is a communication protocol specially designed for home automation devices. It uses power line wiring for signaling and control. The implementation can simple be done by charging and discharge a capacitor, forming spikes on the current AC signal.


The pulses can be placed on 4 different but specific positions on the current AC wave. It's like a 4 bit digital number.

The receiver can simple find the position of each pulse by first recognizing the zero crossing and then start counting since the pulse sense.

Available Transmission Frequencies on AC Power Lines

As in any communication so here a frequency table specifies the allowed transmission frequencies on Power Lines.

North America: 0-500Khz




 3 – 9kHz

 Electricity providers

 9 – 95kHz

 A-Band Electricity providers

 95 – 125kHz

 B-Band Clients of electricity provider

 125 – 140kHz

 C-Band Clients of electricity provider

 140 – 148.5kHz

 D-Band Clients of electricity provider

Electronic Filters:


  • Active Filters
  • Passive Filters

Filter Types

  • Low Pass​  


  • High Pass   


  • Band Pass   

BandPass_Filter_DIAGRAMBandpass_ActiveBandpass_Passive copy

  • Band Stop   




From theory to practice …


Project Description

  • "Weight bridge" – Remote Display
  • Receiver – Transmitter Design
  • FSK Modulation 72Khz Band-A


First Stage Filter. AC Power Line Filter

The first step of the project was to filter the AC 50-60Hz Power Line signal. The best way to block any other undesired signals than the communication frequency was to design a band pass filter allowing only the communication frequency zone (72Khz) to pass.

The filter was first designed and simulated in spice software. 


Simulation Output:


Great! it looks working as it was designed to.

Because on this project we are going to play with 220-110V 50-60Hz Mains AC the above filter was modified to be more secure for experimentation and human use in the future.


  • Between the 47uH inductor and 10K resistor a 1:1 transformer was added to isolate the main circuit from Mains.
  • In parallel with R1 (10K resistor) a TVS diode was added to protect the circuit from Mains voltage spikes. 


In continue to the above filter two more filters was included in the design. One for receiving signals and one for transmitting signals.

Receiver Filter

For the receiver a simple L-C Band Pass filter was designed to remove any remaining noise and undesired signals. 


Simulation Output:


Transmitter Filter

In transmission mode we don't want to transmit any noise higher than the transmission frequency. Taking advantage of the Power Amplifier, used to transmitte the output signal, i designed a Low Pass active filter


Simulation Output:


Looking on the internet about PLC solutions i found a bunch of different chips produced by the following companies:

  • STMicroelectronics
  • Microchip
  • Texas Instruments
  • Echelon
  • Maxim Integrated

A common rule i try to follow in most of my projects is to make simple and reliable designs. To do so i try to use as less chips as possible. From the above PLC solutions only STMicroelectronics offer's a chip that includes almost everything in one chip. The ST7540 PLC Modem including the Analog Front End as well as the Power Amplifier, all in a single chip solution looks to be the best choice. 

In this design i used one more chip. A common 8-bit MCU, the Atmel's Atmega168 to control the modem and hold the communication protocol. There is no specific reason why i used this MCU but it was the MCU i knew better.

The ST7540 Block Diagram


ST7540 Receiver Path


The receiver path of the ST7540. The receiving signal is captured on RX_IN pin. First crosses a Band Pass filter which filters once more the signal depending on the selected communication band. Next, the AGC (Auto Gain Control) manages to normalize the incoming signal so that it has the same "Volume" Gain along regardless of the signal strength variations that may occur during the communication. Finally the signal is filtered again, driven thru a frequency mixer to the demodulator where the signal is demodulated  to bits and be available on RxD Pin. 

ST7540 Transmitter Path


The Transmitter path of the ST7540. The transmitter includes a Power Amplifier with all of it's pins available on the chip footprint. That was one more reason why i chose this modem. I used PA_IN-, PA_IN+ and PA_OUT in appropriate connection with passive components so that it functions not only as a Power Amplifier but as a Low Pass active filter as well. The Current and Voltage loop is a great function that provides control of the output signal strength depending on the cable load and length.

The transmitter path starts with the TxD pin where the digital bits are captured. The FSK Modulator in combination with the DAC converts the digital bits to analog signal. This signal is then filtered and amplified properly to TX_OUT depending on the output Voltage and Current sense. 

Communication between ST7540 & Atmega168


The communication between the ST7540 modem and the Atmega168 can be established using SPI (Synchronous) or UART (Asynchronous)


SPI master-slave interconnection



For this project i chose SPI to establish a Synchronous communication between MCU and Modem.

Circuits: The project was designed in Eagle Cadsoft

  • The final circuitry scheme including all the above described filters. 


  • Full schematic of the final device


  • The PCB design to board





  • Difficulty on SPI Communication
  • Difficulty on data reception
  • Design/Develop data correction protocol. 

SPI Communication Problem

One of the main difficulties i came across on this project was the modem's SPI peripheral. In SPI communication it is used the peripheral device to perform in Slave mode while the Host device is functioning in Master.
In the specific modem (ST7540) the manufacturer has determined the SPI to function only in Master mode making the Host MCU to perform in Slave. 

This comes in contrasts with the basic concept of the implementation where the Host controls the line communication and defines the timing of transmission. The Host defines the synchronization clock as well as the start / end of the SPI communication.

SPI protocol in order to define the start / end of the communication requires an additional line the SS. By this line the Master can signal the Slave when the communication starts/ends. While the ST7540 is working in Master mode it doesn't include this additional line thus increases the difficulty of SPI synchronization. 

After a lot of hours of SPI debugging using logic analyzer and testing different combinations i found an unusual but working method. In order to enable the Slave's (Atmega168) SS pin to indicate SPI's start/stop i used another pin of the same MCU and not one of the ST7540 (while it wasn't included).

So by checking the CD_PD line (carrier frequency detect line) of the ST7540 the MCU knows when there are available data for reception in ST7540. If the MCU detect available data enables the SS pin and the SPI communication starts by receiving the available data. When the data reception ends thus the CD_PD pin has changed state to indicate that there are no more available data the MCU restores the SS pin to its initial state disabling the SPI and clearing the SPI bit counter used to synchronize the communication. 

This method is like deceiving the SPI while the same (Slave) device enables its SS pin. 

Data Correction Protocol

Once successfully completed the data transmission between the ST7540 and the Atmega168 one more problem occurred. After several data transmissions and monitoring the transmitted data using Oscilloscope and Logical Analyzer it observed that many times the data received differed from those sent.

After studying the taken measurements it was found that the received data were not wrong in their content but in the bit sequence. The received bytes were shifted one or more bits to the left thus some of the most important bits were lost in the transmission.

To prevent and automatic correct the received data from possible "undesired shifts" a correction protocol was designed.

On the following example i randomly added 2-shift error on New byte 2 and 1-shift error on New byte 1

Protocol Steps:

  • Transmitter:
  1. The byte to send is first separated to two nibbles.
  2. Nibble 1 and Nibble 2.
  3. The header 0x10 is logical AND at each new byte
  4. The new bytes (New byte 1 and New byte 2) are ready to be send
  • Receiver:
  1. The receiver makes a logical AND to the received byte with 0xF0 and check's if the header is > 0x10. The main idea is to check if the received byte's header is 0x10 or it is shifted left. 
  2. If it's > 0x10 it means that the received byte was shifted left. So the receiver shifts the byte one bit right and checks again. 
  3. This procedure is repeated until the header of the received byte become 0x10.
  4. When the header becomes 0x10 it "means" (if the byte was really shifted) that the right half byte (nibble) is the correct half byte that was first sent from the transmitter.
  5. The same procedure is repeated for the the "New byte 2"
  6. The two right halves of the received bytes are then combined to one new byte which is the final byte to read. 




For safety reasons the power strip where the PLC modules were connected during the tests was modified by adding a four contact switch with light indicator and a fuse.  

Before After

An extra fuse was added to each power cable used to connect the PLC module. 

The Mains 50-60Hz filter was built in a separate removable PCB for extra protection. The PCB was also wrapped with heat shrinkable avoiding user contact to Mains. 



More Photos:

Debugging … Flashing and Debugging again … 



The final project connected on the Mains.


The module board.


The Mains 50-60Hz filter was developed in a separate removable PCB for protection reasons.


The 50-60Hz filter was also wrapped with heat shrinkable avoiding user contact to Mains


RS232 to UART converter.


Modified wall plugs 12V 1A used to power the PLC modules.


First Blinking Led Test.

Final demonstration

The source code as well as the PCB & Schematic can be found here:



Project presentation at 1st Innovation Festival Technological Educational Institute of Piraeus (Video in Greek)





  • 05/04/2014 - 22:24 | Permalink

    Congratulations man, the work done here is awesome. Very well documented and explained. It's nice to see a work in PLC improving far from the old X-10.

    Keep going!

    • 06/04/2014 - 17:06 | Permalink

      Thank you very much for your good words! Thank you for reading!

  • con-f-use
    06/04/2014 - 13:01 | Permalink

    You should have a small SMD version of this fabricated. You could sell it on or make a kickstarter. It should include the filters with porper clearance and isolation gaps. I bet it would sell like crazy. I've been looking for something like this.

    • 06/04/2014 - 17:06 | Permalink

      Thank you very much for your interest and your good words! You may like also this project

  • manosv
    07/04/2014 - 08:55 | Permalink

    Ωραιο Project πατριωτη.Very nice project and well documented congrats.

  • Dave Etchells
    07/04/2014 - 16:35 | Permalink

    Wow, great work! Very clever faking-out of the SPI connection, and correction of the bit-shift errors. Must have been a real nightmare to debug, congratulations on your ultimate success!

  • 08/04/2014 - 09:49 | Permalink

    Pretty! This waas aan incredibly wonderful article. Many thanks
    foor supplying this info.

  • 08/04/2014 - 18:32 | Permalink

    Would you be able to adapt this for use on an electric fence line? (I've previously googled electric fence communication patent and got a bunch of results)

  • 17/09/2014 - 05:36 | Permalink

    Wow! Finally I got a weblog from where I know how to in fact get helpful facts concerning my study and knowledge.

  • 23/09/2014 - 23:05 | Permalink

    I lie the helpful information you supply to your articles.
    I’ll bookmark your blog aand check again here regularly.

    I’m reassonably sure I will be informed a lot of new stuff proper right here!
    Good luck foor thee next!

  • Raj
    17/10/2014 - 14:02 | Permalink


           I am doing the same project, could you please share the source code. 

    Thanks and Regards,



  • ronald
    19/11/2014 - 11:15 | Permalink

    what aplication you used to simulate the transmision filter output ?

    • 20/11/2014 - 19:23 | Permalink

      The application i used to simulate the transmission filter output is pspice. 

  • seetharaman
    27/11/2014 - 08:08 | Permalink


    I'm also working on the same project. I bought st7540 eval kit, and right now we have an issue. The cd/pd pin goes low very often, it seems to detect noise as carrier signal. I tried with both the evaluation kits, im able to find no difference.We are interfacing with spi, so we get junk clock pulses when cp/pd goes low. Have you faced a similar issue before,



  • Annalien Steyn
    04/12/2014 - 15:32 | Permalink

    Hi, I am working for an electronic component manufacturer.  We just released a product that communicates dsi commands over mains via a gateway to dim and switch lights.

    Is my understanding correct that our system works on the principle you explained here?

    (ps.  I only have a building management system background) 🙂 Your explanation is so clear and easy to understand even to the layman.



  • Prithvi
    03/03/2015 - 16:31 | Permalink

    The project you've done seems very interesting which has attracted me to take up the same as my project for partial fulfillment of my course work. So far it has gone well, now i'm facing a problem regarding the coupling filter design and code dumping. Please HELP! 

    Thanks in advance.

    • 03/03/2015 - 20:17 | Permalink

      Hello Prithvi,

      Thank you for your interest about my project. What excatly is your problem you are facing at? 

  • s.m
    13/04/2015 - 09:50 | Permalink


    my problem is that there is no output signal on the base PA_OUT

    basic signal domain TX_out there is very little

    carrier signal should always be available,or just send the information by time and spi to be created

    thank you

    • 14/04/2015 - 21:43 | Permalink

      Check your connections on ST7540 signal output to ST7540 Power Amplifier 

      • Kartik
        09/07/2015 - 09:45 | Permalink

        Hello Haris

        Good Work man!

        But I need to more about the isolation transformer. How you made that? 

        Please elaborate.  

  • s.m
    20/04/2015 - 11:54 | Permalink


    thank of the answer

    I think on the base TX_out its not, justsome noise output.

    signal range on the base TX_out how much should be?

    thank you

  • s.m
    20/04/2015 - 13:21 | Permalink


    If the output st7540 is only associated with micro?

    If we do not have spi communication carrier wave output does not appear?

  • Sergio
    10/05/2015 - 01:16 | Permalink

    hi, great job!!

    Can you write the value of tr1? And where i can buy.

    Thank you.


  • Kim
    16/01/2016 - 16:54 | Permalink

     how many of these PLC's its posible to use in one system i mean like master – slave comunication. If i want for one to receive and send all info to others. 

    • 27/12/2016 - 15:19 | Permalink

      really attractive site with good content and updated topic,providing valuable information

    • 28/12/2016 - 08:18 | Permalink

       I found you’re blog via Google and I have to say. A Massive Thank you so much, I believed your article was extremely informative
        I will revisit to see what further great information I can receive here.

  • Me
    26/01/2016 - 21:50 | Permalink

    Mains lines are unshielded.  Any signal you send over them is also radiating into space in the form of radio waves.  In your opening you mentioning sending data at nearly 200Mbps. Later you mention the legal frequency ranges for powerline communication in Europe and North America.  You can't squeeze a 200Mbps signal into 500khz of bandwidth!  You must be talking about going outside the legal bands. The band limits are there to keep you from interfering with all of the various radio services, broadcast, emergency, military to name a few!

    Using one's house wiring to get information from one room to another is a neat trick. You also mentioned using the national electricity transmission grid. This has been tried before as a way to provide internet access. It caused horrible amounts of interference to all sorts of licensed radio services. Data over powerlines is one of those things that sounds like a nice idea at first but is a really bad one in practice.

  • Sam Kirkman
    08/02/2016 - 01:06 | Permalink

    Hi Haris,

    If you plan to manufacture and sell these at a cheaper price than existing powerline adapters, I will be looking to buy a lot of them.

  • hakim
    11/02/2016 - 17:22 | Permalink

    interesting project, keep innovating bro..

  • 31/03/2016 - 01:32 | Permalink

    Hello Friend! Great job , REALLY became interested in making one for my home automation. You could provide the lay out of the ST7540 board ? Thank you and Congratulations !

  • 29/04/2016 - 15:06 | Permalink

    Hello, great work.

    Actually, I am working in a project like this. I am trying to build Powerline Communication and expected to work in 24 V DC. But, up untill now, I am still unable to read the control register. Do you have any suggestion?
    anw, here's the code that I use and we are using arduino nano as the host.

    #define RXTX      15
    #define BU_THERM  A0
    #define REG_DATA  16
    #define CD_PD     6
    #include "spiCustomS.h"
    #include "spiCustomS.c"

    byte a, b, c;

    void pinSetup() {
      pinMode(RXTX, OUTPUT);
      pinMode(REG_DATA, OUTPUT);
      pinMode(CD_PD, INPUT);
      pinMode(BU_THERM, INPUT);

    void tx_mode() {
      digitalWrite(RXTX, LOW);

    void rx_mode() {
      digitalWrite(RXTX, HIGH);

    void data_mode() {
      digitalWrite(REG_DATA, LOW);

    void cr_mode() {
      digitalWrite(REG_DATA, HIGH);
    void receiveData(){

    void sendData(){
    void ST7540_read() {

    void ST7540_write() {

    void setup() {
      uint8_t temp = 0;
      digitalWrite(REG_DATA, LOW);
      digitalWrite(RXTX, HIGH);


    ISR (SPI_STC_vect)
      /*while ((PINB & (1 << SCK)) != 0);
    void loop() {
      //Serial.write(a); //Serial.print("  ");
      //Serial.write(b); //Serial.print("  ");

      // put your main code here, to run repeatedly:

  • Matías
    01/06/2016 - 19:40 | Permalink

    Very nice project! A little question about your AC Power Line filter, which kind (and more specs if you don't mind) of capacitor did you use for manage such high voltage?

  • spelectro
    16/10/2016 - 19:37 | Permalink

    hey ive a minor project in my btech 5th sem in which ive this topic simulation of power line carrier can you give me idea that from where i can get the stuff for this…..

  • 25/10/2016 - 14:08 | Permalink

    It’s nearly impossible to find experienced people for this topic, but you seem like you know what you’re talking about!

    • 31/10/2016 - 22:45 | Permalink

      Thank you!

      • yoram madar
        17/05/2017 - 11:18 | Permalink

        Hi there, I'm looking for experienced person to help us build such communication for our own use, will pay good money for it



  • George Goldsmith
    26/02/2017 - 03:05 | Permalink

    Do you have a Bill of Materials that you can provide? Great work. I'm investigating using PLC to help make renewable energy systems more sustainable by automating power connection/disconnection based energy consumption and payment. PLC can potentially greatly reduce total cost of this payment management system by not requiring additional communications lines. Thanks.

  • Bas
    18/03/2017 - 17:59 | Permalink

    I build your application and i have some problems with iniitalizating the ST7540 chip in the software.

    When i try to debug it, it constantly waiting in the while loop for detecting a clock edge.

    //Wait for SPI rising edge

    Do you know this problem and do you have any solution?


    Thank you in advance!

  • tfgt
    11/04/2017 - 10:13 | Permalink

    Avant de faire la réalisation dans la pratique, est-il un logiciel pour simuler cette communication par CPL et merci ??

    • tfgt
      11/04/2017 - 10:18 | Permalink

      Before doing the realization in practice, is there a software to simulate this communication by CPL and thanks ??

  • Rachid
    07/06/2017 - 14:02 | Permalink


    Thank you for sharing experience,
    My question is, if I can test the ST7538Q all alone with an ARDOUINO, without power line connection.

    Thanks man.

  • amir ezz
    25/11/2017 - 23:15 | Permalink


    thanks for great jop.

    can i send only one way transmition signal without using the st7538.

    thanks in adavnace

    • 26/11/2017 - 21:58 | Permalink


      ST7540 is the actuall modem. So without that you can’t send or receive any data. If you want to send a less bit signal there are other ways or protocols that can be used such as a simple capacitor discharge  

  • Juliano
    06/04/2018 - 15:50 | Permalink

    Hello… Did you tested this project in a major distance? (From several rooms) It worked well? How long in range do you think it can sent and receive well? Did you tried to do interference in the mains, like shower dimmer on (or other) at the same time? Thanks in advance…  And Sorry for my horrible engllish…!

  • Phil Walker
    07/05/2018 - 21:00 | Permalink

    Great project but the update time of the remote display seems very sluggish
    I was expecting almost istantaeneous update times

  • Leave a Reply

    Your email address will not be published. Required fields are marked *