IoT (Internet of Things) is about connecting physical objects ("things") to the Internet. Technically, this is done by attaching a computer to a "thing." A computer is attached in a way that it can read data from the thing and report to the Internet, and also it can receive commands and control the thing's state.
Usually, the COMPUTER is directly wired to the THING, and the COMPUTER <=> INTERNET connection could be either wired (e.g., Ethernet), or wireless (e.g., Bluetooth, Wi-Fi).
What could the computer be?
It could be your laptop or desktop computer—both expensive, power hungry, and large. You can hardly use your laptop with your fitness tracker while running.
It could be a small single-board computer like the Raspberry Pi, which costs around US $30, BeagleBone for approximately US $60, Intel Edison for US $70, or other similar devices. These computers usually run Linux. These are suitable for some tasks, like being a gateway device, but again they are quite large, very power hungry, and too expensive to run on things like sensors, wearables, and small appliances.
It could be a microcontroller (also called MCU or micro). The microcontrollers on the market are extremely diverse and designed for various needs. For the IoT, you have available to you a wide range of inexpensive, low-powered, tiny microcontrollers.
A microcontroller is a small computer on a single silicon chip. To put it simply, it is a small black box with a bunch of wires (pins) sticking out from it. There are pins for powering the microcontroller and pins for attaching external things, such as sensors, actuators, buttons, etc. These pins are called IO (input/output) pins. For example, to create a Wi-Fi Internet button, you need to get a Wi-Fi-enabled microcontroller, get a button, attach the button to the IO pins, and program the microcontroller to send messages to the cloud backend when the button is pressed, as shown:
During development, people do not work directly with MCUs because it's hard to wire them. Instead, they use modules and development boards. Those modules make it easy to power the MCU and attach peripherals. I've provided an example of the NodeMCU ESP8266 board, which you can plug it to your laptop easily:
Microcontrollers do not have much memory and processing power, which is why they are so inexpensive. For example, the Nordic Semiconductor's nRF52 has 64K RAM and 512K flash. A popular ESP8266 has about 40K available RAM, which means you can't run software like Windows, Linux, or Node.js on them. Because these small computers have such limited resources, programming them can't be done with conventional tools and frameworks.
There are many approaches to tackle the MCU development, but generally speaking, it is not easy for a new person to start. One needs to know C/C++ and spend time (sometimes a significant amount) on setting up the programming environment, but tools for simplifying the process are available. One such tool is Mongoose OS, which is an operating system for microcontrollers that makes programming them easy for both newbies and professional developers. With Mongoose OS, the time it takes to set up the programming environment is reduced to a minute or less, thanks to the features it provides, including:
- An installation time of one minute
- A simple networking interface that allows you to control devices remotely over RESTful, Websocket, or MQTT protocols
- An Arduino compatibility layer for hardware peripherals
- Support for the ESP8266, ESP32, TI CC3200, and STM32 microcontrollers
How to build an IoT project with Mongoose OS
- Navigate to the Mongoose OS download web page and download the mos tool.
- Start mos and follow the setup wizard:
- When the installation is complete, click on "Start prototyping" to switch to the file manager:
- Click on init.js file, change the message Tick to Hello! and press the "Save and reboot device" button. You'll see a new message in the device log.
This simple flow demonstrates how easy it is to start with the microcontroller development and Mongoose OS.
This two-minute installation how-to video from Mongoose OS covers all these steps.
Find other projects that use Mongoose OS here.
Also, check out how easy it is to build your prototype with the Mongoose OS, the ESP8266, and Seeed Studio Grove sensors.