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

Tuya BLE sensor: BTH01 #1

Open
user784213 opened this issue Dec 27, 2023 · 37 comments
Open

Tuya BLE sensor: BTH01 #1

user784213 opened this issue Dec 27, 2023 · 37 comments

Comments

@user784213
Copy link

Hello
I have a very similar sensor: BTH01
Marking on SoC: PHY6222QCW04IYOJSH (PHY6222QC-W04C)
Marking on sensor: 8305 (CHT8305C)
The case looks cheap, same as TS0202, disassembles very easily
Current price on Aliexpress is less than $2
BTH1

@pvvx
Copy link
Owner

pvvx commented Dec 27, 2023

Разработка PHY6222 только началась.
Пока не будет ОТА, не будет и новых прошивок и не будут выложены исходные коды.

Development of PHY6222 has just begun.
Until there is an OTA, there will be no new firmware and the source codes will not be posted.

@pvvx
Copy link
Owner

pvvx commented Dec 28, 2023

@pvvx
Copy link
Owner

pvvx commented Jan 14, 2024

Соединения на печатной плате BTH01

N ножки чипа Куда соединен Маркировка Название вывода чипа
1 Через R2 на С11 + Сенсор Vdd CHT8305_VDD GPIO_P00
32 Сенсор SCL + R4 на Сенсор Vdd CHT8305_SCL GPIO_P34
31 Сенсор SDA + R5 на Сенсор Vdd CHT8305_SDA GPIO_P33
7   TM TM
8   TX1 GPIO_P09
9   RX1 GPIO_P10
11 Кнопка S1 (работает на GND) + C2  + R8 на Vbat   GPIO_P14
20   RX2 GPIO_P18
21   TX2 GPIO_P20
22 C10 на GND REST_N RST_N
15 Через R7 на светодиод D1   GPIO_P15
27   P25 GPIO_P25

@pvvx
Copy link
Owner

pvvx commented Jan 14, 2024

Тестовая прошивка для BTH01 готова, протестирована.
image

@theanch92
Copy link

Hi, first of all thank you for the hard work done! I just flashed your latest firmware BTH01_v05.hex on a BTH01, Bluetooth communication works but the temperature and humidity values were 0, the battery value is fine.
Looking on pcb, my BTH01 appears to have the AHT30 sensor and not the CHT8305C.

20240115_130200
20240115_125843

I have hope that you can also implement this sensor? Thanks so much again!

@pvvx
Copy link
Owner

pvvx commented Jan 20, 2024

I don't have AHT30 yet. But I added processing code. There is no opportunity to check yet...
OTA version coming soon - It will be possible to change the firmware regardless of the sensors.

@theanch92
Copy link

I don't have AHT30 yet. But I added processing code. There is no opportunity to check yet... OTA version coming soon - It will be possible to change the firmware regardless of the sensors.

Flashed FW 0.7 and the AHT30 works perfectly!
Also installed on TH05 and here too everything is perfect!

Great job

@NeoMatrixJR
Copy link

I don't have AHT30 yet. But I added processing code. There is no opportunity to check yet... OTA version coming soon - It will be possible to change the firmware regardless of the sensors.

Flashed FW 0.7 and the AHT30 works perfectly! Also installed on TH05 and here too everything is perfect!

Great job

Did you flash OTA with the example site or did you solder in? Is this fully functioning firmware to add to home assistant via proxy and still has functional screen or is this just testing getting custom firmware on the device? I tried the example web page but it wouldn't list my test device.

@sstidl
Copy link

sstidl commented Jan 24, 2024

@pvvx Hi Victor! I have v0.6 flashed via serial. can i update to 0.7 OTA? or do I have to do this over serial a last time?

@pvvx
Copy link
Owner

pvvx commented Jan 24, 2024

v0.x is the firmware for tests.
While the firmware number is not 1.x or higher, these are test firmwares and many things do not work in them.
Normal OTA will be from version 1.0.
If the firmware works, then there is no need to change it until v1.0 is released.

@g6094199
Copy link

he guys.

sorry but i dont gt how to get the chip to flash mode?
must TM pulled to high (3.3V)? or have i to pull RST (which PIN is this?) to GND?
or what else is wrong?

@sstidl
Copy link

sstidl commented Jan 25, 2024

he guys.

sorry but i dont gt how to get the chip to flash mode? must TM pulled to high (3.3V)? or have i to pull RST (which PIN is this?) to GND? or what else is wrong?

In my case it worked with TM left open and RST shortly pulled to GND
At the same time try to connect with the python script

@pvvx
Copy link
Owner

pvvx commented Jan 26, 2024

USB-UART PCB
RX TX1
TX RX1
RTS REST_N
GND -Vbat
+3.3V +Vbat

@g6094199
Copy link

g6094199 commented Feb 2, 2024

USB-UART PCB
RX TX1
TX RX1
RTS REST_N
GND -Vbat
+3.3V +Vbat

with RTS to REST_N i get

PHY62x2 - Reset Ok
Error read Revision!

but with " RST shortly pulled to GND" it works.

@pvvx
Copy link
Owner

pvvx commented Feb 4, 2024

but with " RST shortly pulled to GND" it works.

Linux ? - Everything is crooked there.

@g6094199
Copy link

g6094199 commented Feb 4, 2024

but with " RST shortly pulled to GND" it works.

Linux ? - Everything is crooked there.

yes, never used windoze in 20 years. so linux is my natural OS.

@TheNitek
Copy link

PHY62x2 - Reset Ok
Error read Revision!

I have the same error with windows, trying to reset manually (I use a arduino uno with board with the atmel removed as a serial adapter and reset line is not availble, I think.)

@g6094199
Copy link

its tricky...even with another instance inbetween. i started the flash and grounded the pin afterwards shortly. you maybe have to play with the timing

@TheNitek
Copy link

Since i get the "Reset ok" message, I guess my timing is ok, but it's still unable to read the revision

@g6094199
Copy link

also did get the "reset ok" as you can read in my post, but it was not "ok".

@tERB00
Copy link

tERB00 commented Feb 24, 2024

I did this:

  • Connected all the pins including REST_N to Gnd
  • Started the script
  • Pulled off REST_N lead from Gnd

Flashed that way first try with no issues.

@TheNitek
Copy link

That's what I am trying, but It doesn't work even after many, many attempts. I feel like my board might be different in some way ...
PXL_20240224_195804265
PXL_20240224_195740436

@pvvx
Copy link
Owner

pvvx commented Feb 24, 2024

REST_N must be released when the Reset OK message occurs.
Without an RTS signal from the adapter to REST_N, the connection is difficult.

@TheNitek
Copy link

New serial adapter is already on it's way 😀 I hope it works then

@pvvx
Copy link
Owner

pvvx commented Feb 24, 2024

but with " RST shortly pulled to GND" it works.

Linux ? - Everything is crooked there.

yes, never used windoze in 20 years. so linux is my natural OS.

On Linux there are always problems with setting the character reception timeout and RTS/DTR on USB-UART adapters.

@tERB00
Copy link

tERB00 commented Feb 25, 2024

That's what I am trying, but It doesn't work even after many, many attempts. I feel like my board might be different in some way ...

I've got exact the same board. And yes, some usb adapters doesn't work with some devices but work with others... I used CH341A programmer in TTL mode on mine.

@TheNitek
Copy link

Different USB2Serial worked the first time, even though I did the reset manually.

@electro-nic
Copy link

Hi! yesterday I flashed the sensor and I would like to set the advertising period to 1 min as on xiaomi but max value 10000
photo_2024-03-03_08-47-17

@electro-nic
Copy link

Firmware 1.6
8:52:06: Поиск устройств
08:52:28: Ожидание соединения с BTH01-DB601F
08:52:38: Model: BTH01
08:52:38: Firmware: github.com/pvvx
08:52:38: Hardware: 0014
08:52:38: Software: V1.4
08:52:38: Device info # hw: 0014, sw: 0014, services: 00004398, sd: 0000
08:52:38: Устройство подключено.
08:53:10: Установка времени на устройстве (23763AE465)...

@draekko
Copy link

draekko commented Mar 15, 2024

Just an FYI for future readers of this issue thread, in my case with my serial adapter i had to tap REST_N to ground to get it working instead of just going straight to ground and then releasing like was suggested. Was using an older cp210x adapter.

@pvvx
Copy link
Owner

pvvx commented Mar 15, 2024

The script has been fixed to work on Linux.

@draekko
Copy link

draekko commented Mar 15, 2024

good to know

@gvieiraaa
Copy link

Sorry if I got this wrong, but I can't use OTA first, I have to flash using UART?

And could I do it with a raspberry pi instead of with a uart usb adapter?

@pvvx
Copy link
Owner

pvvx commented Mar 15, 2024

On rPi you need to switch something to output RTS... /boot/config.txt ...

@NonPIayerCharacter
Copy link

Have one of those, initially it was with CHT8305, but with original firmware I didn't find a use for it. Later removed 8305, as i needed it as a spare part for something else. Found this firmware, looked through source, and seen that it supports AHT2x. Instead of 8305, soldered AHT21, as they are almost pin compatible (AHT21 lacks AD0 and ALERT pins, instead they are NC), and can confirm that this mod works.

@Nikolay-Ch
Copy link

@pvvx - is it not expected to support other data packet formats (for example ATC1441), like for devices on the Telink chipset?

@pvvx
Copy link
Owner

pvvx commented May 9, 2024

BTHome is the only open standard with a registered UUID and paid for in the Bluetooth SIG by Allterco.
https://bthome.io/images/License_Statement_-_BTHOME.pdf
Register and pay for the UUID for ATC1441, then I’ll turn it on.

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