CM Panel technical documentation Buy

Test the CM Panel touch screen

Using evtest

Install evtest

$ sudo apt update
$ sudo apt install evtest

Check the list of available devices

sudo evtest

No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:  1-005d Goodix Capacitive TouchScreen
Select the device event number [0-x]: 

Select the Goodix device and touch it to see the incoming data:

Testing ... (interrupt to exit)
Event: time 1705002268.269590, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 0
Event: time 1705002268.269590, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 302
Event: time 1705002268.269590, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 270
Event: time 1705002268.269590, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 23
Event: time 1705002268.269590, type 3 (EV_ABS), code 50 (ABS_MT_WIDTH_MAJOR), value 23
Event: time 1705002268.269590, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1705002268.269590, type 3 (EV_ABS), code 0 (ABS_X), value 302
Event: time 1705002268.269590, type 3 (EV_ABS), code 1 (ABS_Y), value 270

Using a Python program

Install python3-evdev

$ sudo apt update
$ sudo apt install python3-evdev

Create a file called touch.py with this code:

#!/usr/bin/python

import RPi.GPIO as GPIO
import time
import sys
import getopt
import string 
import datetime
import select
import sys
import os
import termios
import tty
from evdev import InputDevice,ecodes


#http://www.termsys.demon.co.uk/vtansi.htm
color_white = "\x1B[37;40m"
color_red = "\x1B[31;40m"
clear_screen = "\x1B[2J"
cursor_home = "\x1B[H"
white_blue = "\x1B[37;44m" 


print("Touch test")
print("ctrl-c to exit")

x=0
y=0
device = InputDevice('/dev/input/event3')

for event in device.read_loop():
    if event.type==ecodes.EV_ABS:
        print(event.code,event)
        if event.code==53:
            x=event.value
        if event.code==54:
            y=event.value           
        print(x,y)                      

Products related

CM-Panel-Basic

Features Index Buy

All-in-one 7 inch touch WiFi terminal powered by Raspberry Pi CM4S
  • 7 inch TFT display 800x480
  • Capacitive touch
  • MIPI Camera connector
  • WiFi @ 2.4 GHz
CM-Panel-POE

Features Index Buy

All-in-one 7 inch touch POE terminal powered by Raspberry Pi CM4S
  • 7 inch TFT display 800x480 pixel
  • Capacitive touch
  • Embedded micro UPS for safe shutdown
  • Power Over Ethernet @ 10/100 Mbit
  • Hi-resolution audio up to 384KHz@32bit
  • Real Time Clock with backup battery
  • 3 USB Host port
  • 1 RS485/422/RS232 port
  • 1 Relay
  • MIPI Camera connector
  • WiFi @ 2.4 GHz (optional)
CM-Home

Features Index Buy

Home Automation board powered by Raspberry Pi CM4S lite module
  • Power-in @ 12 to 24VDC
  • Double opto-isolated RS-485 ports
  • 2 relays
  • 2 USB 2.0 host port
  • Ethernet port at 10/100Mbit
  • MIPI Camera connector
  • Stereo audio out on 3.5 mm jack

Home page CM Panel technical documentation Buy