Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 8, No. 2, 2024 38 Based on Raspberry Pi Voice Controlled Smart Home System Xude Zhang, Dihong Luo, Xiaoping Wu School of Microelectronics and Artificial Intelligence, Kaili University, Kaili, Guizhou, 556011, China Abstract: Designing a voice-controlled smart home system based on Raspberry Pi enables intelligent and user-friendly interaction experiences in home automation. Raspberry Pi serves as the core control system, connecting to WIFI for remote control. The voice module is responsible for receiving and processing voice signals. After receiving signals from the voice module, Raspberry Pi processes them to control external devices. The smart home external devices include curtain motor control modules, light modules for controlling light colors, and switch modules for controlling circuits. The system has been tested and proven to have high reliability and stability. Keywords: Raspberry Pi; Voice Control; External Devices. 1. Introduction With the widespread application of Internet of Things (IoT) technology and artificial intelligence (AI) technology, smart home systems have gradually become an important part of modern household life. Traditional home systems mostly rely on physical buttons or mobile apps for control, which are not convenient enough and provide a poor user experience. Designing a voice-controlled smart home system has significant practical significance. Based on Raspberry Pi, the voice-controlled smart home system utilizes the powerful computing capabilities and flexible expandability of Raspberry Pi, combined with voice recognition technology, allowing users to remotely control home devices through voice commands. Users only need to speak out the corresponding commands, and the system can automatically recognize and execute the corresponding operations, greatly improving the convenience and intelligence level of home device control [1-5]. 2. System Overall Composition In the smart home system, Raspberry Pi serves as the central control unit, playing a decisive role in the entire system [6]. The voice module converts voice signals into electrical signals, while external devices implement basic smart home functions. Figure 1. Overall System Design Diagram The entire system consists of hardware and software parts. The hardware part mainly consists of Raspberry Pi, voice module, switch module, motor module, and light module, while the software control system ensures efficient and stable operation. The overall design of the system is shown in Figure 1. The entire smart home system adopts a distributed architecture, with Raspberry Pi as the core control unit, connecting and managing various smart home devices. Raspberry Pi communicates with external devices such as the voice module, motor module, light module, and switch module through wired connections, enabling data transmission and execution of control commands. Additionally, the system has remote access and control capabilities, allowing real-time monitoring and operation of the home environment via devices such as smartphones and tablets. 3. Hardware Design of the System 3.1. Raspberry Pi Figure 2. Raspberry Pi Interface Distribution Diagram This system adopts Raspberry Pi 4B as a powerful 39 embedded system motherboard. Its core processor, memory, storage, interfaces, communication, expandability, power, and heat dissipation have been carefully designed and optimized. Raspberry Pi interfaces connect to the voice module and peripheral modules, serving as the bridge for the normal operation of the entire system. The distribution of Raspberry Pi interfaces is shown in Figure 2. The Raspberry Pi 4B features the Broadcom BCM2711 SoC, equipped with a high-performance ARM Cortex-A72 quad-core processor. Its GPU utilizes the 500MHz VideoCore VI, providing robust multimedia processing capabilities. The Raspberry Pi 4B offers various memory configurations, including 1GB, 2GB, and 4GB LPDDR4 RAM. The larger memory capacity allows the Raspberry Pi 4B to simultaneously run more applications and processes, thereby enhancing overall speed and efficiency. Additionally, the Raspberry Pi 4B supports microSD cards as the primary storage medium, further increasing storage capacity. With its rich interface configuration, including USB 3.0 ports, HDMI ports, Gigabit Ethernet ports, and GPIO pins, the Raspberry Pi 4B ensures connectivity and control for the smart home system. The selection of GPIO pins facilitates the input signal from the voice module. The Raspberry Pi boasts powerful processing capabilities, multimedia processing functions, and extensive expansion options. It provides two USB-C ports for high-speed data transfer and supports various networking protocols, including Gigabit Ethernet, dual-band Wi-Fi, and Bluetooth 5.0, enabling seamless connectivity to other devices for data sharing and exchange. Moreover, the Raspberry Pi features a dedicated GPIO header, supporting various user-defined hardware connections, thus offering limitless possibilities for innovative applications. 3.2. Voice Module The voice module is capable of converting sound signals into digital signals for recognition and processing, facilitating human-machine interaction through sound. The working principle of the voice module involves several processes, including sound signal acquisition, preprocessing, feature extraction, pattern matching, and result output. Sound signals are initially captured using sound sensors such as microphones, which convert sound waves into electrical signals. Subsequently, the electrical signals undergo preprocessing, including filtering, amplification, and analog- to-digital conversion, to eliminate noise interference and enhance signal quality. During the feature extraction stage, the preprocessed digital signals are further processed to extract key features from the sound signals. The voice module then matches the extracted sound features with pre-trained voice models. By comparing the similarity between features and models, specific voice commands or content are identified. The voice module utilized in this system is the SNR9912VR, known for its compact size, high integration, and stability. This module offers advantages such as low power consumption, minimal investment, and flexible installation. Its small size enables it to store a considerable amount of energy, while its low power consumption ensures prolonged usage. The voice module employed in this system features two UART interfaces and three I/O interfaces with PWM functionality. By connecting to the GPIO pins of the Raspberry Pi, the voice module enables control of external devices through sound. The voice module is equipped with the ability for bulk recording and autonomous screen recording. Depending on actual requirements, the bulk recording function can be selected, enabling automatic detection of machine connections and initiating recording, thus facilitating a convenient and efficient recording process. Additionally, it is possible to submit voice files to the voice module for burning and recording. Users can independently burn and record voice files of different content as needed, meeting various testing stages and practical application requirements. The circuitry of the voice module is illustrated in Figure 3. Figure 3. Circuit Diagram of the Voice Module 3.3. Peripheral Modules The peripheral modules of the smart home system primarily consist of the switch module, motor module, and light module. After receiving signals from the voice module, the Raspberry Pi processes them and can subsequently control the operation of external devices [7-8]. The switch module, as a critical component of the smart home system, is responsible for connecting and disconnecting power sources. After processing voice information, the Raspberry Pi controls the normal operation of the switch module through GPIO pins. The switch module is constructed with relay components, providing overload protection, short circuit protection, and other safety features to ensure the safe operation of devices. Each switch module effectively manages its power status, enabling automated and intelligent control. By integrating features such as overload protection and short circuit protection, the switch module ensures device safety. The overload protection feature automatically cuts off power when the device load exceeds its capacity, preventing device damage due to overheating or potential fire hazards. The circuitry of the switch module is illustrated in Figure 4. Figure 4. Circuit Diagram of the Switch Module 40 The motor module is responsible for driving various mechanical devices in motion. In this system, the motor module can receive commands from the smart home system and control the opening and closing of curtains, adjusting their speed. It can also drive the opening and closing of windows, automatically adjusting the degree of window opening based on indoor environment and weather conditions to achieve goals such as indoor ventilation and energy conservation. Furthermore, it can precisely control various parts of smart beds, such as the angle of the bed head and the softness of the mattress, providing personalized sleep experiences. Users can adjust the bed's status according to their needs, ensuring comfortable sleep. The motor module incorporates built-in overcurrent protection circuits. When the motor current exceeds the set value, the protection circuit swiftly cuts off the power supply, preventing motor damage due to overload. The overcurrent protection feature also effectively prevents safety hazards caused by circuit faults. Additionally, the motor module features over-temperature protection. When the motor temperature reaches the set value, the protection circuit activates cooling mechanisms or reduces the motor's operating speed, ensuring the motor operates within a safe temperature range. This helps extend the motor's lifespan and enhance system stability. The circuit diagram of the motor module is illustrated in Figure 5. Figure 5. Circuit Diagram of the Motor Module The light module, as a core component of smart homes, directly impacts lighting effects. Modern light modules utilize LED dimming technology, enabling precise adjustment of brightness and color temperature through connectivity with the Raspberry Pi. Figure 6. Circuit Diagram of the Light Module The light module also features adaptive sensing capability, allowing automatic adjustment of lighting status based on factors such as ambient light and time. Equipped with built- in light sensors and time controllers, the light module can monitor changes in ambient light in real-time and automatically adjust parameters such as brightness and color temperature according to preset modes. Additionally, the light module can automatically turn on or off lighting devices based on the time, thus achieving energy-saving and environmental protection goals. The light module is connected and controlled through the Raspberry Pi. As a powerful microcomputer, the Raspberry Pi boasts rich interfaces and expandability, enabling precise control and intelligent management of the light module. 4. System Software Design The software design of the smart home system is crucial to ensure the proper functioning of the Raspberry Pi. The overall software design process for the smart home system is illustrated in Figure 7. A reasonable system architecture forms the foundation of software design. Based on the actual requirements of the smart home system, appropriate operating systems, programming languages, and frameworks are selected to construct a stable and reliable system environment. Additionally, consideration is given to the system's scalability and maintainability to facilitate the easy addition of new features and devices in the future. Adopting a modular design approach during software design involves dividing the system into multiple independent modules, with each module responsible for specific functions. This helps reduce system complexity and enhance maintainability. Clear interface definitions ensure smooth communication and collaboration 41 between different modules, reducing the likelihood of errors. Figure 7. Software Design Flowchart The voice module recognizes sound and converts it into digital signals. The Raspberry Pi's command system controls peripheral modules via GPIO pins. The integration of the voice module with the Raspberry Pi enables seamless coordination between voice and device control, allowing for easy manipulation of home devices through simple voice commands. The software design process for speech recognition is depicted in Figure 8. Figure 8. Software Design Diagram of the Voice Module The peripheral modules mainly include switch modules, motor modules, and light modules. Upon receiving signals from the voice module, the Raspberry Pi processes them and controls the corresponding GPIO pins to execute the desired functions of the peripheral modules. The software flow for the peripheral modules is illustrated in Figure 9. Figure 9. Software Design Flowchart of the Peripheral Module 5. Test Results and Analysis During the system implementation process, the speech module, Raspberry Pi, and peripheral modules were connected and configured to establish the software development environment. Corresponding software code was written to achieve functions such as speech recognition, Raspberry Pi processing, and normal operation of external devices. During testing, the first step involved conducting speech command recognition tests. Throughout the experiment, various speech commands were simulated in different scenarios, including turning on lights, adjusting air conditioning temperature, and playing music. The system utilized the speech recognition module to identify user commands and compared the recognition results with the control module. Additionally, response time tests for control operations were conducted. The system measured the time required from receiving a speech command to executing the corresponding control operation. Stability testing was also performed to assess the system's robustness. Various abnormal situations, such as network interruptions and device malfunctions, were simulated during the experiment to observe the system's performance under these conditions. The results of the tests indicated that the system accurately recognized user speech commands and promptly executed corresponding control operations. It effectively controlled peripheral modules for operation. The system demonstrated good stability and scalability, allowing for the easy addition of new smart home devices and control functionalities. 6. Conclusion This study is based on a Raspberry Pi-based voice- controlled smart home system, aiming to enable users to conveniently control their home environment through voice commands. By integrating voice recognition technology, Raspberry Pi, and smart home devices, the system successfully achieved its objectives. Experimental results demonstrate that the system exhibits excellent performance 42 and stability, offering new insights and methods for the development of smart homes. As Internet of Things (IoT) and artificial intelligence (AI) technologies continue to advance, voice-controlled smart home systems hold promising prospects for broader applications. Enhancing the accuracy of voice recognition and the effectiveness of home control, alongside exploring additional application scenarios and feature expansions, will further enhance the intelligence and convenience of home living experiences. Acknowledgments Qiandongnan Prefecture Science and Technology Plan Project (Qiandongnan Science and Technology Cooperation Letter [2022] No. 74); Guizhou Provincial Department of Education Youth Science and Technology Talent Growth Project (Qian Jiaohe KY Zi [2022] No. 079); Guizhou Province supports municipal (prefecture) university quality improvement project (2022TS026). References [1] Wang Bing, Zeng Daxing, Li Luning, Wang Kaigan. Interactive WiFi-Controlled Small Car Based on Raspberry Pi[J]. Electronics Manufacturing, 2022, 30(16): 36-38. [2] Liu Hua, Tian Zhansheng, Feng Yufei. Intelligent Home Voice Control System Based on Raspberry Pi[J]. Manufacturing Automation, 2018, 40(10): 128-131. [3] Wang Kaiyuan, Hu Dachun. Intelligent Home Voice Control System Based on Raspberry Pi[J]. Science and Innovation, 2017(22): 56-57. [4] Wang Zhenduo, Bian Qian, Shen Haijie, Chen Xiaofan, Tian Xin Zhi. Design of Smart Home System Based on Raspberry Pi and Home Assistant Voice Control[J]. Computer Knowledge and Technology, 2021, 17(18): 20-21+25. [5] Yang Xiao, Liu Miao. Design of Road Pothole Detection System Based on Raspberry Pi Platform[J]. Agricultural Equipment and Vehicle Engineering, 2022, 60(06): 98-101. [6] He Haosheng, Yan Shu. Design of Artificial Intelligence Face Recognition Based on Raspberry Pi System[J]. Information and Computer (Theoretical Edition), 2021, 33(20): 155-157. [7] Zhao Li, Zheng Yanfang, Tian Huifeng, Zhang Baofang. Home Voice Control System Based on Cloud Platform[J]. Laboratory Research and Exploration, 2018, 37(10): 73-75+111. [8] Wang Yulin, Zhao Xueping. Design and Development of Smart Home System Based on Raspberry Pi[J]. New Industrialization, 2021, 11(11): 94-96. [9] Wei Qi. Design and Implementation of Intelligent Home Control System Based on Raspberry Pi[D]. Wuhan University of Engineering, 2022.