“Everything that can be automated will be automated.”
Robert Cannon
Internet of things (IoT) is happily chasing us more and more. I want You to become more familiar with it, if you aren’t yet, and to show you an example.
IoT devices were created for consumer use, home automation, wearable technology and devices with remote monitoring capabilities.
Speaking of home automation, it can control lighting, heating and air conditioning, media and security systems. Long term benefits could lead to energy savings by automatically controlled lights and electronics. For example, Amazon Echo, Google Home, Apple’s HomePod, and Samsung’s SmartThings Hub are standalone platforms for smart homes.
Application of Internet of things is almost infinite: medicine, transportation, building, manufacturing, agriculture, energy management, environmental monitoring.
The most important thing in IoT is the communication. Let’s talk about it.
Bluetooth – operates at frequencies between 2400 and 2483.5 MHz. Packet exchange master/slave is based on a basic clock, defined by the master, which ticks 1600 times per second. A master Bluetooth device can communicate with a maximum of seven devices in a piconet, from all 3 classes, in a range of 100 meters approximately.
Radio modules – the frequencies could be different, for example, 76-108 MHz, 433MHz, 315MHz. The range depends on transmitter’s power and antenna.
WiFi – is a technology for radio wireless local area networking of devices based on the IEEE 802.11 standards. WiFi mostly uses 2.4 GHz and 5.8 GHz. Some versions of WiFi, running on suitable hardware, can achieve speeds of over 1 Gbit/s. The coverage of the access points (hotspots) can extend from an area small as a room to one of many square kilometres large.
Mobile networks – frequencies begin from 450 MHz up to 2100MHz.
Ethernet – general purpose networking standard using twisted pair and fiber optic links in conjunction with hubs or switches.
The Core for IoT could be: Windows, Android, IOs, PLC, Raspberry, Arduino and others.
For the next example, I’m going to use Arduino + Android, connected to a Cloud service over WiFi. The biggest benefit is the access to the system from any part of the world, and these are the simplest and cheapest devices. Nowadays, Arduino is rich with communication modules, adjusted for your needs. There are modules for any type of Arduino shields, or devices with integrated WiFi modules.
ESP8266 NodeMcu v3
It’s a shield with a built in WiFi module, open-source, interactive, programmable in Arduino IDE, has a low cost, in other words, it’s simple and smart.
Technical characteristics of the module:
- Supports WiFi protocol 802.11 b/g/n;
- Supported WiFi modes – access point, client;
- Input voltage 3.7V – 20 V;
- Operating voltage 3V-3.6V;
- Maximum current 220mA;
- Built-in TCP / IP stack;
- 80 MHz, 32-bit processor;
- 4 MB flash memory available + 36 Kb RAM;
- Wake up time and cycle time is around 22ms.
The module has 11 general-purpose I/O ports. Some of the ports have additional features, such as:
- D9, D10 – UART, used to transfer data through the serial port of a computer.
- D1, D2 – I2C / TWI, data is transmitted over two wires, SDA and SCL, a data wire and a clock wire. There is a master and a slave, the master clock generates cycles, while the slave only “confirms” the receiving of bytes. There can be up to 127 devices on a single two-wire bus.
- D5 – D8 – SPI (Serial Peripheral Interface) is a synchronous serial data protocol used by microcontrollers to quickly communicate with one or more peripheral devices over short distances.
- D1 – D10 – outputs with PWM (Pulse Width Modulation), the power control process is supplied to the load by varying the duty cycle pulses.
- A0 – analog input.
Cloud storage is a data storage split over multiple servers (could be in different geographical locations), and the physical environment is typically owned and managed by the hosting company. The benefits are as follows:
- The ability to access data from any device connected to Internet.
- High probability of saving data even in case of hardware failures.
- The possibility of organizing collaboration with data.
RemoteXY
RemoteXY is a tool that can ease the creation and the usage of a mobile graphical user interface for Arduino boards and other controllers. Using the editor, you can make your own graphical user interface and load it into the controller. With this mobile app you could connect to the controller and manage it through the graphical interface.
Another good point is that this service is user-friendly and supported by FLProg IDE, which makes it easy to use for those who are not familiar with programming in C.
First thing you would have to do, is to register in the system and create a Token, which is required when connecting to the device through the cloud server. After that, you can go to Editor menu and create your own project.
The next step is to define the configurations, in our case it would be – Cloud server + Nodemcu V3 + ESP8266 on board + FLProg IDE. Once you have all that, fill in your WiFi router data (name + pass), choose the token which was created before, and set up some design things.
At this point, you can already get the source code and copy it in your IDE.
In the image above, you can see a RemoteXY block, where you can write your own logic with Inputs, Outputs and Variables. There (blue rectangle) you can also define the router SSID and password, and let it be Enabled.
In the Download description section, Fig. 3, you can input some source code, and everything will be ready to go.
When it’s all compiled and loaded into the controller, and the shield is started up, it will connect to WiFi and you will see the results:
Finally you are ready to create your own robot, or whatever you want 😉