post

TinyLCD 35 from Tinylcd NeoSec

Update April 3, 2020

I reinstalled the TinyLCD screen on the latest Raspbian. And sofar it works well, fast screen updates, compared to the Kedei or Itead screens)
The mouse thingy was removed, did not like it so much. Touch screen is enough.

Here is what I did:

1. Fresh image Buster (full) to 16 GB SD card
2. Usual actions with raspi-config, boot to CLI, etc
3. Kill piwiz (sudo apt-get remove piwiz)
4. sudo nano /boot/config.txt
  add line dtoverlay=tinylcd35,touch,rotate=270,rtc-pcf
5. To display console text on TinyLCD35 screen
sudo nano /boot/cmdline.txt single line:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:10
6. Select a smaller font for the console with: 'sudo dpkg-reconfigure console-setup'.
Select "UTF-8" encoding "Guess optimal character set",  "Terminus" font,  font size: "6x12" 
7. Reboot

X11 desktop

sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf

and enter: 

Section "Device"        
    Identifier "tinylcd35"   
    Driver "fbdev"  
    Option "fbdev" "/dev/fb1"  
EndSection  

9. startx will show desktop now. Touch works now corrrect for rotate 270 degrees.

Desktop X Windows, 
'sudo nano /etc/X11/xinit/xinitrc' 

and add the following line before ". /etc/X11/Xsession":

DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 

10. Calibrate X (not working instructions yet for rotation, other than 270, see also the post on Adafruits PiTFT) 

sudo apt-get install xinput-calibrator

Optionally, check if you need to swap axes. if you need to swap just run:

xinit set-int-prop "ADS7846 Touchscreen" "Evdev Axes Swap" 8 1 or 'Evdev Axis Inversion' 1 0 ?

Run calibrator to get correct x,y positions.

xinput_calibrator --output-type auto

Name:   tinylcd35
Info:   3.5" Color TFT Display by www.tinylcd.com
        Options: Touch, RTC, keypad
Load:   dtoverlay=tinylcd35,=
Params: speed                   Display SPI bus speed

        rotate                  Display rotation {0,90,180,270}

        fps                     Delay between frame updates

        debug                   Debug output level {0-7}

        touch                   Enable touch panel

        touchgpio               Touch controller IRQ GPIO

        xohms                   Touchpanel: Resistance of X-plate in ohms

        rtc-pcf                 PCF8563 Real Time Clock

        rtc-ds                  DS1307 Real Time Clock

        keypad                  Enable keypad

        Examples:
            Display with touchpanel, PCF8563 RTC and keypad:
                dtoverlay=tinylcd35,touch,rtc-pcf,keypad
            Old touch display:
                dtoverlay=tinylcd35,touch,touchgpio=

Old text from 2015

I bought a tiny 3.5 ”  lcd touchscreen from NeoSec Solutions Pvt, Ltd, based in Mumbai, India. Not as a desktop replacement but for projects where a small touchscreen will be handy.
Not recommended. I learned there is a newer version with a working RTC, so this is now a not-supported old version.
No forum support, no information on IC’s used, limited documentation.
Just too high a price for this. Better look at an Adafruit solution in the same price range, but with excellent support and better community support also.

In the beginning it looked good. But is has severe problems, such as an older kernel. And the RTC is not working, the time is not updated either from internet via ntp either. Acceptable price (total price including delivery to the Netherlands was $56), nicely packaged, fast delivery from India, professional pcb, bright and crisp screen, working touchscreen, well packaged and configured and friendly support from NeoSec (on demand by email only, no forum, no downloads). Biggest worry I have is the operational (except for date and time!)  but older Raspbian image supplied. Lets hope tinylcd/NeoSec updates its images, or better  supplies an easy to apply patch kit to more recent Raspbian versions like jessie! My first attempts to upgrade failed, I have to try getting Raspbian jessie operational, see the bottom of this post.

What is in the kit I bought (other versions with less features and other dimensions are also available at tinylcd)

  • 3.5” TFT LCD Display, 320×480 Resolution
  • Additional GPIO connector extending from  TFT pcb to use pins not in use (see later)  for other purposes. Esy to break off if not needed.
  • Resistive touchscreen and touchscreen controller.
  • 5 capacitive buttons on small navigation keyboard.
  • PCF8563 CMOS real-time clock/calendar.
  • room for a CR2032 lithium battery provision to maintain correct time and date on power loss.
  • Powered directly from the Raspberry Pi, no additional power required.
  • Touch pen.
  • Ready to plug on the GPIO connector with a size identical to the Raspberry B.
  • Downloadable image of Raspbian for a 8 GB SD card (older version, but well configured for lcd)  ready to run but the time is stuck at 1970.

IMG_2451 The screen fits nicely on the GPIO connector, and has the same size as the Raspberry, plus a breadboard like extension for the GPIO connector. Not that many are free, but it is a handy feature. It is easy to remove this connector, just break it off. IMG_4447 The device also has a RTC (battery on the back), a welcome addition to a Pi! But it does not work, so the time is set to 1970. NTP is inactive.IMG_4448 Here the Raspberry Pi B+ (the 2 Model B is also supported as is the A+!) has booted from the Raspian image as supplied by Tinylcd. The first part of the boot process is visible on the HDMI screen, once the tft It has a special kernel (fbtft drivers, more later on this)  and drivers for touchscreen, for RTC and  a mouse driver for the navigation key included and configured IMG_4452 The navigation buttons, connected to a lot of GPIO pins, and supported by a mouse driver on the desktop. IMG_4453 The screen is bright and crisp, not bad at all! As you can see, it is small and some menu’s will not be visible when folded out. This is not a desktop replacement, and that is not what this small screen is about! IMG_4456 The package came into a nice small tin! The packaging was fine, bubblewrap around the parts, screen protector attached. Well done!

GPIO pins in use

GPIO pins are used for TFT LCD Display, Touch Screen (TS), RTC & Navigation Keys. Note that the navigation keys take away a lot of pins! The SPI is used for the screen and touch. The RTC is on the I2C bus.

RPi 3.5''                             TFT

pin1 3V3 ---------------------------- TFT 3V3 / TS 3V3

pin18 GPIO24 ------------------------ TFT RS

pin19 GPIO10/MOSI ------------------- TFT MOSI / TS DIN

pin24 GPIO8/CE0 --------------------- TFT CS

pin23 GPIO11/CLK -------------------- TFT SCLK / TS DCLK

pin22 GPIO25 ------------------------ TFT RST

pin12 GPIO18/PWM -------------------- TFT BL

pin6 GND ---------------------------- TFT GND

pin21 GPIO9/MISO -------------------- TS DOUT

pin29 GPIO5 ------------------------- TS PENIRQ

pin26 GPIO7/CE1 --------------------- TS CS

pin13 GPIO27 ------------------------ LEFT KEY

pin16 GPIO23 ------------------------ RIGHT KEY

pin11 GPIO17 ------------------------ UP KEY

pin15 GPIO22 ------------------------ DOWN KEY

pin 37 GPIO4 ------------------------ SELECT KEY

pin3 GPIO2/SDA ---------------------- RTC SDA

pin5 GPIO3/SCL ---------------------- RTC SCL

Raspbian

The Raspbian image supplied is well configured. But because it has a special kernel one must be careful not to update the kernel! The readme tells us a lot about the device, how to

  • make the fbtft drivers work
  • calibrate the touchscreen
  • demo python programs  with graphics
  • turn the backlight on or off
  • enable mouse driver for navigation keys
  • enable  RTC IC (1307/PCF8563) (which dows not work!)
  • show demo movies or pictures
  • configure modules enable/disable via DTS (devicetree) in the supplied tinylcd35-all-overlay.dts

DIY Raspbian kernel The supplied kernel is special because it adds  the  Linux Framebuffer drivers for small TFT LCD display modules, see this website. fbtft is the name of the frame buffer (the memory where the Raspberry Pi stores the screen info) driver that copies the buffer via SPI to the LCD screen. Much more details about this is available at the fbtft wiki Now if you want a more recent kernel things are less complicated because the fbtft drivers are now included in Raspbian via its Debian chain! There is a step by step guide how to add the lcd support to a newer version (still wheezy afaik) by Notro. Not easy, but its all there I hope. Lets hope tinylcd updates its images. ot better  supplies an easy to apply patch kit to more recent Raspbian versions like jessie! And I have to discover how to set the time in the RTC, it now fall back to 1970, no internet update also.

From https://www.raspberrypi.org/forums/viewtopic.php?t=100227&p=696446 by huffy2404

» Thu Feb 19, 2015 6:23 am Here is what I did to get mine to work on the Pi 2. This is all taken from the notro/fbtft github wiki located here: https://github.com/notro/fbtft/wiki

Get dtc compiler with overlay support:

wget -c https://raw.githubusercontent.com/RobertCNelson/tools/master/pkgs/dtc.sh chmod +x dtc.sh ./dtc.sh

Get the tinylcd35 overlay source:

wget -c https://raw.githubusercontent.com/notro/fbtft/master/dts/overlays/rpi/tinylcd35-overlay.dts

Note that I am using the NeoSec 3.5″ TFT Display + Touch Screen.

This version does not include the touch pad or any extra buttons.

I believe the tinylcd35 overlay source is set up for the version of the screen that includes the touch pad. In order to get the touch screen to work I had to modify the overlay source file as follows:

On line 88 change:

interrupts = <3 2>; /* high-to-low edge triggered */

to:

interrupts = <5 2>; /* high-to-low edge triggered */

and on line 90 change: pendown-gpio = <&gpio 3 0>;

to:

pendown-gpio = <&gpio 5 0>;

From what I understand this is just needs to reflect the GPIO pin that is connected to the screen’s PENIRQ. Compile the overlay and save it in

/boot/overlays/: sudo dtc -@ -I dts -O dtb -o /boot/overlays/tinylcd35-overlay.dtb tinylcd35-overlay.dts

Add the following to your /boot/config.txt file:

# added for tinylcd 3.5 inch

dtparam=spi=on dtoverlay=tinylcd35

Install a custom Xorg config:

sudo mkdir -p /etc/X11/xorg.conf.d/ sudo

wget https://gist.github.com/notro/63fc8f563b5f85010d30/raw/5e68d6c6df9471f973b3da5305e73a5017590a69/fbtft.conf -O /etc/X11/xorg.conf.d/fbtft.conf

Update the Pi firmware:

sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update sudo reboot

The screen should be black at this point.

You can test by running:

FRAMEBUFFER=/dev/fb1 startx or con2fbmap 1 1

You can find information regarding calibration here:

https://github.com/notro/fbtft/wiki/FBTFT-on-Raspian

I have only completed the tslib portion since that is all I intend to use, but there is info for X there as well. I have successfully tested this on a Raspberry Pi 2 running both wheezy and jessie.

8 thoughts on “TinyLCD 35 from Tinylcd NeoSec

  1. Thanks for the descriptive explanation for the NEO SEC 3.5 Tiny LCD / PiTFT. I have the display running on a Raspberry Pi 2. Some of the programs I run, such as Teamviewer host, and others have Options Menu which open up a Pop-up Box. Unfortunately, the pop-up box expands to greater than the NEO SEC screen allows. As a result, the buttons used to select various options are inaccessible and complete the configuration process cannot be completed.

    I need to either Zoom-Out of this screen and/or be able to divert (Turn On) the HDMI output. I have a connection from the HDMI output to a monitor in place but I’ve tried various commands with no success.. I respectfully ask for your support with this issue. Thank you, Frank.

  2. Pingback: Monitors, HDMI and config.txt – Arduino, Raspberry Pi and ESP8266 Small Computers!

  3. Thanks for the excellent description. I have a working screen but the touch is not responsive, not working at all nor are the controls from the mouse pcb.
    I tried lcd35 before, but switched that off again.

    • Mine functions fine as touch device, I removed the mouse thingy physically and did not enable it in config.txt either (there is an option for that).
      Sure you have the right options in config.txt?
      dtoverlay=tinylcd35,touch,rotate=270,rtc-pcf
      I started with a fresh current Rapbian Buster

      • Had time today and started all over agin – Fresh SD card. Follow all your steps. At the end, i have a picture but no touch screen. And the command xinput_calibrator –output-type auto gives me unable to connect to X Server.

    • I have not looked at the 5.4 kernel, I will wait until it is stable and supported. The overlay is in the distribution now, so eitehr it will be updated, forgotten or deleted. I also heard (for other LCD”s) the fbtft support is missing from the 5.x kernels. These SPI LCD screens are a real PIA.

      • So far as I can tell–and writing/modifying overlays is “above my pay grade”–no one has touched the overlay code to work with kernel 5.4. Said kernel now gets installed through the normal apt update/upgrade process.

        What has happened in general, is that kernel 5.4 has broken pretty much *all* GPIO connected, SPI-driven small displays, so it’s likely there is something common that has changed.

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.