Setting up a Raspberry Pi with a Tontec TFT 3.5″ screen (Model MZ61581)

Install the drivers

Taken from:

This is taken from information last updated on 2015-09-05

Below you will find instructions for installing the appropriate drivers for the Tontec 3.5 inch screen on your Raspberry Pi (including Pi 2). This guide was written for Raspbian wheezy, specifically 2015-05-05-raspbian-wheezy.img, though the guide should work on later versions as well.

1. Initial Config of New Raspberry Pi Install

After booting your Raspberry Pi for the first time on Raspbian-Wheezy, we will need to perform the normal tasks of setting up our Raspberry Pi. E.g expand filesystem,

Then we need “update” and “upgrade”

sudo apt-get update
sudo apt-get upgrade
sudo reboot

2. Update Firmware

We now need to update the dtb file to the newest version to support Tontec screen.

cd /boot/overlays
sudo rm mz61581-overlay.dtb
sudo wget
sudo reboot

3. Enable SPI and set overlay for Tontec MZ61581 Screen

Open /boot/config.txt

sudo nano /boot/config.txt

And add these lines to the bottom


Then save and reboot

4. Set Tontec 3.5 Screen as the default display instead of HDMI

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

Here we will change the default output display from HDMI to Tontec Screen


Option "fbdev" "/dev/fb0"


Option "fbdev" "/dev/fb1"

– if you want to switch back to the HDMI display, just change it back to fb0

5.  Edit cmdline.txt

Here we will enable Tontec Screen to display during the booting process

sudo nano /boot/cmdline.txt

Add fbcon=map:10 at the end of current line. (No need to start a new line)

6.  Reboot

sudo reboot



Calibrate the touch screen for X Windows

Taken from:

We’ll install an xinput_calibrator and a script to load the calibration data each time X starts.


1. Install all the prerequisites required for calibration

sudo apt-get install libtool libx11-dev xinput autoconf libx11-dev libxi-dev x11proto-input-dev -y

2. Download and install xinput_calibrator

git clone
cd xinput_calibrator/
sudo make install

3. Download and setup the calibration script

cd ~
sudo cp ~/ /etc/X11/Xsession.d/
sudo sh -c 'echo "sudo /bin/sh /etc/X11/Xsession.d/" >> /etc/xdg/lxsession/LXDE-pi/autostart'

4. Reboot

sudo reboot


Start up X Windows


Plug in a USB mouse as you won’t be able to click on much as the screen’s not calibrated.

Click on [Menu] -> [Preferences] -> [Calibrate Touchscreen]

Go through the calibration and a console window will appear.

The calibration program will create a file which stores the calibration data( /etc/pointercal.xinput)

Click [File] -> [Close]

To perform calibration again, just delete /etc/pointercal.xinput and restart X. You will be presented again with the calibration program once X starts.