# Extra switches now customizable from webconf

**URL:** <https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765>\
**Category:** Software Updates\
**Created:** [February 26, 2019, 9:01pm UTC](https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765 "2019-02-26T21:01:20Z")\
**Posts on this page:** 8\
**Page:** 4

<div class="post-metadata">

**Author:** ![wanthalf](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/w/ed655f/32.png) [@wanthalf](https://discourse.zynthian.org/u/wanthalf)\
**Post date:** [May 6, 2021, 9:02am UTC](https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765/61 "2021-05-06T09:02:54Z")

</div>

Oh!.. Is it a temporary issue or all the guides about wiring buttons to the RPi just automatically expect that you do not use any MCP at all? Why is there talk about “extra” switches, then - “extra” to what?

Well, I have not studied the code, so I do not know whether you use some python library or just bash scripts, but that should not be a big problem, is it? When seeing the numbers above 100, I just expected a system similar to the IoAbstraction library for Arduinos - but OK, this is a completely different platform, so I should not be surprised and let me confuse by the similar system of PIN numbering.

---

<div class="post-metadata">

**Author:** ![wanthalf](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/w/ed655f/32.png) [@wanthalf](https://discourse.zynthian.org/u/wanthalf)\
**Post date:** [May 6, 2021, 9:16am UTC](https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765/62 "2021-05-06T09:16:38Z")

</div>

I see now - the zyncoder module is written in C using the wiringPi library. I will try to have a look at the code, why is it a problem to deal with both an MCP and native GPIO at the same time… I already noticed that multiple MCPs are not supported either (yet?).

---

<div class="post-metadata">

**Author:** ![MaxMaxis](https://discourse.zynthian.org/letter_avatar_proxy/v4/letter/m/90db22/32.png) [@MaxMaxis](https://discourse.zynthian.org/u/MaxMaxis)\
**Post date:** [May 7, 2021, 4:36am UTC](https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765/63 "2021-05-07T04:36:23Z")

</div>

I just wanted to note a possible alternative to the port expander is the MPR121 I2C [Capacitive touch](https://www.nxp.com/docs/en/data-sheet/MPR121.pdf) 12 input chip, with some pins that can also be programmed as [GPIO](https://www.nxp.com/docs/en/application-note/AN3894.pdf) connections (with tricky looking code) , it could do the encoder interface as well as handling a row of panel buttons.  
 ![MPR121 Capacitive Touch and GPIO](https://discourse.zynthian.org/uploads/default/original/2X/e/e859d40c9dfa9068ce38700a1952d205f42a36b3.jpeg)  
[1 board delivered for $2.33](https://www.aliexpress.com/item/4000375267011.html) (4 for $4.60)  
These boards might be handy for a controller project, you can have 48 inputs using the 4 different I2C addresses available. [Adafruit Writeup](https://learn.adafruit.com/adafruit-mpr121-12-key-capacitive-touch-sensor-breakout-tutorial) . . . [Sparkfun](https://learn.sparkfun.com/tutorials/mpr121-hookup-guide/all)

If it did prove reliable handling rotary encoders, you could have web interface selectable touch switch or digital input options on the remaining pins

---

<div class="post-metadata">

**Author:** ![jofemodo](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jofemodo/32/2_2.png) [@jofemodo](https://discourse.zynthian.org/u/jofemodo)\
**Post date:** [May 8, 2021, 6:02pm UTC](https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765/64 "2021-05-08T18:02:16Z")

</div>

> [@MaxMaxis](#):
>
> MPR121 I2C [Capacitive touch](https://www.nxp.com/docs/en/data-sheet/MPR121.pdf)

It could be a good replacement on future hardware versions.

Thanks!

---

<div class="post-metadata">

**Author:** ![jofemodo](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/jofemodo/32/2_2.png) [@jofemodo](https://discourse.zynthian.org/u/jofemodo)\
**Post date:** [May 8, 2021, 6:12pm UTC](https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765/65 "2021-05-08T18:12:41Z")

</div>

> [@wanthalf](#):
>
> why is it a problem to deal with both an MCP and native GPIO at the same time… I already noticed that multiple MCPs are not supported either (yet?).

It’s not a “real problem”. It could be done, but current code doesn’t allow it because until now nobody tried this combination. That’s all 😉

Currently you can use these configurations:

- 1 or 2 x MCP23017 (interrupts)
- RBPi GPIO for switches & encoders (interrupts) + MCP23008 for switches (polling)

I must apologize because the zyncoder.c code is a mess. It was one of the first pieces of zynthian and it needs a deep refactorization, but as it works quite well and it’s highly critical, i’ve no incentive for prioritizing the task. Mr @riban is pushing to me for doing the task, so perhaps you could joint your forces and increase the pushing … or do the task!!! 🤣

Regards,

---

<div class="post-metadata">

**Author:** ![wyleu](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/wyleu/32/514_2.png) [@wyleu](https://discourse.zynthian.org/u/wyleu)\
**Post date:** [May 8, 2021, 6:22pm UTC](https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765/66 "2021-05-08T18:22:11Z")

</div>

> [@jofemodo](#):
>
> Mr @riban is pushing to me for doing the task

@wyleu would like to add to the push…

---

<div class="post-metadata">

**Author:** ![dhrupadiya](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/dhrupadiya/32/1440_2.png) [@dhrupadiya](https://discourse.zynthian.org/u/dhrupadiya)\
**Post date:** [May 10, 2021, 5:40am UTC](https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765/67 "2021-05-10T05:40:44Z")

</div>

@dhrupadiya backs up @riban and @wyleu.

Can’t help with the code itself (not qualified enough), sorry about that !

---

<div class="post-metadata">

**Author:** ![le51](https://discourse.zynthian.org/user_avatar/discourse.zynthian.org/le51/32/1706_2.png) [@le51](https://discourse.zynthian.org/u/le51)\
**Post date:** [May 10, 2021, 6:36am UTC](https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765/68 "2021-05-10T06:36:42Z")

</div>

oh yes plaese, they are some free gpio’s who are waiting to be wired on custom switches 😉

[Previous page](https://discourse.zynthian.org/t/extra-switches-now-customizable-from-webconf/2765.md?page=3)
