Friday, February 17, 2017

How To Setup mcThings Platform With mcModule To Track Temperature/Voltage Via Losant Dashboard

The exciting part of any IoT solution is tinkering with the hardware and software and make it work! On this part 2, I'm setting up the mcThings platform to gather up information and stream it live via a IoT cloud dashboard application such as +LosantHQ

In order to integrate mcThings with Losant to read temperature and voltage data, you need at least a mcModule, a mcDongle, a mcGateway, a USB stick, coin cell CR2032 batteries, two micro USB data/power cables and mc-Studio IDE software (free to download).
The USB stick is needed for updating the application processor of the mcGateway; while the micro USB power/data cables are needed for powering and transferring data, as well as for updating the mcDongle and the mcGateway board. Here are the steps:

1) Sign up with Losant to create an account

2) Create a New Application



3) Create new device

4) Select Start from Scratch

5) Create a Gateway (you can call it any name you like)

6) Create a Peripheral (you can call it any name you like) and then select the name of the Gateway you created in step 5.

7) Download mcStudio from http://ift.tt/2lpfYGN (make sure .NET Framework 4.6.2 is installed on your computer)

8) Connect the mcGateway to your WiFi network. You can do this by using an ethernet cable to connect the mcGateway to your router. You ou can connect also via WPS WiFi pairing, or via the mcStudio IDE.

mc-Module 110 on far top of the board
9) Update firmware for mcModules and mcGateway. Head again to http://ift.tt/2lpfYGN and download these below:


10) Open mcOTA, click "Search Device" and then insert the coin battery in the mcModule. Once the device information appears, click Start Update.
Wait until message reads Firmware upload complete
11) Repeat the same process above for updating the mcGateway. You’ll need to update both the host module on the gateway and the application processor. The host is updated using the mcDongle and the mcOTA application and the processor is updated using USB. 
When updating the mcGateway's application processor, make sure your USB stick is formatted using FAT32, and place the “mcGw110.bin” file in the USB stick without chaging the name of the file from “mcGw110.bin”

Before inserting the USB stick into the mcGateway board, disconnect the power/data cable from the mcGateway and insert the USB stick. Then, reconnect the power cable and hold down both buttons (RESET and USER SW). The flashing green LED on the mcGateway board will show solid green for a few seconds, indicating the application software is being updated. when the green light starts flashing again, the application processor updating process has completed.

12) Connect the mcGateway to your PC and click Connect Gateway

Create new project

Add TempSensor library

For Temperature and BatteryVoltage, I enter the following code. You can get the code here

Once the code is entered, Save, Build and Load




13) Now, go to "Device Maintenance and Connection". To get there select Tools -> Devices 
Then, connect mcGate110 and select Gateway Config to bring up the GatewayConfigForm and enter the following details:
MQTT Server: broker.losant.com
MQTT Port: 1883
MQTT Username: Your Losant Access Key
MQTT Password: Your Losant Access Secret
MQTT ClientId: This is the Device ID of the gateway you created in Losant.
To obtain the access keys from Losant, go to Applications->Access Keys


14) Once the above is correctly set up, you should be able to refresh and get a Connected message from the Losant dashboard..



15) Now, we are ready to create a widget from the Losant dashboard to visualize the data. In this case, temperature and battery voltage. First, we create a dashboard


Then, select a Block. In my case, I selected GAUGE

Enter the information applicable to you. Choose an Application, Gauge Type, Precision Type, Duration, all can be set how you like. Device IDs / Tags (enter the device module you created). For Label and Attribute you must enter Celcius and Temperature.


To visualize BatteryVoltage, simply enter "Voltage" under label and select "BatteryVoltage" under attribute.

0 comments:

Post a Comment

◄ Posting Baru Posting Lama ►
 

Blog Archive

Entri Populer

Copyright © 2012. Gadget News - All Rights Reserved B-Seo Versi 5 by Blog Bamz