logo elektroda
logo elektroda
X
logo elektroda

[BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem

koloksk1 1572 10
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20417634
    koloksk1
    Level 3  
    After uploading the OpenBeken software to the dimmer module, configuring the ports, the dimming control does not work. The LED, the button on the board and the external one work normally. I think there might be a communication problem, with the MCU (HK HK32F030MF4P6 MCU model). I was able to get the MOSFET on by setting the P7 port to dInput channel 2 (doesn't always work). Maybe someone knows how to solve this problem?

    I am using the script:
    
    startDriver TuyaMCU
    setChannelType 1 toggle
    setChannelType 2 dimmer
    tuyaMcu_setDimmerRange 0 1000
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2


    Pictures of the module:
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem.
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem


    Photo source: https://github.com/arendst/Tasmota/discussions/14506

    List of ports:
    P6(PWM0) - external switch (S1)
    P7(PWM1) - ?
    P8(PWM2) - LED diode on board
    P9(PWM3) - button on board


    List of Tuya DPID:
    1 - switch
    2 - dimmer
  • ADVERTISEMENT
  • #2 20418157
    p.kaczmarek2
    Moderator Smart Home
    Hello, you have an interesting device, I haven't seen it before and haven't analysed it, but I'll try to help "in the dark" somehow.

    koloksk1 wrote:
    Mosfet I've managed to switch on by setting port P7 to dInput channel 2 (doesn't always work).

    dInput copies the High/Low value from a given pin to the channel, using this you cut off the ability to control over the network. I guess you rather want to use TglChannelOnToggle, then changing the state on the switch switches the channel to the opposite state, so control over WiFi also works.


    koloksk1 wrote:

    I use the script:
    
    startDriver TuyaMCU
    setChannelType 1 toggle
    setChannelType 2 dimmer
    tuyaMcu_setDimmerRange 0 1000
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2


    Wait, so you are using channel 2 as a dimmer (dimmer) and as a dInput value at the same time? After all, dInput will set this channel to a value of 0 or 1 for you, and it will still overwrite the dimmer value from this channel. You can't store two things in one variable.

    You must either give your dInput channel to something other than channel 2 (e.g. free 3), or give the dimmer channel (dimmer) to a different slot than the 2.

    Recall the syntax of linkTuyaMCUOutputToChannel :
    
    linkTuyaMCUOutputToChannel	[dpId][varType][channelID]
    

    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem .
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20418567
    koloksk1
    Level 3  
    p.kaczmarek2 wrote:
    Wait, so you are using channel 2 as a dimmer (dimmer) and as a dInput value at the same time? After all, dInput will set this channel to a value of 0 or 1 for you, and it will still overwrite the dimmer value from this channel. You can't store two things in one variable.
    You either have to give your dInput channel to something other than channel 2 (e.g. free 3), or give the channel with the dimmer (dimmer) to a different slot than the 2.


    Buttons(toggle, dimmer) connected to the tuyamcu are not responsive from the beginning, i.e. before setting dinput to P7. Therefore I was looking for another way to switch on the mosfet and by chance I noticed that after setting dinput the mosfet sometimes switches on.
    I also add that I have no communication logs from tuyamcu, only the message about the driver switching on is displayed.
  • ADVERTISEMENT
  • #4 20418577
    p.kaczmarek2
    Moderator Smart Home
    It's become too much of a chaos, you can get lost.

    One by one.... logs.
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem
    I would start with this.

    Then.... I would unset all dInput settings, i.e. set all pins to no role.... so they don't mix...

    Then reboot, but with this script:
    
    
    Kod: [rozwiń] [zaznacz wszystko][Kopiuj do schowka]
    
    startDriver TuyaMCU
    setChannelType 1 toggle
    setChannelType 2 dimmer
    tuyaMcu_setDimmerRange 0 1000
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2
    


    And then I'd check if anything at all reacts to the controls from the web panel, i.e. the toggle control (here channel 1) and the slider control (here channel 2).

    It's also possible to try looking in a completely different place.... for example, is the communication with the MCU alive at all? Or maybe a different baud needs to be set? Have you performed any tests with the uart sniffer? Rather not?
    
    tuyaMcu_setBaudRate 115200
    


    And do you have MQTT connected?
    Helpful post? Buy me a coffee.
  • #5 20418651
    koloksk1
    Level 3  
    p.kaczmarek2 wrote:
    There's too much chaos, you can get lost.
    p.kaczmarek2 wrote:
    One by one.... logs.

    I would start with this.

    Then ... I would unset all dInput settings, i.e. set all pins to no role.... so they don't mix...

    Then reboot, but with this script:


    Code: [expand] [select all][Copy to clipboard]

    startDriver TuyaMCU
    setChannelType 1 toggle
    setChannelType 2 dimmer
    tuyaMcu_setDimmerRange 0 1000
    linkTuyaMCUOutputToChannel 1 1 1
    linkTuyaMCUOutputToChannel 2 2 2





    I would then check if anything responds at all to the controls from the web panel, ie. on the toggle control (here channel 1) and the slider control (here channel 2).


    To be sure, I cleared the entire configuration.

    After changing the loglevel to 7 it started to show the messages:
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0
    

    and when changing the dimmer:
    Debug:TuyaMCU:TuyaMCU_OnChannelChanged: mapped value 100 (OpenBK7321T_App range) to 1000 (TuyaMCU range)
    



    p.kaczmarek2 wrote:
    You can also try to look quite elsewhere.... For example, is the communication with the MCU alive at all? Or maybe you need to set a different baud?
    Changing the baud to 115200 didn't do anything.

    p.kaczmarek2 wrote:
    Have you done any tests with the uart sniffer? Not likely?

    I haven't.

    p.kaczmarek2 wrote:
    And do you have MQTT connected?
    Not currently.
  • #6 20419726
    p.kaczmarek2
    Moderator Smart Home
    It does not appear from these logs that any communication with the MCU is occurring.

    Are you the author of these photos and posts from the linked Tasmota topic?

    Moment....
    koloksk1 wrote:

    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem


    From this photo (and from the LMA35 leads in the photo earlier), it appears that U1_RX, needed for the TuyaMCU is not connected at all! There is no physical connection between the RX port of the TuyaMCU and the TuyaMCU IC.

    Does this device use the TuyaMCU at all? Where did the dpIDs come from, how were they specified?

    Added after 1 [hour] 33 [minutes]:

    koloksk1 wrote:
    Mosfet I was able to enable by setting the P7 port to dInput channel 2 (doesn't always work)
    and if I would disable TuyaMCU completely, delete all autoexec.bat, reboot and set P11 (TX1) to Relay and try switching with it?
    Helpful post? Buy me a coffee.
  • #7 20420468
    koloksk1
    Level 3  
    p.kaczmarek2 wrote:
    Are you the author of these photos and posts from the linked Tasmota topic?

    I am not the author that's why I gave the source. My module is identical and the same chip ZH-Z06-A rev.A is in it .

    I am uploading some of my photos.
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem


    p.kaczmarek2 wrote:
    Does this device use TuyaMCU at all? Where did the dpID come from, how was it determined?

    dpID I deduced according to this guide
    https://www.zigbee2mqtt.io/advanced/support-n...ya_data_points.html#_4-create-a-cloud-project

    Data from dump of default tuya soft (storage.json):
    
    {
    	"gw_bi": {
    		"uuid": "8a3ee6ed8ec6c49c",
    		"psk_key": "xxx",
    		"auth_key": "xxx",
    		"ap_ssid": "SmartLife",
    		"ap_passwd": null,
    		"country_code": null,
    		"bt_mac": null,
    		"bt_hid": null,
    		"prod_test": false,
    		"fac_pin": "wpzhrpz3k0sxl6ew"
    	},
    	"gw_di": {
    		"abi": 0,
    		"id": "bf558876b13a40702dh8xx",
    		"swv": "1.0.2",
    		"bv": "40.00",
    		"pv": "2.2",
    		"lpv": "3.3",
    		"pk": "wpzhrpz3k0sxl6ew",
    		"firmk": null,
    		"cadv": "1.0.3",
    		"cdv": "1.0.0",
    		"dev_swv": "1.0.2",
    		"s_id": "0000037fs2",
    		"dtp": 0,
    		"sync": 0,
    		"attr_num": 0,
    		"mst_tp_0": 0,
    		"mst_ver_0": null,
    		"mst_tp_1": 0,
    		"mst_ver_1": null,
    		"mst_tp_2": 0,
    		"mst_ver_2": null,
    		"mst_tp_3": 0,
    		"mst_ver_3": null
    	},
    	"tls_ca_cnt": 0,
    	"gw_wsm": {
    		"nc_tp": 1,
    		"ssid": null,
    		"passwd": null,
    		"md": 0,
    		"random": 0,
    		"wfb64": 1,
    		"stat": 1,
    		"token": null,
    		"region": null,
    		"reg_key": null,
    		"dns_prio": 0
    	},
    	"is_stride": 0,
    	"gw_ai": {
    		"key": "xxx",
    		"lckey": "xxx",
    		"h_url": "http://a.tuyaeu.com/d.json",
    		"h_ip": "52.58.178.100",
    		"hs_url": null,
    		"hs_ip": null,
    		"hs_psk": "https://a3.tuyaeu.com/d.json",
    		"hs_psk_ip": "3.121.131.36",
    		"mqs_url": null,
    		"mqs_ip": null,
    		"mq_url": "m2.tuyaeu.com:1883",
    		"mq_ip": "18.192.43.219",
    		"ai_sp": null,
    		"ai_sp_ip": null,
    		"mq_psk": "m2.tuyaeu.com:8886",
    		"mq_psk_ip": "3.64.85.28",
    		"time_z": "+01:00",
    		"s_time_z": "[[1679792400,1698541200],[1711846800,1729990800]]",
    		"wx_app_id": null,
    		"wx_uuid": null,
    		"dy_tls_m": 2,
    		"cloud_cap": 1025,
    		"psk21_key": null
    	},
    	"0000037fs2": [
    		{
    			"type": "obj",
    			"mode": "rw",
    			"property": {
    				"type": "bool"
    			},
    			"id": 1
    		},
    		{
    			"type": "obj",
    			"mode": "rw",
    			"property": {
    				"min": 10,
    				"max": 1000,
    				"scale": 0,
    				"step": 1,
    				"type": "value"
    			},
    			"id": 2
    		},
    		{
    			"type": "obj",
    			"mode": "rw",
    			"property": {
    				"min": 10,
    				"max": 1000,
    				"scale": 0,
    				"step": 1,
    				"type": "value"
    			},
    			"id": 3
    		},
    		{
    			"type": "obj",
    			"mode": "rw",
    			"property": {
    				"min": 0,
    				"max": 86400,
    				"scale": 0,
    				"step": 1,
    				"type": "value"
    			},
    			"id": 6
    		},
    		{
    			"type": "obj",
    			"mode": "rw",
    			"property": {
    				"range": [
    					"off",
    					"on",
    					"memory"
    				],
    				"type": "enum"
    			},
    			"id": 14
    		}
    	],
    	"em_sys_env": "bk7231t",
    	"wf_start_md": 3,
    	"timer_arr": {
    		"lastFetchTime": 0,
    		"cnt": 0
    	}
    }
    


    I have the entire fw tuya dump from before the openbeken installation, if needed for analysis I can upload it.
    p.kaczmarek2 wrote:
    And if I would disable TuyaMCU completely, delete all autoexec.bat, reboot and set P11 (TX1) to Relay and try switching with it?

    I checked, still zero response.
  • ADVERTISEMENT
  • #8 20425864
    koloksk1
    Level 3  
    After a preliminary analysis of the paths, I came to the conclusion that pin P7 (PWN1) is not connected to anything. And it looks like the BK7231T communicates with the HK32F030MF4P6 chip using only the tx and sck pins. I made a simplified wiring diagram:
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem

    Some additional pictures:
    [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem [BK7231T] OXT 1ch WiFi Tuya dimmer - OpenBeken dimming / MCU problem
  • #9 20425887
    p.kaczmarek2
    Moderator Smart Home
    As I wrote - in my opinion it is not TuyaMCU.

    It's rather impossible to transfer the UART from certain pins to BK, always the same pins are UART1 and UART2.

    It would be best to check it with some logic analyser, possibly for principle you can still check if it's not something like one signal 1 or 0 to switch on the dimmer and the other is e.g. PWM to set the brightness.... but I don't think so.

    Maybe it's something like I2C, but that's not clear from the pins either, is it? On the table I see some I2C but not where we want it...

    Tough situation. This is the first time I have encountered this. You were exceptionally unlucky to come across a device with something not as common as the TuyaMCU, which could be easily grasped and is already supported.

    Is it possible to buy this dimmer somewhere, but with this particular interior, to analyse it quietly on the factory insert?
    Helpful post? Buy me a coffee.
  • #11 20507842
    p.kaczmarek2
    Moderator Smart Home
    Hello, after testing another dimmer that only communicated via TX with the MCU, I suggest you try to do manually:
    
    startDriver TuyaMCU
    

    And then try to send these packets, they should change the brightness level:
    Quote:

    This works (very bright): uartSendHex 0AFF5502FFF100000A
    It works (very dark): uartSendHex 0AFF5502003F00000A
    It works (disabled ): uartSendHex 0AFF5502000F00000A
    It works (ultra dark): uartSendHex 0AFF55020F1F00000A
    It works (ultra dark): uartSendHex 0AFF5502001F00000A
    It works (semi dark): uartSendHex 0AFF5502005F00000A
    It works (light?): uartSendHex 0AFF5502009F00000A

    Summary:
    The package is like this: uartSendHex 0A FF 55 02 00 9F 00 00 0A
    A I guess 9F is the brightness value...

    This at baud 9600.
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around issues with the OXT 1ch WiFi Tuya dimmer after uploading OpenBeken software. The user reports that while the LED and buttons function correctly, the dimming control fails, possibly due to a communication problem with the HK32F030MF4P6 MCU. Various troubleshooting steps are suggested, including adjusting channel settings, checking physical connections, and analyzing communication logs. It is noted that the P7 pin may not be connected, and the device might not utilize TuyaMCU as expected. Suggestions include using a logic analyzer for further diagnostics and testing with different baud rates. The user also shares links to images of the module and configuration details.
Summary generated by the language model.
ADVERTISEMENT