huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Connect Capactive Touch Screen to Raspberry Pi B Type (I2C)

Thu Jan 08, 2015 10:31 am

Hi,

First of all, I want to say that I'm a beginner :)

I ordered a Raspberry Pi Type B board and a LCD with capacitive touchscreen panel, I did not receive the products yet but I have a question, I have an hdmi board to connect the LCD, but I don't know how to connect the touchscreen panel to the raspberry.

Actually, I know that there I2C pins on the board, but I don't know what I have to buy to connect touchscreen to the raspberry.

Can you help me please ?
Thanks


DirkS
Posts: 9871
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Sat Jan 17, 2015 11:50 am

Without any information about the (touch) screen it's impossible to say how to connect it.
Do you have a link to the product / datasheet?

Gr.
Dirk.

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Sat Jan 17, 2015 1:01 pm

Here is the datasheet of the lcd touchpanel
https://onedrive.live.com/redir?resid=6 ... file%2cpdf

Thanks in advance for your help

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Sat Jan 17, 2015 8:29 pm

huseyin_elektek wrote:Here is the datasheet of the lcd touchpanel
https://onedrive.live.com/redir?resid=6 ... file%2cpdf

Thanks in advance for your help
I can't open that file, microsoft doesn't like mobile devices.
Last edited by BMS Doug on Sat Jan 17, 2015 9:04 pm, edited 1 time in total.
Doug.
Building Management Systems Engineer.


BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Sat Jan 17, 2015 9:40 pm

Page 16, table 6.2 there are six connections and it looks like you'll need a logic level switcher.
Doug.
Building Management Systems Engineer.

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Sat Jan 17, 2015 9:52 pm

Do you know a specific converter that I can use ?

After making the connection, I think I have to activate I2C on raspbian, I found this tutorial : http://skpang.co.uk/blog/archives/575
Do you think my touchscreen will work if I follow this tutorial ? Thanks.

DirkS
Posts: 9871
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Sat Jan 17, 2015 10:59 pm

huseyin_elektek wrote:After making the connection, I think I have to activate I2C on raspbian, I found this tutorial : http://skpang.co.uk/blog/archives/575
You can use 'raspi-config' to enable / disable i2c
Do you think my touchscreen will work if I follow this tutorial ? Thanks.
It's not just about connecting the wires, you also need a driver.
No idea if that's available for your panel.

Gr.
Dirk.

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Sat Jan 17, 2015 11:59 pm

In the datasheet, page 16, it is written, Driver IC FT5316, I suppose it is the driver I have to make work on raspbian, right ? I hope I will find it...

cleverca22
Posts: 202
Joined: Sat Aug 18, 2012 2:33 pm

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Wed Jan 21, 2015 6:03 am

a very quick check thru the kernel source shows no instant matches on 5316, so you may have to write the driver yourself in either kernel or userspace

i got lucky with my mpr121 capacitive touch sensor, the kernel has an mpr121_touchkey that turns it into a keyboard

but thats just a 12 button sensor, it cant do a full screen

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Wed Jan 21, 2015 6:44 am

I get the linux drivers from the company who sold me the touchscreen, I think I can make it work with that, I hope so.

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Wed Feb 04, 2015 3:19 pm

Hi, after getting the connector for the touchscreen, unfortunately it does not work.

The module edt_ft5x06 is loaded but does not seem to be used (with lsmod). And when I try i2cdetect -y 1, I see there is something on address 38, but the company who sold the touchscreen says that it has to be 70. How can i do that ?

The gave me their drivers (I have FT5316 touchscreen), but I can't compile them because they are too old for my raspberry version. How can I solve this ?

Thanks for your help...

DirkS
Posts: 9871
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Wed Feb 04, 2015 4:23 pm

huseyin_elektek wrote:The gave me their drivers (I have FT5316 touchscreen), but I can't compile them because they are too old for my raspberry version. How can I solve this ?
How would they be too old for compiling them yourself?

Or do you mean 'load' instead of compile'?

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Wed Feb 04, 2015 4:31 pm

I said old because there are include which does not exist in rpi-3.12.y sources like :

#include <linux/earlysuspend.h>
#include <mach/ldo.h>
#include <linux/smp_lock.h>
etc ...

You can download the driver here : http://hkappswp.com/file/FT5X06.zip

If I could compile this driver, I will be able to load it in my raspberry and maybe it will work. Or maybe I have to make some changes in native edt-ft5x06.c, but I don't know what to do...

cleverca22
Posts: 202
Joined: Sat Aug 18, 2012 2:33 pm

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Wed Feb 04, 2015 6:15 pm

huseyin_elektek wrote:Hi, after getting the connector for the touchscreen, unfortunately it does not work.

The module edt_ft5x06 is loaded but does not seem to be used (with lsmod). And when I try i2cdetect -y 1, I see there is something on address 38, but the company who sold the touchscreen says that it has to be 70. How can i do that ?

The gave me their drivers (I have FT5316 touchscreen), but I can't compile them because they are too old for my raspberry version. How can I solve this ?

Thanks for your help...
the addresses you gave make perfect sense here

0x70 in binary is 1110000
0x38 in binary is 111000

the reason for the difference, the final bit of the address is the read/write flag, some vendors include it, others don't, causing the address to shift by 1 bit

the next issue i ran into with mpr121_touchkey, the driver has no clue which i2c bus the sensor is on, you must provide platform data to configure that, usually its done by the board manufacturer when they create the linux drivers

you may have to fill in similar gaps with yours to make it work

cleverca22
Posts: 202
Joined: Sat Aug 18, 2012 2:33 pm

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Thu Feb 05, 2015 7:06 pm

just stumbled upon the code i was using

Code: Select all

#include <linux/input.h>
#include <linux/i2c/mpr121_touchkey.h>
#include <linux/i2c.h>
#include <mach/gpio.h>

unsigned short keymap[] = { KEY_ENTER };
struct mpr121_platform_data touch_data = {
        .keymap = keymap,
        .keymap_size = ARRAY_SIZE(keymap)
};
static struct i2c_board_info __initdata rpi_i2c_board_info[] = {
        {
                I2C_BOARD_INFO("mpr121_touchkey",0x5a),
                .platform_data = &touch_data,
                .irq = gpio_to_irq(4)
        },
};
static int __init rpi_i2c_init(void) {
        printk("loading touch test");
        i2c_register_board_info(0,rpi_i2c_board_info,ARRAY_SIZE(rpi_i2c_board_info));
        return 0;
}
module_init(rpi_i2c_init);
when compiled and loaded into the kernel, this tells linux that the mpr121_touchkey driver can handle a device at address 0x5a, and that the 1st touch sensor maps to the ENTER key

i believe ALL i2c based drivers need a piece of code like this, to describe how the board is setup and wired to the chip, but device-tree can also do it if the driver has support
you may need similar code to tell it that edt_ft5x06 can find a device at 0x38

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Fri Feb 06, 2015 7:26 am

cleverca22 wrote:just stumbled upon the code i was using

Code: Select all

#include <linux/input.h>
#include <linux/i2c/mpr121_touchkey.h>
#include <linux/i2c.h>
#include <mach/gpio.h>

unsigned short keymap[] = { KEY_ENTER };
struct mpr121_platform_data touch_data = {
        .keymap = keymap,
        .keymap_size = ARRAY_SIZE(keymap)
};
static struct i2c_board_info __initdata rpi_i2c_board_info[] = {
        {
                I2C_BOARD_INFO("mpr121_touchkey",0x5a),
                .platform_data = &touch_data,
                .irq = gpio_to_irq(4)
        },
};
static int __init rpi_i2c_init(void) {
        printk("loading touch test");
        i2c_register_board_info(0,rpi_i2c_board_info,ARRAY_SIZE(rpi_i2c_board_info));
        return 0;
}
module_init(rpi_i2c_init);
when compiled and loaded into the kernel, this tells linux that the mpr121_touchkey driver can handle a device at address 0x5a, and that the 1st touch sensor maps to the ENTER key

i believe ALL i2c based drivers need a piece of code like this, to describe how the board is setup and wired to the chip, but device-tree can also do it if the driver has support
you may need similar code to tell it that edt_ft5x06 can find a device at 0x38

Yes I have something similar in the driver code, and at startup, I can see with dmesg that the driver is registered, but it is not used at all. And with i2cdetect, I can see the touchscreen on 0x38 address, but I don't know what to do to make it work...

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Mon Feb 09, 2015 2:25 pm

Hi everyone,

I get to something today, I adapt the driver they gave me, and it seems to work better now, I have pixcir_ts added as event and when I try with evtest, the touchscreen works and the calibration is perfect.

I have however a last issue, the touchscreen works but it does not work on graphical interface of raspbian, can anybody explain me why ? do I have another configuration to make ?

Thanks in advance again...

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Tue Feb 10, 2015 9:48 am

Hi,

Another information, in the log I can see that my touchscreen is added as a Keyboard, and not a touchscreen, (with 10_evdev.conf), is that normal ?

I don't understand why it is working with evtest, but not in the GUI.

Please help me :(

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Thu Feb 12, 2015 1:41 pm

Hi,

In the log file (/var/log/Xorg.1.log), I can see that my touchscreen is added as a keyboard.
Adding extended input device "pixcir_ts" (type: KEYBOARD, id 9)

I think it might be the problem, but why is it added as a keyboard ? is it something wrong with the driver ?

Thanks for your help.

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Tue Feb 17, 2015 8:20 am

Hello,

Nodoby can help me ? I do not find a solution to this...

DirkS
Posts: 9871
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Tue Feb 17, 2015 11:04 am

Do you have file or directory'/dev/input/touchscreen' on your Pi?

huseyin_elektek
Posts: 22
Joined: Thu Jan 08, 2015 10:26 am

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Tue Feb 17, 2015 12:07 pm

DirkS wrote:Do you have file or directory'/dev/input/touchscreen' on your Pi?
I have this directory by adding a rule, to link /dev/input/event3 to /dev/input/touchscreen.

As I said, when I start evtest in a terminal, I can see values by touching the screen, but I do not understand why it is not working on GUI.

canibalimao
Posts: 557
Joined: Tue Aug 07, 2012 8:48 pm
Location: Portugal

Re: Connect Capactive Touch Screen to Raspberry Pi B Type (I

Wed Apr 08, 2015 3:28 pm

Have you already tried something on this tutorial: https://learn.adafruit.com/adafruit-2-8 ... h/overview ?

I know the screens are different, but it can be usefull someway. If you get some help, please tell what you did ;)

Return to “Interfacing (DSI, CSI, I2C, etc.)”