The LC01 has four terminals. Two terminals for input and two terminals for output. These terminals accept AC voltage between 80-275:
Caution: Do not supply voltage beyond the maximum voltage range.
Terminal Description (LC01)
IN
- L – Input Live (L)
- N – Input Neutral (N)
OUT
- L – Output Live (L)
- N – Output Neutral (N)
- 1 – Live (L)
- 2 – Neutral (N)
- 3 – Earth (E)
Strip about 1 inch of the outer insulation from the cable. Then, strip the insulation from the blue and brown wires. The green wire is not used.
Using a Phillips head screwdriver (make sure it matches the size of the screws), loosen the two IN L and N screws by turning the screwdriver counterclockwise. Do not over-loosen the screws, as this may cause them to fall out of the terminal. As you loosen the screws, you will notice a widening gap between the plastic housing and the metal terminal.
- Connect the other end of the LIVE wire (usually brown) to the terminal IN (L). Then, using the screwdriver, tighten the screw clockwise.
- Connect the neutral wire (usually blue) to the terminal IN (N). Don’t tighten the screw yet because this terminal share the both input and output.
- Connect its live wire (usually brown) to terminal OUT (L). Then tighten the screw clockwise using the screwdriver.
- Connect its neutral wire (usually blue) to terminal 4 (Output Neutral). Now tight the screw to secure both neutral wires.
NOTE: If your device has an earth/ground wire, connect it to the earth/ground wire of the plug cable. Use a connector rated for AC power to join the wire ends.
After connecting both the power code and the street light (or any other appliance), your wiring connections should look something like this.
The following diagram shows the full wiring diagram:
We use The Things Stack as the LoRaWAN Network Server to register our LC01 LoRaWAN relay. We assume there is a The Things Network community providing LoRaWAN coverage in your area. If not, you can create LoRaWAN coverage by registering one of our LoRaWAN gateways with The Things Stack.
If you haven't already, create a new account with The Things Stack (Sandbox) and log in to the console. First, we will create a new application in the Things Stack.
- On the home screen, click the + Add application button.
- On the Create application page, enter an Application ID to identify your application within The Things Stack and provide an Application name. Read https://thethingsindustries.com/docs/integrations/adding-applications for more information on how to do that.
- Click the Create application button.
- After creating the application, you will be redirected to the Application overview page.
- On the Application overview page, click the + Register end device button.
- We use Over The Air Activation (OTAA) to activate LC01 with The Things Stack. OTAA is the most secure way of activating an end device with a LoRaWAN network server.
- On the Register end device page, select the ‘Enter end device specifics manually’ option under the input method.
- Select the correct Frequency plan and LoRaWAN version. The Regional parameters version will appear automatically based on the LoRaWAN version.
The Frequency plan should match the frequency of the LC01.
- Make sure the Over the air activation (OTAA) is selected by default.
- Select Class C (Continuous) from the Additional LoRaWAN class capabilities dropdown list.
- Using the registration information sheet that comes with the LC01,
- Fill the JoinEUI. The LC01 uses AppEUI instead of JoinEUI. You can enter it in the JoinEUI text box. Then click the Confirm button.
- Enter the DevEUI and AppKey.
- Enter an End device ID that can be used to identify your LC01 within this application.
Click the Register end device button.
- After the end device is created, you will be redirected to the Device overview page.
- Click the Live data tab. You can see a few entries as shown in the image below.
Now plug the power cord into the wall outlet. The diamond-shaped RESET button on the LC01 will blink once. You can also see the status of the join request processing on the network server side under the Live data tab.
Now we are going to control the LED Street light from The Things Stack.
- Click the Messaging tab.
- Make sure the Schedule downlink tab is selected.
- We use FPort 1 for sending downlinks.
- Ensure Bytes is selected as the Payload type.
- To turn on the LED street light, enter the payload 06 01 (in HEX) in the payload field.
Then, click the Schedule downlink button.
- You should see the LED street light turn on within a few seconds. (Some delay is expected with LoRaWAN downlinks.)
If you are in an area with poor LoRaWAN network coverage, the network might not be able to deliver the downlink to your device.
- To turn off the LED street light, enter the payload 06 00 (in HEX) in the payload field.
- Then, click the Schedule downlink button.
- You should see the LED street light turn on within a few seconds.
LoRaWAN uplink and downlink payloads are encoded. To understand the data, you need a small script to decode them. We use a JavaScript function for this. It is called a payload formatter. It reads the payload and extracts useful information, such as relay status, event type, and timestamp. We have written a JavaScript function to decode uplinks from the LC01 device. Here is an example of a decoded payload:
Payload: 00 00 00 06 03 00
After decoding:
{
"Event": "HEARTBEAT_EVNET",
"LoraNode": "LC01",
"RelayStatus": "CLOSE",
"Timestamp": 6
}
To add an uplink payload formatter code to The Things Stack, follow the steps below:
- Go to your LC01 device page and click Payload formatters.
- Click, Uplink.
- Select ‘Custom Javascript formatter’ from the ‘Formatter type’ drop-down list.
- Now copy the Uplink Formatter code from here: dragino-end-node-decoder/LC01/LC01_V1.0.0_TTN_Decoder.txt at main · dragino/dragino-end-node-decoder · GitHub
- Then paste it in the ‘Formatter code’ box:
You can now test the formatter code with a sample payload.
- Enter 00 00 00 06 03 00 in the ‘Byte payload’ box.
- Change the FPort to 2 (because our payload formatter only accepts uplinks from FPort 2).
- Click the ‘Test decoder’ button.
The payload will be decoded into the following JSON object and shown in the 'Decoded test payload' box.
{
"Event": "HEARTBEAT_EVNET",
"LoraNode": "LC01",
"RelayStatus": "CLOSE",
"Timestamp": 6
}
To save the payload formatter, click the ‘Save changes’ button.
After applying the uplink payload formatter, you can see that all uplink payloads shown in the Live Data section are decoded into fields. See the screenshot below.
Integrating with ThingsBoard / ThingsEyeThe same instructions are applied to both ThingsBoard and ThingsEye.Conclusion
This project demonstrates how LoRaWAN technology can be effectively used for remote control of electrical appliances, enabling long-range, low-power wireless communication. By integrating the LC01 LoRaWAN relay with an appliance and configuring it through a LoRaWAN network server, you have created a simple yet powerful IoT solution. This setup is ideal for smart home applications, industrial automation, and energy-efficient remote switching in areas with limited internet connectivity. With this foundational knowledge, you can now expand the system to control multiple devices, schedule tasks, or integrate with cloud-based dashboards for monitoring and control.
Comments