kuman 3.5 inch tft lcd display setup free sample

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.

For this tutorial I composed three examples. The first example is distance measurement using ultrasonic sensor. The output from the sensor, or the distance is printed on the screen and using the touch screen we can select the units, either centimeters or inches.

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.

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.

Next we need to define the fonts that are coming with the libraries and also define some variables needed for the program. In the setup section we need to initiate the screen and the touch, define the pin modes for the connected sensor, the led and the button, and initially call the drawHomeSreen() custom function, which will draw the home screen of the program.

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.

Now we need to make the buttons functional so that when we press them they would send us to the appropriate example. In the setup section we set the character ‘0’ to the currentPage variable, which will indicate that we are at the home screen. So if that’s true, and if we press on the screen this if statement would become true and using these lines here we will get the X and Y coordinates where the screen has been pressed. If that’s the area that covers the first button we will call the drawDistanceSensor() custom function which will activate the distance sensor example. Also we will set the character ‘1’ to the variable currentPage which will indicate that we are at the first example. The drawFrame() custom function is used for highlighting the button when it’s pressed. The same procedure goes for the two other buttons.

Here’s that function which uses the ultrasonic sensor to calculate the distance and print the values with SevenSegNum font in green color, either in centimeters or inches. If you need more details how the ultrasonic sensor works you can check my particular tutorialfor that. Back in the loop section we can see what happens when we press the select unit buttons as well as the back button.

kuman 3.5 inch tft lcd display setup free sample

The touchscreen came on time and looks to be in mint condition. My project is to make a Kuman 3.5 TFT lcd marry a Keystudio Mega 2560. I"m about three hours into my weekend now and I"m clearly missing something quite obvious when it comes to lights and action. When I plug the Mega into the hard drive computer port it lights up and when I check the device manager I can see the the Mega is listed in ports com. If I plug the Kuman touchscreen into the Mega the lights go off on the Mega board and the device manager resets to not show the Mega. The Kuman TFT comes with a small cd with libraries and so forth. When I upload the test library it works okay (within the IDE sketch) when I verify, but when I go to upload to the actual board I get this error message. I have searched the Arduino IDE site for these particular devices. I have found several Kuman videos on you tube but for a different style that has only one row of pins on the side. I"ve uploaded every library I can think of or have heard suggested. I suspect this is a simple problem but I may be more simple. I am open to any primary or basic suggestions if you can spare the time. This is the model I"m using. I also have a spare legit Uno lying around and I get the same results. Do I have the pins lined up wrong? They are actually pressed into place, in the photos I just wanted to show you the positions. What am I doing wrong please? Update...well it works if I follow the pin diagrams with leads, add power and change one letter in the code. So I powered it up, I assume the rest of the test programs will follow. * update - turns out the first two pins on the mega are not to be used and then everything lines up and works. I have a slow learning curve.

kuman 3.5 inch tft lcd display setup free sample

Rotating the screen to the proper orientation proved challenging. The config.txt rotate commands don’t work with the raspberry pi4. I couldn’t get the xorg configuration to rotate the display. When I added kernel commandline parameters to rotate the display, that worked for the initial verbose boot screen… but once KlipperScreen loaded, it was the wrong orientation.

kuman 3.5 inch tft lcd display setup free sample

i had the same issues with this 3,5" TFT LCD and wiring it to an ESP32 and making the TouchScreen work. However i managed to find a solution to the problem. Lets start with the wiring:

Next lets focus on the software side. In bodmers awesome library you have to comment/uncomment the right sections. The User_Setup.h file is pretty straight forward. My display used the ILI9488 processor and is run in 8 Bit parallel mode:

When it came to the touchscreen i faced some difficulties. Since the display with 8 bit there is no dedicated "Touch Pin" like other displays use. I decided to use a different library than @Bodmer (no front, still love you and the library <3). I used the ADAFRUIT Touchscreen library in extend:

kuman 3.5 inch tft lcd display setup free sample

Rotating the screen to the proper orientation proved challenging. The config.txt rotate commands don’t work with the raspberry pi4. I couldn’t get the xorg configuration to rotate the display. When I added kernel commandline parameters to rotate the display, that worked for the initial verbose boot screen… but once KlipperScreen loaded, it was the wrong orientation.

kuman 3.5 inch tft lcd display setup free sample

The RPi LCD can be driven in two ways: Method 1. install driver to your Raspbian OS. Method 2. use the Ready-to-use image file of which LCD driver was pre-installed.

3) Connect the TF card to the Raspberry Pi, start the Raspberry Pi. The LCD will display after booting up, and then log in to the Raspberry Pi terminal,(You may need to connect a keyboard and HDMI LCD to Pi for driver installing, or log in remotely with SSH)

1. Executing apt-get upgrade will cause the LCD to fail to work properly. In this case, you need to edit the config.txt file in the SD card and delete this sentence: dtoverlay=ads7846.

This LCD can be calibrated through the xinput-calibrator program. Note: The Raspberry Pi must be connected to the network, or else the program won"t be successfully installed.

kuman 3.5 inch tft lcd display setup free sample

Understanding that many people have problems configuring their Kuman TFT display on the Raspberry Pi together with RetroPie, I have decided to make this step-by-step of how to install the Kuman TFT 3.5" display which you can connect directly to the GPIO ports of the Raspberry Pi and run your applications. A lot of people have been buying this Kuman display from Amazon and other online markets for its economical price but it is not an easy display to install for certain applications, compared to other displays that come with integrated HDMI ports that will surely be a lot easier to manipulate and start working.

I advise you to buy a GPIO cable or a ribbon cable to connect the display to the Raspberry Pi, because sometimes (and it happened to me) at the time of manipulating the display and fitting it on the pins of the Raspberry, the screen being so the thin can be broken easily.

Next, copy the following code to download the best driver from Github:git clone https://github.com/goodtft/LCD-show.gitchmod -R 755 LCD-showcd LCD-show/chmod +x LCD35­-show./LCD35­-show

If, after installing, the screen is a mess together with the TV missing icons or words, please connect via SSH to your Raspberry Pi and run this command:cd RetroPie­-Setup/sudo ./retropie­-setup.sh

The previous command will open the Retropie configuration file where in the end you have to look for something like SPEED and FPS and change the values to something like:dtparam=audio=ondtoverlay=tft35a,speed=62000000,fps=40,rotate=90#dtoverlay=ads7846,cs=1,penirq=17,penirq_pull=2,speed=25000000,fps=20,keep_vref$gpu_mem_256=128gpu_mem_512=256gpu_mem_1024=256overscan_scale=1