Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capacitive touch sensor ttp223 #456

Closed
habersatt opened this issue Jan 24, 2019 · 8 comments
Closed

capacitive touch sensor ttp223 #456

habersatt opened this issue Jan 24, 2019 · 8 comments

Comments

@habersatt
Copy link

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

@comdoxx
Copy link
Contributor

comdoxx commented Jan 25, 2019

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.

@habersatt
Copy link
Author

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

@habersatt
Copy link
Author

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

@comdoxx
Copy link
Contributor

comdoxx commented Jan 26, 2019 via email

@habersatt
Copy link
Author

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

@burberius
Copy link

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.

@habersatt
Copy link
Author

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

@MiczFlor
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants