Previously we introduced how to remotely control LED by using IBoard and LEWEI50 server, in fact, we only need to do a few modifications on it to achieve control on ITEAD intelligent switch.
ITEAD intelligent switch uses 433MHz wireless module for communication, so we need to add a 433MHz transmitter modules on IBoard, then you can send commands to ITEAD intelligent switch to control lighting in the house. For specific 433MHz wireless control protocol, you can refer to “ITEAD Intelligent Switch 433MHz Communication Protocol”
Each intelligent switch has a separate IDKEY, but this group of IDKEY was not printed on the product but in the factory code, so we need to read IDKEY of the switch to be controlled. We can use ITEAD Intelligent Switch Protocol library introduced last time (Click HERE).
ITEAD Intelligent Switch Protocol library uses interruption pin D2 as data input pin of 433MHz receiver module, which is IRQ pin of nRF24L01 interface on Iboard, the IRQ pin is to be connected to the DATA pin of 433MHz receiver module. Connection diagram is shown as below:

Open demo program in ITEAD Intelligent Switch Protocol library, download it onto Iboard. Then we can use serial monitor software such as AccessPort to read the serial output data (serial baud rate is 115200). Click touch button of intelligent switch, a "tick" sound indicates that the switch has issued the current switch information, and then we can see information received by IBoard in software monitor window. In the example, the return value of the intelligent switch "0×07000403", the first eight-bit data is the current switch state, "0×06" indicates the state of ON, "0×07" indicates the state of OFF. What we need is the last 24-bit data, "0×000403" is IDKEY of the intelligent switch.

Then we need to connect IBoard to 433MHz transmitter module, and Iboard will send high and low levels to data pin of 433MHz transmitter module to achieve wireless data transmission commands, while when the intelligent switch receives the switch information of corresponding IDKEY, it will change the current switch status accordingly and send out information of current switch status. In this example, we will use A0 as output pin of 433MHz transmitter module. Plug in the network cable and connect it with the router. The actual circuit diagram is shown as below:

In order to connect to LEWEI50 to control via Ethernet, we need to download related Arduino code of LEWEI50, and the downloading address is: GitHub - lewei50/LeweiClient: An arduino example(HTTP) with Lewei50 (IOT) platform for free use ..
Then download the Demo program we made for control of intelligent switches.
As we introduced before, modify user key, the corresponding gateway and sensor information.
After setting up the contents in the website, open the demo program for control of intelligent switch with Arduino IDE. Replace the "LW_USERKEY" value with user KEY, "LW_GATEWAY" value with gateway ID value, "MY_NAME" value with gateway name value, "MY_DESC" value with gateway name value and the ID value to define intelligent switch with the abbreviations value of control device.
The above operations are the same as using IBoard to control LED, so I will not repeat. For specific operation, you can refer to this article “To Remotely Control The LED with IBoard”.
If the value you use is the same as that we described in the article, then the "LW_GATEWAY", "MY_NAME", "MY_DESC" and intelligent switch ID value in the DEMO program will need no modifications, otherwise please modify in the code according to the values that you filled.
We use A0 of IBoard to control 433MHz transmitter module, so we need to replace TX_PIN value in the code with "A0" and also put IDKEY value of intelligent switch read via the window previously into the corresponding value of “IDKEY” in the code, which is "0×00000403" in the example.

After compiling, download the program onto IBoard via Foca.
Since the routine for control of intelligent switch requires cross-segment network, we need do some configurations on the router, for configuration method, you can refer to “To Remotely Control The LED with IBoard”as well.
After configuration, enter "User center" on LEWEI50 webpage, click the "My Device" button under "My LEWEI50 device" directory, under the "Control" column of "Control Devices" list, we can see the icon of intelligent switch, its color will change each time when the icon is switched. When the color of switch icon is blue, it indicates that the switch is open and intelligent switch will be turned on; when the color of switch icon is red, it means the switch is closed and intelligent switch will be turned off; when the color of switch icon is gray, it indicates switch is open while Iboard is not connected yet.
LEWEI50 also provides cellphone software, so that we can control intelligent switches with smart phone. Downloading address for mobile software is: http://www.lewei50.com/home/sitecontent/downloads.
After installing the software, click "LEWEI50" icon on the phone, after entering the login interface, enter the username and password when registered, then click on the "Login" button. Next, the control interface will appear on the screen, click on the "reverse control" icon, the cellphone will automatically search for controllable device which will skip to the "controllable device list". In the list, we can see the defined intelligent switch "dummy-da" options, and the right icon indicates the status of the switch, among which, gray indicates that switch is shut off and blue indicates the switch is ON. You can change the state of intelligent switch by clicking the icon.

As LEWEI50 provides only one-way control instead of two-way feedback mechanism, we can turn on/off the intelligent switch in the house through the webpage, but the intelligent switch state cannot be synchronized to the corresponding position of the page. If you shut down the intelligent switch manually, it may still show the original state on the page – of course, we can create a sensor in LEWEI50 to monitor the status of each switch in the house. We do hope that LEWEI50 can provide a two-way interface to allow webpage to control a device as well as to receive device feedback and to synchronize status.
More about this article: To Control ITEAD Intelligent Switch via Ethernet