Losant is a great tool for developing IoT applications and API gateways using a visual designer. It's great for building software integrations that interact with devices, which can be anything that connects to their service. In this example, we'll set up an Arduino connected to an off-the-shelf cellular module so that we can send it commands from a Losant workflow. This way, you'll be able to visually program applications that interact with remote hardware!
Hologram NetworkHologram.io is a cellular network provider perfect for makers. At $0.60 /mo plus $0.40 per mb, you'll have plenty of data for most IoT projects. You can get a free SIM card by going to hologram.io and then activate it at dashboard.hologram.io.
WiringMost GSM modules, like the SIM800L, will have Power, Ground, RX, and TX. Although you can use certain other pins for SoftwareSerial, it is unstable. Use an Arduino that has extra onboard serial pins. For the Arduino Micro, wire to Serial1. If you end up using SoftwareSerial, set the baudrate to 57600, 38400, or 9600 (unstable)
Before inserting the SIM card make sure you are putting it in the right way.
Not all Arduino boards have regulated power, so in many cases you'll want to supply a separate power supply for your cellular module.
Install TinyGSM Arduino Library- Open the Arduino IDE
- Go to Sketch > Include Library > Manage Libraries
- Search for TinyGSM and install it
- Download the library here as a.zip https://github.com/Losant/losant-mqtt-arduino
- Go to Sketch > Include Library > ADD.ZIP Library
- Select the downloaded library and it should install
- Create a New Application in Losant
- Create a New Standalone Device for your application
- Generate an Access Key and Access Key Secret
- Copy this Arduino sketch https://github.com/HologramEducation/hologram-tinygsm-examples/blob/master/losant-mqtt/toggle-led.ino
- Copy the Device ID, Key and Secret to the correct field in the Arduino sketch
- Program the Arduino sketch, be sure to set the correct modem you're using at the top of the sketch
We need a flow that sends a command "toggle" to the device we set up before.
- Create a New Cloud Workflow in your app
- Download or copy toggle.flowhttps://github.com/HologramEducation/hologram-tinygsm-examples/blob/master/losant-mqtt/toggle.flow
- Drag the toggle.flow to the "Import Existing Flow" box in the Settings panel
- Save and deploy
You should be able to toggle the virtual button to turn Pin 13 on and off!
Comments