logo elektroda
logo elektroda
X
logo elektroda

Twin BL0942 mod - Two BL0942 on two UARTs on one power metering device

XJ_ 1818 8
ADVERTISEMENT
📢 Listen (AI):
  • Energy consumption monitoring module with sensors and mobile app.

    This is an interesting device that has two separate power measurement circuits. It can be now run without cloud, in OpenBeken.

    I added support (version 1.18.17) for measuring devices with two BL0942 connected to UART1 and UART2 (Beken).

    Currently, energy is always counted only from the first BL0942, the second one is informatives and values are not counted in main energy. In the future, the option of counting energy from UART1 and UART2 together could be added.
    For HASS (MQTT), the second one reports with the suffix _b.

    To use this feature, code must be compiled with flag ENABLE_BL_TWIN enabled in obk_config.h (or using compiler directive)

    Code: C / C++
    Log in, to see the code


    See related topic for online builds: https://www.elektroda.com/rtvforum/topic4033833.html

    To activate function, there is a new command BL0942opts [value]
    The meaning of the value is simple (bit0 = UART1, bit1 = UART2)
    0 - default (as before this modification), one BL0942 on the port according to flag 26 (as the main one, with energy)
    3 - two BL0942 on the UART1 and UART2 ports, UART1 is taken as the main one (with energy calculation) and the second as informative (without energy)

    When working with both ports, I recommend disabling logging on UART.

    To activate the twin BL mode, you need to add the following to autoexec.bat

    logtype none
    BL0942opts 3
    startDriver BL0942
    


    WebUI using two BL0942:
    Display with electrical energy data.

    Flashing instructions:

    Always use an external power supply [3V3] to ensure sufficient power. As bonus, on most devices you don't need to connect the CEN pin and just turn off/on to start flashing.

    1. Connect the CBU module to the USBTTL converter using the CBU pins:

    VCC , GND , RX1 , TX1

    Electronic module highlighting RX1, TX1, RX2, TX2, GND, and VCC connections.

    2. Backup the original using BK7231Flasher.exe
    - select the correct com port + speed (my USBTTL converter works fine up to 1500000 baud for BK7231N)
    - processor set type BK7231N
    - read backup
    - on / off - reading flash will start

    3. Compile your own flash for BK7231N with the ENABLE_BL_TWIN flag enabled
    - save the compiled bin to the BK7231Flasher.exe folder with the firmware

    4. Upload a new flash using BK7231Flasher.exe
    - select correct com + speed 1500000
    - processor set type BK7231N
    - select compiled bin (the one with ENABLE_BL_TWIN enabled)
    - flash backup write
    - on / off - flash write starts

    4. BK7231Flasher.exe - Change OBK settings for flash write
    - set SSID+pass
    - write only OBK configuration
    - on / off - obk config write starts

    This is my "How do I that"
    Electronic circuit with sensors placed on a metal tray

    Using "spring contacts" pins without soldering.

    Circuit board with connected wires and electronic components.

    Develop forum topic {history}: https://www.elektroda.com/rtvforum/topic4086343-90.html

    Cool? Ranking DIY
    About Author
    XJ_
    Level 11  
    Offline 
    XJ_ wrote 135 posts with rating 32, helped 11 times. Been with us since 2024 year.
  • ADVERTISEMENT
  • #2 21457296
    p.kaczmarek2
    Moderator Smart Home
    Thank you for presentation and implementation! That's the spirit of the open source.

    Very interesting device. What is the use case for such dual power measurement?

    And what is the price of this device, is it cheaper than buying two separate BL0942 power metering devices?
    Helpful post? Buy me a coffee.
  • #3 21457428
    XJ_
    Level 11  
    p.kaczmarek2 wrote:
    Very interesting device. What is the use case for such dual power measurement?

    PM

    Added after 3 [minutes]:

    p.kaczmarek2 wrote:
    And what is the price of this device, is it cheaper than buying two separate BL0942 power metering devices?


    It was cheaper, a device with one is about 14USD, with two 16USD (discounted)
    actually, https://www.aliexpress.com/item/1005007938950273.html


    Tuya Smart Life WiFi energy meter with two sensors on a white background.

    Added after 1 [minutes]:

    p.kaczmarek2 wrote:
    Thank you for presentation and implementation! That's the spirit of the open source.


    Red heart emoji.
  • ADVERTISEMENT
  • #4 21457530
    p.kaczmarek2
    Moderator Smart Home
    I see, so price is actually very good. It makes it useful for various energy-metering purposes, like figuring out which phase uses the most of electricity, which can be later useful to reduce that reduction.

    It also certainly saves some space in the box.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 21459166
    _Arecki_
    Level 15  
    p.kaczmarek2 wrote:
    it is useful for various energy measurement purposes, such as finding out which phase is using the most electricity
    .
    Different phases are probably hard to measure, or at least accurately, as there is only one voltage input. So it could well measure the energy consumption of two consumers on one phase.
    And this is probably what the manufacturer suggests.

    Twin BL0942 mod - Two BL0942 on two UARTs on one power metering device .
  • #6 21459474
    XJ_
    Level 11  
    _Arecki_ wrote:
    Different phases are probably hard to measure,

    Sure, that's why I use three devices. Each one is on one phase.
    On each of them, the main BL0942 /UART1/ measures the total power consumption of that particular phase. The second BL0942 /UART2/ on the same phase, for measuring the heating consumption. That way I get the total consumption plus informatively how much of that it is the heating.

    For those who don't know, one device with two measuring clamps CANNOT be used to measure two phases (it would give a meaningless power factor).
  • #7 21459616
    p.kaczmarek2
    Moderator Smart Home
    Correct, I meant it's good for two different devices, not phases. This device is single phase only.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #9 21462442
    XJ_
    Level 11  
    groove6j wrote:
    Great job! Works well!

    Thanks
📢 Listen (AI):

Topic summary

The discussion revolves around the implementation of dual BL0942 power measurement circuits on a single device, allowing for energy monitoring without cloud dependency through OpenBeken firmware. The user has integrated support for two BL0942 chips connected to separate UARTs, but currently, only the first chip's energy readings are counted. Future updates may enable combined energy counting. The device is priced competitively at approximately $16 for dual measurement compared to $14 for a single unit, making it suitable for various applications, such as monitoring energy consumption of different devices on the same phase. However, it is noted that accurate phase measurement is limited due to a single voltage input. Users have shared insights on using multiple devices for comprehensive phase monitoring and offered to share custom firmware builds for those who prefer not to compile their own.
Summary generated by the language model.
ADVERTISEMENT