Comments (96)
Good news, setting that pin (PB6) to a level and not leaving it floating fixed the issue :)
The 2 on the left are the new firmware the one on the right the old custom version
https://github.com/atc1441/ATC_MiThermometer/blob/master/ATC_Thermometer/main.c#L30
Its already updated in the repo and can be flashed.
from atc_mithermometer.
Ok, played a bit more and with the Osci it was now quite obvious what the reason is.
the pin needs to be pulled HIGH on boot that will be perfectly done but the moment the TLSR goes to sleep the GPIO will be reset and low again,
the goal is now to enable the GPIO B6 even when in sleep mode.
Nice to see the reason
from atc_mithermometer.
Yeap, just flashed it and it works! Good job!
from atc_mithermometer.
I need to find such a small torx, maybe I have one at work. Gonna take a few days.
I ordered both in the same shipment, I can compare the numbers on the back next wekk.
from atc_mithermometer.
Pressing the screen does not do anything for me. Sounds like a hardware issue. However, my fridge is approx. +6 degrees celsius, well within the spec'ed range. I have not tested stock firmware yet.
Edit:
Also, letting it come up to room temperature does not help, only reinserting the battery does, and it can't be too fast. Seems the caps need to discharge first.
from atc_mithermometer.
Goes on the way tomorrow..
from atc_mithermometer.
IT IS FIXED :)
Setting it to a pullup level keeps it high during sleep.
For me all the devices i have work that way.
Please try it out, the newest version is online and ready to be flashed
from atc_mithermometer.
i could imagine that the humidity went down because while flashing the SOC is on the hole time an drains the battery but only while flashing so now the battery is a bit lower than usual, and maybe also because the thermometer was touched, dont know if it was just done OTA
Both is just a guess.
@giannoug i dont trust Github Actions for that part. i always want to make shure that everything works on a real flashed device.
i know you only want to help :)
from atc_mithermometer.
Hey, it seems @leahneukirchen also hat that problem with one Thermometer,
did you try to reinsert the battery?
there is one unknown pin goin to the lcd controller and it may have something to do with that.
my devices all work fine so its hard for me to debug
from atc_mithermometer.
I have one running your firmware, which went out in the freezer and came back fine later.
I have one running on stock firmware again which showed this behavior, it went out after 5-30s with your firmware after power cycling.
In general, power cycling made the display work again, but then it went off with the latter one again.
from atc_mithermometer.
Do any one of you may have the possibility to open one ?
that way its could be compared against the other ones to see if they are a different revision
from atc_mithermometer.
I took few more from my order and they work as expected. I had a problem with one more, however after turn off and on again it shown temperature. Anyway the first one is still off, switching on/off, reflash or battery replace didnt help.
board1
board2
from atc_mithermometer.
Thank you for the images. My boards are exactly the same.
Must be something else
from atc_mithermometer.
I have flashed my 14 sensors and all are experience that same issue. After several minutes screen freeze and doesn't display current temperature correctly. Power cycle fixing the issue but just for a another several minutes. I haven't have this problem on the stock firmware.
from atc_mithermometer.
I flashed 4 of my sensors, and one of them is experiencing the aforementioned screen blanking. Reinserting the battery fixes it, but only temporarily. It may have to do with the fact I use that one in the fridge as I pulled it out this morning and it hasn't blanked yet. I will swap it with another and see if I can replicate the issue.
from atc_mithermometer.
I have flashed my 14 sensors again this morning using the latest .bin file. After flashing I set them to as follow:
Smiley: OFF
Advertising Type: Mi Like
Show battery in LCD: Disabled
Advertising interval: 10 Seconds
So far all good, sensors doesn't freeze anymore and reporting back to my Home Assistant by connecting via ESPHome BLE_tracker and xiaomi_cgg1 platform.
example of my configuration:
esp32_ble_tracker:
sensor:
- platform: xiaomi_cgg1
mac_address: "A4:C1:38:BD:89:4E"
temperature:
name: "Bedroom Temperature"
humidity:
name: "Bedroom Humidity"
battery_level:
name: "Bedroom Battery Level"
from atc_mithermometer.
Reporting back that the thermometer that was working fine for days now, blanked after 30min of being in the fridge. I suspect it has to do with low temperatures. Will try another thermometer.
from atc_mithermometer.
Reporting back that the thermometer that was working fine for days now, blanked after 30min of being in the fridge. I suspect it has to do with low temperatures. Will try another thermometer.
try my settings:
Smiley: OFF
Show battery in LCD: Disabled
This prevent sensor on blinking between two screens (battery or humidity) in my case those settings have solved the issue.
from atc_mithermometer.
@benek984 Unfortunately those settings did not help. I can quite consistency reproduce the screen blanking by placing any of my 4 thermometers in the fridge. Need to try using ATC format, using Mi at the moment.
from atc_mithermometer.
@bbbenji ok the not showing of data on the lcd when in freezer is also same for me. Havent tested that with stock firmware but i think that is display related. If i press on the lcd when in freezer it comes back while pressing it.
Dies this work as well?
from atc_mithermometer.
Tested a bit further, Stock vs. Custom rom in freezer, the display of the Stock rom stays on the custom not
Hard to do an i2c capture while in freezer, i could imagine they set the voltage of the lcd controller higher when under a specific °C
from atc_mithermometer.
Looking further onto the PCB i following the unknown pin i already mentioned and will try to capture if that one has something to do with it.
from atc_mithermometer.
Still an issue at 26° on one sensor
from atc_mithermometer.
Thank you for the info.
Is it instant off after inserting the battery or how is the behavior?
from atc_mithermometer.
After new flash. When I connect
I waiting 60s its ok, then connect with flasher turn off.
Maybe related with some ble discovery
Because now, after insert battery, goes off 10-20s after
from atc_mithermometer.
Now after blink one time
28°
Maybe temperature related.
I flashed stock again, and then custom, I never reached the 60s as the first time
from atc_mithermometer.
At 17°C works fine....
from atc_mithermometer.
I flashed the firmware of HEAD on the Mi that went dark quickly, and it turns off immediately after the MAC now... Bluetooth works fine.
I also opened it and wiggled the LCD connector a bit, but I think that is not the issue, as it displays fine in the begining.
(Display was fine with the stock firmware, too.)
from atc_mithermometer.
Maybe are clones
I have one with a "very soft purple" background lcd
from atc_mithermometer.
Indeed, the LCD colors are different. The working one is "very soft purple", the non-working one is "dark greenish".
from atc_mithermometer.
The problem is above 20°C
It's working at -10°C (-9.9 on lcd)
Cold kills battery fast :)
from atc_mithermometer.
It was only cold for a few minutes. But we have 20°C inside, so....
from atc_mithermometer.
Maybe less
Put in freezer, remove/reinsert the battery less 15° because hot hands
My works that way. If I take it out freezer. Go blank after a while
from atc_mithermometer.
Powercycled it at 11.8°C, display came back; warmed up in ~15min to 20°C. Still on.. let's see.
from atc_mithermometer.
Went out at ~20.5°C again. :(
from atc_mithermometer.
Maybe is the Humidity...
21.3°C 78% still on
from atc_mithermometer.
Humidity fell to 60%.
from atc_mithermometer.
I could also imagine that the display needs to be set into a different mode on different temperatures. So like pull pin low on low temp and high on high temp.
A reinit of the lcd is needed after setting a different level on that pin. But that shouldnt be a problem to do.
To bad there is no info on the lcd controller
from atc_mithermometer.
On mine i had only problems on very low temp so far maybe someone can upload an comparison of the two lcds in one picture
If i pull the pin low now in the current firmware, when pulled high on tests the display was turning of after the mac showing just like you mentioned @leahneukirchen
from atc_mithermometer.
Perhaps expose the pin over bluetooth so we noobs can toggle it over the browser. :)
from atc_mithermometer.
10s broadcast maybe faulty
from atc_mithermometer.
@leahneukirchen only toggle would help to much as the init is needed. So needed compine that somehow first :-/
@nikito7 can you explain that a bit more?
I can imagine that the newly added alarm do somethong wrong there, it will do an instant advertise if the Temp or Humi changes more than 0.5C / 5% between a main loop delay (5-6 seconds), there is a bug in it that will advertise twice if in the same loop a timed advertising was happening.
Will change that
from atc_mithermometer.
@nikito7 fixed that particular bug right now
from atc_mithermometer.
chart was for lcd off event
from atc_mithermometer.
Yeah should not fixed that one. Only changed the instant advertising.
Will look deeper into what the stock firmware is doing with the pin. Maybe even capture some data while im freezer with a wire to a logic analyzer or something.
from atc_mithermometer.
Can you confirm that 10s broadcast is working?
If working. Esphome or homeassistant is filtering data
from atc_mithermometer.
@nikito7 yes can confirm that it does work at 10s interval just tested it again. Its 10-15 Seconds to be precise as its only tested for the interval if the main loop interval was overflowed as well.
There is a problem with interval bigger than 3minutes but that will be fixed later.
from atc_mithermometer.
Hi benek984
I did everything like you, but maybe i'm forgetting something... i can read the values in MQTT.. can you please put an example about how are you reading it?
I created this sensor:
- platform: mqtt
name: "testing pc"
state_topic: "esp_entrada/sensor/temperatura_ordenador/state"
unit_of_measurement: "°C"
but status is always unknown..., what i'm missing ?
Thanks for answering!
I have flashed my 14 sensors again this morning using the latest .bin file. After flashing I set them to as follow:
Smiley: OFF
Advertising Type: Mi Like
Show battery in LCD: Disabled
Advertising interval: 10 SecondsSo far all good, sensors doesn't freeze anymore and reporting back to my Home Assistant by connecting via ESPHome BLE_tracker and xiaomi_cgg1 platform.
example of my configuration:
esp32_ble_tracker:
sensor:* platform: xiaomi_cgg1 mac_address: "A4:C1:38:BD:89:4E" temperature: name: "Bedroom Temperature" humidity: name: "Bedroom Humidity" battery_level: name: "Bedroom Battery Level"
from atc_mithermometer.
Hi benek984
I did everything like you, but maybe i'm forgetting something... i can read the values in MQTT.. can you please put an example about how are you reading it?
I created this sensor:
- platform: mqtt
name: "testing pc"
state_topic: "esp_entrada/sensor/temperatura_ordenador/state"
unit_of_measurement: "°C"but status is always unknown..., what i'm missing ?
Thanks for answering!
Use api in esphome.yaml
api:
password: pass
And add integration "esphome" in homeassistant
edit:
-Or you miss mqtt integration
-Ip address changed
-reboot
That should be easy, its auto discovery
No edit yaml needed in homeassistant
from atc_mithermometer.
Hi Calcu2006,
I use ESPHome plugin with Home Assistant, to read values from sensors I have ESP32 board with ESPHome on board.
As mentioned by nikito7 this will autodiscover sensors added to the ESP32 config so you don't need to edit your yaml config file in home assistant.
Example config below:
esphome:
name: esp32_ble_01
platform: ESP32
board: nodemcu-32s
wifi:
ssid: "xxxx"
password: "xxx"
power_save_mode: none
use_address: 192.168.10.135
Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "xxx"
password: "xxx"
captive_portal:
Enable logging
logger:
Enable Home Assistant API
api:
password: "xxx"
ota:
password: "xxx"
web_server:
Enable Bluetooth scanning for this ESP32
esp32_ble_tracker:
sensor:
-
platform: xiaomi_lywsd03mmc
bindkey: "26d11deb1fcfae7862a462839a5156a9" ----- "This is fake value but is necessary for that platform, you can use diffrent xiaomi platform from ESPHome but I found this one the most stable for those sensors".mac_address: "aa:aa:aa:aa:aa:aa"
temperature:
name: "Bedroom Temperature"
humidity:
name: "Bedroom Humidity"
battery_level:
name: "Bedroom Batery Level"
from atc_mithermometer.
Thanks, i was creating MQtt sensors... now everything works, thanks again !
from atc_mithermometer.
Same issue - revert to stock firmware
from atc_mithermometer.
Same issue here. Right after flashing, the boot screen appears (showing "Atc", happy face and mac), then screen turns off. This is what happens all of the time, but it stayed a couple of seconds in the temperature / humidity screen once.
from atc_mithermometer.
I compiled a version now where it pulls the LCD pin high and not low, maybe someone who has the error can flash it and test it, that way we would know if looking into that direction would help.
especially @rnizametdinov and @giannoug
Edit. File deleted to prevent miss flashes
from atc_mithermometer.
@atc1441 Just flashed ATC_Thermometer_LCD_HIGH.bin
. Doesn't seem to fix the issue. It goes to blank screen straight after booting
from atc_mithermometer.
Thank you for testing it. Looks like its still a different error.
Are the other ones from you working fine?
from atc_mithermometer.
@atc1441 What other ones are you referring to? I don't have other devices available and the stock firmware works fine (both the one that came from the manufacturer and the one you provide in the README)
from atc_mithermometer.
Thought you maybe bought a pack of four or something.
But no problem :)
from atc_mithermometer.
The good ones have lcd issue now
Dont update :p
from atc_mithermometer.
@nikito7 yes that was just for the bad ones as a test :)
Will delete the file now.
from atc_mithermometer.
especially @rnizametdinov and @giannoug
Edit. File deleted to prevent miss flashes
I have 3 thermometer.
2 of them - turn off screen on this firmware.
And last one - work 3 hours and everything OK.
I tray change battery between them - everything same: first 2 screen off, last one - work fine.
I will tray open them and find differense.
PS. Visual they all the same ("green" screen)
from atc_mithermometer.
Thank you
from atc_mithermometer.
Thank you
Right - turn off screen. As I can see - they are the same :(.
I try use good motherboard with "bad" display - work well.
I try use bad motherboard with "good" display - don'twork.
On motherboard I see two connection roads from main controller to display controller - is it use i2c for display control?
from atc_mithermometer.
Why chip numbers change?
from atc_mithermometer.
Thank you for the in depth pictures, it seems like they changed something in the LCD controller ic then,
All my have the F200 version. and they work fine
from atc_mithermometer.
33 work
3E not
from atc_mithermometer.
I swapped lcd too, and... the lcd is not the problem
from atc_mithermometer.
Yes it will be the lcd controller as this is the only thing different.
Will order one more and with luck i get a bad one that i can use to debug it
from atc_mithermometer.
Four digits, its the time I think (board itself, chips, etc)
from atc_mithermometer.
@atc1441 Yes I got a lot of them, but only had one available when I tested! I've tried 2 more but it seems they both have the new LCD controller and aren't working.
Can you share some information about how are you going to reverse engineer them? If I understood correctly, the LCD is using an I2C bus. Will an Arduino-based I2C sniffer work? I might be able to get some packets out of them
from atc_mithermometer.
Understand,
the reversing is done with a mix of I2C Sniffing and looking into the Stock firmware with Ghidra
The communication is so far only in one direction so from the MCU to the LCD Controller.
I just got the idea that maybe the unknown GPIO could be a signal from the LCD Controller to the MCU and not in the other direction, need to test that, maybe by cutting the trace to see from where the voltage comes.
Also the Stock firmware is the same for both variants so its can not really be an I2C cmd as there is only writing and no reading as mentioned
from atc_mithermometer.
Can you auto detect chip on code?
This may need to be dynamic.
Because xiaomi firmware is just one for all
from atc_mithermometer.
Yes that would definitely be the plan, but for that we first need to know what is wrong :)
from atc_mithermometer.
@atc1441 But why is the LCD working on boot and then stops? I can see the boot screening showing "Atc" along with the last 2 chars of the mac and it then stops. Isn't the boot screen controlled by the same code?
from atc_mithermometer.
I think that has something todo with the retention.
The cpu goes to sleep all the time and on wakeup it is like a reset. That is happening between the ATC and the temp. I can not really debug what its wrong there without a non working device otherwise i would test stuff
from atc_mithermometer.
I can see the bootscreen when I insert the battery, if that helps. It dies exactly before showing the main screen.
from atc_mithermometer.
Can we use a voltimeter on lcd pins?
from atc_mithermometer.
Yes not problem with voltmeter,
Cou can cut the trace between the lcd controller and thermometer and meassure both side what level they have.
See the image i posted earlier about the trace
from atc_mithermometer.
I think that has something todo with the retention.
The cpu goes to sleep all the time and on wakeup it is like a reset. That is happening between the ATC and the temp. I can not really debug what its wrong there without a non working device otherwise i would test stuff
Here I have two with LCD controllers
IST3055NAO
RBTNN700
2013
one of them freezes
most of the others are ... R200, so no problems with those.
Should I send you the "Freezer" to try out? If so, address?
from atc_mithermometer.
Just send you a mail.
Would be very kind of you!
from atc_mithermometer.
@ralf-e I got the Thermometer from you,
I played around with it to see where the problem is and tested different things, right now it still is not solved as i had not too much time.
but just so you know
from atc_mithermometer.
Nice to hear that it works for you as well, i am quite confident that this is the solution :)
from atc_mithermometer.
I played around with it to see where the problem is and tested different things, right now it still is not solved as i had not too much time.
one of my parts has the identical LCD controller version as the thermometer I sent you. Here the error only occurs every few days. Can it possibly only be a question of timing problems with the connection between the LCD controller and MCU (component variation)?
from atc_mithermometer.
I looked at what the stock firmware does and it pulls the pin HIGH.
For now my firmware did only pull it low as HIGH did not work becuse of the sleep reset. At that point i hadnt looked into it with the osci.
It is pulled high as in the stock firmware and i am very shure it will help
As the firmware is the same for all versions and the mcu does not know what lcd controller is connected it can not behaiv different on other lcd controllers
from atc_mithermometer.
Upload new firmware on three my device - work fine. Awesome job!
After upload humidity drop a little, dont matter for me (I monitor difference between main room and bathroom)
p.s atc1441 , can you compile fw with "mi like" broadcast by default? So we choose "ATC_Thermometer.bin" or "ATC_Thermometer_Mi_like.bin" ?
Now we must change "mi like" after every battery out\insert.
from atc_mithermometer.
A precompiled version with mi like is definitely an option.
But that gives another problem, i have to recompile every update for both versions and test them. I want to avoid that.
My other plan was to make it save the values in flash so they dont get lost.
from atc_mithermometer.
@atc1441 Take a look into GitHub Actions and Releases. You can have it compile FW for you automatically on every push and add a release in the Releases page
from atc_mithermometer.
After upload humidity drop a little, dont matter for me (I monitor difference between main room and bathroom)
Send FB05 setting @rnizametdinov
from atc_mithermometer.
It's weird that the humidity went down. Does this change significantly impact power draw?
from atc_mithermometer.
Humidity went down for me too for all sensors after flashing
from atc_mithermometer.
Lets see if they recovery in about 3 hours or so and if not i will investigate further. i only changed something in the removing of the Mi id and the Pullup resistor.
another thing to test would be to flash the old firmware and see if its up again
from atc_mithermometer.
stock firmware maybe had a default offset.
I always send FB05, always... and click mi-like :-)
from atc_mithermometer.
Yes from Stock to Custom is about 5% difference, but what is strange is that its flashed from Custom to new Custom
from atc_mithermometer.
Charts are ok here. He need FB05 after flash.
Or is something else
from atc_mithermometer.
Yes from Stock to Custom is about 5% difference, but what is strange is that its flashed from Custom to new Custom
I flash from stock to custom, and have stable 5% Hum drop.
@nikito7 thanks for advice.
My other plan was to make it save the values in flash so they dont get lost.
It will be awesome!
from atc_mithermometer.
Ok the 5% drop it totally fine then.
Thought you where already on stock before
from atc_mithermometer.
Related Issues (20)
- "Advertising interval" term is missused? HOT 4
- Compatibility with TH05? HOT 2
- CGG1-M 2022 shows 0,0°C temperature and 0% humidity
- LCD Refresh interval longer than 12.x seconds
- Qingping CGDK2 zigbee fw shows wrong temp HOT 1
- New device from Xiaomi: XMWSDJ04MMC HOT 1
- Problem activating LYWSD03MMC v2.1.1_0159 HOT 2
- Lost Advertising Type after Battery change HOT 1
- ad interval setting seems to not work HOT 2
- lywsd03mmc not flashing with new firmware HOT 1
- Random bind key
- Force into pairing mode. HOT 2
- Custom battery levels
- Calibrate LYWSD03MMC in Zigbee mode (ZHA)
- Venus operating System HOT 1
- Way to read Data from ATC-flashed devices via Android Gadgetbridge-App
- Device bricked after successful flash and battery removal HOT 1
- Does the sensor have a spare GPIO I can use?
- Remote display solutions experiences HOT 1
- More Options HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atc_mithermometer.