This article shows how can you setup a simple sensor configuration.
Please note that sensors only work with devices with an Enterprise license.
If you use an Android device it also needs to be rooted and locked.
First we need to burn the firmware to the M5Stack.
- Open Sensor Designer Application.
- Connect the M5Stack to your PC via USB.
- Connect the device to the application with Connect or Quick connect buttons.
- Select the type of connected device and click on the Firmware button. Download the latest version. Burn it to the device by clicking the burn button.
Now let’s create the configuration of the M5Stack in the Sensor Designer Application. In my example, I used a Button unit in Port A and a Relay Unit in Port B.
- Login to the server. Select the customer and the screen you want to use the sensors on.
- Select the connected device type from the list.
- Click on ‘Port A+’ button, and select ‘Button’ from the list.
I will leave the configuration on the default settings because I only need the click event now. You can also enable other click types.
- Click on ‘PortB+’ and select ‘Relay’ from the list.
I will also not change the default settings here.
- Now the configuration of the sensors is ready. Press the ‘Send configuration to screen over the cloud’ button and the screen will store the configuration. It can give to the M5Stack later.
Once you have your M5Stack and the needed sensor you can begin setting up your first sensor connected interactive content.
- Create new content with two pages. I will set a red background color for the default page and a green background color for the second page.
- In Content properties click on the ‘Edit sensor events’ button.
- Now, I want the button clicks to switch the page from one to the other. For this, I need to navigate to ‘Page wide events’ and add a new action to ‘React to sensor events’ field on each page.
- In the sensor configuration I did not change the event the button will send. So the ‘Sensor event’ will be ‘click’. The action will be ‘Jump to’ and the target will be the other page.
- Now, I want the relay to light up the lamp on the Green page and not on the Red page. For this, I need to add a new action to ‘Send to sensors on page start’ field on each page.
The type will be Relay and the value will be Close / Open, depending on which page you set. If the message of the Relay is changed in the Sensor Designer Application this will not work.
- Save the modal, save the content, and assign it to the screen.
- Connect the M5Stack to the screen. Connect the sensors and units to the correct M5Stack port.
If this example was followed properly, your device should switch pages with a button click. The lamp should illuminate on the Green page but not on the Red page.