logo elektroda
logo elektroda
X
logo elektroda

Adding a DHT22 Temperature Sensor to T34/BK7231N for Room Heating Control

Tilator  19 3063 Cool? (+5)
📢 Listen (AI):

TL;DR

  • Modified a T34/BK7231N heater controller by adding a DHT22 temperature sensor for room-temperature sensing and relay-based heating on/off control.
  • Wired the sensor to the S1/S2 external switch connector: S1 to ground, S2 to GPIO P14/pin 11, removed the sensor’s NC pin, and used jumper power for VCC.
  • Removed the pullup resistor and capacitor on P14 near the relay under marking BC8, and flashed without desoldering the CPU by soldering UART to BR4.
  • The DHT22 reported correct values immediately; a DHT11 also worked only with divider adjustments.
Generated by the language model.
Modified Tuya relay controller with attached DHT22 sensor.
Hello,

There seems to be multiple different layouts available of this device.

My need was to add a temperature sensor in it to make possible to measure room temperature and use the relay to connect heating on and off.

Smart switch Tuya with DIY modification, label view.

There is S1 and S2 connectors for external switch. I used those to connect DHT22 sensor. S1 is ground and S2 ic connected to GPIO P14, which is pin11 on the CPU. I just took the NC pin off the sensor. All three other pins are at suitable distance from each other to fit the connector.

There is a pullup resistor and capacitor between this P14 and VCC. I took them both off. They are located near the relay under marking BC8.

Modified Tuya relay controller with attached DHT22 sensor.

Only VCC to the sensor needs to be addeb by jumper.

I did not desolder the CPU to flash it. One UART wire can be soldered to the BR4 resistor at the end near number 4. For the second one I used a big and sharp normal knitting needle from my wifes reserves. I holded it at the plase simply by hand. It's easier to keep it on the right spot if it is sharp enoug.

DHT22 sensor gives right values right away. I did try a DHT11 too and it seems to need some dividers to give correct value.

Here is what it looks like:

Web interface of the BK7231 controller with DHT22 sensor information

Here is configuration:

Screenshot of pin configuration settings for BK7231N/BK7231T controller.

DHT22 is where originally should be BTN_TGL_ALL to act as external on/off switch.

Related T34 topic (flashing method): https://www.elektroda.com/rtvforum/topic4036975.html
For more info, see: https://www.elektroda.com/rtvforum/find.php?q=T34

About Author
Tilator wrote 130 posts with rating 13 , helped 2 times. Been with us since 2023 year.

Comments

p.kaczmarek2 25 May 2024 18:13

Yes, this is a good idea. With OBK , such modifications are very easy. We've did similiar thing with DHT11 on our YT channel: https://www.youtube.com/watch?v=KEjOPuYd3CE The second modification that... [Read more]

Tilator 25 May 2024 18:42

You are right and I'm aware of it. The cap you can see is only there to demonstrate the connection. Final installation needs some glue between the parts. Can you tell me is it possible to read the temperature... [Read more]

p.kaczmarek2 25 May 2024 18:52

I think our OBK channels command should work: http://192.168.0.163/cm?cmnd=channels Please try it out and let me know if it works for you. [Read more]

Tilator 25 May 2024 19:01

Thanks. [Read more]

Tilator 04 Aug 2024 10:38

Hello again, There seems to be DS18B20/DS1820 support available now. Thank you again. This was good add on it. I have not tested it yet, but will do it as soon as I have a bit spare time. [Read more]

p.kaczmarek2 04 Aug 2024 23:34

I'm eager to hear some feedback! Please try and let know. PS: Don't use PowerSave 1 with it. [Read more]

divadiow 12 Sep 2024 07:51

@tilator does your DHT22 give readings still with the latest builds? I don't suppose you ever took a pic of the PCB inside the casing? I'm just curious about my one which doesn't seem to work with OBK... [Read more]

Tilator 12 Sep 2024 08:22

At least version version 1.17.661 works fine. Pictures are available if they anyhow help you. [Read more]

Tilator 24 Sep 2024 00:29

Now I had time to try it, but DS18B20 sensor does not come available. There are at least two different physical configurations to install this sensor. Which one should I use? I installed it by connecting... [Read more]

divadiow 24 Sep 2024 10:11

I've always done it like this: https://obrazki.elektroda.pl/7110850100_1727165493_thumb.jpg seen in my pic here https://www.elektroda.com/rtvforum/viewtopic.php?p=21158431#21158431 [Read more]

Tilator 24 Sep 2024 15:44

I did try that too without good outcome. I have this T34 SOC and I try to use GPIO 11 which is UART TX. Might there be some setting wrong related to that? Added after 5 [hours] 11 [minutes]: Seems... [Read more]

p.kaczmarek2 24 Sep 2024 16:43

So, to sum up, you are using GPIO 11 which is UART TX and: - DHT22 works there - LED (to blink it, as Rel role or LED role) works as well - but DS18B20 doesn't work? Added after 34 : Maybe you... [Read more]

Tilator 24 Sep 2024 18:15

Yes, and on top of thet GPIO 9 works with DHT22 too but not with DS18B20. How can I find out if it's on? [Read more]

divadiow 24 Sep 2024 18:35

I thought powersave 1 was OK now with DS1820? https://www.elektroda.com/rtvforum/viewtopic.php?p=21190145#21190145 @max4elektroda [Read more]

Tilator 24 Sep 2024 20:39

Can you tell does the driver give sensor enough power by pulling GPIO line up or does it still need other external power and pull up resistor? [Read more]

Tilator 25 Sep 2024 11:51

I took one of those mini relays having BK7231N and connected DS18B20 to it using GBIO 9. Still no temperature reading. If I add sensor usin WEB UI there happens nothing. No loaded driver listed on front... [Read more]

divadiow 25 Sep 2024 12:07

still requires external power afaik so, 3.3v, gpio and ground. 4.7kohm between data and vcc. [Read more]

Tilator 25 Sep 2024 12:08

Thanks. A bit new info: I got some readings from BK7231N device and the tric was to give it a bit higher voltage. 4,75V. Even thogh the values it gove were a bit high somewhere above 33 C while actual... [Read more]

Tilator 14 Dec 2024 23:16

What's this in log: Info:SENSOR:DHT start, pin is 6 Info:SENSOR:DHT checksum failure! it keeps repeting about once every second. [Read more]

FAQ

TL;DR: With 3 wires and one jumper, you can add a DHT22 to a T34/BK7231N relay for room heating control; one expert warning is, "does not provide isolation from the mains." This FAQ helps OBK users wire the sensor, flash the board, read temperature over HTTP, and avoid DS18B20 troubleshooting traps such as PowerSave and fixed -1.26 C readings. [#21095677]

Why it matters: This mod turns a low-cost relay module into a room thermostat, but incorrect wiring or insulation can expose live mains on the sensor side.

Option Wiring result in thread Reported behavior Best use here
DHT22 S1 = GND, S2 = GPIO P14, add VCC jumper Worked immediately and gave correct values Easiest room-temperature control
DHT11 Similar class of sensor Needed dividers for correct values Less convenient
DS18B20 Needed 3.3V or even 4.75V in tests, plus pull-up Often failed or showed fixed values Harder to integrate

Key insight: DHT22 was the only sensor in the thread that worked reliably on both the T34 and BK7231N setups without extended debugging. DS18B20 support existed later, but setup consistency and power behavior were the main failure points.

Quick Facts

  • The successful DHT22 mod reused the S1/S2 external switch pads, with S1 as ground and S2 tied to GPIO P14, which is pin 11 on the CPU. [#21095664]
  • On the T34 board, the pull-up resistor and capacitor connected between P14 and VCC were removed; they sit near the relay under the BC8 marking. [#21095664]
  • A working DS18B20 setup reported in the thread used 3.3V + GPIO + GND and a 4.7 kOhm pull-up between data and VCC. [#21238822]
  • One tester reported DS18B20 stayed dead at 3.3V but started responding around 4.75V, although the reported temperature was about 10 C too high at first. [#21238824]

How do I wire a DHT22 to a T34 or BK7231N board using the S1 and S2 external switch pads for room temperature control?

Wire the DHT22 to the external switch pads by using S1 as GND and S2 as GPIO P14. Remove the sensor’s NC pin, then connect the other three pins so they fit the connector spacing. Add only a VCC jumper for power. This setup let the relay board measure room temperature and switch heating on and off in OBK. [#21095664]

Which pull-up resistor and capacitor need to be removed on the T34 board when connecting a DHT22 to GPIO P14?

Remove the pull-up resistor and capacitor that sit between GPIO P14 and VCC. In the thread, they are described as the two parts near the relay under the BC8 marking. After removing them, the DHT22 on P14 gave correct readings right away. [#21095664]

What is OpenBK7231T_App (OBK), and how does it help with adding sensors like DHT22 or DS18B20 to BK7231N devices?

OBK is the firmware used in the thread to assign GPIO roles, load sensor drivers, and automate relay logic from temperature input. "OpenBK7231T_App (OBK) is firmware that runs on BK7231-based smart devices, exposes GPIO configuration and drivers, and lets users add functions like DHT22, DS18B20, relays, and HTTP control without redesigning hardware." The thread states such modifications are very easy with OBK. [#21095677]

What is PowerSave 1 in OBK, and why can it affect IR receivers or DS18B20 temperature sensor operation?

PowerSave 1 is an OBK power-saving mode that can break timing-sensitive peripherals. The thread warns that IR codes may not work well with PowerSave, and later adds a direct note: do not use PowerSave 1 with DS18B20. "PowerSave 1 is a low-power operating mode that reduces activity to save energy, but that timing change can disrupt peripherals that need stable sampling or pulse timing." [#21180233]

How can I flash a T34/BK7231N device without desoldering the CPU, and where are the UART points mentioned in the thread?

You can flash it without removing the CPU by soldering to exposed UART points. 1. Solder one UART wire to the BR4 resistor, at the end near number 4. 2. Touch the second UART point manually; the thread used a sharp knitting needle. 3. Hold contact in place while flashing. This method was reported to work on the T34 board. [#21095664]

Why does a DHT22 work on GPIO 9 or GPIO 11 in OBK while a DS18B20 on the same pins gives no reading?

Because the thread shows the GPIOs themselves were not the problem. The same user confirmed DHT22 worked on GPIO 11 and GPIO 9, while DS18B20 failed on both. That points to DS18B20-specific issues such as driver startup, PowerSave, wiring mode, or power level rather than a dead pin. [#21237985]

What is the correct DS18B20 wiring on a BK7231N or T34 device: normal 3-wire mode or parasite-powered 2-wire mode?

Use normal 3-wire mode for this thread’s hardware. The practical recommendation was 3.3V, GPIO, and GND, plus a 4.7 kOhm resistor between data and VCC. The user tested parasite-style wiring and separate VDD wiring, but stable advice in the thread favored external power, not GPIO-powered operation. [#21238822]

How do I check whether PowerSave is enabled in OBK when troubleshooting a DS18B20 sensor that is not detected?

The thread does not give a menu path or HTTP command to check that state. It only suggests PowerSave as a likely cause and asks whether it should be turned off when DS18B20 works nowhere but DHT22 works on the same GPIOs. In this thread, PowerSave is a troubleshooting clue, not a documented diagnostic procedure. [#21237883]

What HTTP command in OBK returns the current temperature reading from a DHT22 or DS18B20 sensor?

The only HTTP command proposed in the thread is the OBK channels query: http://192.168.0.163/cm?cmnd=channels. That command was suggested specifically when the user asked how to read temperature by HTTP. The thread does not show a later confirmation or an example response payload. [#21095708]

Why does the DS18B20 driver in OBK show a fixed reading like -1.26 C, and what does that indicate?

A fixed reading like -1.26 C indicates the driver loaded but did not get a valid sensor reading. The user reported that startdriver DS1820 9 made the driver appear after reboot, yet the temperature stayed fixed at about -1.26 C. In this thread, that behavior matched a detection, timing, or power problem rather than a working sensor. [#21238801]

DHT22 vs DS18B20 for room heating control on a T34 relay board: which sensor is more reliable and easier to integrate?

DHT22 was more reliable and easier to integrate in this thread. It worked immediately on the T34 mod, returned correct values, and also worked on GPIO 9 and GPIO 11 in later tests. DS18B20 support appeared later, but multiple tests still produced no reading, a fixed -1.26 C, or unstable behavior. [#21238801]

Why might a DS18B20 start working only at about 4.75V but fail at 3.3V on some BK7231N-based devices?

The thread points to a power or timing sensitivity in the actual setup. One user reported no DS18B20 response at 3.3V, then partial operation at about 4.75V, with a reading roughly 10 C too high. The same post notes it later worked at 3.3V when configured in both the Web UI and the startup command, which strongly suggests a startup timing issue. [#21238824]

How should exposed DHT22 or DS18B20 wiring be insulated on a non-isolated mains-powered T34 module to make the mod safer?

Insulate and secure every exposed sensor connection so it cannot touch the user or nearby parts. The thread gives a blunt warning: the T34 board does not provide isolation from the mains, so live mains may appear on the sensor ground. One expert warning says, "does not provide isolation from the mains," so the final installation should be glued or otherwise fixed in place, not left exposed. [#21095677]

What could cause repeated OBK log messages like 'Info:SENSOR:DHT checksum failure!' every second on a DHT sensor setup?

That message means OBK is polling the DHT sensor, but the data frame fails checksum validation each cycle. In the thread, the log repeats about once every second, which matches continuous retry behavior. Common thread-level causes are incorrect wiring on the sensor pins, leftover passives on the GPIO path, or an unstable physical connection after the hardware mod. [#21348605]

How does OBK detect and handle the T34 platform compared with a standard BK7231N device when loading the DS1820 driver?

The thread does not show a confirmed platform-detection difference between T34 and standard BK7231N for DS1820 loading. The user explicitly asked whether T34 was recognized correctly and whether it should act as BK7231N too, but no final technical answer appears. What the thread does show is inconsistent DS1820 behavior on both board types, so no T34-specific handling was confirmed. [#21238824]
Generated by the language model.
%}