In this project, digital data is transferred over AC lines using two GreenPAK SLG46620V IC’s, along with two KQ-330F power line communication modems. The basic objectives of the project are:
- To enable a power distribution company to gain control over consumer electrical appliances.
- To allow the consumer to check the power consumption and power status of various appliances via the internet. We used a test webserver for this purpose.
In this project, 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.
Below we described steps needed to understand how the solution has been programmed to design the power line communication. However, if you just want to get the result of programming, download GreenPAK Designer Software to view the already completed GreenPAK Design File. Plug the GreenPAK Development Kit to your computer and hit the program to design the solution.
1. Hardware SchematicThe hardware schematic is shown below:
As you can see in Figure 1, the status of all 8 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.
2. KQ-330F Power Line Communication ModemThe 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.
Figure 2 shows the module pinout. The connections of two KQ-330F used in the project are shown in Table 1.
Table 1. KQ-330F Hardware Connections
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.
4. PLC Data SenderThis 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 10 data bits (start bit, 8 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.
Table 2. Counter outputs and Button status bits
4.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.
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.
4.2. Basic Building Block of Data Stream
In the GreenPAK design, we used LUTs to concatenate the 10 packet bits and output them on Pin12.
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.
5. SLG46620V for Receiving Data from KQ-330FThe 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.
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.
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:
Table 3. Serial Data from KQ-330F mapped on SLG46620V 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.
The data received from consumer via the power line modem is received in a custom-built Visual C# application.
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.
In this project we demonstrated how to use a pair of the GreenPAK SLG46620V IC’s and a pair of KQ-330F Power Line Communication Modems to remotely control power for up to eight 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.
Comments