[Tool]:Smart Home Sharing Based on GUI Guider

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

[Tool]:Smart Home Sharing Based on GUI Guider

[Tool]:Smart Home Sharing Based on GUI Guider

  1. Introduction

GUI Guider is a user-friendly graphical user interface development tool from NXP that enables the rapid development of high quality displays with the open-source LVGL graphics library. GUI Guider's drag-and-drop editor makes it easy to utilize the many features of LVGL such as widgets, animations and styles to create a GUI with minimal or no coding at all.

In recent years, Smart Home has emerged rapidly and has a strong momentum of development. Smart Homes connect various household appliances and provide services such as lighting control, telephone remote control, burglar alarm and environmental monitoring. Smart Home applications are more and more widely used, but it is difficult for many developers to start. Using NXP GUI Guider can improve the development speed, reduce development difficulty, shorten development cycle.

This article mainly introduces the use of GUI Guider to realize some functions of Smart Home, and shares some common methods in the use of GUI Guider, including creating a new project, adding controls, adding events, interface design and layout, and controlling the lighting of hardware lights.

  1. Development environment

2.1 Hardware environment

Evaluation of LPC54628 -LPCXpresso54628, also applies to LPCxpresso54618, LPCxpresso54608.

2.2 Software Environment

This Smart Home demo uses GUI Guider version 1.5.1 to set up the software environment. GUI Guider version 1.5.1 supports LVGL versions 7.10.1 and 8.0.2. This introduction is based on version 8.0.2 LVGL.

Download link: https://www.nxp.com/design/software/development-software/gui-guider:GUI-GUIDER

  1. Create a new project

3.1 Double-click the GUI Guider icon to start the GUI Guider.

Alice_Yang_0-1692090118816.png

 

3.2 Click Create a new project (" Create a New Project ") button to start the project creation process.

Alice_Yang_1-1692090118840.png

 

3.3 select LVGL version v8.3.2 and click Next button.

Alice_Yang_2-1692090118855.png

 

3.4 Select LPC54628 as the target board template and click Next button.

Alice_Yang_3-1692090119002.png

 

3.5 Select empty application template EmptyUI and click Next.

Alice_Yang_4-1692090119101.png

 

3.6 Perform the project Settings, and set the project name, project location, and screen type (select RK043FN66H or RK043FN02H according to your screen type). Click Create to create the project.

Alice_Yang_5-1692090119191.png

 

3.7 After the project is created, the interface is as follows.

Alice_Yang_6-1692090119335.png

 

  1. Page Design and Layout

This section describes how to adjust the background color, layout, add various controls (Such as images, image buttons, text, and containers , etc), and set properties.

4.1 Create the image folder, and put the image resources needed in the project under the established image folder.

Alice_Yang_7-1692090119351.png

 

4.2 Adjust the background color of the interface

① Click the Background color icon to open the background color Settings.

② You can set the background Gradient or monochrome by using Gradient.

③ Then select the background color.

Alice_Yang_8-1692090119450.png

 

4.3 Add images

① Open Widgets control options.

② Click to add the Image control.

③ Then click the image shape button in the Attribute box of the property Settings, and “Select Images” will pop up.

Alice_Yang_9-1692090119505.png

In “Select Images”, select the image you want to add, click OK to add the image, and adjust the image size and position.

Alice_Yang_10-1692090119619.png

 

In the same way, you can add the "small house" image. In the Widgets box, you can view the added image and set the image name. In the Screen box, you can view the current interface and set the interface name.

Alice_Yang_11-1692090119692.png

 

4.4 Add text

① Open the control options, select and click the Label control. ② In Property Settings Text, set the text content to SMART HOME. ③ Then click the Background background setting area to set the Label control background. ④ Set the color depth of the Label control to 0, without background color. ⑤ Set the Font color, size and style in the font.

Alice_Yang_12-1692090119801.png

 

4.5 Add a container

Containers are essentially basic objects with layout and automatic resizing capabilities.

  • Open the control option, click Container to add the Container control, and drag the control size.
  • Set the background color in the property Settings. ③ Then set the Border and rounded corner of container in "Border".
Alice_Yang_13-1692090119874.png

 

Name the added Container control cont_TodayInfo. Add other controls to the Container control. You can view other controls (including picture, text, and line controls) added to the cont_TodayInfo container in the Widgets.

Alice_Yang_14-1692090120023.png

 

4.6 Add an Image button

Image button are very similar to simple "button" objects. The only difference is that it displays image in each state defined by the user.

① Open component options, select and click the Imgbtn control. ② Add the Released and Pressed images.

Alice_Yang_15-1692090120122.png

 

In the same way, add other Imgbtn controls and Label controls.

Alice_Yang_16-1692090120274.png

 

  1. Switch the interface

This section describes how to create sub-interfaces and switch between the main interface and sub-interface.

5.1 Add a second new interface

Click “+” to add a new screen, rename the new screen src_Light, add Image, imgbtn controls, and change the background color.

Alice_Yang_17-1692090120367.png

 

5.2 Add interface switching trigger conditions

① Select the imgbtn_Light button on the first screen. ② Select the Events Settings. ③ Click “+” to add an event, and then set the event. ④  In event Settings, trigger conditions need to be selected, here Clicked trigger conditions are selected. Target Select the second new interface src_Llight that you want to load, and then select the Delete current interface option.

When the program is running, when the imgbtn_Light button is clicked, it will switch to the second src_Light interface.


 
Updating Media

 

5.3 Add a trigger condition for returning to the interface

① Select the imgbtn_Home control. ② In the event Settings, select Clicked trigger conditions, Target select src_Welcome for the interface to be loaded, and select Delete the current interface option.

When the program is running, when the imgbtn_Light button is clicked, it returns to the first main screen of src_Welcome.

Alice_Yang_19-1692090120504.png

 

5.4 Design the second interface

Add controls in the second interface, including Switch control, Slider control, Dropdown control, Image control, Imgbtn control, Label control.

Switch control: This switch can be used to turn the light on/off and it looks like a small slider.

Slider control: The slider object looks like a bar supplemented with knobs. You can drag the knob to set the value. The slider can be vertical or horizontal.

Dropdown control: A drop-down list allows the user to select a value from a list. By default, the drop-down list is turned off and displays a single value or predefined text.

The Image control, Imgbtn control, and Label control are described in the previous section.

Alice_Yang_20-1692090120577.png

 

  1. Control hardware light design

Smart home usually has the control of the light, through the control interface to control the hardware light on and off, the steps are as follows:

6.1 GUI Guider generates code project

① Generate the code by clicking the Generate code button.

② Click the Folder icon to open the project folder

Alice_Yang_21-1692090120668.png

 

6.2 Starting the MDK Project

After the generated code is completed, open the project folder and open the MDK project in the specified directory (support MCUXpressoIDE, MDK, IAR).

Alice_Yang_22-1692090120722.png

 

6.3 First, the drive to control the light switch is added to the project

Add a GPIO initializer in lvgl_guider.c.

Alice_Yang_23-1692090120901.png

 

6.4 then, add a custom Led control function under Custom.c

This routine adds Led1_Control, Led2_Control, and Led3_Control lamp control functions.

Alice_Yang_24-1692090121024.png

 

6.5 Add custom event program to GUI Guider

① Select the first Switch control and add the event.

② In the event, select Trigger to trigger the event condition that the Switch control is on and off, and the Target option is set to Null.

  •  In Action, select C to add custom events and click to open Edit Code.
  •  Add a custom event function to Edit Code (open Led3, close Led2, Led1), and add the header file of the file where the custom event function is located.
Alice_Yang_25-1692090121106.png

 

6.6 View custom events in the MDK project

After setting the custom event, the set Led custom trigger event can be found on events_init.c after the GUI Guider regenerates the code again.

Alice_Yang_26-1692090121195.png

 

  1. Program download and demo

After the project is completed, there are two ways to download the program to the development board:

  • Open the project with IDE (MCUXpresso IDE, KEIL or IAR), compile and download the program to the development board.
  • Selecting MCUXpresso, Keil, or IAR from Target in the GUI Guider automatically compiles the program to download to the board.

The following diagram shows how Guider automatically compiles the download program to the development board in GUI.

Alice_Yang_27-1692090121269.png

 

Attached video shows the effect.

 

8.In SUMMARY

This artical mainly shares the Smart Home interface design based on GUI Guider. GUI Guider, as a tool for GUI design, is powerful and easy to use. This article only uses a few functions of GUI Guider, we can further learn to explore GUI Guider, the related project has been placed in the attachment.

The GUI Guider application guide can be found on the NXP official website, and the following are some ways to find information when learning to use GUI Guider.

  1. View the User Guide and click Help->User Guide
Alice_Yang_28-1692090121289.png

 

  1. control Settings and usage instructions, you can click the following small icon to view
Alice_Yang_29-1692090121322.png

 

 

ラベル(2)
添付
評価なし
バージョン履歴
最終更新日:
‎08-15-2023 02:23 AM
更新者: