Arduino Projects

Arduino HMI TFT LCD Display Sensor Monitoring

Description:

Arduino HMI TFT LCD Display Sensor Monitoring- The 10.1” HMI Intelligent TFT LCD Module used in this video is sponsored by the Stone Technologies. Stone Technologies is a professional Manufacturer of HMI Intelligent TFT LCD modules.  Depending on the application the Stone Technologies offers Industrial Type, Advanced type, and Civil Type Intelligent TFT LCD modules available in different sizes. The one I am using in this series of videos is the Civil Type 10.1 inch HMI display Module. For more information visit stoneitech.com.

In this tutorial, you will learn how to send the sensors data From Arduino to the HMI Intelligent TFT LCD module using the Serial Communication. For the best understanding, I have used the Variable resistor or potentiometer which of course you can replace with any other sensor you want. The GUI design and the variable memory addresses remain the same.

For the extreme basics read my previous two articles,

In tutorial number1 I explained how to design a graphical user interface using the images designed in Adobe Photoshop. How to use the button function, data variable function, Hardware parameter function and how to use the Drag adjustment, and Slider Scale function for controlling the screen brightness.

While in tutorial number2 I explained the commands used for reading and writing, how to control the user interface without pressing the on-screen buttons, how to access the brightness control register and so on. So, I highly recommend first, watch my previous tutorials and then you can resume from here.


 In this article, we will cover

  1. Complete Circuit Diagram
  2. Arduino Interfacing with the HMI TFT LCD Module, and
  3. Arduino Programming

Without any further delay let’s get started!!!

Note: for the step by step explanation, watch the video tutorial given at the end of this article.

The purchase links of the HMI TFT LCD Module and other components used in this project are given below.

HMI TFT LCD MODULES

12v Adaptor:

Arduino Uno

Arduino Nano

MAX232 board:

RS232 Cable:

2-channel relay module:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!


HMI TFT LCD Module interfacing with Arduino Circuit Diagram:

Arduino HMI Sensor Monitoring

As you can see the circuit diagram is really simple. The 10.1 inch TFT LCD Module and Arduino is powered up using a 12v adaptor or battery. All the grounds are connected together. The DIN pin of the TFT LCD module which is data-in is connected with the TX pin of the MAX232, the DOUT pin which is the data-out pin is connected with the RX pin of the DB9. The VCC pin of the MAX232 board is connected with the Arduino’s 5 volts, the ground of the MAX232 is connected with the Arduino’s ground, while the TX and RX pins of the MAX232 Board are connected with the Arduino’s pin number 2 and Pin number 3. Later in the programming, I will explain, why am I using pin number 2 and pin number 3 as the Serial Port.

A variable resistor or Potentiometer is used as the Sensor. The middle leg of the potentiometer is connected with the Arduino’s Analog Pin A0, while the other two legs are connected with the Arduino’s 3.3 volts and ground.


Interfacing MAX232 with Arduino and HMI TFT LCD module:

Arduino HMI Sensor Monitoring

As you can see the HMI TFT LCD Module is connected with the Max232 board through RS232 cable which I modified.

Arduino HMI Sensor Monitoring

Normally the RS232 cable comes with the male and female type DB9 connectors. But we have a small problem,

Arduino HMI Sensor Monitoring

As you can see the MAX232 board has the female type DP9 connector, and the HMI intelligent TFT LCD Module also comes with the female type DB9 connector.

Arduino HMI Sensor Monitoring

I replaced the female type DB9 connector with the Male type DB9 connector. I simply soldered three wires. I connected the ground of both the male connectors together, connected the TX pin of the one male connector with the RX pin of the other male connector, similarly connected with the RX of the first male connector with the TX of the other DB9 male connector. Now I can use this cable to connect the HMI TFT LCD Module with the Max232 board without any problem.

Arduino HMI Sensor Monitoring

The VCC of the max232 board is connected with the Arduino’s 5 volts, the ground is connected with the Arduino’s ground, while the TX and RX pins of the Max232 are connected with the Arduino’s pin number 2 and pin number 3.


HMI TFT LCD Module Arduino Sensor Monitoring GUI:

Arduino HMI Sensor Monitoring

The  GUI design remains the same which I used in my previous two tutorials, the variable memory addresses remain the same. Now we will use Arduino to send the sensor data using Serial communication, the received values will be stored in these two memory locations. Let’s have a look at the Arduino’s programming.


Arduino HMI Sensor Monitoring Programming:

/* LCD Type: 10.1” HMI intelligent TFT LCD Display Module by the Stone Technologies
    Programmer: Engr Fahad
    Website: electroniclinic.com
    YouTube channel: Electronic Clinic
*/

#include <SoftwareSerial.h>
SoftwareSerial max232(2,3);

#define Sensor1_H               0x00
#define Sensor1_L               0x02

#define Sensor2_H               0x00
#define Sensor2_L               0x06

int vr = A0;
unsigned char sensor1_send[8]= {0xA5, 0x5A, 0x05, 0x82, Sensor1_H, Sensor1_L, 0x00, 0x00};
unsigned char sensor2_send[8]= {0xA5, 0x5A, 0x05, 0x82, Sensor2_H, Sensor2_L,  0x00, 0x00};


void setup()

{

Serial.begin(115200);
max232.begin(115200);
pinMode(vr,INPUT);

}

 
void loop()

{

 int sensor1 = analogRead(vr); 
 int sensor2 = -53;
     sensor1_send[6] = highByte(sensor1);
     sensor1_send[7] = lowByte(sensor1);
     max232.write(sensor1_send,8);
delay(100);
     sensor2_send[6] = highByte(sensor2);
     sensor2_send[7] = lowByte(sensor2);
     max232.write(sensor2_send,8);
     
     Serial.println(sensor1);
     delay(100);

}



Arduino HMI Sensor Monitoring Program Explanation:

I started off with the SoftwareSerial library. The SoftwareSerial is basically a library that enables the Serial Communication on digital pins other than the Arduino’s default Serial Port. Using the SoftwareSerial library we can create multiple software serial ports with speeds up to 115200bps.

In this particular project, you can also use the Arduino’s default Serial port which is on Pin number 0 and pin number 1. But trust me this will really make you tired, because each time you upload a program, you will have to remove the wires. That’s why I always say never use the Arduino’s default Serial Port for the communication with other devices. The Arduino’s default Serial Port should only be used for debugging purposes.

I created a software Serial Port with the name max232 on the Arduino’s pin number 2 and pin number 3. Pin number 2 is the RX while pin number 3 is the TX.

#include <SoftwareSerial.h>

SoftwareSerial max232(2,3);

Then I defined the Sensors High and Low bytes. These are the same address used in the GUI. 0x0002 and 0x0006.

#define Sensor1_H               0x00

#define Sensor1_L               0x02

#define Sensor2_H               0x00

#define Sensor2_L               0x06

Then I defined a pin for the potentiometer. A potentiometer is connected with the Analog Pin A0 of the Arduino.

int vr = A0;

These are the same commands which I have already explained in my previous tutorial. You can watch my previous tutorial, the link is given in the description.


unsigned char sensor1_send[8]= {0xA5, 0x5A, 0x05, 0x82, Sensor1_H, Sensor1_L, 0x00, 0x00};

unsigned char sensor2_send[8]= {0xA5, 0x5A, 0x05, 0x82, Sensor2_H, Sensor2_L,  0x00, 0x00};

In the Void setup function, I activated the Serial communication, and set the variable resistor as the input.

void setup()

{

Serial.begin(115200);

max232.begin(115200);

pinMode(vr,INPUT);

}

void loop()

{

First we read the variable resistor and store the value in variable Sensor1 which is of the type integer.

 int sensor1 = analogRead(vr);

In variable sensor2 I stored a random value of -53,

 int sensor2 = -53;


next, I split the sensors values into high and low bytes and stored the values in array at locations 6 and 7.

     sensor1_send[6] = highByte(sensor1);

     sensor1_send[7] = lowByte(sensor1);

finally, it is sent to the HMI TFT LCD Module.

     max232.write(sensor1_send,8);

delay(100);

similarly for the Sensor2.

     sensor2_send[6] = highByte(sensor2);

     sensor2_send[7] = lowByte(sensor2);

     max232.write(sensor2_send,8);

     Serial.println(sensor1);

     delay(100);

}



So, that’s it for now. In the upcoming article, I will explain how to control electrical loads using 10.1” HMI TFT LCD Module and Arduino.  If you have any questions, let me know in a comment. Don’t forget to Subscribe to my Website and YouTube channel “Electronic Clinic”.

Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

2 Comments

  1. Hello what is the stone tool version used ? where i can download the same version as yours ?.
    I downloaded the most recent tools at Stone website, i have 3 different versions and i dont have the same properties setting panel, i miss a few functions … i’m trying the same youtube videos as yours: hmi tft lcd youtube video, but i’m stuck at 18:15 min, i miss the slider icon settings … in the properties panel … Help

    I found out many un-used 800×600 Stone and Dwin panels from a closed company, and i want to use them with an arduino.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button