element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Documents I Can See Clearly Now! With the 4D Systems 2.4" Touch Screen for the Raspberry Pi
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: cstanton
  • Date Created: 22 Jul 2015 9:49 AM Date Created
  • Last Updated Last Updated: 10 May 2021 8:50 PM
  • Views 7010 views
  • Likes 7 likes
  • Comments 31 comments
Related
Recommended

I Can See Clearly Now! With the 4D Systems 2.4" Touch Screen for the Raspberry Pi

If there is one add on for the Raspberry Pi that I have seen frequently requested, it has got to be a portable screen, and preferably a touch screen. There is no wonder, either, with the advent of smartphones and tablets that touch screens that are capacitive or resistive are verily sought after. Especially for development.

 

It is no secret that the Pi Foundation have been working on a 7" touch screen, and while that is appropriate for a number of projects where you may want to mimic a portable tablet or perhaps a laptop, I have been coveting a much tastier and cuter opportunity for smaller and embedded projects.

 

Finally, 4D Systems have brought out an affordable 2.4" TouchScreen2.4" TouchScreen compatible with the Raspberry Pi A+, B+ and 2 Model B! It's very, very nice.

 

 

{gallery} 4D Systems 2.4" TouchScreen

image

Pi Foundation Case: Well protected and contained, what's inside?

image

Bright and Cheerful: The 2.4" screen mounted on the Pi fits neatly and viewable through the top of the case

image

Gutted: With the entire top off, so we can see the five buttons.

image

Barebones: Of course the screen works suitably without the case, if that's what you're after.

image

Packaged Up: You receive a small quick start guide inside the box, along with the screen. Nothing else is included.

 

All About Presentation

The TouchScreen sits on the bank of GPIO pins (all of them) and almost fully covers the exposed Raspberry Pi (not counting the USB / Ethernet ports) and it hovers and I am re-assured that there will be a set of "stand-offs" soon to be purchasable  to secure the screen above the pins and connectors of the Pi.

 

What you may immediately notice from the photographs is how nicely the screen fits inside the Official Raspberry Pi CaseOfficial Raspberry Pi Case, this was an intentional design decision between element14 and 4D Systems. Perhaps one day the official case will be designed with portable power in mind, too? We can only hope.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

The screen is very capable, but it does have limitations which are mainly introduced by how Linux handles framebuffers and how these interface with the VideoCore graphics hardware. For example, it is very capable of playing full motion video as can be seen in the YouTube video above. However, you cannot render OpenGL to the screen because of how it handles the backbuffers (I think that's right) though this may be theoretically possible if it was coded correctly (though the implementation may end up being slow) it means that you won't be seeing hardware acceleration to the SPI screen. This is not unique to the 4D Systems screen, you will find this with any SPI screen, and until someone plays with the Broadcom code for the VideoCore and OpenGL we may never see it happen (if it's even possible).

 

This means that the screen is appropriate for other applications than hardware accelerated video. Setup properly it could be used as a touch interface or even a portable video player and there's little stopping you from running two screens at once.

 

Not-So-Quick-Start

I'll pre-empt your gripes:

  • A debian package is being worked on for the driver.
  • A repo' is possibly being worked on, but co-operation with Raspbian for native support should be forthcoming

 

So I'm told,  and likely because it's early days, I haven't seen evidence of the source code to compile it yourself yet, but I am re-assured that there will be up to date releases in support of the latest kernel at least as the add-on is intended to be fully HAT compatible and automatically identify and setup itself when you plug it into the Pi 2 in future. This feedback has already been given internally to attempt to address and accelerate this.

 

Step by Step

To start using your 2.4" TouchScreen you can follow these steps, for ease of setup you'll need internet access and a keyboard, mouse and monitor:

 

  • Image the SDCard for your Raspberry Pi A+/B+/2 Model B with Raspbian
  • Power on your Raspberry Pi and set it up using either SSH or Keyboard & Mouse with a screen as per usual
  • Open up a terminal window, either within X (the desktop environment) or by pressing CTRL-ALT-F2 (F1 to F6 usually work)
  • Type the following:

wget http://www.4dsystems.com.au/downloads/4DPi/4DPi-24-HAT/4DPi-24-HAT_kernel_R_1_0.tar.gz

sudo tar -xzvf 4DPi-24-HAT/4DPi-24-HAT_kernel_R_1_0.tar.gz -C /

    

If you need it, I have also attached the file to this blog post. By default, this file replaces the file /boot/config.txt - so you may want to back that up or make a note of any settings you have in there in case you want to re-apply them.

 

If you have a Raspberry Pi A+ or B+ you will have to alter the /boot/config.txt file using your favourite text editor (I use vim). I'll let you choose which, but if you're having problems just ask in the comments. Change the following line:

 

kernel=kernel7_hat.img

    

to

 

kernel=kernel_hat.img

    

 

Which will give you support for the A+/B+ , why this is different, I do not fully understand but it is likely driver related in how the screen interfaces with the VideoCore on the Raspberry Pi as some of the DMA addressing changed between the two.

 

Everyday I'm Buffering

Your only steps now to get it to display are playing around with the framebuffer on the device, which it identifies as /dev/fb1 - so for example one way to get your desktop to appear on your touchscreen by default is to edit /etc/rc.local and put the following in before the 'exit 0' line:

 

sudo -u pi FRAMEBUFFER=/dev/fb1 startx &

    

 

Frankly, there are more fun ways to play with the framebuffer. For example, I found a project called "Raspberry Pi Framebuffer Copy" that allows you to extend playing about with what's displayed on the screen. So for example you can push a higher resolution image and possibly other features onto the screen if that's what's typically supported over HDMI pretty easily, though it may not look pretty!

 

 

Further Configuration

You may now be asking what else you can do with the screen with questions such as "Where's the calibration?", "How do I tweak the SPI communication speed?" or "What are these buttons?" and perhaps "How do I hold all of these melons?". Some of these questions, and more, will be answered in future released documentation (we're still making sure that they work).

 

In the file /boot/cmdline.txt you will find:

 

24-hat.rotate=0

  

Which you can change to equal '0, 90, 180 or 270' meaning the degrees at which the screen is rotated.

 

You may also be able to add the values:

 

4dpi.sclk=

  

 

and

 

4dpi.compress=

  

 

To cmdline.txt, example values of these are '48000000' and '7' respectively, this increases the frequency of the SPI bus and the compression of the data sent over it, if set to '1' it lets the kernel handle the compression, which may not be optimal and corruption may occur, '7' is the highest value.

 

4dpi.pwm=

  

 

May allow control over the backlight, setting to '0' will disable it and free up GPIO18 on the Pi, setting to '1' allows values to be sent to /sys/class/backlight/4dpi/brightness to control the backlight (between 1 and 255)

 

Undocumented Feature

Hidden within the config files for Xorg you will find that the kernel package for the 2.4" touch screen adds the following file:

 

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

Within this file are settings for the following 'startx' parameters:

 

startx -- -layout TFT

 

Which starts the Xorg environment with output to the 2.4" touchscreen

 

startx -- -layout HDMI

 

Which starts the Xorg environment with output via the HDMI port on the Raspberry pi.

 

In the appendix attached to this post, you will find code that will let you configure the buttons for the screen. There's code for C and for Python, which will give you some diversity in using the buttons (first person to create a Kodi/OpenElec plugin gets a cookie).

 

Now all I need to do is mod a battery and camera into the case and I'll have a nice portable camera!





Attachments:
4DPi-24-HAT_kernel_R_1_0.tar.gz
image4DPi-24-HAT_appendix_R_1_0.pdf
  • raspberry_pi_touchscreen
  • raspberry_pi
  • touchscreen
  • 4d_systems
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply

Top Comments

  • shabaz
    shabaz over 10 years ago +1
    Hi Christopher, This looks nice. And impressive that it all fits into the official case. The RPI blog was very silent that the case was manufactured with specific input from Element 14 to achieve this…
  • cstanton
    cstanton over 10 years ago in reply to shabaz +1
    Hi shabaz , As far as I am aware the screen was manufactured to fit the case, not the other way around. I've no idea about communication about the case between element14 and the Pi Foundation. The LCD…
  • mcb1
    mcb1 over 10 years ago +1
    It looks like there is some info here on their larger sizes 4D Systems | 4DPi-32 At least they ave brought the GPIO back out. Seems someone has been looking into what the display tick http://hardware-libre…
  • Former Member
    Former Member over 9 years ago in reply to clem57

    Got it to work. The driver package link here refers to v1. There's a 4.1.10 and the screen works with RPi3.

     

    http://forum.4dsystems.com.au/forum/forum-aa/4d-systems-hardware/raspberry-pi-display-modules-and-shields/51335-4dpi-24-hat-with-raspberry-pi-3?p=51351#post51351

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • clem57
    clem57 over 9 years ago in reply to Former Member

    Which will give you support for the A+/B+ , why this is different, I do not fully understand but it is likely driver related in how the screen interfaces with the VideoCore on the Raspberry Pi as some of the DMA addressing changed between the two.

    Unless the driver was updated within last month or less, the Pi 3 would not work. If you have the above B+, things would work.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 9 years ago

    Hi,

     

    I have RPi 3 and went through the steps in the tutorial and am unable to get the screen to work. In fact, the RPi stops booting completely. Any ideas?

     

    The OS I have is Raspbian.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 9 years ago in reply to Former Member

    If somebody is interested to have my program (all works but not very fluidly), i can give it.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 9 years ago in reply to Former Member

    A last question (or an other...).

    In my python program, i launch preview, and after i have a loop to adjust contrast, color, stop , shutdown (same as your program) and a button to take a photo.

    But the preview is slow, very very slow.

    How is it possible to have the preview fluid ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 9 years ago in reply to Former Member

    Ok, all is good for me.

    Very clear.

     

    I Thank you.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 9 years ago in reply to Former Member

    hey Greg,

     

    How to do what?

    To chmod file?

    $ chmod a+x /path/to/my/script

    To add a line in script?

    $ sudo nano /etc/rc.local

    This commands opens file, in that file you add a line just above exit line

    /usr/bin/python /usr/local/bin/buttons.py &

     

    Hope this helps image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 9 years ago

    Thank you. I saw this document and I think I understand wich command I need for my application.

     

    A last question.

    seiduna

    I chmod the file to be executable and added /usr/bin/python /usr/local/bin/buttons.py & just before exit 0 line in /etc.rc.local, so it starts just before login.

     

    How to do this ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • clem57
    clem57 over 9 years ago in reply to Former Member

    In the appendix attached to this post, you will find code that will let you configure the buttons for the screen. There's code for C and for Python, which will give you some diversity in using the buttons (first person to create a Kodi/OpenElec plugin gets a cookie).

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 9 years ago

    And what is the commands (with python) to use the button ?

     

    Thank you.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube