Introduction: Resistive Touch Screen on Raspberry Pi
What you need kivy on touchscreen
A Raspberry Pi An sd card with Raspbian (Jessie) installed
A touch screen
A keyboard
*this is for resistive touch screen controller AR1100*
Step 1: Expend Sd Card
Step 1: Expend sd card
type:
fdisk -l
and check how much your sd card is available
nano /usr/bin/raspi-config if [ "$PART_NUM" -ne 2 ]; then to if [ "$PART_NUM" -ne 3 ]; then
Ctrl +x
and exit.
sudo raspi-config and expend filesystem
*if you don't expend sd card and download other things, your Pi will be crushed.
Step 2: Calibrating Touch Screen/ Install Kivy
Activating touchscreen
I used a resistive touchscreen with AR1100 controllar.
Let's calibratethe Microchip AR1100 from the Raspberry Pi (Raspbian):
sudo apt-get install git make g++ libusb-1.0-0-dev libgtk2.0-dev cd ../rpi-AR1100/ make sudo chmod +x AR1100 sudo ./AR1100 -c 9 sudo ./AR1100 -c 9
It connected to AR1100 as USB mouse.
git clone https://github.com/belangeo/pyo.git
move pyo to module folder.
Install Kivy
sudo apt-get update sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \ pkg-config libgl1-mesa-dev libgles2-mesa-dev \ python-setuptools libgstreamer1.0-dev git-core \ gstreamer1.0-plugins-{bad,base,good,ugly} \
gstreamer1.0-{omx,alsa} python-dev cython
git clone https://github.com/belangeo/pyo.git
cd kivy python setup.py build
sudo python setup.py install
Calibrate touch screen
If you are using a touch display, you need to configure Kivy to use it as an input source. To do this, edit the file ~/.kivy/config.ini
and go to the [input] section. Add this:
mouse = mouse mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput
Step 3: Running Demo/ Another Example
step 5:Running Demo
cd kivy/examples/demo/showcase python main.py
If touch screen works crazy(like mouse move up side down) then try:
cd ~ cd kivy nano ~/.kivy/config.ini
or, in kivy/input/providers/mouse.py add:
if button in ('left', 'scrollup', 'scrolldown') and cur and not ( - 'ctrl' in modifiers) or self.disable_multitouch:
+ if (button in ('left', 'scrollup', 'scrolldown') or
+ self.disable_multitouch) and cur and not ('ctrl' in modifiers):
step 6: Another Example with LED lights
pi@raspberrypi ~ $ git clone https://github.com/mrichardson23/rpi-kivy-screen....
cd rpi-kivy-screen/ sudo python main.py
Comments
7 years ago
Nice tutorial. Thanks for sharing.