The OnSemi RSL10-SENSE-DB-GEVK is a sensor powerhouse (but not in a power-hungry way!). This coin cell-powered sensor board is barely larger than a coin cell battery but includes five sensors that can report nine different types of measurements. This post is going to explain how to connect this sensor to the cloud and send sensor values in a way that any application can access. The best part of this entire process is that it doesn't require any code to be written. Everything can be set up in easy-to-use GUIs. I'll also include a neat demo application at the end of a wearable safety system.
Hardware with the default software applicationThe RSL10 Sensor Development Kit comes with an example application preloaded. This application updates the environmental sensor values every five minutes to reduce power consumption. The data is sent every three seconds over Bluetooth.
These are the available sensors:
- NOA1305 (Ambient light)
- BHI160 (Integrated low power smart hub, 3-axis accelerometer, 3-axis gyroscope)
- BMM150 (Low Power, Low Noise 3-axis digital geomagnetic sensor)
- BME680 (Integrated high-accuracy gas, pressure, humidity and temperature sensor)
- INMP522 (Ultra-low noise digital Microphone)
The NOA1305 sensor is activated only when the ambient light value is requested by a peer device. Along with the ambient light sensor, there are low power modes available for the BHI160, BMM150, and BME680. Specifically in the BME680, the air quality is not supported in this low power mode example due to the heating element and the consequent need for higher power consumption.
The application can be modified using the OnSemi IDE, but that long and involved process is outside the scope of this tutorial. It is covered in detail inside the User Manual. I've found that the default code is great for my needs so I'm not even going to change it.
RSL10 Sense and Control AppI'm using an iPhone, so start by downloading the app from the App Store (it's also available on Android). We'll start by checking the values locally, and then send them to the cloud. Open the app, and put the coin cell battery into the Dev Kit (if something happens and the device doesn't connect anymore, remove and reinsert the battery and it should work). The device should automatically pop up and you'll be able to connect to it. At this point, you can select any sensor, but I recommend choosing temperature since you'll have a good feeling if this is right or wrong. Hit Next and you'll see the temperature. Remember that the value is being sent every three seconds, but the sensor is only updated every five minutes. The gyroscope, accelerometer, or magnetometer update more often if you want to see the values change quickly.
CloudMQTTNext, we'll connect to an MQTT message broker. You can host one locally, but I like the features provided at CloudMQTT. Go there and create an account and a new instance. In the RSL10 app, hit the settings icon on the homepage and then manage brokers. Add a generic broker. Fill in the URL, Port Number, Username, Password, and select "Supports MQTT v3.11" and click save. When you exit out of this screen, there's a switch to "Enable Broadcast". When you click this, it will send your data to MQTT instead of displaying it. At this point, power cycle your Dev Kit and reconnect and select your sensors. You'll see the data scroll past on the app and in CloudMQTT under the WebSocket UI tab.
LosantNow that the data is in the cloud, let's use my favorite application to display it. Create an account on Losant and then create an application. The first thing to do is to create an Integration to connect data from CloudMQTT. Add the MQTT details again and at the bottom, you'll need to add a topic. When you're watching the data at CloudMQTT, you'll see that all of the data is sent under one topic relating to the address of the device. Add this topic and the integration is complete.
Now go and create a standalone device. After it is created, enter an attribute. I'll choose temperature for now, which is a number.
Now we'll create a workflow that we'll use to parse the MQTT messages and assign the data to the attribute. Add an MQTT block, connected to a JSON: Decode Block, connected to a Device: State block. Inside the MQTT block, ensure the broker is set to the RSL10 integration you made earlier. The JSON: Decode block will take data.message as the Source String Path and data.decoded as the Destination path. The message is encoded as JSON inside a string so this just stores the decoded JSON at a new field: data.decoded. The Device: State block should be set up so the Device ID is the device you created earlier, and the State is Individual Fields. The Attribute will be set to temperature with the value as {{data.decoded.Temperature_6}}. The double curly brackets are important for Losant to know that this is part of a JSON message. If you're sending anything other than temperature, you can decode the MQTT message yourself (look at in the WebSocket UI console on CloudMQTT) and update accordingly. If any of these steps give you problems, you can add a Debug block and see exactly what is going on behind the scenes.
The final step is to create a Dashboard to visualize the data. There are a few types of Blocks to choose from here so select whatever you like. I'm going to add a Gauge to display the current temperature along with a Time Series Graph to display the temperature over time. The setup of these is all based on personal preference and they are easy to understand so I'll leave it up to you to experiment.
I often spend time in my small workshop alone. I would like something to look over me to ensure I'm staying safe. I'm going to take everything that I've shown so far and extend it so that the OnSemi RSL10-SENSE-DB-GEVK can be worn around and send data to the cloud where I can visualize it, set alerts if anything is dangerous, and keep others updated to my status. I could probably use a bunch of different sensors located around the workshop to detect these things, but this is nice because it's completely integrated and runs off of a coin cell battery so it is wearable. Here's a demo of my idea in action:
This is using the same setup that I explained before, except I also added a new attribute: Light, which is just another decoded value: {{data.decoded.ALS-NOA1305_9}}. I added another time series graph and an Indicator that changes state when the Light reading is above 1000. It only takes a few minutes to add the other sensors from the RSL10 Dev Kit, and you can have a full safety squad on your body at all times.
ConclusionWithout writing a single line of code, you can create some wonderful applications that rely on the OnSemi RSL10-SENSE-DB-GEVK's small size, a multitude of sensors, and low power. I'm loving the complete integration here and the possibilities offered. It's so cool that this little board can get all this data into the cloud to visualize and make decisions on it. I think the built-in sensors go a long way to keeping myself and others safe while I work alone in my workshop.
Comments