With the advancement of wifi module MT7688A technology today we have more and more devices connected to the internet. With this the IoT (Internet of Things) is one of the fastest-growing areas today, some situations pose challenges to the most popular data transmission technologies such as WiFi and Ethernet.
An example of this would be connecting sensors in remote areas without access to the electricity grid. Skylab technology is a solution for situations like this.
In this article, we will explore the basic principles of the protocol. And how it can be common with the board wifi module MT7688A Lora for projects in IoT using the Arduino IDE.
Skylab provides a long-range and low-power radio transmission wifi module MT7688A technology, that is, with this technology we can create projects for long-distance applications, such as a thermometer in a distant plantation powered by a battery or solar panel.
The wifi module MT7688A technology commons unlicensed sub-gigahertz radio frequency bands, such as 433 MHz, 868 MHz. Here in Brazil, we common the 915MHz regulated by Anatel with it, we can create transmission links between devices on the scale of kilometers (3-4 km for urban regions and in rural areas 15 km or more). Design and Components
The project we are going to create is a remote thermometer. Let's create a Peer-to-Peer (peer-to-peer) network with a DHT11 temperature sensor connected to a transmitter, and a receiver showing the data on the display.
The wifi module MT7688A sensor is a digital signal output temperature. And humidity sensors ensure high reliability and long-term stability. The temperature sensor element is an NTC type thermistor and the humidity sensor is an HR202 type, the internal circuit reads the sensors and communicates to a microcontroller via a one-way serial signal.
Other features are easy to find in DHT11. In this project, the DHT22 can be common with the necessary adaptations.
In this post, we will learn how to save data in MT7688A microcontroller memory and get the data saved even after a power outage.
As a demonstration, we will develop a Web Server project to visualize temperature data from the Wi-Fi module MT7688A sensor. Moreover, And the measurements are easy to modify by the common between the preferred scale chosen (Celsius or Fahrenheit).
Also, in this demonstration project, the times to which the common has registered can be viewed. Furthermore, manipulated, which can be common for future projects, with the current time being provided by a web service called Public NTP, which, at these times, is an event.
In this demonstration, the Wi-Fi module MT7688A onboard LED lighting event is triggered, but it could be any other event, such as sending an email to the common.
To assemble the project, the following materials will be needed:
To connect to the NTP time service it is necessary to have a wifi module MT7688A Internet connection
The saving of data that resists power outages finish through the library. Moreover, which manages the NVS (Non-Volatile Storage). Also, NVS memory currently commons a portion of the main flash memory through an internal API. This library saves data in a wrapper around nonvolatile storage on the MT7688A processor.
Non-volatile storage is the type of storage in which data can be persisted, that is, once it is written, the data will be preserved even if there is a loss of the energy source.
Saving data resistant to power failure is common for remembering the last state of a variable, for saving settings, or for any other type of data that you need to save permanently.
Data saved using this library structure within a namespace. Inside this namespace, there are keys ( key ) that will properly be storing the data ( value ).
Within a namespace, there can be as many keys as needed. The namespace name must limit to 15 characters and must have a unique name. That is, the namespaces must have distinguished names. See the example below where the Network data to which the wifi module MT7688A will connect is stored.
There is also the possibility of having multiple namespaces with keys with the same names, without any invalidation taking place:
You must pass as parameters:
preferences.
This function only removes keys from the open namespace and does not delete the namespace.
Get the value of a given key
To get the value of a key, there functions according to the type of variable requires. The first parameter of these functions is where the key name must inform. The optional second parameter is where the default value to return if the key does not exist is informed.
After running this code on Wi-Fi module MT7688A, you must load another sketch so as not to wear out the MT7688A's memory life. Perform this function only when necessary.
When flash memory is in an inconsistent state the library Preferences tries to recover. In other words, when the MT7688A has turned off abruptly and after turning it on again, it should not result in data loss, except when recording new keys at the time of shutdown.
The library must also be able to initialize correctly with any random data present in flash memory.
Conclusion
With this post, we can conclude that using the MT7688A Preference feature brings many advantages in any project, as it allows storing common settings or even connection credentials.
This proposal, in addition to enabling several applications for hydraulic systems relying on the monitoring of such a process synchronously, becomes highly viable due to the price of the materials needed for the construction of the project, differentiating itself from other processes on the market.
Copyrights© Shenzhen Skylab Co.,LTD All Rights Reserved.