Rpi-jukebox-rfid: capacitive touch sensor ttp223

Created on 24 Jan 2019  ·  8Comments  ·  Source: MiczFlor/RPi-Jukebox-RFID

Hello!
Instead of push buttons, I have installed capacitive touch sensors type ttp223. Everything works great except for volume up and down and mute.
My question: How do I adjust the gpio-button.py so I can adjust the volume. Maybe someone has already gained experience.
Thanks in advance.
Clemens

All 8 comments

Hi habersatt,

If everything is wired correctly (VCC, GND and GPIO) and you didn't bridge either A or B or the ttp223's board, it should behave just as a normal button, and adjust volume in both ways: Single touch and holding. Make sure to connect the correct GPIO you take from the gpio-button.py to the sensor. Don't mix up pin number and GPIO number.

If that's done and you still experience trouble, feel free to post (the excerpt of) your gpio-button.py and maybe a photo of your connection.

Hi comdoxx,
Thanks for the answer! I will wire it once more and Hope, i will be sucsessfull.
Clemens

Hi comdoxx,
Unfortunately, the sensor does not behave as it should. After a touch, the volume decreases continuously to 0. If I set the volume to 100, this process repeats itself. An ordinary push button makes everything right on the same pin.
Since I used the sound over a pifiberry dac +, I chose the flexible pinout. Attached now so my gpi-button.py and photos of the wiring.
Thanks and have a nice weekend
Clemens

!/usr/bin/python3

from gpiozero import Button
from signal import pause
from subprocess import check_call

def def_shutdown():
check_call("./scripts/playout_controls.sh -c=shutdown", shell=True)

def def_volU():
check_call("./scripts/playout_controls.sh -c=volumeup", shell=True)

def def_volD():
check_call("./scripts/playout_controls.sh -c=volumedown", shell=True)

def def_vol0():
check_call("./scripts/playout_controls.sh -c=mute", shell=True)

def def_next():
check_call("./scripts/playout_controls.sh -c=playernext", shell=True)

def def_prev():
check_call("./scripts/playout_controls.sh -c=playerprev", shell=True)

def def_halt():
check_call("./scripts/playout_controls.sh -c=playerpause", shell=True)

shut = Button(3, hold_time=2)
vol0 = Button(17,pull_up=True)
volU = Button(5,pull_up=True,hold_time=0.3,hold_repeat=True)
volD = Button(6,pull_up=True,hold_time=0.3,hold_repeat=True)
next = Button(23,pull_up=True)
prev = Button(22,pull_up=True)
halt = Button(27,pull_up=True)

shut.when_held = def_shutdown
vol0.when_pressed = def_vol0
volU.when_pressed = def_volU

When the Volume Up button was held for more than 0.3 seconds every 0.3 seconds he will call a ra$

volU.when_held = def_volU
volD.when_pressed = def_volD

When the Volume Down button was held for more than 0.3 seconds every 0.3 seconds he will lower t$

volD.when_held = def_volD
next.when_pressed = def_next
prev.when_pressed = def_prev
halt.when_pressed = def_halt

pause()

img_4376
img_4378
img_4377

Hi Clemens,

Thanks for the detailed answer. I'm pretty sure, the touch sensor behaves
like a switch. Did you try to touch it on and then off after a second or
so? Does it stop then to increase or decrease volume?

Am Sa., 26. Jan. 2019, 12:24 hat habersatt notifications@github.com
geschrieben:

Hi comdoxx,
Unfortunately, the sensor does not behave as it should. After a touch, the
volume decreases continuously to 0. If I set the volume to 100, this
process repeats itself. An ordinary push button makes everything right on
the same pin.
Since I used the sound over a pifiberry dac +, I chose the flexible
pinout. Attached now so my gpi-button.py and photos of the wiring.
Thanks and have a nice weekend
Clemens

!/usr/bin/python3

from gpiozero import Button
from signal import pause
from subprocess import check_call

def def_shutdown():
check_call("./scripts/playout_controls.sh -c=shutdown", shell=True)

def def_volU():
check_call("./scripts/playout_controls.sh -c=volumeup", shell=True)

def def_volD():
check_call("./scripts/playout_controls.sh -c=volumedown", shell=True)

def def_vol0():
check_call("./scripts/playout_controls.sh -c=mute", shell=True)

def def_next():
check_call("./scripts/playout_controls.sh -c=playernext", shell=True)

def def_prev():
check_call("./scripts/playout_controls.sh -c=playerprev", shell=True)

def def_halt():
check_call("./scripts/playout_controls.sh -c=playerpause", shell=True)

shut = Button(3, hold_time=2)
vol0 = Button(17,pull_up=True)
volU = Button(5,pull_up=True,hold_time=0.3,hold_repeat=True)
volD = Button(6,pull_up=True,hold_time=0.3,hold_repeat=True)
next = Button(23,pull_up=True)
prev = Button(22,pull_up=True)
halt = Button(27,pull_up=True)

shut.when_held = def_shutdown
vol0.when_pressed = def_vol0
volU.when_pressed = def_volU

When the Volume Up button was held for more than 0.3 seconds every 0.3

seconds he will call a ra$
volU.when_held = def_volU
volD.when_pressed = def_volD

When the Volume Down button was held for more than 0.3 seconds every 0.3

seconds he will lower t$
volD.when_held = def_volD
next.when_pressed = def_next
prev.when_pressed = def_prev
halt.when_pressed = def_halt

pause()

[image: img_4376]
https://user-images.githubusercontent.com/47001677/51786442-ae866400-2164-11e9-8189-d11264a85a1e.jpg
[image: img_4378]
https://user-images.githubusercontent.com/47001677/51786443-ae866400-2164-11e9-82fc-cb6391fe3eec.jpg
[image: img_4377]
https://user-images.githubusercontent.com/47001677/51786441-ae866400-2164-11e9-8691-877907c944b2.jpg


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/456#issuecomment-457823508,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGrdgQoDXQARfIDaeL_m3l6PqDm-f4ADks5vHDrmgaJpZM4aRDNu
.

Hi comdoxx!
Yes that i tried. It‘s Not possible to stop the increase or the decrease of Volume by touching the sensor. I'm surprised about that because the sensor works for the functions play and stop and forward and previous without any problems.
Clemens

I had exactly the same problem!
Tried resoldering and a lot of other stuff, but it didn't work.
In the end the solution was to remove the hold_repeat=True from volume up and down.

Hi burberius,
that works! Thanks a lot!!!!
LG
Clemens

Hi @habersatt
I close this thread and started a page in the wiki:
https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/Capacitive-touch-sensors
Possibly you want to add more info to this page?
Thanks @comdoxx and @burberius for leading the way!
All the best, micz

Was this page helpful?
0 / 5 - 0 ratings

Related issues

s-martin picture s-martin  ·  6Comments

Caliandroid picture Caliandroid  ·  7Comments

olli83 picture olli83  ·  5Comments

topas-rec picture topas-rec  ·  9Comments

warlok85 picture warlok85  ·  7Comments