Raspberry Pi with a 3.2″ TFT with Touch control

I have spent the last few weeks working on getting a SainSmart 3.2″ TFT with touch control working with my Raspberry Pi and I have had success.

You can see an update on this project here;

PiScreen TFT Raspberry Pi

I have currently connected it up with a breadboard, I now need to work on a more permanent solution.

Download the Kernel that contains the drivers.

Click on the images for a larger view.

Click the image below for a much larger version

My setup;
5v to TFT
3.3v to ICs
Reset through 10k resistor
Back light connected to 3.3v

I start Xwindows with sudo FRAMEBUFFER=/dev/fb1 startx -- -dpi 60

Thanks to XaLKiDEoS , Notro, drsb and  valdodov.;

100 thoughts on “Raspberry Pi with a 3.2″ TFT with Touch control”

  1. I have the same LCD as you do. i was wondering if you could help me with the pinout of the LCD… valdodov has a different lcd and his schematic doesn’t transfer well to the one you have i think. is there a schematic that you could post or tell me where BL_CNT is connected from the 4094s to the LCD?

  2. Thanks for the schematic, I will try and see if this works. if not, its probably some issue with the kernel. Also, if it is due to the kernel… was the kernel files just supposed to be copy pasted into the specific folders? was i supposed to enter anything in the command-line/terminal to get the display to start working?

    1. Just need to overwrite what is on your SD card.
      Everything is setup to get the displaying going on boot.

      Tis is how I do it;

      mkdir display_kernel
      cd display_kernel
      wget http://valdodov.com/tft_lcd/src/raspberry-pi.tar.gz
      tar xfv raspberry-pi.tar.gz
      rm raspberry-pi.tar.gz
      sudo cp -r * /
      sudo reboot

      1. I have tried doing it the way you mentioned it above, but every time we try it the kernel doesn’t boot (get the rainbow startup screen when plugging in a HDMI monitor). We are running Raspbian.
        Is there anything we need to do before using the commands you listed?

      2. no.. that should be enough.

        Once you install the Kernel as the instructions above, the terminal will not appear out the HDMI port anymore.
        You can disable this by inserting your SDcard into a PC and open cmdline.txt on the SDcard and delete this text from the end of the first line;
        fbcon=map:10 fbcon=rotate:1 fbcon=font:ProFont6x11

  3. Thanks man. Tell me if i understand correctly.
    the Spi (MOSI) is buffering 32 bits (when the strobe is off) then the SPI (MOSI) waits for 32 spi cycles (When strobe is on ) . Am i understanding correctly .
    So when the strobe is on the Spi is not doing anything right ?

    1. The way I understand it is;
      MOSI is always sending and the strobe goes off for every bit that MOSI sends. This way, it gets shifted into the shift registers..
      The 4040 is counting the strobes… then after the 32nd strobes, it latches and sends the data to the LCD

  4. So i have all the items now . I really appreciate yours answers again thank you.
    Just to clarify:
    1. VCC is 3.3 coming from the pi right ? and it has a capacitor going to the ground ?
    2. OE is 3.3 coming directly from the pi, I see in your pic there is couple of resistors ?
    3. And how much VCC does the screen need ?

    Again Thank you

    1. Hey! We had the same problem and the issue was that we wasn’t using the same chips that Mark. If you use another chip there is a possibility that those chips won’t be as fast enough as they should. We bougth the chips where he says in the description and it works perfectly.


  5. That’s great and all, but is there a way to push raw image data (bitmap images, video, etc) to this display without making it an active tty/X display? Something that can run headless and have data pushed to it from a remote ssh session, cron job, etc?

    I’m thinking of a Python or C library, or better yet an optimized binary that you can pipe the raw data to from another process to send it to the screen…

      1. Thank’s for your quick response.
        I feel a bit stupid 😀
        Another noob question : the part at the bottom left of the schematic (“On all chips”) represent the Raspberry Pi ?
        Thank’s you.

  6. Thanks for the quick response, we registered the device and tested it with

    FRAMEBUFFER=/dev/fb1 startx

    however we just got a blank screen and when we rebooted were are now getting the following error returned from dmesg:

    [ 118.601962] fb_ssd1289 fb_ssd1289.0: Missing info about ‘dc’ gpio. Aborting.
    [ 118.602067] fb_ssd1289: probe of fb_ssd1289.0 failed with error -22

    Any help would be appreciated!! Thanks!

    1. is /dev/fb1 present?
      Have you tried another program.. E.g FBI can disapply images to the framebuffer without starting X.
      sudo fbi -noverbose -T 1 -a -d /dev/fb1 file

      If you cant display the image or you get the same error, I would recheck the wiring. Are you using a breadboard?

      1. No /dev/fb1 is not present. We are using a breadboard and just rechecked all of the wiring. The wiring looks good, but we are missing the filter capacitors (can’t get them till tomorrow) would that be the issue? It looks like a few people had this same issue but there is no definitive solution. What exactly is error -22?

      2. the CAPS shouldn’t really matter… you should at least see something.
        I had trouble getting mine going on a breadboard, I always had loose connections.

        How did you install the Kernel/modules?

  7. Hey Mark,

    We were following the instructions on github/notro/fbtft/wiki but I think I just realized that that’s a different method. So in order to install the kernel/modules should we use the compiled files on Voldadov’s site? If so, how do I copy those drivers? I extracted them to the desktop then did:

    sudo cp -r /home/pi/Desktop/root /root
    sudo cp -r /home/pi/Desktop/lib /lib
    sudo cp -r /home/pi/Desktop/etc /etc

    But I had no way of confirming if the files actually copied, was this the correct command?

    We were using notro’s firmware from the aforementioned website. Is this not compatible?

    Should I start with a fresh version of raspbian and copy those 3 files and then it’ll be good to go?

    The hodge podge of different tutorials and methods is kind of throwing us off, so If you could possibly just give us an overview of what we need to do on the software side starting from the beginning!

    This is our first rasp pi project and obviously our inexperience is showing so thank you very much for your help!!

      1. Thanks for the quick response,

        Sorry root was just a typo, I meant boot

        I’m assuming it has to be a wiring issue because your method worked and upon reboot the HDMI output showed only the rainbow screen so I know its trying to route the video to the touch screen but all we’re getting is a blank screen so there has to be something wrong with our circuit. We’ll take another look at the circuit tomorrow and see whats wrong. Thanks again for all of your help!!

  8. Hey Mark,

    Finally got it working! (Sort of) Must have had a few dead rails on my breadboard because I purchased an new breadboard, and lo and behold, our screen works. We can see the boot information and there are no errors, but it stops at a blinking command prompt, but I cannot type with the keyboard, and it does not boot into the desktop. So we’re kind of stuck at a blank command prompt. Is there any code I can edit to make it boot into the desktop? Or is there any way to make the keyboard work?

    1. Do you have the keyboard directly connected to the Pi? Or are you accessing the Pi via SSH from another PC?

      If from another PC,you have to specify the framebuffer.
      You can start X with;

      sudo FRAMEBUFFER=/dev/fb1 startx — -dpi 60

      View pictures with FBI:
      sudo fbi -noverbose -T 1 -a -d /dev/fb1 file

      Play video with;
      sudo mplayer -vo fbdev2:/dev/fb1 -x 128 -y 160 -zoom file

      1. We have the keyboard directly conneected to the pi. Should we be using SSH? And we can get it to work by deleting the

        fbcon=map:10 fbcon=rotate:1 fbcon=font:ProFont6x11

        line from the cmdline file, and using the FRAMEBUFFER command. We were just trying to boot directly to the desktop on the touch screen.

        Also, it does not register any touch inputs, could this be a conflict with the keyboard/mouse?

  9. Hello Mark,

    I am working for several months with the Raspberry and I also know a few experminete performed. Well me too interested this project. I myself already so bought a 3.2 “touchscreen, but I dunno exactly how to wire the. Could you maybe make a wiring diagram. That would be very nice.For example, with http://fritzing.org/

    Many greetings from Germany

  10. hi
    i have 2.8″ display of INANBO and want to config it by raspberry .is this driver file(that you used it)useful for my display???

  11. Hi Mark,
    We are following your circuit for interfacing the raspberry pi with touch screen. We have currently wired on a breadboard and currently working on a better consistent solution like having it on a PCB.
    I was just wondering if the schematic you posted on this page was done in eagle PCB? I am currently using eagle PCB for creating schematic and getting a board layout.
    I wanted to know what kind of Connectors for Raspberry Pi and Sainsmart touch screen for the schematic.
    Any help would be appreciated!! Thanks!

  12. Hi

    I have rebuild your project…. very nice but my display on the way….can´t test it at the moment. 🙁

    does the touch function work in xbmc? will use this gadget for a little internet radio.
    if i read right… i can´t use the display AND the HDMI???

    Thx for help

    1. Hi

      My display has arrived yeeeha…. but doesnt work only blank white screen

      i have a TFT_320QVT or 1982AY-cxh ……. K613690S

      i think the pin layout is diffrent to yours….. they have other names on some pins 🙁

      hope to get this work….

      1. okay driver is loading no failures all ok
        with FRAMEBUFFER=dev/fb1 Startx there is a fatal error …….

        FATAL: Module g2d_23 not found.

        what happend? whats wrong?………


    2. cat /proc/bus/input/devices
      I: Bus=0000 Vendor=0000 Product=0000 Version=0000
      N: Name=”ADS7846 Touchscreen”
      P: Phys=spi0.1/input0
      S: Sysfs=/devices/platform/bcm2708_spi.0/spi_master/spi0/spi0.1/input/input0
      U: Uniq=
      H: Handlers=mouse0 event0
      B: PROP=0
      B: EV=b
      B: KEY=400 0 0 0 0 0 0 0 0 0 0
      B: ABS=1000003

      but get blank screen…. 🙁

      1. Ok Toucscreen ins working but get no picture
        only blank screen have checked the wires 20 times…….
        Xorg log

        can you please help me?

      2. do you see the new framebuffer?
        ls -l /dev/fb1

        Have you got fbcon enable (show terminal on TFT)?
        cat /boot/cmdline.txt

        If both of these comeback correct, I would say it is the wiring.
        Are you using a breadboard?

  13. Hi

    Now i went from 3.3 to 5v at all now i get some colored lines flickering
    i´m using other chips as yours they need 5v next should be a software problem i think.

  14. [ 0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 b cm2708_fb.fbheight=416 bcm2708.boardrev=0x100000e bcm2708.serial=0x93fdb0a6 smsc 95xx.macaddr=B8:27:EB:FD:B0:A6 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.me m_base=0x1ec00000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 console=ttyAM A0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:1 fbcon=font:ProFont6x11

    is this right ? i think its the wrong size

    1. Ignore it… below is a copy of my DMESG. And mine is working fine.
      It has to be your wiring. Are you using a breadboard? What chips are you using, are they fast enough?
      Maybe place a LED at each output on the chips to confirm that data is being sent.
      [ 0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0xe bcm2708.serial=0xf4a38b4 smsc95xx.macaddr=B8:27:EB:4A:38:B4 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:1 fbcon=font:ProFont6x11

  15. Hi

    i have installed notro´s fbtft…… now my dmesg is

    [ 115.876282] fbtft_device: SPI devices registered:
    [ 115.876331] fbtft_device: spidev spi0.0 500kHz 8 bits mode=0x00
    [ 115.876348] fbtft_device: spidev spi0.1 500kHz 8 bits mode=0x00
    [ 115.876359] fbtft_device: ‘fb’ Platform devices registered:
    [ 115.876379] fbtft_device: bcm2708_fb id=-1 pdata? no
    [ 115.876614] fbtft_device: GPIOS used by ‘sainsmart32’:
    [ 115.876631] fbtft_device: (none)
    [ 115.876641] fbtft_device: ‘fb’ Platform devices registered:
    [ 115.876658] fbtft_device: bcm2708_fb id=-1 pdata? no
    [ 115.876691] fbtft_device: fb_ssd1289 id=0 pdata? yes
    [ 115.916139] fb_ssd1289 fb_ssd1289.0: Missing info about ‘dc’ gpio. Aborting.
    [ 115.916238] fb_ssd1289: probe of fb_ssd1289.0 failed with error -22

  16. All wired pins blinking

    DC blinking faster and all powering pins are good

    i have used CD 74HCT4094E and CD4040BE

    I´m using same GND for all is it ok?

    1. crw-rw—T 1 root video 29, 1 Jan 12 12:33 /dev/fb1
      dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:1 fbcon=font:ProFont6x11

  17. lsmod |grep ssd1289
    ssd1289 22454 1
    fb_sys_fops 1440 1 ssd1289
    sysimgblt 2143 1 ssd1289
    sysfillrect 3299 1 ssd1289
    syscopyarea 3020 1 ssd1289

  18. Hi

    Part has arrived an screnn is not full working 🙁
    hae the boot screen with white lines ….. by starting xbmc screen gets smoothy to white and finish….. think its wrong screen size… how can i set the resolution for all in to 320×240?

    1. hm…. can see the boot rows…. sometimes…….

      sometimes with blue stripes…. sometimes not all letters only a small stripe….. and agter getting message ???52×21??? screen goes slowly white……

  19. Hello

    I have been working a project for a while now and i am trying to get this screen working with this exact same setup. I have tested and rebuild this circuit multiple times all i can seem to do is get is the HDMI rainbow screen and a white screen with a slight flicker. if you have any ideas on what i can do to try and get this working it would be much appreciated.

      1. I am using the same chips and TFT as you are using. The driver i am using is Raspbian. I am using a breadboard but i have checked the circuit multiple times using a multimeter to confirm the connections so i am not sure if that is an issue.

        I used the following to setup the screen on the Pi.

        mkdir display_kernel
        cd display_kernel
        wget http://valdodov.com/tft_lcd/src/raspberry-pi.tar.gz
        tar xfv raspberry-pi.tar.gz
        rm raspberry-pi.tar.gz
        sudo cp -r * /
        sudo reboot

        Is there another step i am missing?

      2. those steps are correct.
        I had major issues when using a breadboard with my first prototype… it only worked 1% of the time.
        It was a lot easier once I soldered to a prototyping board… it worked first go .. and always worked.
        You can also try a LED(through a resister)at each pin on the chips to if they are sending data.

  20. Hey Mark,

    Thank you for your help. I found a small connection issues with one of the ribbon cables i was using from the raspberry to the breadboard. Now that it is fixed everything works great without any problems. Thanks.

  21. I used 74HC 4094 but nothing work.
    Should i use 74HCT 4094?
    Is there a difference between HC and HCT?
    Thanks for your answers!

  22. good job ! it’s working well on Rpi b+ too

    I have a question about kernel: I install the Rpi version 2014-06-20-wheezy-raspbian, kernel version 3.12.25+ #700 after upgrade, but after apply valdodov, kernel come back to 3.6.11 #41 …

    how apply your kernel patch without change back version ?

    (I tried to update and upgrade after applying your patch, but tft still white and no FrameBuffer created)

    thanks in advance !

    1. Hi Romain,
      It did work on Rpi B+ indeed, but the startx command never worked properly,
      which command you used to make it work,
      I used:
      sudo FRAMEBUFFER=/dev/fb1 startx — -dpi 60
      FRAMEBUFFER=/dev/fb1 startx — -dpi 60
      sudo FRAMEBUFFER=/dev/fb1 startx

      with no luck, any recommendation would be great,
      Thank you in advance,

      1. Try this
        1. Disable framebuffer driver option for /dev/fb0
        Open up the framebuffer conf file;

        pi@raspberrypi ~ $ sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf

        Comment out the line of text below;
        Option "fbdev" "/dev/fb0"
        This can be done by adding a hash (#) at the beginning of line.
        #Option "fbdev" "/dev/fb0"

      2. Mark Williams, Thank you soooo much, i have been struggling with this for weeks, you the saver 🙂


  23. Hello
    Thanks for the Kernel but on my Pi is nothing to go the Display is not working. I have the Sainsmart 3,2 TFT with the Modul that is in the Video (selfmade) but i find no error in my circuit board it is with 3 74HC4094 and 1 74HC4040 . ? Is there a Kernel that Support this Version with no updates.?

  24. Hi,
    Thanks bunch for the info, its great,
    I managed to get it working with the driver, but i have a very strange problem,
    first the lcd mirror the data, so i see the lines but all mirrored,
    second, the startx doesn’t work, i used both:
    1- sudo FRAMEBUFFER=/dev/fb1 startx
    2- FRAMEBUFFER=/dev/fb1 startx

    it keep saying, errors,

  25. I think its only working properly with version of 2013,
    any newer versions always return errors when using FRAMEBUFFER….startx,
    and also the other problem that the 2013 version doesn’t work properly on new models of Raspberry Pi, such as B+ ,,etc

    1. It has been awhile since I have looked at this version of the display with the above SPI interface.
      I will try and help.
      some questions;
      What are the exact models and manufacture of the 4094 and 4040 are you using?
      Are they being powered from the 3.3v?
      Do you have a link to the TFT you are using?

    1. those components all look correct to me.
      I don’t think it has anything to do with the back light.

      At first glance I would have said there is an issue with the decoupling capacitors on all the ICs.
      The capacitor you link is correct. You have all the capacitors connected as shown in the schematic?

      You can also try and force the 4040 to go faster my connecting it to 5v

      1. i found the issue…. above GND is a Pin named “VCC” – it was not connected (and looking at your schematics, it didn’t look like it has to be connected to 5v)

        After connecting it to 5v of the pi, flickering stopped and the colors aren’t pale anymore

        Thanks =)

  26. Hi everyone,
    Did anyone tried it with Raspberry pi 2, its not working on it with me at all,
    however if i access it through SSH, i can start normal but not the lcd

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.