sainsmart tft lcd code made in china

SainSmart 3.2" TFT LCD Display is a LCD touch screen module. It has 40pins interface and SD card and Flash reader design. It is a powerful and mutilfunctional module for your project.The Screen include a controller SSD1289, it"s a support 8/16bit data interface , easy to drive by many MCU like STM32 ,AVR and 8051. It is designed with a touch controller in it . The touch IC is ADS7843 , and touch interface is included in the 40 pins breakout. It is the version of product only with touch screen and touch controller.

sainsmart tft lcd code made in china

LCD-specified initialization code is provided, so that you can save time to optimize power control register and gamma curves for best display performance. We have test the provided code, it gives the best display performanace

sainsmart tft lcd code made in china

I divided the program into several subrutines to make it easier to understand. The code is well documented, but, if you have trouble understanding it, leave a comment and I"ll try to explain it.

sainsmart tft lcd code made in china

In this Arduino touch screen tutorial we will learn how to use TFT LCD Touch Screen with Arduino. You can watch the following video or read the written tutorial below.

As an example I am using a 3.2” TFT Touch Screen in a combination with a TFT LCD Arduino Mega Shield. We need a shield because the TFT Touch screen works at 3.3V and the Arduino Mega outputs are 5 V. For the first example I have the HC-SR04 ultrasonic sensor, then for the second example an RGB LED with three resistors and a push button for the game example. Also I had to make a custom made pin header like this, by soldering pin headers and bend on of them so I could insert them in between the Arduino Board and the TFT Shield.

Here’s the circuit schematic. We will use the GND pin, the digital pins from 8 to 13, as well as the pin number 14. As the 5V pins are already used by the TFT Screen I will use the pin number 13 as VCC, by setting it right away high in the setup section of code.

As the code is a bit longer and for better understanding I will post the source code of the program in sections with description for each section. And at the end of this article I will post the complete source code.

I will use the UTFT and URTouch libraries made by Henning Karlsen. Here I would like to say thanks to him for the incredible work he has done. The libraries enable really easy use of the TFT Screens, and they work with many different TFT screens sizes, shields and controllers. You can download these libraries from his website, RinkyDinkElectronics.com and also find a lot of demo examples and detailed documentation of how to use them.

After we include the libraries we need to create UTFT and URTouch objects. The parameters of these objects depends on the model of the TFT Screen and Shield and these details can be also found in the documentation of the libraries.

So now I will explain how we can make the home screen of the program. With the setBackColor() function we need to set the background color of the text, black one in our case. Then we need to set the color to white, set the big font and using the print() function, we will print the string “Arduino TFT Tutorial” at the center of the screen and 10 pixels  down the Y – Axis of the screen. Next we will set the color to red and draw the red line below the text. After that we need to set the color back to white, and print the two other strings, “by HowToMechatronics.com” using the small font and “Select Example” using the big font.

Ok next is the RGB LED Control example. If we press the second button, the drawLedControl() custom function will be called only once for drawing the graphic of that example and the setLedColor() custom function will be repeatedly called. In this function we use the touch screen to set the values of the 3 sliders from 0 to 255. With the if statements we confine the area of each slider and get the X value of the slider. So the values of the X coordinate of each slider are from 38 to 310 pixels and we need to map these values into values from 0 to 255 which will be used as a PWM signal for lighting up the LED. If you need more details how the RGB LED works you can check my particular tutorialfor that. The rest of the code in this custom function is for drawing the sliders. Back in the loop section we only have the back button which also turns off the LED when pressed.

In order the code to work and compile you will have to include an addition “.c” file in the same directory with the Arduino sketch. This file is for the third game example and it’s a bitmap of the bird. For more details how this part of the code work  you can check my particular tutorial. Here you can download that file:

sainsmart tft lcd code made in china

At this stage, any panel would need to connect either to the HDMI or VGA port. Although there is a dedicated TFT connector on the board it"s not currently available for use. Foundation hopes to sell/promote a tested TFT once all tht other stuff is done!

Yes it"s ST7735 based like the Adafruit ones. I"ve got one with an Sainsmart Arduino UNO from China, comes with the ST7735 code for the Arduino by LadyAda.

I have started a project writing framebuffer drivers for small TFT LCDs. I have written a helper module that greatly simplifies writing such a driver. That is if the display is RGB565 and uses SPI. I have ordered two more modules that I will try and make drivers for:

notro wrote:I have started a project writing framebuffer drivers for small TFT LCDs. I have written a helper module that greatly simplifies writing such a driver. That is if the display is RGB565 and uses SPI. I have ordered two more modules that I will try and make drivers for:

sainsmart tft lcd code made in china

This link states that there are two revisions of the waveshares board: 2.1 and 1.1 with the difference being that 2.1 works outside of the box, yet 1.1 would need extra drivers to work properly. It also states that clones of this product are often 1.1 so my best guess is that SainSmart is also based off 1.1

The overall customer support of SainSmart is technically incapable but are generally nice people to deal with. My package got stuck in customs and I had to pay an extra 25 euro, even tho I had explicitly stated that it should be sent from Germany, because I know shit like this happens.

sainsmart tft lcd code made in china

In recent time, China domestic companies like BOE have overtaken LCD manufacturers from Korea and Japan. For the first three quarters of 2020, China LCD companies shipped 97.01 million square meters TFT LCD. And China"s LCD display manufacturers expect to grab 70% global LCD panel shipments very soon.

BOE started LCD manufacturing in 1994, and has grown into the largest LCD manufacturers in the world. Who has the 1st generation 10.5 TFT LCD production line. BOE"s LCD products are widely used in areas like TV, monitor, mobile phone, laptop computer etc.

TianMa Microelectronics is a professional LCD and LCM manufacturer. The company owns generation 4.5 TFT LCD production lines, mainly focuses on making medium to small size LCD product. TianMa works on consult, design and manufacturing of LCD display. Its LCDs are used in medical, instrument, telecommunication and auto industries.

TCL CSOT (TCL China Star Optoelectronics Technology Co., Ltd), established in November, 2009. TCL has six LCD panel production lines commissioned, providing panels and modules for TV and mobile products. The products range from large, small & medium display panel and touch modules.

Established in 1996, Topway is a high-tech enterprise specializing in the design and manufacturing of industrial LCD module. Topway"s TFT LCD displays are known worldwide for their flexible use, reliable quality and reliable support. More than 20 years expertise coupled with longevity of LCD modules make Topway a trustworthy partner for decades. CMRC (market research institution belonged to Statistics China before) named Topway one of the top 10 LCD manufactures in China.

Founded in 2006, K&D Technology makes TFT-LCM, touch screen, finger print recognition and backlight. Its products are used in smart phone, tablet computer, laptop computer and so on.

The Company engages in the R&D, manufacturing, and sale of LCD panels. It offers LCD panels for notebook computers, desktop computer monitors, LCD TV sets, vehicle-mounted IPC, consumer electronics products, mobile devices, tablet PCs, desktop PCs, and industrial displays.

sainsmart tft lcd code made in china

Buying is a Type of Hunting Game. TFT LCD Display For Arduino Buying Guide is an Important Article as No Where There is Any Practical Guide. Practically we will use it as a base either as receiver or the central machinery for some stuffs around Internet of Things. Just for getting started with DIY electronics, we published some articles which possibly will help who are not exactly related to hardware but has more to do with software. Those articles mostly can be found by using the search option on this website, searching with Arduino will help to sort out.

We are avoiding the basic electronic displays like LED display, basic LCD display as we are NOT really related to so basic works of electronics. This website was never for so basic guides. There are hundreds of those basic websites for those guides. Hardware are time consuming to write, most importantly, testing the useless hardware hugely waste our space. It might dishearten our some readers, but basically we need a rapid shift towards our main niche. Ultimately we have to connect with the servers.

We have three options – TFT LCD Display, TFT LCD Touch Display and OLED display. You can check various places, monochrome OLEDs are the choice right now for manufacturing electronic units. OLEDs are hugely power saving but are far better than monochrome LCDs. There is not HUGE options in OLEDs for Arduino. Usage is very lesser in most situations where we will need a display. TFT LCD Touch Display doubles up as an input too. Without a computer, we can do the desired works in the way, suppose we did with the old color mobile phones. Smartphones are mostly a full OS driven, hence can not be compared. Most works which other displays can perform a TFT LCD Touch Display is able to perform.

There are several things to consider. First, it is basically meaningless to buy a bigger display at higher cost. Second, we do not need Mac like beautiful display. Third, connecting the display with various types of Arduino is not exactly very easy. Forth, even the official TFT LCD Touch Display library of Arduino is not fully complete, Adafruit has Open Source contribution. Fifth, there is a firmware of the whole thing, it is kind of “self dependent”. If a cheaper stuff’s library or firm is not compatible, no body’s father reverse engineer it.

We found two company’s name for 2.4″ TFT LCD Touch Displays – one is LuckSender, whose product sold around $4.99 in Ebay, but has a serious detailed pathetic, scary review by an Amazon customer. It probably has problem with compatibility.

Second company we found is named SainSmart. SainSmart is not exactly a small company, it has a modern website (we saw Affiliate link option in footer too – we are never interested to push anyone’s product to our readers), We noticed that, this company’s website has written :

But also we noticed that, SainSmart 3.2″ TFT LCD Display total unit for Arduino sells at Ebay at LESSER price than official website with free shipping. You can probably use the SainSmart’s forum for support. This display stuffs is probably less explored market.

For those who have lesser idea, this total stuff includes a board (shield) and a SD card slot too. $13.00 is not bad pricing for a TFT LCD Touch Display, although (as always) we think, the right price should be $1.30! We are kids, playing, we can not make money out of these, they should “sponsor” us. The market of Arduino is not exactly great right now unlike before, their monopoly is only in boards; Adafruit also not going great. Except display, the market is of China. Do not hurry, watch auctions and it is not improbable to get that brand’s at less than $10.00.

sainsmart tft lcd code made in china

Adafruit_ST7735 is the library we need to pair with the graphics library for hardware specific functions of the ST7735 TFT Display/SD-Card controller.

Basically, besides the obvious backlight, we tell the controller first what we are talking to with the CS pins. CS(TFT) selects data to be for the Display, and CS(SD) to set data for the SD-Card. Data is written to the selected device through SDA (display) or MOSI (SD-Card). Data is read from the SD-Card through MISO.

So when using both display and SD-Card, and utilizing the Adafruit libraries with a SainSmart display, you will need to connect SDA to MOSI, and SCL to SCLK.

Note: Adafruit displays can have different colored tabs on the transparent label on your display. You might need to adapt your code if your display shows a little odd shift. I noticed that my SainSmart display (gree tab) behaves best with the code for the black tab – try them out to see which one works best for yours.

Below the code parts for a LOW SPEED display (pay attention to the highlighted lines) – keep in mind that the names of the pins in the code are based on the Adafruit display:

#define sclk 4 // SainSmart: SCL#define mosi 5 // SainSmart: SDA#define cs 6 // SainSmart: CS#define dc 7 // SainSmart: RS/DC#define rst 8 // SainSmart: RES

#define sclk 13 // SainSmart: SCL#define mosi 11 // SainSmart: SDA#define cs 10 // SainSmart: CS#define dc 9 // SainSmart: RS/DC#define rst 8 // SainSmart: RES

You can name your BMP file “parrot.bmp” or modify the Sketch to have the proper filename (in “spitftbitmap” line 70, and in “soft_spitftbitmap” line 74).

#define SD_CS 4 // Chip select line for SD card#define TFT_CS 10 // Chip select line for TFT display#define TFT_DC 9 // Data/command line for TFT#define TFT_RST 8 // Reset line for TFT (or connect to +5V)

#define SD_CS 4 // Chip select line for SD card#define TFT_CS 10 // Chip select line for TFT display#define TFT_DC 9 // Data/command line for TFT#define TFT_RST 8 // Reset line for TFT (or connect to +5V)

Based on these functions, I did create a little demo to show what these functions do. Either download the file or just copy the code and paste it into an empty Arduino Sketch.

tft.print("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ");