We designed the AIRcable SmartBeacon as a test tool for the CSRmesh as well as a CSRmesh light switch, running on batteries. The commands allow to configure it as well as issue commands into the mesh. Responses are printed in clear text to the serial port. We also added other additional SmartMesh commands to it.
In addition the SmartBeacon can be used as a light switch. The button can be configured to send mesh commands when triggert, allowing light switching, dimming as well as mesh association.
The CSRmesh is implemented in broadcast mode. When broadcasting is enabled the SmartBeacon will listen for mesh commands for a certain amount of time. The broadcast interval can be set between 100ms and 109 minutes. If broadcast type is mesh only then the SmartBeacon will only run the mesh scanner for an amount of time.
The CSRmesh uses the standard BLE advertisement scanner for receiving messages. It is possible to see them without affecting the mesh functionality
scan 3 seconds for iBeacons, raw mesh packages and our specific mesh member status packages:
iBeacon addr=f2545f06a474 name=CSRmesh tx=6 uuid=fef1 rssi=-43
member=0xcd7b power=0x1 light=0x0, temp=28
This example configures the SmartBeacon for CSRmesh only at a fast rate. The CSRmesh relay is able to retransmit packages. If a reply for a command is not heard by any of the nodes that received the mesh package, it will be retransmitted until the time to live counter is exhausted. The CSRmesh relies on scanning to receive messages. The messages are
configure broadcast interval for 100ms in mesh only mode
configure the mesh scanner to run for 80ms
|OK> #T8||this command also enables the CSRmesh relay mode, to retransmit packages in the network to increase range.|
See, if the SmartBeacon is associated to a CSRmesh
check the CSRmesh parameters:
CSRmesh 80ms associated, id=0xcd7b, dst=0x8021
check for broadcast type and timing:
broadcast=100ms, type=mesh at 80ms
At bootup, the SmartBeacon starts a 30 second association procedure. If it was associated before, it will send its association to other devices that are looking for it.
To start the mesh association procedure manually, use this command. After the SmartBeacon is associated in the network it receives the assigned device ID. The device ID tells the SmartDimmer to receive and process mesh commands for this ID.
Start CSRmesh Association
check the CSRmesh association:
CSRmesh 900ms associated, id=0x8021, dst=0x0000, grp=0x0001
Destination, Members and Groups
Deatination is a 16 bit device ID number. Destinations are devices you are sending commands to. The first bit set notates an individual light. A group is a number between 0 and 0x7FFF. The destination number 0 is received by all members in the network. A CSRmesh member is a unique ID the CSRmesh scanner is listening for commands. You can dynamically overwrite the CSRmesh member ID and receive commands for that device. A group membership is also a device ID the SmartBeacon is listening for. Set the group number and you can receive message for this particular group.
Set the destination of the mesh commands
temporarily set destination of the mesh commands to device id 0x8010
|OK> #D8010||set destination of the mesh commands to device id 0x8010 and save it|
|OK> #g2||set group number to 2|
|OK> #i8010||overwrite own device ID with 0x8010|
CSRmesh light set to 100
send a light intensity command to 100, range 0-255.
In our SmartDimmer, this means 100% power.
Toggle light is #l128 and step light is #l129
Mesh Color Command
Even though we are not using colors in our standard light switch, you can still send color commands. The arguments are in hex.
|OK> #cff ff ff||send color command, 3 bytes for RGB to the destination without a reply|
OK> #C60 60 60
Send color R G B to decimal 96 for all colors.
This is the response to the command from a mesh member that implements the color command
OK> Received Light State 0x010060606000000002
send a message "HALLO\r" to the configured destination
enable raw mode, just like SPP over GATT, all typing goes over the CSRmesh to the configured destination
Configuring The Button
The button on some editions of the SmartBeacon can be configured to send mesh commands.
A button press will send CSRmesh power command. Depending on a received state, the command is on or off. If no state is received it toggles between on and off.
Configure the button for light commands. Clicks send light toggle command and long press will repeatedly send light step commands to the configured destination.
Receiving CSRmesh Commands
When running in CSRmesh mode, mesh commands to the device id are printed in text. In addition the digital output pin on the SmartBeacon is switched on:
Sending a light command with return response will print the response package (light model data structure)
OK> Received Light State 0x006400000000000001
The power command can repeat the message until the result is received.
OK> Received Power State 0x1
Received Power State 0x1
Received Power State 0x1
About This Community
|Asked: 12/29/15, 11:54 PM|
|Seen: 1860 times|
|Last updated: 12/30/15, 12:52 AM|