logo elektroda
logo elektroda
X
logo elektroda

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

divadiow 2589 12
ADVERTISEMENT
  • #1 21003628
    divadiow
    Level 38  
    Posts: 4835
    Help: 420
    Rate: 852
    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!
    Attachments:
    • readResult_BK7231N_QIO_2024-13-3-16-02-21.bin (2 MB) You must be logged in to download this attachment.
    • VKL060_V1.3-EN.pdf (6.64 MB) You must be logged in to download this attachment.
    • vkl060_driver_c51.zip (5.77 KB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • #2 21003826
    divadiow
    Level 38  
    Posts: 4835
    Help: 420
    Rate: 852
    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.
  • ADVERTISEMENT
  • #3 21205194
    CodeFaux
    Level 2  
    Posts: 8
    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 38  
    Posts: 4835
    Help: 420
    Rate: 852
    thank you. I'd forgotten about this device. It's buried in a box with all the others.
  • ADVERTISEMENT
  • #5 21206228
    CodeFaux
    Level 2  
    Posts: 8
    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 38  
    Posts: 4835
    Help: 420
    Rate: 852
    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.
  • #7 21238019
    valentinviez
    Level 2  
    Posts: 3
    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 38  
    Posts: 4835
    Help: 420
    Rate: 852
    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.
  • #9 21238304
    valentinviez
    Level 2  
    Posts: 3
    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 38  
    Posts: 4835
    Help: 420
    Rate: 852
    I think I'd recommend a reflash and or RF restore
  • #11 21238532
    valentinviez
    Level 2  
    Posts: 3
    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 38  
    Posts: 4835
    Help: 420
    Rate: 852
    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  
    Posts: 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.
Generated by the language model.

FAQ

TL;DR: Battery range is 2200–3000 mV; "startdriver aht2x 7 8 2 3" enables temp/humidity. Add battery_setup 2200 3000 2.0 2400 4096 for correct voltage and percentage. [Elektroda, divadiow, post #21206241]

Why it matters: This FAQ helps OpenBeken users get the LKTMWL02/AHT20 sensor fully working, fix Wi‑Fi quirks, and calibrate battery on BK7231N boards.

Quick Facts

What hardware is inside this Wi‑Fi temperature and humidity sensor?

It uses a Tuya CBU module (BK7231N), an AHT20 temperature/humidity sensor on I2C, and a Vinka VKL060/VKL080 LCD driver. Power is 2×AAA. The factory firmware references min/max battery thresholds and sleep timing, but OpenBeken replaces that with your own configuration. The LCD sits on an I2C bus as well, separate from the AHT20 pins. [Elektroda, divadiow, post #21003628]

How do I enable AHT20 readings on OpenBeken?

Compile OpenBeken with ENABLE_DRIVER_AHT2X. Flash the RBL (OTA or UART). Add a startup command to launch the sensor. How‑To:
  1. Enable driver and build; flash artifact.
  2. In Startup Command, add: startdriver aht2x 7 8 2 3.
  3. Reboot and check channels 2 (temp) and 3 (humidity). “Use startdriver aht2x 7 8 2 3.” [Elektroda, CodeFaux, post #21205194]

What pin mapping/template should I use for this board?

Use a template with: P9 SoftSDA, P28 SoftSCL, P17 BAT_Relay, P23 BAT_ADC, P20 Button, P26 WifiLED_n. In the template’s command field, put: startdriver aht2x 7 8 2 3. This maps the AHT20 on SCL=7, SDA=8, with temperature on channel 2 and humidity on channel 3. Import the JSON template and save, then reboot. [Elektroda, CodeFaux, post #21205194]

How can I confirm the AHT20 is present on I2C?

Start the I2C driver and scan the software I2C bus. In the Web Console run: startDriver I2C followed by scanI2C Soft. An AHT20 typically responds at address 0x38. Seeing 0x38 confirms the sensor and your soft I2C wiring. If it does not respond, recheck SCL/SDA assignments and pulls. [Elektroda, divadiow, post #21003826]

What is the LCD controller’s I2C address on this device?

The VKL060 LCD controller appears at I2C address 0x3E when scanning the Soft I2C pins set for the display. Use SoftSDA on P9 and SoftSCL on P28 for the scan. This confirms the display sits on a separate I2C target from the AHT20. [Elektroda, divadiow, post #21003628]

Does OpenBeken support the VKL060/VKL080 LCD yet?

Upstream OpenBeken does not include a VKL060 driver. Expect a blank LCD under current builds. The AHT20 readings still work and publish. As one contributor noted, “the most we can achieve is an OpenBeken device with working AHT, on Wi‑Fi, but no display.” [Elektroda, divadiow, post #21238546]

How do I calibrate the battery measurement and percentage?

Enable the battery driver, then set thresholds and ADC parameters. Typical commands: startdriver battery and battery_setup 2200 3000 2.0 2400 4096. This models 2×AAA operation with min 2.2 V and max 3.0 V. After saving, verify that around 3.00 V the reported percentage approaches 100%. Adjust slope if your cells behave differently. [Elektroda, divadiow, post #21206241]

Why do I see “ADC Value low device not on battery” even with power applied?

That debug string can appear when your bench supply or wiring doesn’t meet the internal threshold logic. The driver still reports voltage and percentage correctly. Example: 2.76 V measured, driver showed 2738.8 mV and 82.6% despite the low‑value message. It’s a benign edge case while calibrating. [Elektroda, CodeFaux, post #21205194]

The AP shows but my phone can’t connect or gets no IP. How do I fix Wi‑Fi?

Restore the RF partition with Easy Flasher or flash back the entire factory firmware to reapply calibrated RF, then flash OpenBeken again. Also ensure your AP uses 2.4 GHz WPA2‑Personal (not WPA3 mixed). Several users resolved joining issues after RF restore or full factory reflash. [Elektroda, divadiow, post #21238177]

AP mode seems flaky. Can I configure Wi‑Fi another way?

Yes. Use the Easy Flash config setter to write SSID and password directly, then boot to your router. One user abandoned AP mode due to DHCP issues and configured over serial/tools instead, which proved stable once on the LAN. [Elektroda, divadiow, post #21003628]

How do I send sensor data to Home Assistant?

Enable MQTT in OpenBeken, set broker credentials, then publish channels. With startdriver aht2x 7 8 2 3, temperature is channel 2 and humidity is channel 3. Confirm messages with a test subscriber before adding to Home Assistant MQTT sensors. One tester noted the build “claims to be reporting via MQTT.” [Elektroda, CodeFaux, post #21205194]

Is GPIO16 actually used on this board?

GPIO16 appears unconnected on some samples. The button is on P20 and the battery ADC is on P23. You can leave P16 unassigned if it does nothing in your unit. Traces observed suggest P22 exists but may be unused in the shipped design. [Elektroda, divadiow, post #21206241]

What are the Tuya identifiers for the stock firmware?

Product key pvw2gbuqkfufedmz with schemaId edcm1k. Data points include temperature (ID 1), humidity (ID 2), battery percentage (ID 4), and settings like temp_unit (101), sync_mode (102), sample_period (103), and thresholds (104–105). These aid reverse engineering and mapping. [Elektroda, divadiow, post #21003628]

How often does the stock firmware sample or sleep?

The Tuya schema exposes sample_period options from 1 to 15 minutes. The factory boot log shows a sleep timer of 900 seconds (15 minutes). When moving to OpenBeken, you can control reporting through driver timing and your MQTT setup. This statistic helps tune battery life. [Elektroda, divadiow, post #21003628]

Is there a ready-to-flash OpenBeken build with AHT2X enabled?

Yes. A contributor compiled builds with AHT2X enabled (and some drivers disabled) and shared GitHub Actions Artifacts in their post. You can download that artifact or fork and build with ENABLE_DRIVER_AHT2X, then OTA flash the RBL. Verify channels 2 and 3 afterward. [Elektroda, CodeFaux, post #21205194]
Generated by the language model.
ADVERTISEMENT