Software apps and online services
These are the main steps necessary to run this example:
1. Setup your mcThings module
2. Setup your account at Tago
3. You are ready! Continue to build more cool stuff!
The mcThings platform includes 2 main components: mcModules and mcGateways. A powered and connected mcGateway creates the mcAir network (up to 200m range under optimal conditions) and bridges the information between the mcModules (within range) to and from the Internet. Using the IDE (mcStudio) and mcScript (ultra-low power programming language - a subset of VB.NET) allows you to wirelessly connect, debug and program modules with your customized scripts.
Note: You also require an mcDongle to complete firmware updates on the modules/devices and gateways! We recommend looking at the mcModule120 Dev kit which includes everything you need to get going!
Below is example code that can be used to program the mcModule120 to measure temperature and battery voltage levels wirelessly to the awesome Tago application.
Modify, debug and load the below code using mcStudio into the mcModule120 via the mcGateway. Gateway configuration details are found further down the page.
Class TagoTemps Const TagoTopic As String = "tago/data/post" Shared Event CheckTemp() RaiseEvent Every 60 Seconds Dim temp As Float = TempSensor.GetTemp() // Get Temp from sensor Dim variable As Json = New Json variable.Add("variable", "Temperature") variable.Add("unit", "F") variable.Add("value", temp) // Publish to Tago Lplan.Publish(TagoTopic, variable.ToListOfByte) End Event Shared Event CheckVoltage() RaiseEvent Every 5 Minutes Dim BattVolt As Integer = Device.BatteryVoltage// Get battery voltage Dim variable As Json = New Json variable.Add("variable", "BatteryVoltage") variable.Add("unit", "mV") variable.Add("value", BattVolt) Lplan.Publish(TagoTopic, variable.ToListOfByte) End Event End Class
*Note- You will also need to add the temperature sensor library to the above project - this can be found with the library file in mcStudio and in the attachment section of this project.
First, create a free account at Tago here https://admin.tago.io/signup
Confirm your e-mail, and you are ready to go!
Second, you will need to add one device and get its token to associate with your mcThings module.
From the left menu, select ‘Device’ and click on the top right button to add a new device.
Then, just enter a name for the device and click on ‘Save’ as showed in the figure below.
Select the tab ‘Tokens’ and click on the ‘eye’ icon that will show you the Device-token generated to this device.
Click on ‘Copy token’ button to capture the device-token. This token will be used to setup your gateway.
The mcGateway needs to be configured to direct information from the module to Tago. The mcGateway needs to powered (micro-usb) and connected to the internet using either Ethernet or WIFI.
Click on 'Tools' and then select 'Devices' within the drop-down menu. Connect to your mcGateway and then select the 'Gateway Config' button.
Enter the following configuration:
Username: Any value you wish (like 12345)
Password: This is your device-token from the device you just setup
Make sure that the configuration looks like this one pictured below. After your gateway is configured, press the save button.
Now that your gateway is configured and connected, and you have loaded the code into your module, you will start sending data to Tago. You will be able to find the variables in the list while adding the widgets in the dashboard.
Then, you can to build dashboards to visualize your data.
From the left menu, select “Dashboards”, and click on the top right ‘+’ button to add a new Dashboard. Then, enter a name for the Dashboard and save it.
Click on the “+ Add widget” button on the top right to start adding widgets. Let’s add one widget to show the variable temperature. Click on ‘Add Widget’ + button and pick the widget Gauge.
Start the configuration of this widget by adding the variable to be displayed. Type the variable name that will be sent by the device as ‘temperature’, and click ‘OK’. Then, click on ‘Save’, and your widget will be ready! The complete configuration is showed in the figure below.
You can continue to add more widgets to visualize the other sensors from the mcThings board. Here is one example of how your dashboard may look like when you add more widgets like gauge, table, and chart.
Everything in this dashboard will be updated in real-time. You also can share it with others by entering their emails in the tab ‘Share’ inside the ‘Edit Dashboard’ option. Go further and create scripts using Analysis, or notifications using Action.
Leave any questions or comments below and please join the Tago and mcThings hubs here on Hackster so you don't miss out on new projects.
Thanks for reading!