STONE Interface with Arduino

STONE Technologies is a professional manufacturer of HMI Intelligent TFT LCD module.
STONE Technologies offers the variety of display type and size to full fill the application requirements.
Based on application type, STONE has Industrial Type Display, Advanced type Display and Civil Type Display. and each type of display is having various size of screen resolution.

This display is the solution for the people/company who wants to deploy there product as soon as possible with great quality of touch screen display. I will recommend STONE display for such demand.

In this article we will see how to interface STONE display with Arduino.

Following things we will be covering,
1. Serial Communication
2. How to access memory location
3. Button Events

In my product i have used STONE’s 7 inch size display which looks perfect for plenty of application.

1. Serial Communication

As a part of serial communication, we will send the data from Arduino to STONE Display. The communication is over RS232. So while doing hardware connection we will need RS232 converter module.

Arduino works on TTL logic level. So, voltage level will be approx. +5v. And STONE has RS232 interface for communication. So RS232 module will converter the voltage level (+5v and 0v) from TTL to RS232 voltage level (+13V and -13V). RS232 has its own advantage over TTL is that it work like charm in the noisy environment.

Here is the schematic for RS232 module

From the above circuit DB9 connector will be connected to the display and 4-pin connector will be connected to the Arduino.

While sending the data from Arduino, we just have to take of frame format like following one.

So in our case we will be using the frame format like following,

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

So here is explanation,

0xA5, 0x5A : Header format
0x05 : Data Length
0x82 : Command
0x00,0x00 : Address
0x00,0x00 : Data.

After forming the frame send the frame to STONE display using serial interface with 115200 baud rate (default).

2. How to access memory location

STONE has memory location allocated for every variable. So, Because of this frame is much smaller and carries more information. So, to cover this part we will access the memory location for brightness control.

Brightness control has memory address of : 0x6F01

We can access the memory location using command or we can use other operator to change the value of that location. Following is the screenshot where i have explained, how to change brightness.

If we use any variable from variable configuration then you can see the property for their address. And we can use that address to change the value at that address.

3. Button Events

In the STONE, we can intelligently give the effect for button press and we can go to different screen with small configuration change.

We will be using already created GUI screens which has button pictures on it. GUI screens are required to show the button area. And in STONE we will be using button control which will add touch screen mask.
In the button property we have options like Button effect and page switch. In that option we just have to select the page number which you want to show for button effect and page switch.

Here is the example of such screen.

Code


#include <SoftwareSerial.h>

/* Address of the Data Variables*/
#define ADC0_DISPLAY_ADDR 0x0000
#define ADC1_DISPLAY_ADDR 0x0004
#define ADC2_DISPLAY_ADDR 0x0008
#define ADC3_DISPLAY_ADDR 0x000C

/* Indexes from the frame */
#define FRAME_ADDR_INDEX_H  4
#define FRAME_ADDR_INDEX_L  5
#define FRAME_VALUE_INDEX_H  6
#define FRAME_VALUE_INDEX_L  7


SoftwareSerial mySerial(2, 3); // RX, TX

int ldr_value;
int pot_value;

/* Frame which will be send from Arduino to Display */
unsigned char display_frame[8] = {0xA5,0x5A, 0x05, 0x82, 0x00,0x00, 0x00, 0x00};

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Native USB only
  }


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(115200);  
}

void send_Value_to_display(int addr,int value)
{
  display_frame[FRAME_ADDR_INDEX_H] = (addr & 0xFF00) >> 8;
  display_frame[FRAME_ADDR_INDEX_L] = (addr & 0x00FF);
  display_frame[FRAME_VALUE_INDEX_H] = (value & 0xFF00) >> 8;
  display_frame[FRAME_VALUE_INDEX_L] = (value & 0x00FF);
  mySerial.write(display_frame,8);
}

void loop() // run over and over
{
   ldr_value = analogRead(A0);
   pot_value = analogRead(A1);
   Serial.print("A0 Val : ");
   Serial.print(ldr_value);
   Serial.print("& A1 Val : ");
   Serial.println(pot_value);
   
   send_Value_to_display(ADC0_DISPLAY_ADDR,ldr_value);  //Send Value for ADC0
   send_Value_to_display(ADC1_DISPLAY_ADDR,pot_value);       //Send Value for ADC1

   delay(500);
   
}

Tutorial

Leave a Reply

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