If you have come across Mongoose IoT Platform in forums or have heard about it in the IoT community and you are ready to take it out for a test drive, then this guide will help you get started!
It’s open source and licensing is based on dual license, GPLv2 for everyone with commercial use and / or need support. It’s in Alpha release and ready for you to test now.
Let’s take a deeper look
Mongoose IoT Platform embeds V7 and provides the following API for interacting with hardware and network:
SPI. ESP has two SPI interfaces. The documentation for the device mentions them as SPI and HSPI. HSPI stands for Hardware SPI. An SPI is used by the chip to work with flash, meaning it is always busy. It is possible to use bit-banging, but so far we didn’t do it and implemented HSPI only (by the way, there is an excellent blog about ESP which tells a lot about SPI).
There is also an API for GPIO and a simple HTTP client together with a set of built-in functions.
A lot more information is available for you in the readme as well.
Now that we have the bases covered, let’s get started.
1. Download the archive with Mongoose Flashing Tool. This utility is used for flashing the firmware onto the device. You can use another utility if you wish. The benefit of Mongoose Flashing Tool is that it immediately generates a device id and password required to connect to the cloud.
There is a version for OS X and Windows. Linux users can build the binary themselves.
When you connect ESP8266 to your USB and run Mongoose Flashing Tool, you’ll see this on your screen:
2. Hit «Load firmware». The firmware will flash to the device. Depending which specifications of ESP you are working with, you may require additional gestures. If you use simple ESP01, you need to connect GPIO0 to GND.
3. Connect the terminal. In Mongoose Flashing Tool there is a built-in console, you can also use picocom or whatever you like. Speed - 115200.
4. We now see the console. We tried to make it as convenient as possible, it looks like Bash.
In this console, you can immediately type JS code. («Smartjs NNN / MM $» - is the prompt, NNN - the amount of free memory, MM - the amount of memory currently consumed directly by the interpreter).
It looks like an ordinary console:
When you press Enter the command is executed and the result of the evaluation is printed. So you can do without a lot of explicit “print()” commands.
Another way to write and run the JS code is to type it in your favorite editor, save the file and upload it to the device by selecting «Upload file» on the Mongoose Flashing Tool UI. That file can be executed via the command File.load (”file_name”). Type this command in the console or add it to a file init.js (if you need the file to automatically be executed as the device loads).
As an example, if you wanted to monitor the temperature in your apartment, you could set up in minutes. Just connect the temperature sensor to the ESP, write the “driver” (or use the ready made one) in JS, register ESP in the cloud, write a small script that reads the temperature and send it to the cloud. Once that’s set up, you can go to the dashboard and look at the chart.
And that’s it - you are up and running! We’ve done it in 2 minutes and recorded our engineers taking it live, check out the video here.
Of course, the firmware will work without the cloud, too. But the cloud is more convenient and shaves the work needed right down. We have a link to the cloud on GitHub. If you have a GitHub or G+ login you can register within a few clicks.
You do have the option to add any missing features that you need using C. You can write new functionality in C and not associate it with JS. This would be an opportunity to use almost all of the API (in most cases JS API - a thin wrapper around the C functions) and in addition, you can use the functions of the ESP SDK. Building the firmware from the source is not difficult thanks to the docker image.
A bit about the future
Mongoose IoT Platform is in ALPHA 1 release and we are working hard towards the next edition. Your feedback is important to get us there!
Test Mongoose IoT Platform, connect your device and let us know what worked well for you, what you think we could improve. On our list already is increased amount of RAM available to the user, ability to update scripts from the cloud, and port to other platforms.