Home Solutions Controlling Smart Display Page Switching via Modbus RS485 with Arduino

Controlling Smart Display Page Switching via Modbus RS485 with Arduino

September 26,2023

Introduction

This example demonstrates how to use an Arduino board to switch pages on a standard 3.5-inch Smart Display module via Modbus RS485. The host controller uses an Arduino Mega 2560 with a Modbus RS485 shield, a physical button, and an LED.

In this demo, pressing the physical button switches the Smart Display from the first page to the second page. Pressing the button again switches the display back to the first page.

Arduino Modbus RS485 Smart Display System Block Diagram

System Block Diagram

Required Components

  1. 3.5-inch Modbus Smart Display
  2. Arduino Mega 2560
  3. Modbus RS485 shield for Arduino Mega 2560
  4. Arduino IDE v2.0.4
  5. Modbus RS485 dongle
  6. Physical button
  7. GUI Builder v0.4.2 or later
  8. LED
 

Demo Workflow

  1. Design the project in GUI Builder
  2. Build and upload the project
  3. Program the Arduino host
 

Design the Project in GUI Builder

First, create a new project in GUI Builder and enter a project name. Select the 3.5-inch TFT device under "Device Type", select "ModbusRTU (RS485)" under "Protocol", and set the display orientation to Landscape. Next, select Blank under "UI Template", and then click "Create" to create the project, as shown below.

Design the Project in GUI Builder - 1

 

After the project is created, the initial page appears in GUI Builder.

Design the Project in GUI Builder - 2

 

This demo uses two pages. Click "Page", and then click "+" to add the second page.

Design the Project in GUI Builder - 3

 

Background styles can be managed from the Resource section.

Design the Project in GUI Builder - 4

 

The desired background can then be selected for each page in the "Page" section.

Design the Project in GUI Builder - 5

Build and Upload the Project

After designing the two pages, configure the connection settings and upload the project to the Smart Display. First, switch to the "Page Info" page, click "Device", and select "Device Property". In the Device Config Window, confirm that the protocol is set to "ModbusRTU (RS485)", select the appropriate COM port, and set the baud rate to match the Smart Display. Click "OK" to apply the settings, and then click "Connect to Device". Once the Smart Display is connected, click "Upload The Project" to upload the project.

Build and Upload the Project - 1

 

When the project upload is complete, click "OK".

Build and Upload the Project - 2

 

After the upload is complete, the startup screen appears on the Smart Display.

Build and Upload the Project - 3

 

The Smart Display then switches from the startup screen to the first page, indicating that the project has been uploaded successfully.

Build and Upload the Project - 4

Program the Arduino Host

When using Modbus to connect the host to the Smart Display, it is important to use the correct register addresses in the program. For more information about RS485 communication between the host and the Smart Display, refer to the communication log in GUI Builder. The figure below shows the register address definitions required in the Arduino IDE program for this example.

Program the Arduino Host - 1

 

Next, configure the pin modes and external components, such as the physical button and LED, and set the baud rate for serial communication.

Program the Arduino Host - 2

 

The figure below shows how the Arduino host detects a change in the physical button input and sends the corresponding value to the Smart Display via Modbus communication to switch the display page.

Program the Arduino Host - 3

 

After verifying and uploading the program in Arduino IDE, the physical button can be used to switch pages on the Smart Display. The LED is off when the Smart Display shows the first page. When the physical button is pressed to switch to the second page, the LED turns on, as shown below.

Switching Smart Display Pages with a Physical Button

 

The Arduino program is available on GitHub, where you can find additional details about this demo project. The actual hardware setup is shown below. For more information about the Modbus RS485 shield used in this demo, refer to the technical documentation.

Arduino and Smart Display Modbus RS485 Hardware Setup

Conclusion

This example demonstrates how to use an Arduino Mega 2560 as the host controller to switch pages on a Smart Display via Modbus RS485. After creating the display pages and completing the required settings in GUI Builder, the Arduino host can switch between the two pages based on input from the physical button.

This example provides developers with a basic understanding of Modbus communication and control between an Arduino host and a Smart Display, and can serve as a reference for developing host-controlled Smart Display applications.

Have questions about display solutions for your business? Contact Us!

Subscribe

Receive emails about news updates from Winstar.

Contact Us

Price/Datasheet/General inquiry

Technical Support

Contact us for any technical information

go top
Contact Us
close

We value your privacy

By clicking "Allow All Cookies", you agree to the storing of cookies on your device to enhance site navigation, analyse site usage, and assist in our marketing and performance efforts. You can find further information this subject in our policy.

We value your privacy

Winstar and certain third parties use cookies on www.winstar.com.tw. The details regarding the types of
cookies, their purpose and the third parties involved are described below and in our Cookie Policy.
Please click on “Allow All” to consent to our usage of cookies in order to have the best possible
experience on our websites. You can also set your preferences or reject cookies (except for strictly
necessary cookies).

Manage Consent Preferences

Always Active
Essential Cookies

These cookies are essential in order to enable you to move around the website and use its
features, such as setting your privacy preferences, logging in or filling in forms.

Analytics Cookies

Also known as “statistics cookies,” these cookies collect information about how you use a website, like which pages you visited and which links you clicked on. See Detail