FAQ
TL;DR: 3 thresholds let one ADC pin drive 3 buttons; "start driver - always first" with OpenBeken’s ADCButton, AB_Map, and event handlers. [Elektroda, p.kaczmarek2, post #20539846]
Why it matters: This helps OpenBeken users make Tuya BK7231T 3‑gang touch switches work reliably without extra hardware.
- Example ADC counts and thresholds: no-press ~4095; buttons ~1604, ~897, ~2; set AB_Map 450, 1250, 2900. [Elektroda, p.kaczmarek2, post #20539846]
- Final pinout proven on a 3‑gang unit: P22 WiFiLed0; P24 Relay0; P07 Relay1; P08 Relay2; P23 ADC_Button5. [Elektroda, rishabmehta7, post #20541973]
- Working event bindings used: OnADCButton 0→Ch2, 1→Ch1, 2→Ch0. [Elektroda, rishabmehta7, post #20541973]
- Create autoexec.bat in the Web Application → LittleFS tab. [Elektroda, p.kaczmarek2, post #20539998]
- A firmware fix was added; update to the latest build. [Elektroda, p.kaczmarek2, post #20541682]
Quick Facts
- Example ADC counts and thresholds: no-press ~4095; buttons ~1604, ~897, ~2; set AB_Map 450, 1250, 2900. [Elektroda, p.kaczmarek2, post #20539846]
- Final pinout proven on a 3‑gang unit: P22 WiFiLed0; P24 Relay0; P07 Relay1; P08 Relay2; P23 ADC_Button5. [Elektroda, rishabmehta7, post #20541973]
- Working event bindings used: OnADCButton 0→Ch2, 1→Ch1, 2→Ch0. [Elektroda, rishabmehta7, post #20541973]
- Create autoexec.bat in the Web Application → LittleFS tab. [Elektroda, p.kaczmarek2, post #20539998]
- A firmware fix was added; update to the latest build. [Elektroda, p.kaczmarek2, post #20541682]
How do I make three Tuya touch buttons on one ADC pin work in OpenBeken?
Use the ADCButton driver and AB_Map to split the ADC range into three buckets. Bind OnADCButton events to your relay channels. Start the driver, set AB_Map 450 1250 2900, then add handlers that toggle the relays. This approach was validated by the developer. [Elektroda, p.kaczmarek2, post #20539846]
How do I configure it end-to-end? (3-step How‑To)
- In Configure Module, set P23 to ADC_Button.
- In autoexec.bat: startDriver ADCButton, then AB_Map 450 1250 2900.
- Add handlers: OnADCButton 0→toggleChannel 2, 1→toggleChannel 1, 2→toggleChannel 0. Adjust channel numbers if needed. [Elektroda, rishabmehta7, post #20541973]
What thresholds should I use for AB_Map?
Measure raw counts, then set boundaries at midpoints between clusters. Example counts: 4095 (no press), 1604, 897, 2. Boundaries used: 450, 1250, 2900. These split the ADC space into three stable button zones. “Create margins between values (as average values).” [Elektroda, p.kaczmarek2, post #20539846]
Where do I put autoexec.bat in OpenBeken?
Create autoexec.bat via the Web Application under the LittleFS tab. Save the file there so it runs at boot. This is the supported method for persistent scripts and driver startup. [Elektroda, p.kaczmarek2, post #20539998]
Why do my button events look off by one?
Update to the latest firmware. A fix adjusted behavior, so event indexes may differ from earlier builds. After updating, remap your OnADCButton handlers if necessary to match the observed indexes. [Elektroda, p.kaczmarek2, post #20541682]
What pin mapping worked on a DS‑103‑like 3‑gang switch?
Verified mapping: P22 WiFiLed0, P24 Relay0, P07 Relay1, P08 Relay2, P23 ADC_Button5. This configuration, combined with AB_Map 450 1250 2900 and event handlers, delivered stable control. [Elektroda, rishabmehta7, post #20541973]
How do I read ADC counts to choose thresholds?
Temporarily assign P23 to Temp to view raw ADC counts. Example readings observed: 4095 (no press), 1604, 897, 2 for buttons. Use these to compute midpoints for AB_Map. Revert P23 to ADC_Button after measuring. [Elektroda, rishabmehta7, post #20523046]
What happens if I press two touch buttons at once?
Combined presses can yield blended counts like ~602, ~4, or ~3. Treat multi-press as an edge case and ignore or handle separately. Keep thresholds centered on single-press clusters to minimize false triggers. [Elektroda, rishabmehta7, post #20523046]
Does the ADC button channel number matter in OpenBeken?
No. You can place the ADC_Button on an unused channel, even channel 10. As the developer notes, “firmware will read ADC internally.” This keeps it separate from relay channels. [Elektroda, p.kaczmarek2, post #20541682]
Can I flash OpenBeken without opening the device?
Yes. The user flashed with Cloud Cutter using a DS‑103 profile, then corrected pins manually. Once OpenBeken runs, configure the ADC and relays as described. This approach avoids soldering. [Elektroda, rishabmehta7, post #20523046]
Is using one ADC pin for multiple buttons reliable?
Yes, with proper thresholds and the ADCButton driver. The developer confirms it is “a known practice.” Use AB_Map midpoints and event handlers for stable control. Real hardware testing reported success. [Elektroda, p.kaczmarek2, post #20523162]
Which product was this tested on?
A Tuya 3‑gang touch switch sourced as “WiFi Smart Light Switch Glass Panel” was referenced. The method applies to similar BK7231T boards that multiplex buttons on one ADC pin. [Elektroda, rishabmehta7, post #20534003]
How do I prevent false triggers near thresholds?
Pick boundaries at the average between measured clusters to add margin. For the shared ADC case, AB_Map 450 1250 2900 separated the zones cleanly. Re-measure after installation and tweak if needed. [Elektroda, p.kaczmarek2, post #20539846]