The previous project we added Bluetooth(X-NUCLEO-IDB05A1) and connected it to our smart device to control the onboard LED wirelessly. In this project we are going to add the X-NUCLEO-IKS01A3 which a motion MEMS and environmental sensor expansion board for the NUCLEO-L476RG. With this we are going to measure the temperature which will send it to your smart device so you can read it anywhere.
If you have little or no experience with DK IoT Studio, or the NUCLEO-L476RG I suggest completing the first two projects:
Blink will ensure the software and hardware work together and the Bluetooth will get you started with the DK IoT Studio app.
Be sure to connect the X-NUCLEO-IKS01A3 to the NUCLEO board, should fit right on top of the Bluetooth board X-NUCLEO-IDB05A1.
First, you will need to either start a new project or you can build off of the Bluetooth project.
Add an interval element to the work space and this will connect to the temp sensor. You will need to add the temp sensor through “Add Element”.
The STTS751 will be added at the bottom of the element toolbox, click and add. You will also need to re-add the BLUENRG if you have not done this yet, same process as the temp element. You should have the following in the work space:
Check each element properties to make sure they read the following.
The data types are changed to floating points so you can see the actual temperature in decimal.
Next is the application work space.
In the application work space, we need an interval element, this triggers how often the data is read. The Bluetooth element should already be on the work space. We also need a label where the temperature data will print. The BLECharacteristicCustom connects to the label which will set the text with the temperature reading in Celsius. I also included another label to display the word “Temperature” which is optional. Work space should look as follows:
Here is what properties should read:
Add the + “C” to establish the units are in Celsius.
The temperature label will just display the work temperature and will not be connected to anything.
Be sure to place your labels where you want them in the app view.
Once satisfied with positioning you can save (1) compile (2) and program firmware (3) in the NUCLEO-L476RG board section.
When you download firmware a bin file appears at the bottom of the screen. Click and drag the bin file over to the NODE_L476RG drive in the file explorer.
In the third phase we will now be configuring the Digi-key IoT app on your smart device. You can find the app in the app store by searching Digikey IoT. It will ask you to sign in which is the same as the credentials on the browser. Once logged in you will see a familiar screen. Select the devices tab in the toolbar on the left. Then select add device at the top.
From here if your Bluetooth is turned on and the program is downloaded on the NUCLEO-L476RG drive, a device should appear with name of the project.
Select the project and it should automatically start provisioning device. Once provisioning is complete it will bring you to the application section you created. The Bluetooth indicator at the bottom will flash on and off until it connects to the device and should stay solid black once found.
This project is a good start to using sensors with DK IoT Studio. The temperature sensor on the X-NUCLEO-IKS01A3 is one of many sensors on the board. You are able to use multiple sensors at the same time with DK IoT Studio.
If you have any further question feel free to ask, or post the question in Digi-key Techforum DK IoT Studio section.
If you need to login, register or get more information on how to get started with DK IoT Studio visit the Main Page at Digi-key where we provide video and links to jump start your projects. You can also visit the DK IoT Studio EEWiki page for more projects.