In addition to the use of intelligent transit box, you can also use other devices with 433MHz wireless communication module to control ITEAD intelligent switch. To facilitate DIY designs, we provide a customized intelligent switch communication library (Arduino version), with which you can simply call send and receive functions of 433MHz to control intelligent switch by using Arduino control panel and 433MHz wireless module.
Next, I will briefly explain some of the functions in the library "ITEAD Intelligent Switch Protocol":
Switch.Init(baud)
Function: initialize intelligent transit box, including baud rate of serial port, setting transmission pin as output and initializing receiving interruption, etc.
Parameter:
baud:baud rate of serial port
Switch.PAIR()
Function: Send request pairing command 0×40000000
Switch.ON(IDKEY)
Function: turn on the intelligent switch with ID address as IDKEY.
Parameter:
IDKEY: this parameter is 32-bit, because the corresponding IDKEY of intelligent switch has only 24 bits, the former 8 bits are invalid while the latter 24 bits are valid IDKEY.
Switch.OFF(IDKEY)
Function: turn off the intelligent switch with ID address as IDKEY .
Parameter:
IDKEY: this parameter is 32-bit, because the corresponding IDKEY of intelligent switch has only 24 bits, the former 8 bits are invalid while the latter 24 bits are valid IDKEY.
Switch.INVERT(IDKEY)
Function:reverse the current status of intelligent switch with ID address as IDKEY
Parameter:
IDKEY:this parameter is 32-bit, because the corresponding IDKEY of intelligent switch has only 24 bits, the former 8 bits are invalid while the latter 24 bits are valid IDKEY.
Switch.QUERY(IDKEY)
Function:query the current status of intelligent switch with ID address as IDKEY
Parameter:
IDKEY:this parameter is 32-bit, because the corresponding IDKEY of intelligent switch has only 24 bits, the former 8 bits are invalid while the latter 24 bits are valid IDKEY.
Switch.Available()
Function:the N.O. of data bytes returned to serial port from switch received by 433
Switch.Read()
Function:read the data returned to serial port from switch received by 433
There is a demo program in the library as below:
#include <cloudswitch.h>
void setup(){
Switch.Init(115200);
Switch.ON(0x000002C2); //Turn on the switch with 0x0002C2 IDKEY.
}
void loop(){
while(1)
{
if(Switch.Available())
{
unsigned char value = Switch.Read();
Serial.write(value);
}
}
}
</cloudswitch.h> |
Download the demo program above to the intelligent transit box or Arduio development board, then you can turn on the intelligent switch with IDKEY as 0x0002C2, and you can also find the 32-bit data returned by the intelligent switch in the way of HEX through the serial port (8-bit status + 24-bit IDKEY). If the switch status is changed by remote control or touch, the corresponding status will also be printed out on the serial port.
ITEAD Intelligent Switch Protocol Library (8.0 KiB, 43 hits)