Software apps and online services
In this project, we're going to show you how easy the mcPlug and the mcThings platform is to create feasible, realistic, scalable and automated IoT solutions. For this example, we'll use a mcModule120 to check a temperature, and if it is too hot, it then sends a message to tell the mcPlug to turn on a fan! We'll be using Losant as our MQTT broker and also using IFTTT!Use-Cases?
Using the mcPlug along with the rest of the mcThings platform gives the ability to create countless IoT solutions. Because you can use the mcModule to relay the temperature information, you can place the device anywhere due to the battery!
- Smart Greenhouse - Automate a greenhouse or other temperature sensitive environment by controlling devices/appliances automatically with variables measured by other mcThings devices.
- Agriculture/industrial - Powers water heaters, pumps, etc automatically based on any other variable you wish to measure.
- Retail - Provides power to lights/displays/etc automatically based on other variables.
- Home Automation - Wirelessly and automatically provides power to house appliances, holiday lights, Christmas tree, that neon bar sign that your wife hates, lamps, blenders, fans, etc.
- The possibilities are endless!
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.
We programmed the mcModule120 to check the temperature every 30 seconds. If the temperature was over 25C, it then publishes a topic to Losant. Using the below workflow, another topic was published which allowed the mcPlug to provide power to the fan! If the temperature was below 25C, the plug would then turn off the fan.
See the code at the end of this project for both the mcModule and the mcPlug.Setting Up a Workflow in Losant
We setup a workflow that received the incoming MQTT topic and then relayed an outgoing topic which provided power to the fan via the mcPlug.
*Check out the walk-through on connecting the mcThings platform to Losant's application. We also have examples in our other projects (including video!)*.
We also wanted to use the Losant 'Go' smartphone app, so we added a device to the workflow, selected the Losant Button, and then setup the device and the application. We also added a virtual button that allows you to activate the workflow directly from the workflow screen.
You could also capture data on how often and how long the fan, appliance, device, etc. is running or not, as well as visualize that data using the Losant application.Using IFTTT
Within the below code, we included a line so you can publish to the IFTTT service.
You could track the usage within a google spreadsheet, send a notification to your phone, or use any of the tons of IFTTT applets that are available!Thanks for Reading!
The mcThings IoT hardware platform is perfect for creating real commercialized IoT solutions that are feasible, ultra-low power, scalable and battery powered to be placed anywhere.
We'd love to hear your ideas for other use-cases for the mcPlug and the mcThings platform in general!
Please become a member of our hub here on Hackster to stay up-to-date with new projects! We've got plenty more to come.