AN-1188 Power Line Communication to Send Digital Data using GreenPAK™

In this application note, digital data is transferred over AC lines using two Silego GreenPAK™ SLG46620V CMIC IC’s, along with two KQ-330F power line communication modems. The basic objectives of the application note are:

In this application note, eight appliances are controlled using one SLG46620V and their power status (whether the appliance is ON or OFF) is sent back using another SLG46620V. The data communication is carried out over the KQ-330F.

Hardware Schematic

The hardware schematic is shown below:

Hardware Schematic

Figure 1. Hardware Schematic

As you can see in Figure 1, the status of all eight appliances is fed to SLG46620V pins after passing through corresponding relays. The contact of the relay is fed with a 5v signal, which is the same voltage supplied as VDD. When the device is powered off by the consumer or by the Power Distribution Company, a low appears on the SLG46620V’s Digital Input pin for the corresponding appliance. This data is sent to the KQ-330F, which converts the data to a suitable baud rate for the KQ-330F.

Similarly, the data from the Power Distribution Company is received serially by SLG46620V from KG-330F. The data is then distributed to up to 8 corresponding appliances, which are operated using 5v opto-isolated relays.

It must be noted that power line communication is prone to data corruption. To avoid this, the wires used on the DC side should be very short.

KQ-330F power line communication Modem

The KQ-330F is a single 9-pin small size high performance data transceiver module. It works with 220V AC, and operates at a serial baudrate of 9600bps.

KQ-330F Module

Figure 2. KQ-330F Module

Figure 2 shows the module pinout. The connections of two KQ-330F used in the application note are shown in Table 1.

Sr. No. Pin No Connections on Consumer Side Connections on Power Distribution Company Side
1 1 Not Used Not Used
2 2 Not Used Not Used
3 3 PIN 10 of SLG46620V (PLC Data Receiver) Rx of COM port module
4 4 PIN 12 of SLG46620V (PLC Data Sender) Tx of COM port module
5 5 5V 5V
6 6 Ground Ground
7 7 5V 5V
8 8 AC (Live or Neutral) AC (Live or Neutral)
9 9 AC (Live or Neutral) AC (Live or Neutral)

 

Table 1. KQ-330F Hardware Connections

GreenPAK Design code

There are two SLG46620V IC’s used in the design. One is for sending data to the KQ-330F and the other for receiving data from KQ-330F.

PLC Data Sender

This design reuses the SLG46620V design from AN-1156 Fall Detection Alert using GreenPAK.

Rather than rewriting the design explanation, please refer to AN-1156.

During normal operation of the 4-bit DFF counter, it counts from 0000 to 1001. Since we have to process ten data bits (start bit, eight status bits, stop bit), after reaching the 10th state (1001), we need to reset the counter to its initial state (0000) in the next cycle. The AND gate (3-L3) resets the 4-bit counter before going to 11th state of the counter where Q4 and Q2 are high.

Sr. No. Q4Q3Q2Q1 Decimal Data
0 0000 0 Start Bit (0)
2 0001 1 Appliance 1 Status
3 0010 2 Appliance 2 Status
4 0011 3 Appliance 3 Status
5 0100 4 Appliance 4 Status
6 0101 5 Appliance 5 Status
7 0110 6 Appliance 6 Status
8 0111 7 Appliance 7 Status
9 1000 8 Appliance 8 Status
10 1001 9 Stop Bit (1)

 

Table 2. Counter outputs and Button status bits

1. Concatenating Start bit, 8 digital status bits, and Stop bit

In this section, the 10 bits (start bit, 8 button status and stop bit) will be routed to PIN 12 one at a time. The structure of an example data stream is shown below.

Example Serial Data stream

Figure 3. Example Serial Data stream

Figure 3 shows that the output on PIN 12 should be typically HIGH. When we are ready to send data, we send a START bit (0), followed by the 8 status bits and a STOP bit (1) at the end of the packet.

2. Basic Building Block of Data stream

In the GreenPAK design, we used Lookup tables (LUTs) to concatenate the 10 packet bits and output them on Pin12.

Concatenation of Data Stream

Figure 4. Concatenation of Data Stream

When ENABLE_WRITE is LOW, Pin12 outputs HIGH. When ENABLE_WRITE goes HIGH, the multiplexers are used to sequentially pass the packet bits to Pin12.

After the bit indicating the status of Appliance 8, a stop bit (VDD) will appear at the output. We then reset the counter.

Pin12 is connected to the KQ-330F. Since we desire a baud rate of 9600, and 9600-1 = 0.000104, the CLK signal from the GreenPAK’s CNT0 is set to 104µs.

SLG46620V for receiving data from KQ-330F

The serial data from KQ-330F TX pin is connected to Pin10 of the PLC Data Receiver GreenPAK. Inside the GreenPAK, Pin10 is connected to the SPI Block’s MOSI input.

Serial Data from KQ-330F received in SLG46620V

Figure 5. Serial Data from KQ-330F received in SLG46620V

Our objective in this section is to convert the serial 8-bit packet into 8 parallel bits. To accomplish this, we need to feed the serial bits into the SPI block with the correct timing.

Signal Waveforms

Figure 6. Signal Waveforms

Figure 6 shows the desired signal waveforms, where:

  • Yellow: Pin7 (nCSB)
  • Blue: Pin10 (PLC Tx Data IN)
  • Pink: Pin6 (SCLK)

We detect a START bit with the P DLY0 configured as a falling edge detect, since we know that the line will typically be HIGH but a START bit is LOW. That edge detect is used to set SR latch 3-bit LUT0, which will then output HIGH. 152µs later, CNT5 will output HIGH, triggering the second SR latch 3-bit LUT1. We waited 152µs to make sure that the first SCLK occurs in the middle of the first serial bit transmitted, which is the first “1” in Figure 6. Both SR latches will be held HIGH until 8 counts of SCLK have occurred, then they will be reset by the output of DLY9. Inverter 2-bit LUT3 is used to gate both SCLK and the chip select input to the SPI block, nCSB. CNT6 is used to create our 9600Hz clock source.

When the serial data packet reaches the SPI block, it is converted into parallel bits, which are mapped as shown in Table 3:

Sr. No. Serial Data SLG46620V Mapped Pin
1 Device 1 status 12
2 Device 2 status 13
3 Device 3 status 14
4 Device 4 status 15
5 Device 5 status 16
6 Device 6 status 17
7 Device 7 status 18
8 Device 8 status 19

 

Table 3. Serial Data from KQ-330F mapped on SLG46620V Pins

Data at output pins

The serial data is converted into parallel data, and is output on pins 12:19 via the SPI Parallel Output Block. Each output pin can be used to drive an appliance via 5v opto-isolators.

SPI Parallel Output Block Pins

Figure 7. SPI Parallel Output Block Pins

Data Management at Power Distribution Company Network

The data received from consumer via the power line modem is received in a custom-built Visual C# application.

Visual C# Application for Receiving/Sending Data to/from consumer

Figure 8. Visual C# Application for Receiving/Sending Data to/from consumer

This application is extremely easy to use. First, the user selects the serial Com Port that is connected to the KQ-330F. Then the user needs to select 9600 in the Baud Rate combo box. If everything is connected properly, pressing the ‘Open Port’ button will cause the status bar to start filling green.

After this, the personnel at Power Distribution Company can fully control the consumer appliances by turning ON/OFF any connected appliance. The status of all the appliances will update accordingly on the C# application, and can also be posted on a webserver so that the consumer can view the status of their appliances.

Device Status displayed on the internet

Figure 9. Device Status displayed on the internet

Conclusion

In this application note we demonstrated how to use a pair of Silego GreenPAK SLG46620V’s and a pair of KQ-330F Power Line Communication Modems to remotely control power for up to 8 appliances. We created a Visual C# application for a user interface.

This concept can be scaled for many consumers and appliances, since one power distribution company could have several thousand customers.

About the Author

Name: Bilal Ahmed

Background: Bilal Ahmed received an MS in Electronics Engineering from NED University, Karachi. He has more than 10 years of experience in PLC, SCADA, Data acquisition, Industrial automation, Robotics and Embedded systems. Currently he works as Head of Embedded systems and Robotics in HF Electronics.

Contact: appnotes@silego.com

 

Files



See full list of Application Notes

© 2017 Silego Technology. 1515 Wyatt Drive, Santa Clara, CA 95054.
Facebook LinkedIn Twitter YouTube Google