logo elektroda
logo elektroda
X
logo elektroda

DIY Clock/calendar/thermometer/hygrometer/IR receiver BK7231T MAX7219 DHT11

p.kaczmarek2  3 3225 Cool? (+17)
📢 Listen (AI):

TL;DR

  • A DIY smart clock combines a WB2S BK7231T module, MAX7219 LED matrix, DHT11 temperature/humidity sensor, IR receiver, photoresistor, and 3D-printed enclosure.
  • OpenBeken drives the hardware, reporting measurements to Home Assistant, syncing time via NTP, and mapping IR codes to GPIO roles and scripted GET requests.
  • The autoexec script starts MAX72XX, MAX72XX_Setup 0 1 26, NTP, and MAX72XX_Clock, with ntp_timeZoneOfs 2.
  • The finished prototype alternates between internet time and DHT11 readings, and Home Assistant Discovery pairs it automatically without YAML.
  • The enclosure and PCB are still prototype-grade, with glued spacers and a hand-built drilled board, and the author considers making an official version later.
Generated by the language model.
DIY device with an LED display showing the time. .
Hello, I'm going to present here a little DIY project that I did over the weekend. My project is based on a WB2S WiFi module (BK7231T), a MAX7219 matrix LED display, a DHT11 thermometer/hygrometer, an IR receiver, a photoresistor and a housing from a 3D printer. The gadget described here is fully compatible with Home Assistant, and runs OpenBeken , which allows it to continuously, for example, report measurements to HA and also forward received IR codes to HA. In addition to this, the firmware is also capable of handling these codes independently (without HA) and e.g. forwarding commands via HTTP GET requests to OpenBeken or Tasmota devices, which makes it possible, for example, to script the IR remote control to control other smart devices at home without the need for any main server/Home Assistant.

Introduction .
At the heart of the project is the WB2S module (BK7231T):
Diagram of pin layout and dimensions of the WB2S module. .
Outputs (from Tuya documentation):
[/tr] Function [td:16dd78e118] Common GPIO, which is connected to the P26 pin on the internal IC [td] Pin no.
Symbol I/O type Function
1 VBAT P Power supply pin (3.3 V), which is connected to the VBAT pin on the internal IC
2 PWM2 I/O Common GPIO, which is connected to the P8 pin on the internal IC
<span>3 GND P Power supply reference ground pin
4 PWM1 I/O Common GPIO, which is connected to the P7 pin on the internal IC
5 1RX I/O UART1_RXD, which is used as a user-side serial interface pin and is connected to the P10 pin on the internal IC
6 PWM0 I/O Common GPIO, which is connected to the P6 pin on the internal IC
7 1TX I/O UART1_TXD, which is used as a user-side serial interface pin and is connected to the P11 pin on the internal IC
8 AD AI ADC pin, which is connected to the P23 pin on the internal IC
9 PWM4 I/O Common GPIO, which is connected to the P24 pin on the internal IC
10 Price I Low-level reset, high-level active (internally pulled high) Docking IC-CEN
11 PWM5 I/O
.
I chose the module because I already had several of these (received from a user who replaced them with ESPs in smart devices) and because I need platforms to test my firmware:
https://github.com/openshwprojects/OpenBK7231T_App
I wanted to have some kind of platform to test new peripherals, for this reason I gathered what I had of the parts into one project and this is how this clock was created.

Apart from the peripherals there is basically only a 3.3V LDO regulator on board, here a MIC29150 3.3WU, although a regular AMS1117-3.3V would also fit.

Uploading the batch .
To upload the OBK I used:
https://github.com/openshwprojects/BK7231GUIFlashTool
All according to the instructions from the link, but you can also look at the flashing tutorials on Youtube Elektroda.com:
https://www.youtube.com/@elektrodacom

Prototype
I made a prototype still on the WB3S soldered into the base of the NodeMCU:
DIY prototype with WB2S module, LED display, and other components on a breadboard .
Everything is connected via OBK drivers, which are configurable and can be scripted with the OBK scripting language without recompiling the batch.
LED display and prototype board on a workbench. .

Build, board
I decided to print the case on a 3D printer, my Ender 3 Pro, from PLA filament. I made the board guerrilla-style, from a prototype/drilled board. Let's start with the board. Here is the WB2S still with the wires from the contact board:
WB2S module connected to wires on a mounting stand .
I then desoldered these cables and soldered the legs to it:
WiFi module WB2S soldered onto a prototype board WB2S (BK7231T) electronic module with soldered wires. .
Everything went nicely into the plate:
WB2S module soldered onto a prototype PCB. .
These boards are comfortable to solder, just make sure the temperature is low, otherwise the solder fields fall off:
Prototype board with soldered wires held by a third hand tool against a workshop background. .
My LDO regulator, fairly unknown, MIC29150 3.3WU, and it's in SMD housing, but I managed:
Voltage regulator MIC29150 3.3WU on a wooden table. WiFi module WB2S soldered to a prototype board. Image of a printed circuit board with soldered electronic components. .
A continuation of, as some call it, "sculpting". GPIO pinouts:
Soldered prototyping board with pins Prototype circuit board with mounted electronic components .
A GPIO map was also created during the work - otherwise it will be easy to get lost when servicing the design in the future:
Prototype electronic board with labeled pins on a wooden table. .
The additional pads, located on the 'back' of the WB2S, I have also taken the liberty to derive. The UART2 port could come in handy, if only as a simple GPIO:
Electronic module with soldered wires on a prototype board. Prototype board with WB2S module mounted in a holder. .
Then work on the enclosure began. I started by sizing up the display:
Electronic module on a 3D printer during operation. .
3D printed case part on the printer bed. .
The project was created in Blender, the enclosure will be a two-part...

Test fitting for the case, the display part of the case is not complete here:
Prototype circuit board with wires and electronic components. .
In an ideal world, you wouldn't need to glue plastic spacers onto the case, you just include them in the 3D design, but this is just a prototype. Maybe in the next version I'll make a dedicated PCB for it.
Again, a fitting:
DIY prototype device with electronic components on a white base. Interior of DIY clock prototype with PCB and electronic components DIY prototype with WB2S module in a case with a display DIY prototype with WB2S module in a case with a display .
First tests:
LED display with WiFi module showing temperature 28°C. LED display showing time 19:40 with a 3D-printed casing.
DIY prototype device with red LED display and connecting wires. .
Almost complete case set, only without the rear panel. One part slides into the other. The display sticks to the base and the top slides over it.
3D printed enclosure parts on a workbench .

OpenBeken configuration .
My firmware is designed to do a lot without programming, so configuring the device comes down to selecting pin roles:
Configuration interface of the WB2S_MAX_DHT_IR_Clock device with pin assignments. WiFi module configuration interface with pin settings .
On P6 is the DHT11, its associated channels are 1 (for temperature) and 2 (for humidity).
On P23 is the ADC (photoresistor, actually a photoresistor and a simple resistor forming a voltage divider), the associated channel is channel 0. This photoresistor will be used to adjust the brightness of the display depending on the external lighting.
There is an IR receiver on P24.
The measurement results can be seen on the main web panel of the device:
Screenshot of DIY clock interface with DHT11 sensor .
In addition, the device is scripted in autoexec.bat. The script enables the MAX72XX driver, starts the NTP, also starts the clock driver, and allows control of other devices via the IR remote - mediated by GET requests (SendGet command):

startDriver MAX72XX
MAX72XX_Setup 0 1 26
startDriver NTP
startDriver MAX72XX_Clock
ntp_timeZoneOfs 2
.
The following snippet creates aliases for commands that control other devices:

alias my_ledStrip_off SendGet http://192.168.0.200/cm?cmnd=POWER%20OFF
alias my_ledStrip_plus SendGet http://192.168.0.200/cm?cmnd=backlog%20POWER%20ON;add_dimmer%2010
alias my_ledStrip_minus SendGet http://192.168.0.200/cm?cmnd=backlog%20POWER%20ON;add_dimmer%20-10
alias main_switch_off SendGet http://192.168.0.159/cm?cmnd=POWER%20OFF
alias main_switch_on SendGet http://192.168.0.159/cm?cmnd=POWER%20ON

alias my_send_style_cold SendGet http://192.168.0.210/cm?cmnd=backlog%20CT%20153;%20POWER%20ON
alias my_send_style_warm SendGet http://192.168.0.210/cm?cmnd=backlog%20CT%20500%20POWER%20ON
alias my_send_style_red SendGet http://192.168.0.210/cm?cmnd=backlog%20color%20FF0000%20POWER%20ON
alias my_send_style_green SendGet http://192.168.0.210/cm?cmnd=backlog%20color%2000FF00%20POWER%20ON
alias my_send_style_blue SendGet http://192.168.0.210/cm?cmnd=backlog%20color%200000FF%20POWER%20ON
alias my_send_style_plus SendGet http://192.168.0.210/cm?cmnd=backlog%20POWER%20ON;add_dimmer%2010
alias my_send_style_minus SendGet http://192.168.0.210/cm?cmnd=backlog%20POWER%20ON;add_dimmer%20-10
.
The following snippet maps IR events to the created aliases/commands:

// 1
addEventHandler2 IR_Samsung 0x707 0x4 my_ledStrip_off
// 2
addEventHandler2 IR_Samsung 0x707 0x5 my_ledStrip_plus
// 3
addEventHandler2 IR_Samsung 0x707 0x6 my_ledStrip_minus
// 4
addEventHandler2 IR_Samsung 0x707 0x8 main_switch_off
// 5
addEventHandler2 IR_Samsung 0x707 0x9 main_switch_on
// 6
addEventHandler2 IR_Samsung 0x707 0xA startScript autoexec.bat next_light_style
// 7
addEventHandler2 IR_Samsung 0x707 0xC my_send_style_plus
// 8
addEventHandler2 IR_Samsung 0x707 0xD my_send_style_minus

// stop autoexec execution here
return
.
The following snippet is a lighting style switch:

// this is function for scrolling light styles
next_light_style:

// add to ch 10, wrap within range [0,5]
addChannel 10 1 0 5 1

// start main switch
//main_switch_on

if $CH10==0 then my_send_style_cold
if $CH10==1 then my_send_style_warm
if $CH10==2 then my_send_style_red
if $CH10==3 then my_send_style_green
if $CH10==4 then my_send_style_blue
.
Home Assistant Discovery correctly pairs this device with HA, without having to write a single line of Yaml code:
Screenshot from the Home Assistant app showing a list of devices and their statuses. .


Gallery
A few pics of the final operation of the device:
DIY device with an LED display showing the time. DIY LED display with 3D printed case Matrix LED display showing temperature 21°C in a white casing .
It alternates between showing the current time from the internet and the measurements from the DHT11.
Now I see a small typo, but maybe no one will realise .... it does not affect the operation.


Summary .
This is just a prototype, but I think it is fully functional and does the job well. I didn't do the board under it, but the pinout of my "sculpture" is fully sufficient for servicing, as well as the enclosure in its current form passes the test. In a free moment, it would be possible to make an "official version", already with the board designed under it and with the PCB mounts already included in the 3D printout. I will have to think about it, maybe I will design something in Eagle and order 5/10 pieces in China in the cheapest price range (10cm by 10cm), or I will etch something myself, but about that another time. The main thing is that the front rather looks good and gives a nice effect both day and night.
It's also worth noting here that the whole gadget allows me to use the remote to control any number of devices in the room without Home Assistant. The project receives the IR signal and then makes a GET request to the OBK or Tasmota device in question. HA here is not needed, although if I want to use it, I can simply forward it on to MQTT when an IR event is received.... the possibilities are very high.[/td]

About Author
p.kaczmarek2
p.kaczmarek2 wrote 14460 posts with rating 12470 , helped 650 times. Been with us since 2014 year.

Comments

szeryf3 30 Aug 2024 10:34

Super project. [Read more]

p.kaczmarek2 30 Aug 2024 10:45

Thanks, then I'll add a handful more loose information. The project compiles on the following platforms: https://obrazki.elektroda.pl/3711576500_1725007421_bigthumb.jpg . But the IR may be missing... [Read more]

TechEkspert 30 Aug 2024 22:41

Nice end result, I wonder if hiding the display behind the milky plexiglass would have the effect of smoothing out the displayed characters. [Read more]

FAQ

TL;DR: This DIY build combines 5 main hardware blocks and, as the author says, "does the job well" for makers who want one Wi‑Fi device to show time, calendar-style data, temperature, humidity, and receive IR commands. It solves local display plus smart-home control with OpenBeken, Home Assistant Discovery, MQTT, NTP, and HTTP GET actions from one WB2S board. [#21209171]

Why it matters: It shows how to turn a spare BK7231T/WB2S module into a practical smart display and IR bridge without writing YAML or depending on Home Assistant for every action.

Option Output voltage Packaging / build note Fit in this project
MIC29150 3.3WU 3.3 V SMD package; author used it successfully Installed on the prototype board
AMS1117-3.3 3.3 V Regular alternative mentioned by author Would also fit

Key insight: The most important takeaway is that the IR receiver is not just for reporting codes. OpenBeken can map remote buttons to local HTTP GET commands, so the clock can control other OpenBeken or Tasmota devices even without Home Assistant.

Quick Facts

  • The hardware stack uses a WB2S Wi‑Fi module with BK7231T, a MAX7219 matrix LED display, a DHT11 sensor, an IR receiver, a photoresistor, and a 3D-printed PLA enclosure. [#21209171]
  • OpenBeken pin use in this build is explicit: P6 = DHT11, P23 = ADC photoresistor, and P24 = IR receiver; DHT11 channels are 1 for temperature and 2 for humidity, while the ADC uses channel 0. [#21209171]
  • The startup script enables MAX72XX, NTP, and MAX72XX_Clock, then sets ntp_timeZoneOfs 2 so the display shows internet time and rotates sensor readings. [#21209171]
  • The enclosure is a two-part design printed on an Ender 3 Pro in PLA, and the author suggests a future PCB could fit the cheap 10 cm × 10 cm board size tier in China. [#21209171]
  • Some OpenBeken build platforms may miss IR support because the IRLibrary port needs a 50 us interrupt, while MAX display drivers must be included at compile time for this project. [#21209205]

How do I build a DIY clock/calendar/thermometer/hygrometer on a WB2S (BK7231T) using a MAX7219 display, DHT11 sensor, IR receiver, and photoresistor?

Build it around a WB2S module, a MAX7219 matrix display, a DHT11, an IR receiver, a photoresistor on ADC, and a 3.3 V LDO. 1. Assemble the prototype on perfboard and map every GPIO before wiring. 2. Add the two-part PLA enclosure and fit the display first. 3. Flash OpenBeken, assign pin roles, and start MAX72XX, NTP, and the clock script. The finished device alternates internet time with DHT11 measurements and can forward IR commands to other smart devices. [#21209171]

What is OpenBeken, and how does it help a BK7231T-based DIY device work with Home Assistant and MQTT?

OpenBeken is firmware that lets a BK7231T device expose configurable drivers, scripting, web setup, and smart-home integration without recompiling for every change. "OpenBeken" is custom firmware that runs on BK7231T-class Wi‑Fi modules, replaces vendor software, and adds pin-role setup, scripting, NTP, MQTT-friendly integration, and local automation features. In this project, it continuously reports measurements to Home Assistant, can forward received IR codes to HA, and can also act locally through HTTP GET commands without HA. [#21209171]

How do I flash OpenBeken onto a WB2S or BK7231T module with BK7231GUIFlashTool?

Use BK7231GUIFlashTool and follow the linked OpenBeken flashing instructions. 1. Connect the WB2S/BK7231T module for flashing. 2. Use BK7231GUIFlashTool with the proper OpenBeken firmware. 3. Verify boot, then configure pins and scripts in the web panel. The author says the process was done exactly per the tool instructions and also points to Elektroda YouTube flashing tutorials for guidance. [#21209171]

Which GPIO pins were used in this WB2S clock project for the DHT11, ADC photoresistor, IR receiver, and MAX7219/MAX72XX display?

This build uses P6 for the DHT11, P23 for the ADC photoresistor, and P24 for the IR receiver. The MAX72XX setup line is MAX72XX_Setup 0 1 26, which shows the display driver was configured on three GPIO-related values: 0, 1, and 26. The author also created a separate GPIO map during assembly to avoid losing track of the WB2S pinout on the prototype board. [#21209171]

How do I configure OpenBeken pin roles and autoexec.bat so a MAX72XX clock starts NTP and shows DHT11 temperature and humidity readings?

Set the DHT11 on P6, ADC on P23, IR on P24, then start the display and time services in autoexec.bat. The exact startup shown is startDriver MAX72XX, MAX72XX_Setup 0 1 26, startDriver NTP, startDriver MAX72XX_Clock, and ntp_timeZoneOfs 2. Temperature is bound to channel 1, humidity to channel 2, and the ADC photoresistor to channel 0, so the web panel and display logic can use live sensor data. [#21209171]

What is the MAX72XX driver in OpenBeken, and why does it need to be included at compile time for a MAX7219 display project?

The MAX72XX driver is the OpenBeken display driver that lets the firmware talk to the MAX7219-class LED matrix hardware used in this clock. "MAX72XX" is a display-driver class that controls LED matrix or segment modules through a dedicated serial interface, and OpenBeken needs that driver compiled in before the firmware can start and use the display. The author states a standard GitHub OpenBeken build will not support this project out of the box unless the MAX display drivers are included during compilation. [#21209205]

How can I use IR remote codes in OpenBeken to trigger HTTP GET requests and control Tasmota or other OpenBeken devices without Home Assistant?

Map each IR code to an alias that sends an HTTP GET command. In the shown setup, Samsung IR codes such as 0x707 0x4, 0x5, and 0x6 trigger aliases like power off or dimmer changes on other devices at 192.168.0.200, 192.168.0.159, and 192.168.0.210. That lets the clock act as a local IR-to-network bridge, so a handheld remote can control OpenBeken or Tasmota targets even when Home Assistant is not involved. [#21209171]

Why might IR support be missing on some OpenBeken build platforms, and what does the 50us interrupt requirement mean for the IRLibrary port?

IR may be missing because some build targets do not provide the timing hook the IR library expects. The author says IR support can be absent on those platforms because you would need to plug a 50 us interrupt into the IRLibrary port. That means the firmware needs a periodic timing source at 50 microseconds to sample or decode incoming IR pulses correctly; without it, the display project can still compile, but IR reception may not work. [#21209205]

WB2S/BK7231T vs ESP modules: which is better for a DIY Wi-Fi clock with sensors, IR reception, and Home Assistant integration?

WB2S/BK7231T is the better fit here if you want to test OpenBeken features on hardware you already have. The author chose WB2S because several spare modules were available after users replaced them with ESPs, and because the project doubles as a test platform for new firmware peripherals. He also openly calls these Wi‑Fi modules “exotic,” so the choice is practical for firmware development rather than a claim that BK7231T universally beats ESP. [#21209205]

MIC29150 3.3WU vs AMS1117-3.3: which 3.3 V regulator is a better fit for a small BK7231T prototype board?

Both fit this prototype because both are 3.3 V regulators, but MIC29150 3.3WU is the proven choice in the shown build. The author actually installed a MIC29150 3.3WU in an SMD package and notes that a regular AMS1117-3.3 V would also fit. If you want to copy the thread exactly, use MIC29150; if you want an easier drop-in alternative, AMS1117-3.3 is the stated fallback. [#21209171]

What is Home Assistant Discovery, and how does it automatically add an OpenBeken device without writing YAML?

Home Assistant Discovery is the auto-pairing mechanism that lets Home Assistant detect and create entities for compatible devices automatically. "Home Assistant Discovery" is an integration mechanism that announces device capabilities to Home Assistant so sensors and controls appear automatically, without manual YAML definitions or custom entity files. In this project, the author says Discovery paired the OpenBeken device correctly with HA and required not a single line of YAML. [#21209171]

How do I make a photoresistor voltage divider on the WB2S ADC input to auto-adjust MAX7219 display brightness based on ambient light?

Connect the photoresistor and a simple resistor as a voltage divider, then feed the divider into the WB2S ADC on P23. The author states that P23 is used for the ADC, the associated channel is 0, and the light sensor exists specifically to adjust display brightness according to external lighting. Keep the wiring simple and stable, because the design uses raw perfboard construction rather than a dedicated PCB with controlled analog routing. [#21209171]

What are the best practices for soldering a WB2S module onto prototype perfboard without lifting pads or losing track of the pinout?

Use low soldering temperature, add a GPIO map early, and break the build into testable stages. The author warns that on these prototype boards the solder pads can fall off if the temperature is too high, and he created a GPIO map during assembly so future servicing would not become confusing. He also brought out extra pads on the back of the WB2S, including UART2, which helps later rework or reuse as simple GPIO. [#21209171]

How should I design and 3D-print a two-part PLA enclosure in Blender for a MAX7219 clock project on an Ender 3 Pro?

Design it as a two-part shell where the display mounts to the base and the top slides over it. The author modeled the enclosure in Blender, printed it in PLA on an Ender 3 Pro, and used repeated test fits before final assembly. He notes that plastic spacers were glued in for this prototype, but a cleaner next revision would include those mounts directly in the 3D model or move to a dedicated PCB with built-in mounting points. [#21209171]

What effect would putting a MAX7219 matrix display behind milky plexiglass have on character smoothing, readability, and brightness?

It would likely smooth the displayed characters, but the thread does not confirm the brightness tradeoff with a measured test. A commenter specifically wondered whether hiding the display behind milky plexiglass would smooth the character appearance, which makes it a plausible enclosure refinement for the next prototype. The practical limitation is clear: this is a suggestion from the discussion, not a tested result shown in the build photos or script. [#21209947]
Generated by the language model.
%}