An Experiment with Arduino Uno and Tft Nextion for

48 downloads 0 Views 907KB Size Report
Studies presented by CERP [10], ITU-T [21], Gartner [12] reinforce that ..... http://www.gartner.com/it-glossary/internet-of-things/. [13] GitHub. Oficial site for.
An Experiment with Arduino Uno and Tft Nextion for Internet of Things Antonio Carlos Bento Universidade Nove de Julho Computing Science Dept. São Paulo, Brazil [email protected] Abstract— This manuscript presents the results of an applied research on the Internet of Things (IoT), involving automation and control of objects at a distance, as general objective should be presented the results of a technical experiment, considering an application with devices used for automation, such as devices Arduino and the Tft Nextion display, which provided the development of the project in a practical way, demonstrating the facilities and possibilities for the construction of solutions for IoT, the results demonstrated the possibilities for the development of a simple project, but that could contribute to the studies and creation of more robust solutions, due to the lack of scientific bibliographical references on subjects that involve the Internet of Things, mainly the display devices Nextion. Keywords—Nextion; Arduino; IoT; internet; display

I. INTRODUCTION The main objective of this study is to present the results obtained by applying the experimental method the technical concepts obtained through bibliographical research and personal experiences, the use of resources and devices to contemplate the needs of a project involving the Internet of Things, paradigm in increasing evolution, expanded its use in several areas of knowledge. Because it is a subject that involves interdisciplinarity, this is composed of several resources that may involve different lines of study, such as: computing, information systems, artificial intelligence, robotics and mechatronics, as well as networks and communications infrastructure, this study proposes to present results of an experiment that can serve as a basis for the development of new ones, as well as to serve as a basis for study in related disciplines. The subject of the Internet of Things is basic content for the development of solutions that approach the knowledge about automation, being this a highlight in several subjects that involve the evolution of emerging technologies, since it is a still growing study, it is common to lack of materials that can support the different types of projects that can be developed. Studies presented by CERP [10], ITU-T [21], Gartner [12] reinforce that communication between the devices, or objects, are of different types and with specific details, is becoming a great evolution, or revolution in the concepts of

978-1-5386-5630-3/18/$31.00 ©2018 IEEE

communication and device control remotely, on the other hand the growth of the Internet provides great possibilities for remote resource access. This document is divided in the following format: Bibliographic Review, in this chapter the main sources of study on the subject and some discussions are presented. In the chapter Method and Materials, the methods of scientific research used, as well as the materials and devices used during the development of this project are presented, finally in the chapter and Results and Discussions, the developed experiments are presented, together with specific discussions about the project and some points of attention, addressing the final results. II. BIBLIOGRAPHY REVIEW In this work, the IEEE Xplore library was used as the main study base. It was selected as a consolidated and internationally known base, serving as a reference for the development and creation of productions of various academic research materials in the scientific society. The researches were developed in the years 2017 and 2018, having as main research object the Internet of Things, the Arduino devices and the Nextion display. It was noticed during the bibliographic review, the small amount of research results, which involved the keyword Nextion device, this is deduced to be a relatively new device in comparison of its competitors, nevertheless the Nextion device has a large library of components as well as advanced and easy-to-use features. It is important to highlight that other databases such as technical documentation, manuals, technical discussion forums, other knowledge base libraries were also used, since they sometimes deal with very specific knowledge to meet the type of project that was developed, originated in own projects, which were applied different techniques that complemented the study. As of studies for the Internet of Things were used the references of: [2] A. E. Khaled; S. Helal, [5] B. P. L. Lau; N. Wijerathne; B. K. K. Ng; C. Yuen, [9] C. Marchand; L. Bossuet; U. Mureddu; N. Bochard; A. Cherkaoui; V. Fischer, [10] CERP, [11] F. Zheng; Y. Tang; L. Shao, [12] Gartner, C. W. Tsai, [21] ITU-T, [22] J. Fei; C. Lu, [23] J. He; J. Wei; K.

Chen; Z. Tang; Y. Zhou; Y. Zhang, [24] J. Santos; J. J. P. C. Rodrigues; J. Casal; K. Saleem; V. Denisov, [26] K. Sun; H. Zhang; D. Wu; H. Zhuang, [28] L. Y. Yeh; P. Y. Chiang; Y. L. Tsai; J. L, [29] M. E. M. Cayamcela; S. R. Angsanto; W. Lim; A. Caliwag. For studies on Arduino devices, in addition to some scientific references, technical documents and manuals were also used, as follows: [1] Arduino, [3] A. Sharida; O. Zidan; M. Salamn; I. Hashlamon, [4] A. Y. Ardiansyah; R. Sarno; O. Giandi, [6] Bento A. C., [13] GitHub, [15] H. T. Wu; J. K. Chen, [16] H. Zhang; G. Li; Y. Li, [17] I. Masngut; G. N. P. Pratama; A. I. Cahyadi; S. Herdjunanto; J. F. J. Pakpahan, [25] K. K. M. Rahman; M. M. Subashini; M. Nasor; A. Tawfik, [27] L. Nóbrega; A. Tavares; A. Cardoso; P. Gonçalves, [18] I. Orlovskyi; A. Pirozhok, [30] S. Dhar; K. Patra; R. Ghatak; B. Gupta; D. R. Poddar. For the Nextion display device, documents and technical annuals were used, in addition to the few research materials found: [7] Bento, A. C., [8] Bento, A. C., [14] GetHubIteadLib, [19] Itead. Studio, [20] IteadLibNextion.

III. METHOD AND MATERIALS The materials used in this project involve devices used in the Internet of Things (IoT), are usually interconnected among other equipment or objects, which allow the execution of actions or execution of projects remotely, using a communication network, devices such as the controller Arduino Uno, which is used to enable communication and control of connected devices, was chosen because of its low cost, ease of location. For the development of solutions for the Arduino, the Arduino IDE was used, being this one software developed for the creation of applications, configurations and loading of libraries for the Arduino controller, allowing the configuration and control of the devices used in the research, it is also used to monitor the results and control the sending and receiving of data. Another material used was the Nextion touchscreen display, a display is necessary to create and apply configurations in the devices, which need to present some information on the screen, to control or monitor some analysis or data collection by some sensor, this way Nextion display has been selected for its ease of use and solution creation. Nextion has its own editor developed by ITEAD, the company that manufactures the product, the ITEAD Nextion screen editor is used to create the screens, allowing the control of the devices, as software for the development of programs, it allows to move objects to the screen allowing the configuration of the properties and elements of each object. The method used for the development of this study is the experimental method, which is the development of experiments applying techniques to solve some type of problem, demonstrating the applicability of the presented hypotheses, with the use of techniques as well as the development of applications using software development

techniques, in which the C ++ language was used, and the Nextion screen development software has its own characteristics for the creation of algorithms. Other tools were used as cables to connect devices, Usb connectors, power connectors, cable with mini Usb connector, a MicroSD memory card to transfer the designs to the display Nextion, A Compaq Presario notebook with Windows 10 64 bit, was also used to install the Arduino IDE, and the Nextion ITEAD editor.. IV. RESULTS AND DISCUSSIONS To start the project, it is necessary to configure the software, the libraries of the devices and configure them appropriately according to the manufacturers' documentation, at the discretion of the users to carry out the procedures according to their needs, device version, type selection of libraries that should be used, noting that normally libraries can also be developed by the users themselves as some that are available from the GitHub site [13]. First, it is necessary to download the Arduino IDE to make the correct settings, the Arduino development platform, can be located on the Arduino manufacturer's website [1], after downloading according to the version of the operating system, it is necessary load the device libraries, the Arduino libraries, is already configured by default, to install the Nextion display libraries it is necessary to look at the Arduino libraries base as Bento explains [6]. After the correct library installations and device configurations, the development platform itself should present the sample files for each installed device, they are very useful and will also serve as a basis for this study, using some adaptations for the development of the solution, the which should be used as a prototype for validation of the results. In order to complete the environment and finalize the installation of the devices, it should also be necessary to install the screen creation platform of the Nextion ITEAD editor, available in ITEAD [19] and [20], this development platform should be used to create the screens , they should be used as an interface between the user and the device to facilitate the configuration and change of requirements required for each type of project. With the Arduino Uno is necessary connect to the USB cable which will connected to the notebook Compaq Presario, the output Usb from the Notebook, will charge the power supply fro the Ardino Uno, but it is possible to connect also with na external power supply, as a charger with 12V, or a power connector adapter for 5V, with this Project was used only the notebook Usb connection. The Nextion display will be connected to the Arduino Uno controller with the 5V output from Arduino, the transmission pin TX, and the receiver pin RX, will be conencted in different position like this: Arduino TX connected to Nextion RX, Arduino RX connected to Nextion TX, it is necessary pay attention for this setup, because the communication will not work, if the cables will not connected correctly.

Fig. 3. Nextion display connection schema.

Fig. 1. Arduino Uno and Usb cable used with the project.

The connections for the Nextion display device are very simple, it is only necessary to connect the TX (Blue) and RX (yellow), the power cables 5V (red) and Ground (black) in the controller, for that study the Arduino Uno, because it is only for a practical application without many more sophisticated details, the connection cables of the Nextion display are connected directly to the Arduino Uno, to have a better control of it is also possible to use electronic resistors.

The Arduino Uno device comes with a Usb cable, this to facilitate communication and power input to the device, it also has an external input, which allows you to connect a 12V charger or even in a socket with adapter for 5V, care must be taken when connecting the power and ground cables so that the device does not cause a fire or even damage the device.

Fig. 4. Arduino Uno connection Schema.

Fig. 2. Nextion display with cable adapter and Micro Usb adapter.

The Nextion touchscreen device, comes with a USB adapter, to connect the device directly to a computer for example, or to another 5V power source, it is important to also pay close attention when connecting the adapter, not to reverse the cables, for example, the red wire that is the power cable, must be connected to the adapter in the cable with positive signal +, the black ground cable, must be connected to the negative pin - of the adapter, be very careful not to reverse the wires, as it may cause an accident, or even damage the device.

For the Arduino Uno device, the four pins are used, as shown in Fig. 4, where the TX and RX connections are inverted between the devices, ie the Nextion TX cable must be connected to the Rx input of the Arduino Uno, the Nextion display Rx cable must be connected to the Arduino Rx as previously reported , it is extremely necessary to be aware of the connection of the power cables (red) to the 5V input of the Arduino Uno, the display's Ground (black) cable must also be connected to the ground of the controller. After making the connections according to the documentation and technical manuals, the devices can be connected to the USB cable of the computer, always being careful not to touch the metal part of the cable in the metal part of the connection of the Arduino Uno, this to not cause a acidente or damage the devices.

number box, line 5 is the library for the connection via serial, in line 5 the configuration of the Nextion's TX and RX pins is performed for pins 12 and 13 in the Arduino, which are commonly used in several configurations In line 6 is created the connection with the outputs 12 and 13, in line 8 is loaded the page object that was created in the screen editor which is called pgButton, in line 9 and 10 is loaded the button objects that were created in the screen editor with the name button1 and button2, using ID number 1 and 2, the number box use the ID #3.

Fig. 5. ITEAD NExtion screen Editor with the project.

Only 4 elements for the Nextion display, a object page, a text box, two button objects, one to increase the value, another to subtract the value from the numerical box, when the user press the add button, the display should show the updated value, it is used as limit values 0 for minimum and 20 for maximum. 01- #include 02- #include 03- #include 04- #include 05- #include 06- SoftwareSerial nextionSerial(12, 13); // RX, TX 07- Nextion nex(nextionSerial); 08- NextionPage pgButton(nex, 0, 0, "sensor"); 09- NextionButton button1(nex, 0, 1, "btnPlus"); 10- NextionButton button2(nex, 0, 2, "btnMinus"); 11- NextionNumber number1(nex, 0, 3, "n0"); 12- void setup(){ 13- Serial.begin(9600); 14- nextionSerial.begin(9600); 15- nex.init(); 16- button1.attachCallback(btn1_callback); 17- button2.attachCallback(btn2_callback);} 18- void loop(){ 19- nex.poll();} 20- void btn1_callback(NextionEventType type, INextionTouchable *widget){ 21- int v1; 22- v1=number1.getValue(); 23- v1=v1+1; 24- number1.setValue(v1);} 25- void btn2_callback(NextionEventType type, INextionTouchable *widget){ 26- int v2; 27- v2=number1.getValue(); 28-v2=v2-1; 29- number1.setValue(v2);} In the lines 1-5 the libraries of the Nextion device available in [19] [20] [1] are loaded, as well as the libraries of the pages created in the display, together with the libraries for the use of the buttons 1 and 2, line 4 is the library for the

The setup function presented in line 12 is one of the phases used during the initialization of the Arduino device, in this function the initial configurations of the devices are performed, in line 13 the speed of 9600 baud rate is selected for the Arduino communication in the line 11, the line 14 configures the 9600 baud rate for the Nextion device. In line 20 and 25 the number box will increase or decrease 1 digit, if the plus or minus button is pressed, as shown the fig. 6.

Fig. 6. The project in operation..

With the results presented, the experiment proved to be efficient and easy to apply, being necessary the knowledge about some technical resources, the devices demonstrated their resources efficiently, although this is an experiment with few resources, this can serve as a basis for more projects such as to demonstrate data collected by sensors. Due to the lack of scientific material available on the subject that deals with the use of devices for the Internet of Things with the Nextion display device, this study provides great opportunity to contribute to research projects that require an interface, interactive, easy and low price, there are other display devices, in some comparative tests are discussed its pros and cons. With the rapid evolution of projects for the Internet of Things, a great contribution is made to the creation of new studies that can collaborate for projects, such as for intelligent cities, patient monitoring and remote object control.

Acknowledgment Special thanks for the coleagues, relatives, students which has contribuited for the development of this project.

References [1] [2]

[3]

[4]

[5]

[6]

[7]

[8]

[9]

[10]

[11]

[12] [13] [14] [15]

Arduino. 2018. Official Available at: https://www.arduino.cc A. E. Khaled; S. Helal. (2018).A framework for inter-thing relationships for programming the social IoT2018 IEEE 4th World Forum on Internet of Things (WF-IoT). vol. , issue. , pp. 670-675, IEEE Conferences, DOI: 10.1109/WF-IoT.2018.8355215 A. Sharida; O. Zidan; M. Salamn; I. Hashlamon. (2018). Sensorless position control for a single DOF system2018 Advances in Science and Engineering Technology International Conferences (ASET), vol. , issue , pp. -16, Feb. 6 2018-April 5 2018, IEEE Conferences, DOI: 10.1109/ICASET.2018.8376937 A. Y. Ardiansyah; R. Sarno; O. Giandi. (2018). Rain detection system for estimate weather level using Mamdani fuzzy inference system. 2018 International Conference on Information and Communications Technology (ICOIACT), vol. , issue , pp. -848854, 6-7 March 2018, IEEE Conferences, DOI: 10.1109/ICOIACT.2018.8350711 B. P. L. Lau; N. Wijerathne; B. K. K. Ng; C. Yuen. (2018).Sensor Fusion for Public Space Utilization Monitoring in a Smart City. IEEE Internet of Things Journal. vol. 5, issue. 2, pp. 473-481, IEEE Journals & Magazines, DOI: 10.1109/JIOT.2017.2748987 Bento A. C.. IoT: NodeMCU 12e X Arduino Uno, Results of an experimental and comparative survey. International Journal of Advance Research in Computer Science and Management Studies, v. 6, p. 46-56, 2018. Bento, A. C.. IoT: Results of an Experimental Survey with Nodemcu, Nextion, DS1307 and NRF24L01+. International Journal of Current Innovation Research, v. 4, p. 969-974-974, 2018. Bento, A. C.. IoT: Results of an experimental survey with NodeMCU 12e, TFT Nextion and RTC DS1307. International Journal of Advance Research in Engineering, Science & Technology, v. 5, p. 6-14, 2018. C. Marchand; L. Bossuet; U. Mureddu; N. Bochard; A. Cherkaoui; V. Fischer. (2018).Implementation and Characterization of a Physical Unclonable Function for IoT: A Case Study With the TERO-PUF. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems. vol. 37, issue. 1, pp. 97-109, IEEE Journals & Magazines, DOI: 10.1109/TCAD.2017.2702607 CERP. (2009). IoT – Internet of Thinsgs of European Research Cluster. Internet of things: Strategic Reserach Roadmap, Available at: http://www.internet-ofthingsresearch.eu/pdf/IoT_Cluster_Strategic_Research_Agenda_2009.p df F. Zheng; Y. Tang; L. Shao. (2018).Hetero-Manifold Regularisation for Cross-Modal Hashing. IEEE Transactions on Pattern Analysis and Machine Intelligence. vol. 40, issue. 5, pp. 1059-1071, IEEE Journals & Magazines, DOI: 10.1109/TPAMI.2016.2645565 Gartner. (2018). Internet of Things Definition. Available at: http://www.gartner.com/it-glossary/internet-of-things/ GitHub. Oficial site for devices libraries: GetHub-IteadLib. Nextion Libraries. https://github.com/itead/ITEADLIB_Arduino_Nextion H. T. Wu; J. K. Chen; C. W. Tsai. (2018). Wildfire monitoring and guidance system2018 27th Wireless and Optical Communication Conference (WOCC), vol. , issue , pp. -13, April 30 2018-May 1 2018, IEEE Conferences, DOI: 10.1109/WOCC.2018.8372717

[16] H. Zhang; G. Li; Y. Li. (2018). A Home Environment Monitoring Design on Arduino. 2018 International Conference on Intelligent Transportation, Big Data & Smart City (ICITBS), vol. , issue , pp. 5356, 25-26 Jan. 2018, IEEE Conferences, DOI: 10.1109/ICITBS.2018.00021 [17] I. Masngut; G. N. P. Pratama; A. I. Cahyadi; S. Herdjunanto; J. F. J. Pakpahan. (2018). Design of fractional-order proportional-integralderivative controller: Hardware realization. 2018 International Conference on Information and Communications Technology (ICOIACT), vol. , issue , pp. -656660, 6-7 March 2018, IEEE Conferences, DOI: 10.1109/ICOIACT.2018.8350813 [18] I. Orlovskyi; A. Pirozhok. (2018). The laboratory stand with SCARA robot for training masters' students of electrotechnical specialties. 2018 14th International Conference on Advanced Trends in Radioelecrtronics, Telecommunications and Computer Engineering (TCSET), vol. , issue , pp. -12491254, 20-24 Feb. 2018, IEEE Conferences, DOI: 10.1109/TCSET.2018.8336421 [19] Itead. Studio. Nextion Development Software and Informations. https://nextion.itead.cc/ [20] IteadLibNextion. Libraries and examples for Nextion devices. https://github.com/itead/ITEADLIB_Arduino_Nextion [21] ITU-T. (2012). Internet of Things Global Standards Initiative. Available at: http://www.itu.int/ITU-T/recommendations/rec.aspx?rec=y.2060. [22] J. Fei; C. Lu. (2018).Adaptive Sliding Mode Control of Dynamic Systems Using Double Loop Recurrent Neural Network Structure. IEEE Transactions on Neural Networks and Learning Systems. vol. 29, issue. 4, pp. 1275-1286, IEEE Journals & Magazines, DOI: 10.1109/TNNLS.2017.2672998 [23] J. He; J. Wei; K. Chen; Z. Tang; Y. Zhou; Y. Zhang. (2018).Multitier Fog Computing With Large-Scale IoT Data Analytics for Smart Cities. IEEE Internet of Things Journal. vol. 5, issue. 2, pp. 677-686, IEEE Journals & Magazines, DOI: 10.1109/JIOT.2017.2724845 [24] J. Santos; J. J. P. C. Rodrigues; J. Casal; K. Saleem; V. Denisov. (2018).Intelligent Personal Assistants Based on Internet of Things Approaches. IEEE Systems Journal. vol. 12, issue. 2, pp. 1793-1802, IEEE Journals & Magazines, DOI: 10.1109/JSYST.2016.2555292 [25] K. K. M. Rahman; M. M. Subashini; M. Nasor; A. Tawfik. (2018). Development of bio-shields for Arduino Uno. 2018 Advances in Science and Engineering Technology International Conferences (ASET), vol. , issue , pp. -15, Feb. 6 2018-April 5 2018, IEEE Conferences, DOI: 10.1109/ICASET.2018.8376901 [26] K. Sun; H. Zhang; D. Wu; H. Zhuang. (2018).MPC-Based Delay-Aware Fountain Codes for Real-Time Video Communication. IEEE Internet of Things Journal. vol. 5, issue. 1, pp. 415-424, IEEE Journals & Magazines, DOI: 10.1109/JIOT.2016.2577520 [27] L. Nóbrega; A. Tavares; A. Cardoso; P. Gonçalves. (2018).Animal monitoring based on IoT technologies. 2018 IoT Vertical and Topical Summit on Agriculture - Tuscany (IOT Tuscany). vol. , issue. , pp. 1-5, IEEE Conferences, DOI: 10.1109/IOT-TUSCANY.2018.8373045 [28] L. Y. Yeh; P. Y. Chiang; Y. L. Tsai; J. L. Huang. (2018).Cloud-Based Fine-Grained Health Information Access Control Framework for LightweightIoT Devices with Dynamic Auditing andAttribute Revocation. IEEE Transactions on Cloud Computing. vol. 6, issue. 2, pp. 532-544, IEEE Journals & Magazines, DOI: 10.1109/TCC.2015.2485199 [29] M. E. M. Cayamcela; S. R. Angsanto; W. Lim; A. Caliwag. (2018).An artificially structured step-index metasurface for 10GHz leaky waveguides and antennas. 2018 IEEE 4th World Forum on Internet of Things (WF-IoT). vol. , issue. , pp. 568-573, IEEE Conferences, DOI: 10.1109/WF-IoT.2018.8355195 [30] S. Dhar; K. Patra; R. Ghatak; B. Gupta; D. R. Poddar. (2018). Reconfigurable dielectric resonator antenna with multiple polarisation states. IET Microwaves, Antennas & Propagation, vol. 12, issue 6, pp. 895902, 5 23 2018, IET Journals & Magazines, DOI: 10.1049/ietmap.2017.0864