Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot seem to get it to work on version B1.9 #125

Closed
bbosilje opened this issue Sep 28, 2021 · 137 comments
Closed

Cannot seem to get it to work on version B1.9 #125

bbosilje opened this issue Sep 28, 2021 · 137 comments

Comments

@bbosilje
Copy link

bbosilje commented Sep 28, 2021

When I try to flash it with the latest firmware in the repo, the display remains "frozen" with the last values it displayed with the stock firmware.

When I flash back to the original firmware on the web page, the display comes back with all the segments lit up (ie: 1888.8 E, 88 %, Bluetooth icon, battery icon and full face).

Screen Shot 2021-09-28 at 13 56 41

I am still able to communicate with the device through the flashing webpage, but nothing I do seems to change the display.

Am I doing something wrong or does this revision of the unit (B1.9) not work with the existing firmwares in this repo?

@Toaster232
Copy link

I have the same problem with 2 unit's. Both have CMIIT ID: 2019DP8115 (On the back of the carton box)
After installing de original software back on the unit. The display shows 88% and LOW battery icon and says the temp is 27c when looking at the ESPHome log.

@vanMacG
Copy link

vanMacG commented Sep 29, 2021

My first thermometer works fine, so I ordered some more. With he new ones I have the same problem. After flashing a custom firmware (31, 32n, 32z) the display freezes. When putting the battery out and back in the display stays empty. But I'm able to connect with the webupdater. After flashing the original firmware back, the display is like the picture in first post.

Here are pictures of the packaging and the PCB:
IMG_20210929_170646
IMG_20210929_170702
IMG_20210929_170729

@vanMacG
Copy link

vanMacG commented Sep 30, 2021

Besides the display problem, the measurement also doesn't work. After sucessfully connecting with the webupdater, at the top of the page, it says: "Temp/Humi: waiting notify for data after connecting".
When using GraphMemo after some time: "load 0 samples."

Maybe @atc1441 knows the new ones and can help...?

@dvonessen
Copy link

I also have a similar problem. Except, using the original FW doesn't bring back the LCD.
Is there someone helping with this problem?

Regards

@vanMacG vanMacG mentioned this issue Oct 5, 2021
@atc1441
Copy link

atc1441 commented Oct 5, 2021

Comparing the old and new pcb we can see they use a new lcd controller ic.

So that means we need to adapt the display communication

https://img.mysku.me/uploads/pictures/05/59/35/2020/02/19/30f83a.jpg

@vanMacG
Copy link

vanMacG commented Oct 5, 2021

Would better images of the chip help, so you can read the printing?

And besides the display, the measurement seems also broken...

@atc1441
Copy link

atc1441 commented Oct 5, 2021

Pictures would help to, mostly these chinese chips are not known/without datasheet but we can try

@vanMacG
Copy link

vanMacG commented Oct 5, 2021

20211005_160546
I'm sorry for the image quality, I only have smartphone/tablet camera. I checked with a magnifying glass:
MCBSLM01
V5K000EG3

@Reimund-Koenig
Copy link

Hello everybody,

there is a funny Information: Package of mine showed same date "2021.08" (see 3rd picture) but when I opened up my case, I realized that I have HW-B1.6 (2021-03) and not HW-B1.9 (2021-05).
They change their HW very fast. Chip on the first picture has no description at all :-(
TeLink chip on the 2nd picture is at least the same.
3rd Picture shows the package.

Question: Should I re-open #130 because it is a different HW? Or do we manage it in one issue, because the HW behaves the same?

IMG (1c)
IMG (1b)
IMG (1d)

@Reimund-Koenig
Copy link

Reimund-Koenig commented Oct 7, 2021

Good morning,

I at least found a way to recover the Mi-Thermometer (screen and sensors).

  • Connect though it with pvvx TelinkMiFlasher
  • Click Original-FW
  • Click Flash to Device
  • Go to the Xiaomi Home App
  • Connect your device (still possible)
  • Go to Settings and select "Firmware Update"
  • Done --> You can use your device again :)

Cheers Reimund

@atc1441
Copy link

atc1441 commented Oct 7, 2021

So that means they made a detection for what display controller they got in a device with just one firmware.

This is good as we can see how they detect it and copy it, as in the first model there was no way to read from the display controller just writing.

Can you maybe dump the firmware update file link? You need to be rooted if i remember correctly

@atc1441
Copy link

atc1441 commented Oct 7, 2021

Took a while to get it but here we go

Changed the MiHome plugin so it will alert with the firmware URL 😁

Screenshot_20211007-101413_Mi Home

New firmware attached as reference
LYWSD03MMC_0130_upd_miaomiaoce.sensor_ht.t2.zip

@atc1441
Copy link

atc1441 commented Oct 7, 2021

Update and downgrade from an to 0130 works fine. So can be developed with now and reversed further

@vanMacG
Copy link

vanMacG commented Oct 8, 2021

Sounds great. Unbricking the device with webupdater and the zip you provided here worked.
If you need testers, let us know ;)

@H4R0
Copy link

H4R0 commented Oct 10, 2021

I got mixed batches where you order for example 4 sensors at once.

Half of them got bricked and I was able to unbrick them with the given stock firmware.

Note that for me not only display was not working but also temperature reports.

BLE communication was the only thing that still worked.

@pvvx
Copy link
Owner

pvvx commented Oct 10, 2021

So that means they made a detection for what display controller they got in a device with just one firmware.

Display controller on I2C:
image

PS: I don't have new versions of devices yet :(

@DeBuXer
Copy link

DeBuXer commented Oct 11, 2021

Note that for me not only display was not working but also temperature reports.

BLE communication was the only thing that still worked.

Same issue here, only in my case it is also not possible to receive the settings from the device like explained here.

I got 6 of these new devices. So if I need to test something, let me know! :)

@vanMacG
Copy link

vanMacG commented Oct 11, 2021

PS: I don't have new versions of devices yet :(

Do you need the vendor where I bought mine? V1.9. (German ebay, but shipping took 1 week...)

@mariuszkorba
Copy link

Thanks for all this info - it helped me reviving my two devices (both CMIIT id: 2019DP8115).

For what's worth, @atc1441 custom firmware (#125 (comment)) worked for me, so it did the method @Reimund-Koenig described (#125 (comment))

Both sensors are now working happily with my Homes Assistant, though sadly using Xiaomi firmware and the Mi bind codes.

@atc1441 if you decide to update your .bin to work with these new devices, also count me in for any testing you might need 😄

@atc1441
Copy link

atc1441 commented Oct 12, 2021

Need to get my hands on one of the newer devices or best on both of them.

Then its quite simple to add them.

Will order some.

Just got a donation from O. So its only fair to invest that money back into it :)

@atc1441
Copy link

atc1441 commented Oct 12, 2021

Any best links for odering from germany ?

@mariuszkorba
Copy link

Nice one; how can I chip in as well?
BTW. Great work, you and @pvvx 💪

I got mine devices from here: https://www.aliexpress.com/item/4000427410383.html, and they arrived, albeit to the UK, reasonably quickly.

Good luck with getting yours soon.

@vanMacG
Copy link

vanMacG commented Oct 12, 2021

Any best links for odering from germany ?

I ordered mine here on ebay and got V1.9. But shipping takes a week...

@atc1441
Copy link

atc1441 commented Oct 12, 2021

@vanMacG ordered one there because of speed.

@mariuszkorba thanks as well
A link is in my Repo https://github.com/atc1441/ATC_MiThermometer

Maybe someone can send me one as well?
As there are two new versions and not known what some will get

@DryTaste
Copy link

DryTaste commented Oct 12, 2021

@atc1441 I can send you a B1.6 one if needed.

@rbarreiros
Copy link

rbarreiros commented Oct 12, 2021

Got exactly the same problem, got the MCBSLM01 lcd controller, and the latest xiaomi firmware from @atc1441 doesn't work for me. I got 4 new ones, only did this to one of them, got other 3 running original firmware, is it possible to read the flash and dump the bin ?

Managed finally to connect to xiaomi home, added and downloaded latest firmware, it downloads a 0130 version also (same as @atc1441) but works, I suspect it may have been a problem flashing the firmware.....

@MrTheoW
Copy link

MrTheoW commented Oct 12, 2021

@atc1441 I got two spares laying here. Other two in this 4-pack are already in use without any hiccups.
Will check the versions and contact you if it are the newer versions. Shouldn't take too long from the Netherlands to get it to you.
Btw... You guys are awesome! Thanks for sharing this with us and for all the effort you guys are putting into it.
🙏

@aptalca
Copy link

aptalca commented Oct 25, 2021

Thanks for the new firmware. I flashed both a 1.6 and a 1.9 successfully. Strangely, the 4 pack I ordered from aliexpress contained 2 1.6s and 2 1.9s :-)

@atc1441
Copy link

atc1441 commented Oct 25, 2021

Ok finally added the persistent storage function to my firmware.
It took some time to get it working as intended but now its all as it should.

The settings can be saved with the new button in my TelinkFlasher.html

Will now be quiet on off topics wanted to get this one at least known.

@jeffeb3 Fair enough on that :)

@pvvx
Copy link
Owner

pvvx commented Oct 25, 2021

The test version 3.3 includes support for B1.6 and B 1.9 with autodetection. I can’t test it yet.

PS: I don't have new versions of devices yet. All ordered from different local stores came with the old version - B1.4.
Dozens of these thermometers have accumulated - I will soon throw them in the trash ...
Ordered again from other suppliers ...

@pvvx
Copy link
Owner

pvvx commented Oct 25, 2021

I bet he will update his firmware in some days to support 1.6 and 1.9 as well

Such code for B1.6 with UART
https://github.com/atc1441/ATC_MiThermometer/blob/master/ATC_Thermometer/lcd.c#L77
will consume a lot of power.
13 bytes * 10 bits / 38400 baud = 0.0033854 sec = 3.4 ms power more than 4 mA...

Sensor SHT4x - 6.9..8.2 ms power > 4 mA.
https://github.com/atc1441/ATC_MiThermometer/blob/master/ATC_Thermometer/sensor.c#L67

@TimeTravel-0
Copy link

I bet he will update his firmware in some days to support 1.6 and 1.9 as well

Such code for B1.6 with UART https://github.com/atc1441/ATC_MiThermometer/blob/master/ATC_Thermometer/lcd.c#L77 will consume a lot of power. 13 bytes * 10 bits / 38400 baud = 0.0033854 sec = 3.4 ms power more than 4 mA...

Sensor SHT4x - 6.9..8.2 ms power > 4 mA. https://github.com/atc1441/ATC_MiThermometer/blob/master/ATC_Thermometer/sensor.c#L67

I assume the issue is with the sleep() function running delay loops internally.

Regarding UART, is it possible to switch to uart_dma_send() ? http://wiki.telink-semi.cn/tools_and_sdk/Driver/doc/kite/html/md__project_1__table_of__content_17__t_s_i__u_a_r_t__features.html

Regarding sensor readout delay: What about removal of the delay and just read out prior to every "run measurement" command (adds readout delay of the measurement interval, but temp&hum rarely change fast enough).

@atc1441
Copy link

atc1441 commented Oct 25, 2021

@pvvx
Average current with my custom firmware on:
B1.4 is 15uA
B1.6 is 20uA

Average current with your custom firmware on:
B1.4 is 14uA
B1.6 is 16uA

Average only deep sleep area is:
B1.4 is 5.62uA
B1.6 is 7.93uA

So the overal DeepSleep is higher on the B1.6 version as well

@TimeTravel-0 will implement the "read previous measurement" just now to test it.
EDIT: Seems to work fine while it does not really decrease the current consumption, will push that version still

Switching to DMA uart is possible and what Victor is using in his version

@pvvx
Copy link
Owner

pvvx commented Oct 25, 2021

Corrected B1.6 - there was an error in the transmit buffer for UART-LCD ...

So the overal DeepSleep is higher on the B1.6 version as well

UART-GPIO not disabled, UART-CLKdiv?

Regarding UART, is it possible to switch to uart_dma_send() ? http://wiki.telink-semi.cn/tools_and_sdk/Driver/doc/kite/html/md__project_1__table_of__content_17__t_s_i__u_a_r_t__features.html

DMA + pm_wait_us
https://github.com/pvvx/ATC_MiThermometer/blob/master/src/lcd.c#L91
image

B1.6 correct UART pm_wait_us 3.35 ms
image
(test on TB-03F-KIT AI-Thinker development board)

@redam
Copy link

redam commented Oct 26, 2021

The test version 3.3 includes support for B1.6 and B 1.9 with autodetection. I can’t test it yet.

PS: I don't have new versions of devices yet. All ordered from different local stores came with the old version - B1.4. ...

Your 3.3 test version does work perfectly on my device, I don't know if it is B1.6 or B1.9 but previous version would make the screen freeze, then blank if removing/reinserting battery and no data was sent to esphome. Thank you for the support, it now works great on 3.3 :)

@jeffeb3
Copy link

jeffeb3 commented Oct 26, 2021

@pvvx,

I installed 3.3 on a B1.9 and I get a blank screen. The BT communication seems ok. So does the measurement.

Screenshot_20211026-093442

I had a little trouble flashing from the atc1441 version, so I downgraded to an old bin I had in my downloads before the pvvx flasher would connect.

@jeffeb3
Copy link

jeffeb3 commented Oct 26, 2021

Interestingly, if I go from pvvx/ATC_thermometer33.bin to atc1441/ATC_thermometer.bin (I think version 54, but whatever version was working before), the screen is still blank...

Going back to the stock 0130 works fine. But then back to v3.3 blanks the screen again. Let me know what else I can test.

@pvvx
Copy link
Owner

pvvx commented Oct 26, 2021

Going back to the stock 0130 works fine. But then back to v3.3 blanks the screen again. Let me know what else I can test.

It is necessary to read the complete logs of the interface initialization and the operation itself with the LСD controller microcircuit.

Several orders with aliexpress are still in the process of delivery. All orders from local shops with fast delivery came with the old version B 1.4 ...

@atc1441
Copy link

atc1441 commented Oct 26, 2021

@pvvx this is the full I2C communication of B1.9 sniffed by byte patching the firmware into thinking to have B1.9 hardware but being B1.6

I2C Writing B1.9:

Address = 3E then data in HEX

3E EA

250us wait

3e A4
3e 9c
3e ac
3e bc
3e f0
3e fc

3e 00 00 00 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00

3e c8

Write data to display later 2 examples:

3e 04 db 6d 00 00 a5 a8 00 00 7d cb
3e 04 db ef 00 00 a5 e4 00 00 7f cb

@jeffeb3
Copy link

jeffeb3 commented Oct 26, 2021

I have a spare one I was going to ship to Aaron, but it was estimating $40 and 6-10 days to get to Germany (I live in CO, USA). I'm not sure Russia would be much better. At that price/time, we decided it would be more worthwhile to test here remotely instead of shipping one.

The atc1441 version worked fine from the stock firmware. The weird thing was that it didn't coming from pvvx/v3.3. Is there some way to clear or initialize the eeprom?

@pvvx
Copy link
Owner

pvvx commented Oct 26, 2021

I have a spare one I was going to ship to Aaron, but it was estimating $40 and 6-10 days to get to Germany (I live in CO, USA). I'm not sure Russia would be much better. At that price/time, we decided it would be more worthwhile to test here remotely instead of shipping one.

Since the beginning of summer, I have been resting far from the city and delivery here is rather difficult :)
The price is not important. It is important for delivery and availability at hand for full debugging and optimization of consumption.
I hope that orders from aliexpress will be faster than delivery from other countries ... I ordered it a long time ago. And then again the lottery - new or old versions will come :)

Is there a way to clear or initialize the EEPROM?

Hardware only - programming via SWS pin (USBCOMFlashTx.html - Erase All Flash). When the firmware is started, the EEPROM is checked for compatibility of the save with the old versions. Version 3.3 maintains compatibility with version 0.9.
Simple EEPROM cleaning does not provide for pincode protection purposes. All critical parameters and entries for newer versions from the EEPROM are checked and corrected.

PS: Update for B1.9 v3.3test2...

@BasicCPPDev
Copy link

B1.9 v3.3test2.bin fixed blank screen for me.

@jeffeb3
Copy link

jeffeb3 commented Oct 26, 2021

ATC_B19V33t2.bin fixes the screen. It looks like it is working properly. 🎉

@bbosilje
Copy link
Author

bbosilje commented Nov 3, 2021

My issue with applying the alternate firmware to the versions I have is resolved. I am going to close the issue.

Thank you all!

@bbosilje bbosilje closed this as completed Nov 3, 2021
@pvvx
Copy link
Owner

pvvx commented Nov 6, 2021

I got it with aliexpress B1.9. Date on the package: 2021.09.
One of these days I will do software optimization and consumption tests.

@pvvx
Copy link
Owner

pvvx commented Nov 6, 2021

@pvvx Average current with my custom firmware on: B1.4 is 15uA B1.6 is 20uA
Average current with your custom firmware on: B1.4 is 14uA B1.6 is 16uA
Average only deep sleep area is: B1.4 is 5.62uA B1.6 is 7.93uA

Average current with origial firmware v130 on B1.9 - 18..20 uA.
Extended ADV test periods, without measurement transfer unit - 19.2 μA
OriginalPower -> Main loop in Advertising mode (B1.9)

image
Average current with custom firmware v3.3 on B1.9 - 14..15 μA
Extended ADV test periods - 14.7 μA (default settings)
image

@pvvx
Copy link
Owner

pvvx commented Nov 6, 2021

@TimeTravel-0

Regarding sensor readout delay: What about removal of the delay and just read out prior to every "run measurement" command (adds readout delay of the measurement interval, but temp&hum rarely change fast enough).

For SHV4 sensor in next version sw, if the parameters are set: The sensor is in "low power mode", then the last measurement is read in the next advertising cycle. Those. without waiting for the readiness of the measurement...
image
Reduces average consumption not significantly: 14.7 -> 14.5 μA

@jddonovan
Copy link

jddonovan commented Nov 17, 2021

I suppose this is the best place to add a little info about the SHTV3 vs SHTV4 sensors. Few thoughts on the attached graph (green = SHTV3, yellow = SHTV4):

  • Raw values (as attached) suggest that the new sensor is slower to react, but only marginally.
  • The clearly visible differences in values seem to be from some sort of internal averaging that uses averaging and hysterisis heavily (compared to previous version). Doesn't go up quite as fast, but reacts instantly when actual temperature turns around
  • Much less noise, maybe part due to internal averaging/hysterisis, probably a better physical sensor too.

The graph values are RAW values from sensor. However, I use my own code for smoothing temperature that employs hysterisis, not averaging. Ie. if temperature is changing in the same direction, apply value. If delta-T (change in temperature) has opposite sign, ignore the value unless difference is bigger than T (assumption that the latest value is just noise).

When applying my code on the raw output of the sensors, differences between V3 and V4 dissappear almost completely (better than just mean average). V4 obviously still lagging, but only during large temperature differences. That suggest that the V4 has additional hysterisis post-processing compared to V3 and that the physical sensor membrane might have a larger thermal mass, or it is otherwise slower to respond than V3. The temperature peak differences, however, remain quite large over a surprising long period of time (~15mins), so the use of some long term average cannot be discounted. It is definitely hard to argue that it's due to thermal mass alone. It simply doesn't make sense for lagging such a long period.

No calibration done and both sensors give same values (within 0.01 degrees). I calculate LQI (255/255 of the advertisements received) and packet loss (% of lost all 4x advertisements for the value, ie. the counter jumped more than +1) for the sensors. Packet loss was 0% for both devices/sensors, so lack of data points means the value has been the same as previous value when rounded to 0.01 accuracy.

This is for fun and somewhat unscientific, but these results suggest that the SHTV3 versions are better at capturing quick temperature differences (for protective relays etc.) whilst SHTV4 is better for most use (indoor temp, cooling systems etc.).

image

@pvvx
Copy link
Owner

pvvx commented Nov 17, 2021

@jddonovan The PCB version B1.4 does not have a metallization wrap around the sensor...
The internal resistance of the battery matters - the capacitors installed on the PCB along the power circuit on the board are small, voltage surges occur, which affects the noise of the sensor.
SHT4x has a shorter measurement time. 6 versus 10 ms for SHTV3.

@jddonovan
Copy link

@pvvx thank you for the clarification! And I entirely missed the metallization.

I'v soldered 40µF caps on around 10 of the devices of the 60+ I've had. Caps don't seem to have much impact on the noise, but it might also be due to TX being set at -3db -> difference will no doubt show if power is increased. Caps are there for tx +1db and to squeeze the last juice out of the CR batteries.

Here are two other sensors, this time from the bathroom, yellow SHTV4, and some additional thoughts **(click to expand)** image

For the life of me I can't explain the lagging with anything else than sensor's internal code changes, ie. extra processing. Devices are side by side with same firmware & settings. Just a heads up for those who are using this for automation.

But by far the biggest factor for the "noise" is actual real temperature micro-fluctuations that will be present practically in any room caused by air exchange systems or pressure differences from the wind from outside. Figuring how to get the temperature constant is incredibly hard – I put few sensors to be calibrated in a box with thermal mass inside for baseline noise.

All this tinkering is months ago, and again, more practical than scientific. In any case, we're typically talking tiny differences (0.01C). My biggest reason to optimise (smooth) the output is to save database space but still being able to record as accurately as possible.

thermo
Works great with AA/AAA batteries too!

image

I use these sensors, amongts other things, in an industrial metal workshop in the cold Finnish climate. When one of the 4 loading doors are opened, the temperature drop gets detected rapidly by the sensor devices and sent to MQTT. There are also multiple sensors installed close to the work stations. I have a ESP32 chip controlling the HVAC system to control air flow and temperature, effectively improving energy efficiency and comfort. It also reacts to how many people are logged in as working at the site (max 12 ppl) and to dust and VOCs. It's really more of a hobby, but with real tangible results.

Thank you so much @atc1441 and @pvvx! Without you guys we wouldn't have these cheap devices and dare to experiment.

@shaaati
Copy link

shaaati commented Jan 8, 2023

I noticed a weird behaviour that threw me off for quite some time:
It seems that weak/bad batteries can result in a similar behaviour to what is described in this thread.
Two devices running on firmware 3.8 seemed to be frozen (display didn't update with new values and devices were missing in Home Assistant, display can easily be checked by covering the measurement hole with a finger for a few seconds).
Then, when I removed and re-inserted the battery, the display stayed blank and the devices seemed to be "dead" (no Bluetooth, nothing in HA).

Turns out when you insert a good and healthy battery (it seems I bought a bunch of extraordinarily bad ones) they work again as if nothing happened.
Just reporting here in case anyone else has similar problems and stumbles upon this issue just as I did.

FaBjE pushed a commit to FaBjE/ATC_MiThermometer that referenced this issue May 28, 2023
FaBjE pushed a commit to FaBjE/ATC_MiThermometer that referenced this issue May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests