Connect an SPI TFT with Touchscreen to your Arduino - ILI9341 LCD with XPT2046 Touch screen

Поділитися
Вставка
  • Опубліковано 22 жов 2020
  • You can get buy some really cheap LCD and touchscreen modules from places like eBay. They're actually great devices that let you add a display to your Arduino and microcontroller projects for under £10. But they don't come with any documentation so they can be a bit tricky to get working if you've never used them before.
    In this video I'll walk you through the connections and software needed to get them working. My screen is a generic, red, Chinese sourced device using the very common combination of an ILI9341 based LCD module with a touchscreen driven by the XPT2046 touch controller.
    You can easily get hold of one of these touchscreens at Amazon or eBay.
    Amazon: amzn.to/39ZyWMD
    eBay : ebay.us/sOCSyI
    Make sure you visit the project pages on my website for circuit diagrams and breadboard layouts, along with more information and details.
    bytesnbits.co.uk/spi-lcd-setu...
    ILI9341 Library
    github.com/adafruit/Adafruit_...
    XPT2046 Library
    github.com/PaulStoffregen/XPT...
    Adafruit GFX Library
    github.com/adafruit/Adafruit-...
    Adafruit LCD tutorial
    learn.adafruit.com/adafruit-2...
    Adafruit GFX Library Tutorial
    learn.adafruit.com/adafruit-g...

КОМЕНТАРІ • 352

  • @mellee3436
    @mellee3436 Рік тому +3

    Thanks very much for this. After literally thousands of experiments/hours (over a year or so) with Arduino Uno and ILI9341 I finally got it working, thanks to this excellent video. The voltage dividers were my problem. I used 4.7K and 10K resistors in my setup. Thanks again.

    • @BytesNBits
      @BytesNBits  Рік тому

      Great to hear you've got your project working.

    • @mellee3436
      @mellee3436 Рік тому

      @@BytesNBits I'm using the ILI9341 FAST driver for experiments now..

  • @DavidTLutz
    @DavidTLutz Рік тому +9

    Thanks for a GREAT tutorial! I spent 2 several hour periods trying to figure out why I could never get anything but a white screen. I checked all connections several times. I finally fired up the oscilloscope and found that I only had 1.1V on the clock signal. Checking my voltage divider I discovered that a 10K resistor had snuck into my 2.2K resistors. That one got used for the clock signal. Once replaced everything worked fine. Lesson: once you run out of big options as the problem, try the little ones - maybe try them first. 🙂

    • @BytesNBits
      @BytesNBits  Рік тому +1

      Hi. That's a really awkward 'bug' to have to find. Glad it all worked in the end.

  • @rondivecchia4561
    @rondivecchia4561 3 місяці тому

    Very informative! Thank you for taking the time to put this together. It is much appreciated.

  • @Harry-Powney
    @Harry-Powney 3 роки тому

    Thank you for your efforts, this has helped me enormously. I look forward to your future videos

  • @gammacount1328
    @gammacount1328 2 роки тому

    Great job! Very clear and comprehensive explanations. Thank you.

  • @makermatrix9815
    @makermatrix9815 3 роки тому +7

    I learned that you don't need to burn another pin on the Uno to get the TFT Reset function working on these screens. It can piggyback off the Uno's Reset pin, which is otherwise useless unless you plan to get into HVSP tools to recover the chip afterwards. The bit of magic that allows this is to tell the library to use a negative number for TFT_RST. This activates a software TFT Reset function, removing the need for a separate digital pin from the MCU. This only appears to be documented in the library code itself. I've also seen it documented that you can hook TFT Reset to a pullup, but I was not able to make that work. Piggybacking on the Uno RST pin is working great on three different screens I've got here, though.

    • @BytesNBits
      @BytesNBits  3 роки тому +2

      Hi. Thanks for the tip. I'll try that out. Always good to save a pin for later :)

  • @robconnelly202
    @robconnelly202 3 роки тому

    Super helpful and very clear. You just saved me boatloads of time.

  • @dankclee
    @dankclee Рік тому +1

    Thank you for publishing this video!!

  • @stijndepuysseleir2499
    @stijndepuysseleir2499 Рік тому

    Thanks for pointing out the HIGH values for the CS pin. From white to working...

  • @BartdeBoisblanc
    @BartdeBoisblanc Рік тому

    This and your video on how to modify the Adafruit and Touchscreen sketches are great quite helpful. By the way I think that game is called breakout. Pong usually has two players with paddles.

    • @BytesNBits
      @BytesNBits  Рік тому

      Hi. You're absolutely right. Just me talking off the top of my head!

  • @drlerkan
    @drlerkan 3 роки тому

    You really explained it very well. I found answers to many questions. thanks.
    I subscribed for your other important information :)

    • @BytesNBits
      @BytesNBits  3 роки тому +1

      Thanks for the sub! I hope you find my other videos useful.

  • @danielfromca
    @danielfromca 2 роки тому +2

    Thanks so much for this really great & well explained tutorial. Definitely helped me understand better how to connect the display to an Arduino & how they work together.

  • @johnvine5731
    @johnvine5731 2 роки тому

    Another thumbs up here. That was a great help. Thanks very much for your kind efforts.

  • @atihrot755
    @atihrot755 Рік тому

    Thank you for your advice. I wish you a nice rest of the bottom. This screen gave me a hard time. I like watching your works, I'm always learning something. Keep up the good work and good luck. Could you post some codes for the clock or the weather station. Or some games. Thank you.

    • @BytesNBits
      @BytesNBits  Рік тому

      Glad you're enjoying the channel. Lots of projects to come. Just trying to find time to make them!

  • @mahlodibogashu5211
    @mahlodibogashu5211 3 роки тому

    Thank I just got the exact lcd and i will be following up thanks for your effort sir.

  • @accci4551
    @accci4551 Місяць тому

    Thx for publishing this video! now I know wha the LED at the display is

  • @makermatrix9815
    @makermatrix9815 3 роки тому

    Fantastic. Glad I found your channel.

    • @BytesNBits
      @BytesNBits  3 роки тому

      Thanks. I hope you find it useful.

  • @jimdesposito9433
    @jimdesposito9433 11 місяців тому

    Great tutorial, thank you! BTW, you can use an Arduino Nano, or probably any other Arduino board, as long as you select the right one in the 'boards' drop-down.

    • @BytesNBits
      @BytesNBits  11 місяців тому

      Thanks for the info!

  • @trombonista92
    @trombonista92 2 роки тому

    very high production quality ,

  • @MOHJH59
    @MOHJH59 2 роки тому

    So detailed needed instruction...thank you so much...

  • @jefferyosei101
    @jefferyosei101 Місяць тому

    Thank you so much, this is EXACTLY what i needed!

  • @56NeilWatson
    @56NeilWatson 2 роки тому

    Thanks (name?) for this tutorial. I have need of a touch screen for another project someone has done which I'm copying. I thought I'd have a play first to get familiar with it first and have learnt a few things. I went down the road of using a TXSO108E level shifter board which works really well.

    • @BytesNBits
      @BytesNBits  2 роки тому

      Hi. The level shifters are much better than the resistor dividers.

  • @michaeldutsonlandscapephot2184
    @michaeldutsonlandscapephot2184 2 роки тому +2

    Excellent video Bob,. Probably about the clearest and most understandable ones on UA-cam; very nicely done. Thanks for taking the time to post this. I've now placed an order for a similar 4" screen which I will be using as the settings and data readout interface on a replacement range cooker controller I'm building. A bit of a learning curve, but such is life.
    I understand that bitmap images can be installed on the SD card and then uploaded on screen - did you try this at all?? I was hoping to use a bitmap image created in Photoshop and then use the touchscreen co-ordinates to see when a particular 'button' is pressed. Not sure how data readout would work with a bitmap image background though.

    • @BytesNBits
      @BytesNBits  2 роки тому +1

      Hi Michael. Thanks for the comments. Sounds like a great project!
      I did make a few videos in the series on the touch panel and SD card. Have a look at these...
      SD card - ua-cam.com/video/FI7yXDi-fKA/v-deo.html
      Simple SD card images - ua-cam.com/video/aVCWLk10sAw/v-deo.html
      Writing your own image handler - ua-cam.com/video/exjzGMX4fqs/v-deo.html
      Have fun!

    • @michaeldutsonlandscapephot2184
      @michaeldutsonlandscapephot2184 2 роки тому

      @@BytesNBits Cheers Bob. It's a dark evenings project for me. I'm struggling to get parts for the range cooker in the kitchen, and those I can get are priced at well over 200 quid to overhaul the full control system. It's a no brainer to do it using modern components which offer far more accuracy and options. Your videos certainly help in making the new controller have the Wife Acceptance Factor. 👍🏻

    • @BytesNBits
      @BytesNBits  2 роки тому +1

      @@michaeldutsonlandscapephot2184 Great. I like the 'Wife Acceptance Factor' idea. That sounds like a hard target to reach.

    • @michaeldutsonlandscapephot2184
      @michaeldutsonlandscapephot2184 2 роки тому +1

      @@BytesNBits WAF is generally an unachievable goal! 🙄

  • @activ8me3
    @activ8me3 2 роки тому

    I really like your style. You are not a snob maker - like most. Wow.

    • @activ8me3
      @activ8me3 2 роки тому

      ... and I liked your reference to adafruit. The tiny Ai corp that my daughter and are startuping is going north too.

    • @BytesNBits
      @BytesNBits  2 роки тому

      Hi Armin. Thanks. I try to keep it real. Good luck with the new venture.

  • @PavolFilek
    @PavolFilek Рік тому

    Beautiful explanation.

  • @tiagosilva2196
    @tiagosilva2196 3 роки тому

    Great Video!! A real lifesaver!! Thanks so much!!

  • @BilalAhmad-dd3eu
    @BilalAhmad-dd3eu Рік тому

    Greatly explained.
    Thank you.

  • @tothlaszlo8008
    @tothlaszlo8008 3 місяці тому

    Thank you the video! Its verry big help to understanding! 👍

  • @coby1kenobii
    @coby1kenobii 3 роки тому

    Great video, thanks!

  • @epicdaniel508
    @epicdaniel508 10 місяців тому

    Great video!

    • @BytesNBits
      @BytesNBits  10 місяців тому +1

      Glad you enjoyed it

  • @srideepaindu818
    @srideepaindu818 7 місяців тому

    Worked like a Charm :D... Thanks

  • @Gouzation
    @Gouzation 2 роки тому

    Hi, Great video i was just wondering if this is the same screen that you used in your retropie GPIO gamepad video?

  • @RealDevastatia
    @RealDevastatia 11 місяців тому

    You have neat handwriting. :D

  • @maruanuar
    @maruanuar 3 роки тому

    Hey great video ! Was wondering if you could share the software you used to draw the circuits at minute 9:56 ?

    • @BytesNBits
      @BytesNBits  3 роки тому +1

      Hi. I used Fritzing (fritzing.org/) for this project.

  • @williampowell7518
    @williampowell7518 2 роки тому +1

    Great tutorial. I am a novice with mcirocontrollers but I am trying to use the SD card slot but unsure of the physical connections to use. for the sd card slot there is a sd_cs,sd_mosi,sd_miso & sd_sck

    • @BytesNBits
      @BytesNBits  2 роки тому +1

      Hi. The mosi, miso and sck connections are the SPI bus so you just run the same connections as you're using on the LCD side. The cs (chip select) needs to run back to a separate output pin on the Arduino to allow it to select what device it wants to talk to on the SPI interface.

    • @mellee3436
      @mellee3436 9 місяців тому

      Most software wants SD_CS to be pin 5 on esp32.

  • @sudheerillipilli4691
    @sudheerillipilli4691 2 роки тому

    Sir, hardware spi settings are enough for speeding of screen or any other things need ? Nice explanation.

    • @BytesNBits
      @BytesNBits  2 роки тому

      There are a number of ways of speeding up the screen but most need a more powerful microcontroller board. I've done some tutorials for the Raspberry Pi which will give you some ideas.

  • @TomasCarrascoFerrarezi
    @TomasCarrascoFerrarezi Рік тому

    Awesome tutorial, just a question, is this library compatible with the ILI9486 chip? i'm looking for a bigger screen and they all seem to run on this chip

    • @BytesNBits
      @BytesNBits  Рік тому

      No. The Adafruit driver only supports a small range of chips - have a look in the source code notes at the top of the listing. You'll need to find a suitable driver. Have a look at this project - www.engineersgarage.com/arduino-ili9486-driver-3-5-inch-tft-lcd-touch-screen/.
      The drivers are often compatible with the Adafruit GFX library so most of the code will be the same as in the tutorial.

  • @nucleoy6000
    @nucleoy6000 4 місяці тому

    Hello! nice video! I was wondering why don't you use the 3.3V output from the arduino board itself to power the screen instead of using the 5V output and doing the voltage conversion bridge? thx!

    • @BytesNBits
      @BytesNBits  4 місяці тому

      Even if you use the 3.3V output for power the IO pins run at 5V.

  • @viktorhugo8252
    @viktorhugo8252 Рік тому

    @ 8:35, If there is no voltage regulator on the TFT you have to use 3,3Voltage for VCC and LED

  • @Benqo
    @Benqo 3 роки тому

    Hi, I have found some tutorials with just 10k resistors between the screen and Adruino´s pins instead of the voltage dividers. Which alternative is better?

    • @BytesNBits
      @BytesNBits  3 роки тому

      Hi. It's sort of a personal choice, both will work. The best solution is actually to use logic level converters. They are also a neater package to connect up!

  • @MrBobWareham
    @MrBobWareham 8 місяців тому

    Loved the video it was very interesting, but why did you use Arduino and not use esp32 as it has so much more power to drive the screen?

    • @BytesNBits
      @BytesNBits  8 місяців тому

      Thanks. The video is really more to show people how to connect up and use an SPI screen. The Arduino is the more common beginner board. Yes, in a real project you'd probably opt for the ESP32 or RP2040.

    • @MrBobWareham
      @MrBobWareham 8 місяців тому

      Thanks for the reply, love the channel and your presentation.Bob@@BytesNBits

  • @Fachher
    @Fachher Рік тому

    Thank you for this video. It helped me to correctly connect my display to my Arduino. Before this video I've connected everything directly without any resistor. My display showed one single frame and then turns white. Now the graphicstest example renders letters, rectangle, lines etc but not on the whole screen. It is more like 240x240 instead of 240x320. What could be the reason for it. I double checked the wiring.

    • @BytesNBits
      @BytesNBits  Рік тому

      Hi. You need to play around with the screen dimensions and rotation to get it to match your screen. If you've set the screen dimensions it sounds like you might have it rotated incorrectly.

  • @nielspaulin2647
    @nielspaulin2647 Рік тому

    EXCELLENT

  • @salustianomoreno1394
    @salustianomoreno1394 3 роки тому

    Hello, thank you very much for your work, it has helped me to configure the TFT, I have not found anything better anywhere else, excellent work.
    I have to connect two TFTs to control them from my arduino MEGA, my presumption is if I have to add another group of redistances or is it possible to share the common terminals, with the resistors that I use for the first display?
    Thank you very much from Spain

    • @BytesNBits
      @BytesNBits  3 роки тому +1

      Hi. The data signals like MISO, MOSI and CLK can be simply connected to your second display. You'll just need to assign a new chip select pin. I haven't tried it, but I expect in the software you'll be able to create a second TFT object and initialise it with the same data pins but new CS pin. You'll then have one TFT object talking to one display and the other talking to the other display. Let me know how you get on.

    • @musaenoch2277
      @musaenoch2277 2 роки тому

      I dont mean to be off topic but does any of you know a tool to get back into an instagram account??
      I was stupid forgot my login password. I appreciate any help you can offer me

    • @everettjoseph6400
      @everettjoseph6400 2 роки тому

      @Musa Enoch instablaster =)

    • @musaenoch2277
      @musaenoch2277 2 роки тому

      @Everett Joseph i really appreciate your reply. I found the site thru google and Im waiting for the hacking stuff now.
      I see it takes quite some time so I will reply here later when my account password hopefully is recovered.

    • @musaenoch2277
      @musaenoch2277 2 роки тому

      @Everett Joseph It did the trick and I actually got access to my account again. I am so happy!
      Thanks so much, you really help me out!

  • @mbanc443
    @mbanc443 4 місяці тому

    Hello, and thank you very much for a valuable info on those type of ILI9341 with UNO but I'm using Mega2560 and it still doesn't work w/ it. Any idea why? Thx in advance! Great job here!

    • @BytesNBits
      @BytesNBits  4 місяці тому

      Make sure you check what pins you're using for the connections. You'll need to use one of the SPI channels and then a few general IO pins on the Mega2560 and then adjust the code to match with what you've used. The driver code should be compatible.
      I hope you get it going.

  • @ezion67
    @ezion67 Рік тому

    Thanks for the nice tutorial. I try to understand the ins and outs, level shifting from 5v to 3v3 using voltage dividers is straight forward. However the MISO lines need shifting UP from 3v3 to 5v. How does that work with this resistor set up? What am I missing?
    The only thing I can think of is that the MISO pin (input) on the Arduino is 3v3 compatible and should be connected WITHOUT the voltage divider?
    Edit: I checked the data sheet. The inputs on the ATMega328p are not 3v3 compatible. Assuming the the circuit is NOT operating in the gray "it might work" era. Is maybe the internal pull up used together with the voltage divider to create a offset on the the MISO input pin?
    Please clarify, thanks in advance.

    • @BytesNBits
      @BytesNBits  Рік тому

      Hi. You're absolutely right on the voltage levels. The 3.3V signal works more from the flexibility of the Arduino than by true digital signal levels. This circuit used voltage dividers to show the principle with simple components. In reality you're much better off using level shift ICs.

    • @ezion67
      @ezion67 Рік тому

      @@BytesNBits Thanks for your answer. I did the calculation, even using the internal pull up to create a voltage offset it would still operate on what you call "the flexibility of the Arduino". So for me active level shifters it is.

  • @NayanPrakash06
    @NayanPrakash06 3 роки тому

    Hello.. Thank you for the video.. Have made the connections and works well .. Is it possible to interface the SD card (the one present on the module) as well .. If yes, can u please share the procedure.. Will be of great help.. I tired interfacing by selecting a different CS and making it HIGH but didn't work ..

    • @BytesNBits
      @BytesNBits  3 роки тому

      Hi. You're on the right track. You need to connect the data and clock lines to the SD card connections and, as you rightly did, connect a new output from the Arduino to the chip select on the SD card interface. Again make sure you set it inactive before starting to initialise the SPI devices. From there you need to learn how to use the SD card package. Have a look at www.arduino.cc/en/reference/SD. There are a few examples for you to look through and see how the package is used.
      I hope this helps.

    • @NayanPrakash06
      @NayanPrakash06 3 роки тому

      @@BytesNBits Thank you for the reply. I tired the mentioned method but the combination of three doesn't work. Tested the wiring and code multiple times. When connected and used separately i.e. SD card only or Display and touch only, works well. If is it possible for u, can you please try out using all the three together?? Will be of great help. Thanks in advance!

  • @denakkusativ1072
    @denakkusativ1072 Рік тому

    Thank you so much for the video. I got one question though: Is it possible to loosen the pcb on the back? I obviously do not want to remove it, but for my project I need a bit more space behind the display itself. I know there is a cable coming from the LCD display that’s connected to the shield (I think that’s how it’s called), so it has to be possible, right?

    • @BytesNBits
      @BytesNBits  Рік тому

      Hi. These displays tend to have a ribbon cable coming out of them which is connected to the circuit board. The actual lcd panel is then stuck to the pcb. As long as you don't damage the ribbon cable you should be fine. You can also buy the displays with just the ribbon cable so you can solder to your own circuits. Have a look on eBay. I hope this helps.

    • @denakkusativ1072
      @denakkusativ1072 Рік тому

      @@BytesNBits Thanks for the incredibly fast response. You said that the lcd panel is ‚stuck‘ to the pcb. Is it possible to tell how they typically assemble them? Is it some type of double sided tape or glue? Do you have experience with separating the two components without damaging either of them?

    • @BytesNBits
      @BytesNBits  Рік тому

      @@denakkusativ1072 I has a look at my panel. It looks like there are two trips of double sided tape along two edges of the panel. Only guessing though. There don't seem to be any screws or solder points holding it on.

    • @denakkusativ1072
      @denakkusativ1072 Рік тому

      @@BytesNBits That sounds very promising to me. Thank you so much

  • @fjalarsigurdarson4862
    @fjalarsigurdarson4862 Рік тому

    The Arduino does have a 3.3V output, clearly marked. The thing is, most of these smaller screens say they need 3.3V but they do not really kick in unless they get 5V.

    • @aspirin4709
      @aspirin4709 Рік тому

      Sir,is it ok to connect it's to an arduino nano wit series resistance of 10k.

    • @fjalarsigurdarson4862
      @fjalarsigurdarson4862 Рік тому

      @@aspirin4709 I am simply not that smart in electronics to advice anyone :-) I just know this fact about the 3,3V and the screens from experience and from reliable sources. I highly recommend this guy:
      ua-cam.com/video/7x1P80X1V3E/v-deo.html

    • @BytesNBits
      @BytesNBits  Рік тому +4

      Hi. The 3.3V output on the Arduino is for supplying power. The atual IO pins operate at 5V logic which has to be shifted down for the LCD inputs.
      Using a 10K resistor is fine but you'll need to double the paired resistors in the voltage dividers.

  • @lalithkumarreddy8311
    @lalithkumarreddy8311 3 роки тому

    Sir which esp32 board should i go for if i want to display images?I mean number of pins and all! A link of the esp32 specs you are using is highly appreciated!

    • @BytesNBits
      @BytesNBits  3 роки тому

      Hi. Pretty much any of the ESP32 boards will work (much better that the Uno I was using!). As long as it's got an SPI interface and a couple of spare I/O pins it will be fine.

  • @djix030
    @djix030 7 місяців тому

    Hi, I have this screen connected to an ESP32-S3 with the 3.3V it works perfectly! , why do you use the 5V with this army of resistor ??

    • @BytesNBits
      @BytesNBits  7 місяців тому

      With the ESP32 you can remove the resistors. The video is based on the Arduino which runs at 5V.

  • @michaelhartrey8937
    @michaelhartrey8937 3 роки тому

    Have you tried to use the touch interrupt pin on one of these displays? I’ve been using one for an ESP32 internet radio but I had to resort to polling for touch inputs. When trying to use the T_IRQ pin it kept firing all the time without the screen being touched. I’m wondering if it was my particular screen or whether I’m missing something.

    • @BytesNBits
      @BytesNBits  3 роки тому

      Hi Michael. The T_IRQ pin is best thought of as a prompt to start polling the touch panel. Once you enable the interrupt function in your code the screen will wait until a touch event before pulling the T_IRQ pin low. Once it's pulled low you need to disable the interrupt and then handle the touch input. The T_IRQ input will give multiple triggers as you talk to and handle the touch event, so disabling it will mask of these multiple interrupt triggers. Once you've finished handling the touch event and the screen isn't being touched you can re enable the interrupt to wait for the next event.
      Have a look at github.com/PaulStoffregen/XPT2046_Touchscreen, at the bottom of the readme file. He covers this in more detail.
      I hope this helps.

    • @michaelhartrey8937
      @michaelhartrey8937 3 роки тому +1

      @@BytesNBits Thanks, I’ll take another look at it.

  • @GetRealwithMike
    @GetRealwithMike 9 місяців тому

    Great tutorial. I want to make video screens for my model spacecraft. It would show a video clip of the different systems on board. I can create the video but I wanted to learn how to build the screen using a Nano and a smaller screen that the one here. Can you make a tutorial for that? Thanks

    • @BytesNBits
      @BytesNBits  9 місяців тому

      To get video to work you'll need a more powerful system. I'd go for a Raspberry Pi Zero. Arduinos and even Pi Pico or ESP32 will struggle to get any video playback.

  • @RandomTorok
    @RandomTorok Рік тому

    I read something that if you short J1 then you can simply use 3.3 volts to power the device. Have you heard that or tried it?

    • @BytesNBits
      @BytesNBits  Рік тому

      I haven't come across that. It could well be true. I'd check the data sheet for your panel first though!

  • @patrickk2791
    @patrickk2791 3 роки тому

    Hi, first of all thank you for the well made video, it's been very interesting and a great help! Secondly, I was wondering if the values of the resistors are crucial or if it is just the ratio that matters. I haven't got 2.2k and 5.1k, but I do have 4.7k and a 10k, which should be ~3.4 Volts (I measured it to be ~3.38). But I am uncertain if this will have any other effects?
    You see, my screen is only functional when I do not have the Touch SPI connected. My touch is functional even with the TFT SPI pins connected, but then the screen only shows white, and sometimes flickers when I sent data to it. I suspect it's the difference in values of the voltage divider resistors, but I am unsure of the effect of having (roughly) the same ratio, but higher resistance values.
    Your advice is much appreciated.

    • @BytesNBits
      @BytesNBits  3 роки тому +1

      Hi Patrick. The resistors should be ok. The current drawn by the inputs is around 1uA. The screen not working when the touch is connected can often be the chip select functions getting mixed up on initialising the classes. Are you making sure to set both chip selects inactive (high) before you initialise the library classes?
      // avoid chip select contention
      pinMode(TS_CS, OUTPUT);
      digitalWrite(TS_CS, HIGH);
      pinMode(TFT_CS, OUTPUT);
      digitalWrite(TFT_CS, HIGH);
      tft.begin();
      ts.begin();
      I hope this helps.

    • @patrickk2791
      @patrickk2791 3 роки тому

      @@BytesNBits Hi, thank you for the fast response. I am indeed setting the chip select pins to high before calling the tft and ts begin functions. So something else is going wrong.

    • @BytesNBits
      @BytesNBits  3 роки тому +1

      Hi. If it's just the resistors that are different you could rule them out by adding a level shifter, e.g. amzn.to/3eyDRqp. They are useful to have around anyway. I'd also check that your connections are all secure. I found that if using the touch caused the board to shift it could blank the screen.
      You could also try connecting the SPI to the touch but wiring the CS pin high (3.3V inactive). Comment out the touch screen code and see if it works. This should try to separate out a software error or a hardware / circuit error.

    • @patrickk2791
      @patrickk2791 3 роки тому

      Hi! That happens to be the exact level shifter ordered earlier this week, along with a whole bunch of resistors including the 2.2k and the 5.1k Ohms, they should arrive shortly and I will report back my findings.
      Until then I have found the following;
      With the touch SPI disconnected and the T_CS wired directly to the 3.3V pin on the Uno, the TFT screen functions like normal (with the slightly modified graphicstest script). Slowly adding more touch SPI pins makes it more and more unstable:
      - With T_CS to 3.3v, T_DO and screen MISO shared connection, it seems to be ok.
      - Further adding T_DIN shared connection to screen MOSI sometimes creates missing or discoloured pixels/short lines on the screen, sometimes functions like normal, and sometimes messes up the fill screen color wipes then functions like normal to end up with a white screen after a few seconds.
      - When I add the T_SCK to the screen SCK, it just seizes to work entirely it is fully white, with sometimes a flicker of black.
      This is all without any touchscreen code in the sketch, purely the graphicstest example with the lines added as shown in your video.
      With this I feel like it has to be in the hardware somewhere, but am at a loss of what it could be.

    • @patrickk2791
      @patrickk2791 3 роки тому +2

      EDITED, see below!
      Update from my side as promised:
      I switched the voltage divider setup from the 4k7 and 10k to 2k2 and 5k1. I also unplugged all my (rigid) breadboard wiring and replaced it with (flexible) jumper wires which allowed me more colours and a tidier layout. The screen now works with both touch and tft SPI connected (Minus the T_IRQ). It can even register the touch and act upon it by updating the screen.
      One issue still remains, like you said; sometimes while using the touch functionality on the screen, the tft just goes completely white. I wonder if soldering it to a perfboard would solve this.
      I have yet to try the level shifter, I shall edit this comment as soon as I've got something conclusive to share.
      EDIT 1:
      I still have yet to test the level shifter, but I have discovered something interesting while playing around with drawing on the screen while simultaneously using the touch functionality. The blanking/becoming completely white of the screen is caused by touching and releasing a lot, while data is being sent to the screen. The larger the amount of data (such as fillScreen's or large amounts of text) the bigger the chance it will get stuck on the white screen. Sending no data at all allows me to quickly tap the touch screen without ever causing the white screen to appear.
      Have you got any advise on how to resolve this?
      EDIT 2:
      I hooked up and tested the level shifter, it is working fantastically now! I used the TXS0108E level shifter for those interested, same one as linked by Bytes N Bits. The connections are as follows:
      I have the OE pin connected to ground with a 10k pull-down, and connected to the 3.3v pin of the Arduino.
      VA is also connected to this 3.3v pin.
      VB is connected to 5V.
      GND to GND.
      A1-A7 to the TFT LCD Touchscreen
      B1-B7 to the Arduino pins.
      I can do full fillScreen's while tapping like a madman, and still experience no white screen whatsoever.
      I am so relieved. Thank you for helping me!
      Purely out of interest and for educational value, do you know why using this level shifter made such a big difference compared to the voltage divider setup?
      Thanks again,
      Patrick

  • @atihrot755
    @atihrot755 Рік тому

    Dear Sir. I finally found a way to get it up and running. It's already drawing correctly, but there are still some little things that I can't confirm. I installed the SPFD 5408-master library, where I opened and installed the SPFD 5408 TouchScreen subfolder in that library. X and Y minimum and maximum should be set there. Those numbers should have been entered in the code SPFD 5408 tftpaint. It also had to be reinstalled and now it works properly. But now it only works with a finger. With a small writing pen, the LCD does not respond at all. If you have any suggestions, thank you.

    • @BytesNBits
      @BytesNBits  Рік тому

      Hi. You've probably got a capacitive touchscreen, like your phone will have. These do not respond to the plastic stylus pens. You'll need a capacitive touchscreen pen.

  • @alnoorratansi9364
    @alnoorratansi9364 2 роки тому

    Hi Great Video, What does the voltage jumper do at the back of the screen ??

    • @BytesNBits
      @BytesNBits  2 роки тому

      I have no idea! I can't see it mentioned in any of the documentation. There are some schematics you can download for the screen but I haven't got the software to open them.

    • @alnoorratansi9364
      @alnoorratansi9364 2 роки тому

      @@BytesNBits I found out , If it is lest open then it is set for 5v , if shorted it is set 3.3v

    • @BytesNBits
      @BytesNBits  2 роки тому

      @@alnoorratansi9364 That's great thanks. I'll make a note of that one!

  • @dienau6313
    @dienau6313 3 місяці тому

    Sir may I have a question? is there any touchscreen library used for esp32? Since the XPT2046_Touchscreen library just used for arduino uno.

    • @BytesNBits
      @BytesNBits  3 місяці тому +1

      The Arduino library should work for the ESP32 as long as you program it in the Arduino IDE

    • @dienau6313
      @dienau6313 3 місяці тому

      @@BytesNBits thank you

  • @melaxoho4037
    @melaxoho4037 2 роки тому

    Hi,
    nice explain video but i think there is a misstake in minute 8:15. You say the Pin "LED" should be connected to 5V - that's wrong. And never put 5V on a Input of a 3,3V Display - it can be destroyed!
    This pin is a control Pin for the LED Backlight - not the power for it. (you can see the Transistor at the PCB that is the switch for the Cathode to GND) It should be connected to a GPIO Pin for the PWM input for the backlight control. It is by default pulled high (backlight on) you can PWM at any frequency or pull down to turn the backlight off. Brightness adaption a.s.o. You can see that in the schematic of the displays.
    And the Signal MISO is not needed at these Displays - i always let it unconnected. So we have 8 Pins to use these Displays: GND, 5V (itern transformed to 3,3V by the Regulator XC6206P33), MOSI/SDI, DC/RS, CS/SS, Reset, SCK and LED Control. That's it.
    Greetings from Germany

    • @BytesNBits
      @BytesNBits  2 роки тому

      Hi. Thanks for the tips. You're absolutely correct.

  • @traflaw8286
    @traflaw8286 2 місяці тому

    hello sir, i managed to make the lcd work using the calibration code u made, but when i tried it again the next day, it won't display anymore. I didn't touch the wirings.

    • @BytesNBits
      @BytesNBits  2 місяці тому

      That's a strange one. Not sure what to say if it was all working. Have you checked in case a wire has come loose.

  • @SUHANISHARMA-mk4sv
    @SUHANISHARMA-mk4sv Рік тому

    Hello, @bytesnbits, thank you so much for this tutorial, I wish I had found it earlier. I'm a beginner at mechatronics, so my biggest source of learning is youtube. Previously I referred to some other video on youtube and there they had connected VCC to 3.3v and all the other SPI pins directly to Arduino Uno, after that I spent several hours trying to fix what when wrong and I realized the mistake I made initially but now when I'm trying to run it with the right connections and logic level, it is just showing a white screen and flickers. Is it possible that I've already damaged my component?

    • @BytesNBits
      @BytesNBits  Рік тому

      Hi. That's a possibility. The screens are quite tolerant to 5V but if you've been playing about with them at that level for a while it may well have damaged one or more inputs. If you can get hold of a spare and get your display up and running, then try the non working one to see if it is OK.

    • @SUHANISHARMA-mk4sv
      @SUHANISHARMA-mk4sv Рік тому

      @@BytesNBits I'll try that, thank you

    • @notchurn
      @notchurn Рік тому

      @@SUHANISHARMA-mk4sv i had same issue. Do you have any advices?

    • @SUHANISHARMA-mk4sv
      @SUHANISHARMA-mk4sv Рік тому

      @@notchurn Luckily my tft lcd was fine, for me the issue was in the code, I ran the graphics test in parts instead of running the whole code at once and it worked.

    • @stevechapman7564
      @stevechapman7564 9 місяців тому

      I have just purchased 2 of these screens and had the same issues. I found that I had to bridge out the jumper on the back of the board called J1 it is between the 2 3pin SOT devices. hope it helps.

  • @Venaber
    @Venaber 11 місяців тому

    thanks