logo elektroda
logo elektroda
X
logo elektroda

Investigating a battery-powered temperature & humidity sensor with I2C LCD - CBU/AHT20/VKL060

divadiow 1506 12
ADVERTISEMENT
  • #1 21003628
    divadiow
    Level 34  
    Grabbed this from Ali as it's not one I've seen on the forums or played with myself. Comes in Zigbee and Wifi flavours.

    View of Tuya Smart WiFi/Zigbee thermometer and hygrometer with LCD display.

    As with the TH01s and the door sensors this takes 2x AAA batteries so some considered deep-sleep power management settings will be needed or the batteries will die within a day or two. Especially so considering there is no TuyaMCU.

    The packaging contains only the device, a double-sided 3M spot sticker and a reset pin for the push button hole, situated under the battery cover. No manual or protective device sheath.

    Digital temperature and humidity meter with LCD display. Interior view of a device with two AAA Duracell batteries. Package with temperature and humidity sensor and accessories Packaging of temperature and humidity sensor with accessories Packaging of temperature and humidity sensor with accessories Device addition screen showing a temperature and humidity sensor being added. Software update screen showing no updates available App screen showing temperature 21.0°C and humidity 66%. App interface showing temperature and humidity sensor data

    That factory firmware version is not suitable for Cloudcutter exploitation. LED behaviour is flashing when in pairing mode then off.

    Inside the device we see a CBU (BK7231N) module with RF shield (which I later removed), an AHT20 - an i2c temperature and hygrometer sensor, an LCD display (not sure of resolution) and a Vinka Microelectronics VKL080. VKL060 is a dot-matrix memory-mapped LCD driver that can support an LCD screen with a maximum of 60 points (15SEGx4COM).

    I emailed Vinka about this as their site only lists a VKL060, Googling VKL080 produces no results of meaning. I was impressed with the prompt response. I never usually get one.

    Screenshot of an email regarding VKL060 chip identification.

    Datasheet and driver attached though they are available from their site.

    Inside the device:
    Close-up of Vinka VKL060 chip on a PCB Electronic module labeled LKTMWL02 with components including battery slots. LKTML02 sensor circuit board with BK7231N Wi-Fi module Circuit board with LCD display and electronic components Electronic board with LCD display and SMD components. Vinka VKL080 chip on a circuit board. Close-up of the CBU module with visible markings and serial number on the LKTMWL02 board. Close-up of AHT20 chip on a circuit board. Close-up of an electronic board with an LCD display Close-up of PCB model LKTMWL02 with visible components and markings.

    I soldered pwr/gnd and used pogo pins on the RX2/TX2 to capture factory boot log

    Code: JSON
    Log in, to see the code


    Interesting it mentions BK7231NL. It also does some of the work on pin assignments for us, which we'll need later
    Code: Text
    Log in, to see the code


    Easy Flasher had trouble setting a baud reliably to dump flash so I soldered RX1/TX1 and shortened cables direct to USB-TTL
    Close-up of solder connections on a PCB with an electronic module visible.
    Close-up of an electronic circuit with wires connected to a PCB, on a wooden work surface.

    Factory fw attached. This firmware appears to be custom so no GPIO extraction was successful

    Code: Text
    Log in, to see the code


    Code: JSON
    Log in, to see the code


    Full Tuya API response for this device
    Code: JSON
    Log in, to see the code


    After flashing OBK the AP was oddly behaved. It would appear but my phone and PC could sometimes not connect or it would connect but not receive an IP from DHCP on the device. Once or twice it did let me bring up the web console but then died. I flashed it a few times and restored RF partition too. Back to factory firmware then to OBK again to fix mac address. I decided to forget AP mode and use the Easy Flash config setter. It's been fine connected to the router, so :shrug:

    Flashing software interface for Tuya devices with writing error

    We know some pins from the boot log and that BAT_ADC must be P23

    Code: Text
    Log in, to see the code


    I tested the Btn and LED were correct. Not sure how or what dInput should be used for.

    I looked through devicelist.json for a similar config that could be used to complete BAT_REL, AHT20 SCK, AHT20 SDA. The template for this device covered all the above known pins

    "Generic Temperature and Humidity Sensor Battery Powered SHT30"
    https://www.elektroda.com/rtvforum/topic3945688.html

    Image of the interior of a battery-powered temperature and humidity sensor, models BK7231N and CBU, showing electronic components.

    Using that template produces this in the gui

    OpenBK user interface displaying temperature, humidity, battery level, and voltage data.

    Yes, while on external PSU, the battery level is correct, but I'm feeding it 3.35v not 3.85. The temp/hum is clearly wrong. This of course assumes the SHT3X driver is correct for the AHT20. I'm not sure OBK has a working driver for the AHT20 though or if the pins are just wrong at the moment. We could do with having a list of supported chips alongside the driver list here https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/drivers.md - for example, CHT8305 now supports CHT8310 too. Unfortunately I cannot get multimeter probes under the AHT20 to be able to trace SDA/SCL to the CBU.

    I have however traced the pins for the VKL060 :D. Here's what we know for certain so far
    Pin diagram of CBU module with labels.

    though I have no way of using the display at present. The LCD is currently blank with OBK, as one would expect. I recall seeing something about SoftSDA and SoftaSCL in another post, so gave that a go on the pins for the LCD controller. With these set:

    Code: Text
    Log in, to see the code


    and after running:

    Code: Text
    Log in, to see the code


    we get a result:

    Code: Text
    Log in, to see the code


    But I'm yet sure what happens from here. I guess the driver needs sorting?

    So, I think I've come to a pause before I investigate further. For now, an OBK template work-in-progress with known and unknown pins is

    Code: JSON
    Log in, to see the code


    please post your thoughts/suggestions on any of the above!
  • ADVERTISEMENT
  • #2 21003826
    divadiow
    Level 34  
    actually. switching the SHT3X pins assigned to SoftSDA/CLK produces this on scan, so I guess maybe those pins are right

    Code: Text
    Log in, to see the code


    and only P17 set as BAT_RELAY gives any readings for voltage and battery level, so I guess that's right, just needs calibrating down.

    so now:
    GPIO pin diagram for LKTMWL02 with function labels.
  • #3 21205194
    CodeFaux
    Level 2  
    You were correct in identifying the part, and the template was correct, aside from assigning the wrong driver, which is understandable.

    This device uses AHT2X driver -- not compiled by default. Edit
    src/obk_config.h
    and uncomment
    #define ENABLE_DRIVER_AHT2X 1


    Once compiled, flash the rbl via OTA.

    The driver cannot be configured in the WebUI Pin section.

    The driver must be started via command, which must be added via Startup Command, or autoexec.bat

    Format is
    startDriver aht2x <scl> <sda> <temp_channel> <humidity_channel>


    Once running a binary which includes the driver (note: I've included a link to my own compiled artifact below) you can import this template;
    
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Temperature and Humidity Sensor Wi-Fi",
      "model": "unknown",
      "chip": "BK7231N",
      "board": "LKTMWL02-1.0",
      "flags": "0",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "9": "SoftSDA;0",
        "16": "dInput;8",
        "17": "BAT_Relay;5",
        "20": "Btn;6",
        "23": "BAT_ADC;4",
        "26": "WifiLED_n;0",
        "28": "SoftSCL;0"
      },
      "command": "startdriver aht2x 7 8 2 3",
      "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic4052685.html"
    }
    


    It assigns temperature to channel 2 and humidity to channel 3. I don't know what I'm doing yet so I'm not sure if that's wise or correct, but it looks like it works to me.

    I'm still learning how to do all this, but I've cloned the repo and applied the required changes; binaries can be downloaded from the Artifacts at my repo the same way they can from the Build System. I've turned off TuyaMCU, Wemu, and Hue drivers and enabled AHT2X. It is my test/learning repo so it'll be messy; this is my first unsupported OpenBEKEN device so I'm just now learning how it works inside.

    It shows temperature and humidity in the web interface, claims to be reporting via MQTT -- I haven't tested it further.

    Does anyone reading this know about displays in OpenBeken? Is there a chance it can be enabled and used without a driver, ie, poked and tested via commands? I bought four of the stupid things thinking they were Zigbee and I refuse to ship them back to China. I've got free time so I'm willing to give it a poke.


    EDIT: Battery calibration works, but the firmware seems to be confused somehow?


    startdriver battery
    battery_setup 1500 3000 1.95 2400 4096


    Info:DRV:DRV_BATTERY : Measure Battery volt en perc
    Info:DRV:DRV_BATTERY : ADC Value low device not on battery
    Info:DRV:DRV_BATTERY : battery voltage : 2738.759765 and percentage 82.583984%


    "Battery" is my bench supply, hooked up and feeding a measured 2.76v so I could take a swing at calibrating it. I'm not sure why it says the value is low, why it thinks that means it's not on battery, what the "en perc" means, but it's reading the right value and calculating a valid percentage, so I'm not sure how to correct this one.
  • ADVERTISEMENT
  • #4 21205220
    divadiow
    Level 34  
    thank you. I'd forgotten about this device. It's buried in a box with all the others.
  • #5 21206228
    CodeFaux
    Level 2  
    lol -- you did most of the work for me. Thank you. Solely due to your work, my mistake of ordering FOUR of the wrong thing from -overseas- can be mitigated.

    I've got almost no experience with OpenBEKEN, so approaching this from zero wasn't something I was willing to deal with, but finding that someone got both the pins mapped and devices identified was huge for me. I spent literally 20+ years doing consumer electronics repair; it's not beyond me, it's just more effort than I was willing to spend on these damn things. I seriously didn't expect to find anyone else talking about them, largely because "How the heck do you talk about a thing which does not identify itself meaningfully?"

    But, glad to hear they're still around for you and our effort can produce shared results. I'm still gonna poke at it, maybe even see if I can produce a driver for the display. Since I know the pinout, and have this ridiculously handy datasheet, --and-- basic driver source from the efforts of some kind soul, it should be within my grasp.

    I'll let you know if it turns out to be within my attention span, lol. Feedback always helps.
  • #6 21206241
    divadiow
    Level 34  
    that's cool. I have since learnt to enable a driver or two, but hadn't even considered going back to try this device. might dig it out to see it in action.

    yes, the VKL driver was where it was left hanging.

    Added after 50 [minutes]:

    untouched since

    Investigating a battery-powered temperature & humidity sensor with I2C LCD - CBU/AHT20/VKL060

    and now
    Investigating a battery-powered temperature & humidity sensor with I2C LCD - CBU/AHT20/VKL060

    with autoexec

    Code: Text
    Log in, to see the code


    taking battery_setup 2200 3000 from the info in the boot output

    Code: Text
    Log in, to see the code


    Added after 5 [minutes]:

    Code: Text
    Log in, to see the code


    Investigating a battery-powered temperature & humidity sensor with I2C LCD - CBU/AHT20/VKL060

    Added after 2 [minutes]:

    Code: Text
    Log in, to see the code


    Added after 34 [minutes]:

    I'm not convinced basic_pin_pin:16 goes anywhere making "16": "dInput pointless.

    We know that the button is 20 and ADC is 23 and there are only 3 traces coming from the underside of the CBU where P16 is. So it seems the traces would have to be P20, P22 and P23/ADC. No P16. Assuming the trace would be directly under the pad, none line up with P16 anyway.

    Investigating a battery-powered temperature & humidity sensor with I2C LCD - CBU/AHT20/VKL060

    Makes you wonder what P22 is/would have been for though.
  • ADVERTISEMENT
  • #7 21238019
    valentinviez
    Level 2  
    Hello,
    I am very interested in your project, I have the same thermometers.
    So, I tried to use the firmware you generated above.
    Once the download is finished, the screen turns on and the temperature is correct! (Great)
    However, the sensor never connects to the Wi-Fi, so I cannot configure it.
    I tested with a 2.4GHz network but it's impossible, it refuses to connect to the Wi-Fi.
    Can you help me?

    I am a beginner and stuck :(
  • #8 21238177
    divadiow
    Level 34  
    and to carry on/confirm from DM suggestion: is your AP WPA2/WPA3 or WPA/WPA2?

    I have had it before that something gets messed up with the RF and although it broadcasts, nothing can connect to it. You could try the "Restore RF" in Easy Flasher, but I do prefer flashing back the entire factory firmware from 0x0, so you get the calibrated RF - as it came from factory - then start again flashing to OBK.
  • ADVERTISEMENT
  • #9 21238304
    valentinviez
    Level 2  
    I'm in WPA2-Personal, I use an access point NETGEAR WAX214v2

    Added after 13 [minutes]:

    I just tried with an open Wi-Fi network, and the RF stack reinitializes, but it still doesn't work.
  • #10 21238340
    divadiow
    Level 34  
    I think I'd recommend a reflash and or RF restore
  • #11 21238532
    valentinviez
    Level 2  
    I’ve tried several times, but it doesn't change anything 😔. The only thing that works is flashing the latest OpenBK firmware. However, this firmware doesn't make the thermometer work, and the screen doesn't turn on 😔, and I don't know how to flash this firmware with the VKL060 library 🥲.
  • #12 21238546
    divadiow
    Level 34  
    hmm. I think I'm a little confused about which OBK firmware you're flashing in which the wifi *doesn't* work but you're expecting the AHT driver to be present. Which is this?

    Yes, the latest OBK builds will need AHT2X driver enabling and there is no VKL060 driver, so the most we can achieve at the moment is an OpenBeken device with working AHT, on wifi, but no display.
  • #13 21449292
    mikewindlake
    Level 1  
    I bought a few of these but found they keep dropping off the network with the out of the factory firmware. I'd like to reflash them to something that will work with Home Assistant. Is there a package to download or basic instructions?

Topic summary

The discussion centers on a battery-powered temperature and humidity sensor device available in Zigbee and Wi-Fi versions, using 2x AAA batteries and lacking TuyaMCU, necessitating careful deep-sleep power management to extend battery life. The sensor employs the AHT20 (AHT2X) temperature and humidity sensor IC, interfaced via I2C at address 0x38, with pins mapped to SoftSDA and SoftSCL. The device includes a VKL060 I2C LCD display, but no dedicated driver for the display is currently available in OpenBeken firmware. Enabling the AHT2X driver requires modifying the OpenBeken source (uncommenting ENABLE_DRIVER_AHT2X in src/obk_config.h) and starting the driver via startup commands specifying pin assignments and sensor channels. Calibration commands (e.g., AHT2X_Calibrate) and battery driver setup are also necessary for accurate readings. Users report challenges with Wi-Fi connectivity, particularly with WPA2/WPA3 networks, and recommend reflashing factory firmware or performing RF restores to resolve connection issues. The latest OpenBeken firmware supports the sensor but lacks VKL060 display support, resulting in functional temperature readings without display output. The device is identified as using a BK7231N chip on an LKTMWL02-1.0 board. Community efforts focus on driver development, pin mapping, and firmware customization to enable integration with platforms like Home Assistant, as factory firmware is prone to network dropouts.
Summary generated by the language model.
ADVERTISEMENT