Python program on raspberry pi to communicate on power, using KQ330 PLC (Power Line Communication)
The PLC can transmit the data via power line, which are suitable for either residential (at-home) or commercial (offices, apartments, hotels, warehouses) network applications, which utilize power lines. No need to install new wires this module works is a single-row 9-pin small-sized high-performance carrier data transceiver module. Specifically designed for reliable transmission of high-speed data in 0V-220V AC/DC and non-powered environments (such as pipelines and earth, a signal line and earth, two signal lines, 12V AC/DC power lines, etc.) And developed cost-effective carrier modules. Suitable for industrial control, railways, community intelligence, smart home, building control, and other applications that require carrier transmission of data. Transmission distance up to 2.5Km (power line). The actual highest carrier rate is 2400 BPS. other features are :
These instructions will give an idea about the pin connection of KQ330 and a basic program to communicate with PLC.
for the basic of serial communication with only TX-RX between raspberry pi refer * serial communication
A step by step process for running (since i didnt find the data sheet of KQ330 this was made by observing other projects and video)
pin connection
there are totally 9 pins as shown
* pin 1 for 230V AC power
* pin 2 for 230V AC power
* pin 3 5V DC supply if its used as transmitter
* pin 4 GND supply
* pin 5 5V/3.5V DC supply if its used as receiver
* pin 6 RX pin should be connected to TX of the controller
* pin 7 TX pin should be connected to RX of the controller
* pin 8 & 9 i didnt had to use
Consider running this write(1).py basic program of sending seconds every second using import time
on one of the Raspberry Pi with transmission connection with KQ330 i.e
* pin 1 for 230V AC power
* pin 2 for 230V AC power
* pin 3 5V DC supply if its used as transmitter
* pin 4 GND supply
* pin 6 RX pin should be connected to TX of the controller
since serial communication is working from tx port and not from USB
port='/dev/ttyAMA0',
baudrate of KQ330 is 9600 as per the specification, but do try with 100 (it works only for 1 second with 5V power )
baudrate = 9600,
keep transmitter KQ330 as far as possible while coding if its connected to AC Power line
:bomb:
Consider running this read_v1.py basic program for receiving data on one of the Raspberry Pi with receiver connection with KQ330 i.e
* pin 1 for 230V AC power
* pin 2 for 230V AC power
* pin 5 5V/3.3V DC supply used as Receiver
* pin 4 GND supply
* pin 7 TX pin should be connected to RX of the controller
since serial communication is working from rx port and not from USB
port='/dev/ttyAMA0',
baudrate of KQ330 is 9600 as per the specification, and should be same as tranmitter side.
baudrate = 9600,
this re.sub is used to filter the other character and symbols which gets read by disturbance
to check the real value which is received use
print x
or to filter other characters from the string use
z=re.sub('[^0-9]', '', x)
for other filter options refer
what i asume is
* Happy coding !!!