Research and implementation of smart home control terminal based on Android system

Update: July 2, 2023

introduction

In recent years, smart phones have been rapidly popularized around the world. According to data released by market research company Gartner, in the first three quarters of 2011, global smart phone sales increased by more than 55% year-on-year, and smart phones are occupying more and more mobile phone market shares; With the rapid development of social economy, people’s living standards have been raised to a new level, and the requirements for the living environment are getting higher and higher. The emerging smart home based on Internet of Things technology makes people gradually enter the digital and network-based environment. The intelligent society of the platform.

Based on the increasing popularity of Android phones and the open source system, this paper connects Android terminals with smart homes, researches and implements a smart home control terminal based on Android systems. In the system, the Android terminal communicates with the home appliances or sensors in the smart home through the surrounding wireless network to realize the control of home appliances, the reading of sensor values ​​and home security.

Android system architecture

The Android operating system is divided into four layers from top to bottom, namely the application layer, application framework layer, component library layer, virtual machine and Linux kernel layer. As shown in Figure 1.

Figure 1 Android frame diagram

Application layer: The Android operating system is released together with a series of core application packages. The core applications include E-mail client, SMS (short message) program, calendar, Google map, web browser, contact book, etc. Currently, all applications are It is written in Java language.

Application framework layer: Developers use the core application to call the API provided by the Android framework. This application structure is designed as a component that is easy to reuse. Any application can publish its functions, and other applications can use these functions (functions related to system security issues will be prohibited by the framework). This application reuse mechanism allows users to easily replace program components. Hidden behind each application is a series of services and systems;

Component library layer: Android includes a set of C/C++ function libraries, mainly including libc, Media Framework, WebKit, SGL, OpenGLES, FreeType, SQLite, etc., which are used in various components of the Android system. The frame is presented to the developer;

Runtime environment: Android includes a core library that provides most of the functionality of the Java programming language core library. Every Android application runs in its own process, with an independent instance of the Dalvik virtual machine. Dalvik is designed to efficiently run multiple virtual systems simultaneously. The Dalvik virtual machine executes an executable file with a suffix of dex, which is optimized for small memory usage. At the same time, the virtual machine is based on registers, and all classes are compiled by the Java compiler, and then converted into “.dex” format by the “dx” tool in SD. The Dalvik virtual machine relies on some functions of the Linux kernel, such as the thread mechanism and the underlying memory management mechanism;

Linux kernel layer: The bottom layer of Android is an independent operating system developed based on the Linux2.6.23 kernel. The main thing is to add a virtual CPU called Goldfish and the specific driver code required for Android to run. This layer is used to provide the underlying services of the system, including security mechanism, memory management, process management, network stack and a series of driver modules. As a virtual middle layer, this layer is located between the hardware and other software layers.

Specific design of Android terminal

General framework of smart home

Android terminals can communicate with home appliances, sensors and security devices through the network (3G, WiFi or Bluetooth). When you are out, use 3G to operate; when you are at home, use WiFi or Bluetooth to operate, which can save 3G traffic. as shown in picture 2.

Figure 2 System Architecture of Smart Home

The system mainly includes: comprehensive security, home appliance control, energy saving management, health detection, comfort control, etc. This paper mainly studies the management and control of the above-mentioned parts by the Android terminal. If the Android terminal wants to manage and control the device, it needs to send a control command to the community server, so that the community server knows the IP address of the mobile phone, and then it can establish a connection and communicate with the community server.

Module division of Android terminal

The Android terminal part of the system is designed, and the module division is shown in Figure 3.

Figure 3 Android terminal module division

Home appliance control: The user enters the home appliance control interface and can control home appliances (such as lights, TVs, air conditioners, etc.) after networking. The Android device sends a control signal to the community server, and the community server sends the control signal to the home wireless IoT gateway, and then classifies it according to whether it is an infrared device. If it is an infrared device, it sends the control signal to the infrared home appliance controller, and the infrared home appliance control The device then controls different devices according to different home appliance control commands. If it is a non-infrared device, the home wireless IoT gateway directly sends the control command to the corresponding home appliance for control. As shown in Figure 4.

Figure 4 Home appliance control

Video monitoring: Enter the video monitoring interface, you can select different cameras to view, including the living room, bedroom and outdoor, you can use the camera to monitor the video inside or outside the home;

Smart medical care: When someone at home is detecting the heartbeat and pulse, the detection result will be sent to the Android terminal for Display, and the family’s health status will be monitored in real time; when an elderly person or child falls at home, the alarm information will be sent to the guardian’s through the smart home server displayed on the Android terminal. When the Android terminal receives the alarm information, the Android terminal will first pop up a window prompting “user fell” on the current interface, reminding people that the elderly at home have fallen, and they can check the camera installed at home through the Android terminal to check the elderly. situation in order to deal with it accordingly. The pop-up prompt interface and monitoring interface of the Android device are shown in Figure 5.

Figure 5 (a) Alarm pop-up window prompt Figure 5 (b) Alarm viewing result

Energy consumption monitoring: In order to save energy, Android can manage high-power electrical appliances (TV, air conditioner, refrigerator, etc.), and check the electricity consumption of electrical appliances (such as electricity consumption time, power and cost, etc.);

Security management: There are security devices (such as window magnets, door magnets, infrared, etc.) in the system. Turn on the security device when you go out. If someone breaks in, an alarm message will be sent to the Android terminal. You can check the situation at home through the camera. If it is just a false alarm or there is no real intruder, you can reset the security device through the Android terminal. ; If there is an accident, it is convenient for the user to deal with it in a timely manner;

Data receiving and sending: The values ​​of temperature, humidity, smoke and other sensors in the system are sent to the community server through the home wireless IoT gateway, and the community server then sends the data to the Android terminal for display. If other accidents such as fire or gas leakage occur at home, the value of the sensor displayed on the Android terminal can also be directly seen, so that corresponding processing can be made in time.

Network data download: When entering the TV preview interface, you can select different locations in the drop-down box, such as Chongqing, Beijing or Shanghai, etc., and the corresponding TV program previews of different locations will be downloaded from the Internet and displayed in the interface. To facilitate users to watch TV programs in time.

Flow chart of Android terminal

The user needs to register when entering the application for the first time, and then log in to enter the control interface. The overall flow chart of the system is shown in Figure 6.

Figure 6 The overall flow of the system

test verification

When entering the control interface of the software, you can control home appliances such as TV, air conditioner, lamp, and fan; receive the values ​​of sensors such as temperature, humidity, and smoke, and display them on the interface to manage the power consumption of high-power electrical appliances ;If family members are detecting heartbeat, pulse, etc., the smart medical interface can view the detected values, so as to monitor the health of family members in real time. If an elderly person falls at home, the fall signal will also be sent to the Android terminal; when leaving home, turn on the security After the device is installed, the security devices such as window contacts, door contacts, and infrared at home will start to work. When someone breaks in, an alarm message will be sent to the Android terminal for display to remind the user, and the situation at home can be checked through the camera; When users need to check the TV program preview, they can also check the TV program preview of each station through the program preview function, so as to watch their favorite programs in time. As shown in Figure 7.

Figure 7 Test results

conclusion

With the development of Internet of Things technology, smart home is getting more and more attention. This paper realizes that Android mobile phone and tablet are used as a control terminal of smart home to control home appliances, receive sensor values ​​and monitor video; and run normally under terminals of different versions or resolutions of the Android system.

Author information: Key Laboratory of Industrial Internet of Things and Networked Control, Ministry of Education, Chongqing University of Posts and Telecommunications

This article is copyrighted by China Power Grid and “World Electronic Components” magazine. If it is reproduced, please indicate the source.

View more : IGBT modules | LCD displays | Electronic Components