logo elektroda
logo elektroda
X
logo elektroda

GPIODoctor in OpenBeken - a convenient way to learn GPIO roles in an IoT device

p.kaczmarek2 6693 0

TL;DR

  • OpenBeken's Web App GPIO Doctor helps identify GPIO roles on BK7231, W600, W800, BL602, and XR809 IoT devices.
  • It tests pins interactively by driving outputs high/low for relays and LEDs, or by using input pullup and dInput modes to catch buttons and door sensors live.
  • The workflow targets roughly 30 available GPIOs and maps relay/button channels together, while PWM channels 1–5 handle RGBCW ordering.
  • It helped configure several devices faster than manual pin swapping or Tasmota, but it does not support I2C LED controllers or TuyaMCU devices.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI voice):
  • GPIO Doctor interface for pin configuration in OpenBeken
    Changing the firmware of an IoT device usually takes place in two steps: first, a new batch must be uploaded (usually via UART), and then the new firmware must be properly configured to work with our equipment. This configuration includes assigning the role to selected GPIOs, i.e. determining on which pin there is, for example, a relay, on which there is a button, and on which there is, for example, an LED indicating the WiFi status.
    This search for GPIO roles is rather familiar to all users of firmware such as Tasmota, or even mine OpenBeken , there are different ways to set GPIO roles, including:
    - you can use a ready-made template already created by someone before, there are templates for OBK here
    - you can extract the configuration from the Tuya batch, which has been supported recently BK7231GUIFlashTool but more on that another time
    - you can test the board with a multimeter and visually, check where which pin is connected, of course after disconnecting it from the power supply, also bearing in mind that some peripherals are connected through resistors and so on
    - you can also guess.
    Here I will deal with ... the topic of guessing, more specifically, a tool that makes this guesswork easier. But first - a little reminder.

    The BK7231 chips, as well as other supported platforms (W600, W800, BL602, XR809), have roughly 30 available GPIOs. As a rule, only some of these pins are used, even though an IoT device may have several relays and several buttons. This means you have to somehow figure out which pin has what role...
    Both in Tasmot and OBK, buttons and relays are combined into groups, giving them indexes. At OpenBeken, these are the so-called channels. Button and relay on one channel work together. Similarly, instead of the (momentary) button, you can use the TglChannelOnToggle role (to change the state of the relay when someone switches the bistable switch) or e.g. dInput (to rewrite the 1:1 state from the input to the relay, or dInput_n, i.e. with negation).
    Similarly with PWM - for PWM pins, you can (or even need to) set channels, sequentially with indexes 1, 2, 3, 4 and 5, to determine which PWM is responsible for red, which for green, etc. The order is of course RGBCW.
    Details in the documentation:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/README.md
    Here is a list of available GPIO roles:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/ioRoles.md
    It is also worth looking at the list of devices inside:
    https://openbekeniot.github.io/webapp/devicesList.html
    The topic assumes a basic knowledge of these concepts.

    GPIO Doctor at OpenBeken
    The tool for convenient pin testing in OpenBeken resides in the so-called Web App, i.e. in the Web Application, which is an overlay on the device with this batch. This application is characterized by the way it is createdand loading - it is written entirely in Javascript/HTML/Vue, and is loaded from Github, via GH Pages. This has several consequences:
    - this application takes practically no load on the IoT device (only the REST interface, quite modest, through which it communicates) takes up space
    - this application can be freely developed with dozens of convenient tools, practically zero cost of memory on BK or other system
    - this application requires a network connection, but you can also host it locally everything is open source
    - this application can refresh itself conveniently in the background via Ajax and gives a greater level of interaction than classic websites
    We enable the application in OBK, Web Application button , then select a tab GPIO Doctor to open said Doctor.
    GPIODoctor in OpenBeken - a convenient way to learn GPIO roles in an IoT device
    This is what GPIO Doctor looks like:
    GPIODoctor in OpenBeken - a convenient way to learn GPIO roles in an IoT device
    Before using it, remember that the changes are automatically saved there, so if we already have a configuration, it may be worth exporting it in the Config tab.
    Using GPIODoctor to search for relays/LEDs :
    One by one, for each pin, press the "Set output high" button and after a while, when this button changes to "Set output low", press it again. We look/listen to see if the given relay/LED reacts. If so - we found the pin responsible for this LED. If not, you can click "Clear" to clear the role of the pin and search further.
    Using GPIODoctor to search for door buttons/sensors :
    One by one, for each pin, first press Set input pullup, and then physically press the button of interest and hold it. We observe whether the state on a given pin has changed. The status will refresh itself, on its own, in the background. This does not require a page reload. Just remember to hold the button, not click it. You have to hold for a second and see if there is another state.
    If the input pullup doesn't work (it is used by default for buttons by Tuya, and for example we are looking for a door sensor, you can try the second input mode - without pullup).
    Below is a video of the tests of the door opening sensor, you can see how the status refreshes:



    (in the video above I do not move anything on the computer, I only move the door opening sensor, the website refreshes itself in the background)
    If we do not find anything on a given pin, we clear it (you can also set all of them to input mode and test them at once), when we find it, we can change the pin mode to Button (default testing is done on dInput, i.e. digital input, digital entry).
    Using GPIODoctor to search for PWM LEDs :
    All RGB, RGBCW products are usually based on PWM pins. We search for PWM pins in the output mode, i.e. just like relays, everything as discussed earlier, then it's only worth changing the role to PWM manually and setting the channel (R is 1, G is 2, B is 3, C is 4, W is 5, red - red, green - green, blue - blue, cool white - cold white, warm white - warm white).
    What does GPIODoctor not support?
    Of the more popular mechanisms, GPIODoctor does not support two things:
    - "I2C" or "I2C style" controllers for LEDs, type SM2135, SM2235, BP5758, etc.
    - devices based on TuyaMCU, in their case it is worth getting acquainted with analyzer
    What after finding the pins?
    After configuring everything, it is worth clearing the unused pins/channels with the Clear button, as well as exporting the template in the Config tab, so that you have a backup copy for the future. It may also be necessary, for example, to change the channel, e.g. when we are looking for buttons, we are looking for the dInput pin in the role mode (digital input), but if we already find a button and we want it to work as a button, then we need to set the role of Button manually. The same with the channel - you have to manually set the same channel on the button that has the relay. It's to connect them together. This should be remembered, otherwise the firmware will not know which button operates which relay.

    What if not GPIODoctor?
    It is worth mentioning that the latest version of the flasher can be found here:
    https://github.com/openshwprojects/BK7231GUIFlashTool
    allows you to simply drag and drop a 2MB Tuya input to the decoder field:
    GPIODoctor in OpenBeken - a convenient way to learn GPIO roles in an IoT device
    and get the pinout/JSON to paste into Web App:
    GPIODoctor in OpenBeken - a convenient way to learn GPIO roles in an IoT device
    Unfortunately, this doesn't always work - e.g. for the deep sleep door sensor, the Tuya JSON configuration could not be found.


    Summary
    GPIODoctor has already helped me to run several devices for one reader (he sent me some products to upload OBK - then the products are of course sent back, I will present them soon). It is certainly more convenient than manually changing the role of pins and returning to the main panel to check if a given relay is working. And it's certainly easier than a similar process in Tasmot, where after changing the GPIO role, the device had to reboot for some strange reason. I actually spent too much time on these devices with Tasmota. Now at least in OBK it will be a bit faster...
    The use of GPIO Doctor may require updating the firmware to the version from today/yesterday (i.e. May 5, 2023).
    If there are any problems with the tool, or suggestions on how to improve it - please write boldly, I will be happy to help.

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 14724 posts with rating 12808, helped 659 times. Been with us since 2014 year.
  • ADVERTISEMENT
📢 Listen (AI voice):

FAQ

TL;DR: OpenBeken GPIODoctor helps map roughly 30 GPIO pins; as the author says, it makes GPIO "guesswork" easier for users flashing IoT devices and assigning relays, buttons, sensors, and PWM LEDs after firmware replacement. [#20569378] Why it matters: Correct GPIO mapping decides whether an OpenBeken-flashed device can safely operate its relays, buttons, LEDs, and sensors.

Method Best use Concrete limit or value
GPIODoctor Manual discovery of relays, LEDs, buttons, sensors, and PWM outputs Tests roughly 30 GPIOs interactively
Ready OpenBeken template Fast setup when a matching device already exists Uses existing device-list entries
Tuya JSON extraction Recovering pinout from a Tuya firmware dump Drag-and-drop a 2 MB Tuya input
Multimeter and visual tracing Hardware verification with power disconnected Requires board access and caution

Key insight: GPIODoctor is most useful after flashing OpenBeken, when the firmware runs but GPIO roles remain unknown. It turns pin discovery into live input/output testing instead of repeated manual configuration changes.

Quick Facts

  • OpenBeken-supported platforms named in the thread include BK7231, W600, W800, BL602, and XR809, each with roughly 30 available GPIOs. [#20569378]
  • The OpenBeken Web App runs as JavaScript, HTML, and Vue loaded from GitHub Pages, while the IoT device exposes only a modest REST interface. [#20569378]
  • PWM channel order for RGBCW is fixed as 1=R, 2=G, 3=B, 4=C, and 5=W, covering red, green, blue, cool white, and warm white. [#20569378]
  • BK7231GUIFlashTool can accept a 2 MB Tuya firmware input and produce a pinout or JSON for pasting into the Web App. [#20569378]
  • GPIODoctor may require firmware from May 5, 2023, described as the current or previous day build in the original post. [#20569378]

What is GPIODoctor in OpenBeken and what problem does it solve when configuring IoT device GPIO pins?

GPIODoctor is an OpenBeken Web App tool for discovering unknown GPIO roles after flashing IoT firmware. It helps identify which pin controls a relay, LED, button, door sensor, or PWM channel. The author frames the problem as GPIO "guesswork" across roughly 30 available pins on BK7231 and similar platforms. It reduces repeated manual role changes and panel switching during configuration. [#20569378]

How do I use GPIODoctor in OpenBeken to find which GPIO controls a relay or LED?

Use output testing on each pin and watch or listen for a relay or LED reaction.
  1. Open Web Application, then select the GPIO Doctor tab.
  2. For each pin, click “Set output high,” wait, then click “Set output low.”
  3. If nothing reacts, click “Clear” and test the next pin. A relay click or LED change identifies the matching GPIO. [#20569378]

How can I use GPIODoctor to identify GPIO pins connected to buttons, door sensors, or other digital inputs?

Set each candidate pin as an input, then hold the physical button or sensor state and watch the live status. Start with “Set input pullup,” because Tuya commonly uses pull-up mode for buttons. If that fails, try input mode without pull-up, especially for a door sensor. The Web App refreshes status in the background, so the page does not need a manual reload. [#20569378]

What is the difference between dInput, Button, TglChannelOnToggle, and dInput_n roles in OpenBeken?

dInput copies a digital input state 1:1, while dInput_n copies it with negation. Button is the normal momentary button role. TglChannelOnToggle changes the relay state when a bistable switch toggles. "TglChannelOnToggle is an OpenBeken GPIO role that toggles a channel when an input changes, making bistable wall switches act like relay control inputs." These roles still need correct channel assignment. [#20569378]

How should I assign OpenBeken channels so a button controls the correct relay?

Assign the same channel index to the button and the relay it must control. OpenBeken groups buttons and relays by channel, so channel matching connects their behavior. For example, a button on channel 1 controls a relay on channel 1. If the channels differ, the firmware cannot know which button operates which relay. [#20569378]

How do I find and configure PWM pins for RGB, RGBCW, cool white, and warm white LEDs in OpenBeken?

Find PWM pins by testing them like output pins, then manually change their role to PWM. Click output high and low for candidate pins and observe which LED color changes. After discovery, set the PWM role and assign the correct channel. OpenBeken uses channels 1 through 5 for red, green, blue, cool white, and warm white outputs. [#20569378]

What does the RGBCW channel order mean in OpenBeken PWM configuration?

RGBCW channel order maps PWM channels to LED color outputs in a fixed sequence. Channel 1 is red, channel 2 is green, channel 3 is blue, channel 4 is cool white, and channel 5 is warm white. The author states the order as RGBCW, so wrong channel numbers swap colors or white channels. [#20569378]

Why should I export the OpenBeken configuration before using GPIODoctor?

Export the configuration because GPIODoctor changes are saved automatically. If the device already has a partial or working configuration, testing can overwrite pin roles. Use the Config tab to create a backup before experiments. That backup lets you restore known settings after testing roughly 30 candidate GPIOs. [#20569378]

What should I do after finding all GPIO roles with GPIODoctor in OpenBeken?

Clear unused pins and export the finished template from the Config tab. Then manually set final roles where testing used temporary modes. For example, a discovered dInput pin may need the Button role. Also set matching channels for related buttons and relays, because OpenBeken links them by channel index. [#20569378]

Which devices or LED controllers are not supported by GPIODoctor, such as SM2135, SM2235, BP5758, or TuyaMCU?

GPIODoctor does not support common I2C or I2C-style LED controllers, including SM2135, SM2235, and BP5758. It also does not handle TuyaMCU-based devices. "TuyaMCU is a device architecture where a separate Tuya microcontroller controls functions, so OpenBeken must analyze MCU communication instead of direct GPIO roles." The thread points TuyaMCU users to a separate analyzer. [#20569378]

How can I extract a GPIO pinout or JSON template from a Tuya firmware dump using BK7231GUIFlashTool?

Use BK7231GUIFlashTool by dragging a 2 MB Tuya firmware input into its decoder field. The tool can output a pinout or JSON template. You can then paste that JSON into the OpenBeken Web App. The thread notes a failure case: a deep sleep door sensor did not expose a usable Tuya JSON configuration. [#20569378]

GPIODoctor vs Tuya firmware JSON extraction — which method is better for discovering GPIO roles in OpenBeken?

Use Tuya JSON extraction first when a valid 2 MB Tuya dump contains the configuration. It can directly produce a pinout or JSON template. Use GPIODoctor when no template exists, extraction fails, or you need live confirmation. The author gives one failure case: the deep sleep door sensor did not yield the Tuya JSON configuration. [#20569378]

What is TuyaMCU and why do TuyaMCU-based devices need a different analyzer instead of GPIODoctor?

TuyaMCU-based devices need a different analyzer because their functions are not exposed as simple OpenBeken GPIO roles. "TuyaMCU is a Tuya device design where a dedicated MCU exchanges control data with the WiFi module, hiding relays, buttons, or sensors behind a protocol." GPIODoctor tests pins directly, so it misses protocol-controlled functions. [#20569378]

What safety precautions should I take when testing GPIO connections on a mains-powered IoT device with a multimeter or OpenBeken?

Disconnect the device from power before visual inspection or multimeter tracing. The thread explicitly says to test the board only after disconnecting it from the power supply. Treat mains-powered IoT boards as hazardous, because relay modules and power supplies can connect to dangerous voltages. Also remember that some peripherals connect through resistors, which can confuse tracing. [#20569378]

Why might GPIODoctor not appear or work correctly in OpenBeken, and which firmware version is needed?

GPIODoctor may require updating OpenBeken to the build from May 5, 2023, or the adjacent day. The author wrote that GPIO Doctor usage may need firmware from “today/yesterday,” then identified the date as May 5, 2023. Because the tool lives in the Web App, also ensure the Web Application can load from GitHub Pages or a local host. [#20569378]
AI summary based on the discussion. May contain errors.
ADVERTISEMENT