logo elektroda
logo elektroda
X
logo elektroda

How to Change Firmware on PH-W218 WiFi 8-in-1 Water Quality Tester with CB3S Chip?

Upright6771 5841 78
ADVERTISEMENT
  • #1 21131505
    Upright6771
    Level 4  
    Hi there,

    I am interested to change Firmware of my PH-W218.

    There is an CB3S Chip on the Board.

    Datapoints, that the Device support:

    8: temp_current
    101: sensor_list
    102: temp_warn_max
    103: temp_warn_min
    106: ph_current
    107: ph_warn_max
    108: ph_warn_min
    111: tds_current
    112: tds_warn_max
    113: tds_warn_min
    116: ec_current
    117: ec_warn_max
    118: ec_warn_min
    121: salinity_current
    122: salinity_warn_max
    123: salinity_warn_min
    126: pro_current
    127: pro_warn_max
    128: pro_warn_min
    131: orp_current
    132: orp_warn_max
    133: orp_warn_min
    136: cf_current
    137: cf_warn_max
    138: cf_warn_min
    141: rh_current
    142: rh_warn_max
    143: rh_warn_min

    What is the best way, to start with that new Device? I am already familiar with ESPHome and Home Assistant.

    Close-up of the interior of a PH-W218 device showing a CB3S chip. Display of a PH-W218 water quality tester with three screens.
  • ADVERTISEMENT
  • #2 21131597
    p.kaczmarek2
    Moderator Smart Home
    This looks like a TuyaMCU device. We have a very good TuyaMCU support. Please check out the following guide:
    TuyaMCU flashing, setup and configuration guide - configure dpIDs for Home Assistant
    It seems you already have done the most important part - you know the meaning of dpIDs. The futher integration should be very easy. I can still help, if something is not clear, but the guide should show the most basic steps.
    Helpful post? Buy me a coffee.
  • #3 21131623
    Upright6771
    Level 4  
    Thank you, I will check your link in a quiet moment with a cup of coffee. :-)

    Is there a way to backup the old firmware to go back to stock if there is something not working?

    Are you know which Channel Type I do need to map for Orp and PH for example?
  • #4 21132970
    Nordlicht77
    Level 9  
    @Upright6771

    Hi
    Haben es es geschafft das Gerät zu flashen

    Hi
    Were you able to flash the device?
  • #5 21132998
    p.kaczmarek2
    Moderator Smart Home
    Upright6771 wrote:

    Is there a way to backup the old firmware to go back to stock if there is something not working?

    Of course. You can take a 2MB backup with our flasher and restore it later:
    https://github.com/openshwprojects/BK7231GUIFlashTool


    Upright6771 wrote:

    Are you know which Channel Type I do need to map for Orp and PH for example?

    If a given channel type is missing, I can add it for you. You can also just use publishFile to make custom HASS Discovery packet, or just use ReadOnly channel type
    Helpful post? Buy me a coffee.
  • #6 21133907
    Upright6771
    Level 4  
    Good morning,
    First of all, thank you very much for your support.

    I still have a question that is bothering me and to which I have not found an answer.

    The device has 3 displays. Do I have to control these via Openbeken or will the display remain as it is with the original firmware?

    Can this be answered in general terms from other projects?

    Have attached a new Image in the First Post.
  • #7 21134253
    p.kaczmarek2
    Moderator Smart Home
    Please consult TuyaMCU guide:
    TuyaMCU flashing, setup and configuration guide - configure dpIDs for Home Assistant
    TuyaMCU devices works in such a way that WiFI module only does the communication and the secondary MCU does all the processing. So, displays will keep working after migrating to OpenBeken, as in the original firmware, we just may need to configure OBK to send the require data to displays, but most of the data should be handled by the MCU itself.
    Helpful post? Buy me a coffee.
  • #8 21134490
    Nordlicht77
    Level 9  
    yes, everything can still be operated on the display
    After you do that TuyaMCU guide have processed
    Please download ltchiptool
    And connect the following pin
    CB3S FTDI
    TX -> RX
    RX -> TX
    GND -> GND
    VCC -> VCC
    Then try the following setting, see picture

    Screenshot of ltchiptool v4.1.1.1 program with settings for device operation.

    Press start and then pull VCC from FTDI
    If you also receive a window with chip data, we are one step further
    Try with 3 volts and if it doesn't work with 5 volts
    I want to know if it was just a coincidence for me, make sure the Get Chip Info item is selected
  • #9 21134728
    Upright6771
    Level 4  
    Hi,

    I have successfully created a Backup file and after that I wrote new firmware to the chip.

    I have tried to reset by switch power off and on, but the AP is not visible.

    I also have tried to write the OBK config.
  • ADVERTISEMENT
  • #10 21134800
    p.kaczmarek2
    Moderator Smart Home
    Is the WiFi module back in circuit or how do you power it? What does the TX2 log say? Have you tried writing your SSID/pass directly with OBK config tool via flash?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #11 21134812
    Upright6771
    Level 4  
    Thanks for the tip about the power supply. My UART converter wasn't supplying enough power. I can now see the AP on my lab power supply.
  • #12 21134847
    p.kaczmarek2
    Moderator Smart Home
    I'm good to hear that we have a progress. Do you have a 2MB backup? If you've done that before pairing with Tuya, please consider sharing it. If it was paired with Tuya already ,then don't share - better safe than sorry. Now it's time to see if we can configure OBK...
    Helpful post? Buy me a coffee.
  • #13 21134942
    Upright6771
    Level 4  
    Yes, I have a backup, but device was connected with tuya cloud.

    My first autoexec.bat looks like:

    // Start TuyaMCu driver
    startDriver TuyaMCU
    // set TuyaMCU baud rate
    tuyaMcu_setBaudRate 9600
    // set TuyaMCU default wifi state 0x04, which means "paired",
    // because some TuyaMCU MCUs will not report all data
    // unless they think they are connected to cloud
    tuyaMcu_defWiFiState 4
    
    // temp_current
    setChannelType 1 temperature
    setChannelLabel 1 "Current Temperature"
    linkTuyaMCUOutputToChannel 6 val 1
    
    // ph_current
    setChannelType 2 ReadOnly
    setChannelLabel 2 "Current pH"
    linkTuyaMCUOutputToChannel 106 0 2
    
    // tds_current
    setChannelType 3 ReadOnly
    setChannelLabel 3 "Current TDS"
    linkTuyaMCUOutputToChannel 111 0 3
    
    // orp_current
    setChannelType 4 ReadOnly
    setChannelLabel 4 "Current ORP"
    linkTuyaMCUOutputToChannel 131 0 4
    


    But the Result:

    Screen of the OpenBK_BA8200022 interface displaying channel data and configuration options.

    Questions:
    1) Why are all values = 0?
    2) Where is Temperature 0.0C (8) come from? <- solved by myself by define the Channeltype in the Config Tab
    In the Log Browser, I can see some things like this: Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04
  • #14 21134978
    Nordlicht77
    Level 9  
    It looks like this to me, but now the output doesn't exactly match the point in the display


    Code: Arduino
    Log in, to see the code
  • #15 21134987
    p.kaczmarek2
    Moderator Smart Home
    
    linkTuyaMCUOutputToChannel 106 0 2
    

    The 0 here (raw) does not look correct.

    Can you try adding quering the state to see if it updates the values? tuyaMcu_sendQueryState

    You don't need tmSensor on non-battery powered device I guess.
    Helpful post? Buy me a coffee.
  • #16 21134989
    divadiow
    Level 34  
    Upright6771 wrote:
    Yes, I have a backup, but device was connected with tuya cloud.


    you could always upload the config file though
    OpenBK_BK7231N_CB2S_USB_PLUG user interface with control options for the plug and USB ports.
  • ADVERTISEMENT
  • #17 21135004
    Nordlicht77
    Level 9  
    My data is here, it should be the same

    >>21124305
  • #18 21135009
    Upright6771
    Level 4  
    p.kaczmarek2 wrote:

    Can you try adding querying the state to see if it updates the values? tuyaMcu_sendQueryState

    I have - there is no update.

    Nordlicht77 wrote:
    My data is here, it should be the same
    >>21124305

    So you are no further ahead than me? ;-)
  • #19 21135019
    p.kaczmarek2
    Moderator Smart Home
    It looks like you need channel types for things like SALT, etc, but I personally, at the moment, don't even know what those units mean.

    Would you be able to provide the preferred Home Assistant classes for the mentioned channel types? I can add them for you even today, but I am not sure which HA classes I should use for them...
    Helpful post? Buy me a coffee.
  • #20 21135022
    Upright6771
    Level 4  
    I can do that, but something as simple as temperature doesn't work.

    Shouldn't that at least work?
  • #21 21135029
    Nordlicht77
    Level 9  
    Yes
    I think you also have the values ​​problem with the point and that
    Apparently PH TDS and other water data icons are missing in the firmware
    There will definitely be more different devices to come
    I wrote about it in my config as it currently is in Gui
    and underneath as it should be
    //currently : Temperature 389.0C (PH current)
    //correct: 3.89 PH (PH current)
  • #22 21135039
    Upright6771
    Level 4  
    Upright6771 wrote:
    p.kaczmarek2 wrote:

    Can you try adding quering the state to see if it updates the values? tuyaMcu_sendQueryState

    I have - there is no update.

    Here a small copy from my Log. Maybe it helps?

    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    Debug:TuyaMCU:SendNetworkStatus: sending status 0x3 to MCU 
    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    Debug:TuyaMCU:SendNetworkStatus: sending status 0x3 to MCU 
    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    Debug:TuyaMCU:SendNetworkStatus: sending status 0x3 to MCU 
    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    Debug:TuyaMCU:SendNetworkStatus: sending status 0x3 to MCU 
    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    Debug:TuyaMCU:SendNetworkStatus: sending status 0x3 to MCU 
    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    Debug:TuyaMCU:SendNetworkStatus: sending status 0x3 to MCU 
    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    Debug:TuyaMCU:SendNetworkStatus: sending status 0x3 to MCU 
    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    Debug:TuyaMCU:SendNetworkStatus: sending status 0x3 to MCU 
    Info:TuyaMCU:Received: 55 AA 03 2B 00 00 2D 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 43 (NetworkStatus) len 7
    Info:TuyaMCU:ProcessIncoming: (test for S09 calendar/IR device) received TUYA_CMD_NETWORK_STATUS 0x2B 
    Debug:TuyaMCU:SendNetworkStatus: sending status 0x3 to MCU 
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=51
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=51
    ExtraDebug:TuyaMCU:Will send TUYA_CMD_QUERY_STATE (state_updated==false, try 991).
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=51
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=52
    ExtraDebug:TuyaMCU:Will send TUYA_CMD_QUERY_STATE (state_updated==false, try 993).
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=52
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=52
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=53
    ExtraDebug:TuyaMCU:Will send TUYA_CMD_QUERY_STATE (state_updated==false, try 995).
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=53
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=54
    Info:TuyaMCU:Received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:ProcessIncoming[v=3]: cmd 0 (Hearbeat) len 8
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=54
    ExtraDebug:TuyaMCU:Will send TUYA_CMD_QUERY_STATE (state_updated==false, try 997).
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=54
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=55
    ExtraDebug:TuyaMCU:Will send TUYA_CMD_QUERY_STATE (state_updated==false, try 999).
    


    Hinzugefügt nach 2 [Stunden] 15 [Minuten]:

    New Update.

    I can set tuyaMcu_defWiFiState 4, but nothing happens (log say OK)

    BUT: After I configure my mqtt credentials, the CHannels will be filled with values.

    Now I have configured all Channels. Maybe it could help, that there are readOnly_div10, readOnly_div100, readOnly_div1000. After that we can finetune, to add new types for orp, salt and so on :-)
  • #23 21136053
    Nordlicht77
    Level 9  
    It would be nice if we could format the numbers.
    I also use openHAB
  • #24 21137789
    p.kaczmarek2
    Moderator Smart Home
    No problem, I can add more ReadOnly types, here they are:
    https://github.com/openshwprojects/OpenBK7231...mmit/22dec3702f57f164b85204b2ca7a2c73a4c6b4e9

    That being said, you don't even need channelTypes to connect dpID data to HA or other environment. You can just script publish commands manually and publish data under the whatever names you want.
    You can also do:
    
    publishFloat myXYZ $CH10*0.1
    
    Helpful post? Buy me a coffee.
  • #25 21137796
    Upright6771
    Level 4  
    Thank you,

    I will try. How can I upload this commit into my Firmware?
  • #26 21137820
    p.kaczmarek2
    Moderator Smart Home
    This is a public commit, so you can just do OTA to latest release:
    Screenshot of a GitHub repository showing file and release information.
    Helpful post? Buy me a coffee.
  • #27 21137829
    Upright6771
    Level 4  
    Oh, sorry. I could have seen that. I guess I was just too quick with writing...

    Looks good.

    Screen with pool data, including temperature, pH, ORP, and TDS.

    Tonight or tomorrow I will propose some native new data types (with suffix for MQTT so that the value arrives directly cleanly in Home Assistant)
  • #28 21138660
    Nordlicht77
    Level 9  
    Hello
    There is also a command that does round
    addRepeatingEvent 30 -1 publishFloat ph_aktuell $CH4/100
    Comes to me 7.400000
    it should be 7.40
  • #29 21138792
    p.kaczmarek2
    Moderator Smart Home
    I see, I've added an argument for publishFloat so you can specify number of decimal places:
    https://github.com/openshwprojects/OpenBK7231...mmit/e9a092fa5848ae13c5728e0d3e387cd881d750ef
    Your code should be now:
    
    publishFloat ph_aktuell $CH4/100 0 2
    

    0 stands for "bRemoveGET" and 2 is "2 decimal places" so it will be 7.40
    Helpful post? Buy me a coffee.
  • #30 21139852
    Nordlicht77
    Level 9  
    I no longer get any data via sendQueryState

    clearConfig didn't work either

    tuyaMcu_sendRSSI

    Info:CMD:[WebApp Cmd 'tuyaMcu_sendRSSI' Result] OK
    Info:MAIN:Time 474, idle 190057/s, free 73584, MQTT 0(29), bWifi 1, secondsWithNoPing 400, socks 2/38

    tuyaMcu_sendQueryState
    Info:CMD:[WebApp Cmd 'tuyaMcu_sendQueryState' Result] OK
    Info:MAIN:Time 703, idle 206017/s, free 73400, MQTT 1(41), bWifi 1, secondsWithNoPing 629, socks 2/38

    It could be that something is wrong here

    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 0, product_information_valid=0, self_processing_mode = 1, wifi_state_valid = 0, wifi_state_timer=0

Topic summary

The discussion revolves around changing the firmware on the PH-W218 WiFi 8-in-1 Water Quality Tester, which utilizes a CB3S chip. Users share their experiences with flashing the device, utilizing TuyaMCU for integration with Home Assistant, and troubleshooting issues related to communication and data output. Key steps include creating backups of the original firmware, configuring channel types for various sensors (like pH, TDS, and temperature), and ensuring proper connections between the WiFi module and the MCU. Users also address problems with data formatting and the need for specific commands to ensure accurate readings on the display and through MQTT. The conversation highlights the importance of correct baud rates and the potential need for hardware adjustments to achieve successful firmware updates.
Summary generated by the language model.
ADVERTISEMENT