In this tutorial, we are going to use the mc-Things' platform and hardware to send data to Losant. Once in Losant, we can graph the sensor data and build workflows to give the data life.
- - Tiny computer with a bunch of sensors
- - Hardware required for updating the firmware on your mc-Modules and the mc-Gateway
- - mc-Things IDE
- - The gateway will allow you to speak to your mc-Modules and send data back and forth
- Windows Machine - Right now, mc-Things’ development environment only supports a Windows environment.
First, you need to go to to make sure you have the latest firmware and drivers
Now that your mc-Module and mc-Gateway are updated, get them connected to mc-Studio
Everything is connected, let's open up the MC Studio and write some code
This is how mc‑Script™ functions. Sleep until there is something to do. mc‑Script™ is made to solve this problem and operates by design in a low power mode close to the hardware.You may ask yourself where the LedRed variable comes from. mc‑Script™ “knows” the device and “knows” what the RedLed is. A number of standard constants exist automatically to simplify development.
Create a Gateway device in Losant for the mc-Gateway
Losant and create an for this project. Then, create a new device.
Create a Peripheral device in Losant for the mc-Module
Create an in Losant
Connect the mc-Gateway to Losant’s MQTT broker
MQTT Port - 1883
MQTT Username - Your Losant Access Key
MQTT Username - Your Losant Access Secret
MQTT ClientId - This is the Device ID of the gateway you created in Losant.
File > Add Library code > TempSensor.This menu option will add the library to your project.
Create a new project in mc-Studio
CheckTempevent will check the temperature data every 30 seconds and publish that data to Losant.
CheckVoltagewill do the same but monitoring the voltage of the battery.
CheckVoltageis helpful because we can set up a in Losant to notify us if the battery in the mc-Module gets too low.
Check out data in Losant
Now, if you set everything up correctly, navigate to the data explorer to graph your temperature and voltage data from the mc-Module.