logo elektroda
logo elektroda
X
logo elektroda

Flashing OpenBeken Firmware on WL2S Module with Lightning LN882HK Chip for ELIVCO LSPA9

sithyoda 33840 180
ADVERTISEMENT
  • #151 20921508
    p.kaczmarek2
    Moderator Smart Home
    What do you mean by A0?

    We've pushed a new version that shows the temperature of WiFI module from the internal ADC, the temperature is displayed on the main HTTP page.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #152 20921518
    divadiow
    Level 35  
    Pinout:
    A0 - S2 output (pulled up to 3.3V by a resistor)
    A1 - relay
    B3 - LED
    B8 - button

    vs no A0 on the Elivco one

    Added after 44 [seconds]:

    >>20921508

    excellent. will update
  • #153 20921551
    p.kaczmarek2
    Moderator Smart Home
    It's a TglChannelOnToggle, it's used to connect external switch.
    Helpful post? Buy me a coffee.
  • #155 20921637
    tarwirdur
    Level 4  

    >>20920589

    I've uploaded 6 builds ((BLE/NO_BLE) * (NO_POWERSAVE/MIN_POWERSAVE/MAX_POWERSAVE))
    https://litter.catbox.moe/y9s2le.zip (The link will be available for 3 days)

    $ md5sum builds.zip
    f97adfee208fc6320430b2578d7d3f7d builds.zip
  • ADVERTISEMENT
  • #156 20922021
    divadiow
    Level 35  
    >>20911994


    template updated to add TglChanOnTgl;0

    tested. same unit as GUTEK. please update device in list

    Visible are components of an electrical installation: a light switch, a bulb with a holder, and a mini smart switch.
  • #157 20922270
    p.kaczmarek2
    Moderator Smart Home
    @divadiow thank you for correction, I've added missing A0 to the template:
    https://github.com/OpenBekenIOT/webapp/commit/bb7ecd3d066fb0782d608d73d64052430d73d79c
    Helpful post? Buy me a coffee.
  • #158 20923632
    divadiow
    Level 35  
    >>20921637

    Thanks. What is the significance of BLE /NO BLE?
  • Helpful post
    #159 20923666
    @GUTEK@
    Level 31  
    >>20921637
    I tested these builds by uploading via OTA. This is more indicative because I measured it with a wattmeter plugged into the socket. More accurate measurements would mean I would have to desolder the system again and connect it to the power supply. I can only do this on the weekend.
    So the measurements look like this:
    NO_BLE_NO_POWERSAVE - 0.6W; LN temp: 50.984253
    NO_BLE_MIN_POWERSAVE - 0.4/0.3W; LN temp: 41.141731
    NO_BLE_MAX_POWERSAVE - 0.4/0.3W; LN temp: 39.960632
    NO_POWERSAVE - 0.6W; LN temp: 56.102364
    MIN_POWERSAVE - 0.4W; LN temp: 43.503937
    MAX_POWERSAVE - 0.4W; LN temp: 42.322834
    Where it is 0.4/0.3W, the wattmeter simply showed such values alternately. The temperatures are also approximate because you would have to leave the system for a few minutes to stabilize.
  • ADVERTISEMENT
  • #161 20924029
    p.kaczmarek2
    Moderator Smart Home
    Please open a pull request if you believe that the following setting may help reduce energy usage.
    Helpful post? Buy me a coffee.
  • #162 20924334
    ksichu
    Level 10  
    Hello everyone, if I may join the discussion:
    I have a Cozylife Wifi Smart Switch based on LN882H
    https://pl.aliexpress.com/item/1005006088242391.html
    [in the pick3&save promotion it was for $2 ;) ]

    I loaded the MAX_POWERSAVE firmware from https://litter.catbox.moe/y9s2le.zip
    My measurements [of the desoldered system] look like this:

    firmware; MAX_POWERSAVE
    I-min...I-max: 55--95mA;
    temp [max]: 28*C
    voltage: 3.3V
    power min-max: 0.1815--0.3135W

    So the maximum power consumption during operation is 0.3W at a temperature of about 27*C
    Charged from an hour simultaneously by [ping -t] and toggle every 1 second.
    Pretty good.

    Therefore, it seems that the system itself works stably and does not heat up.
    Maybe it`s a relay or a poor power supply that is responsible for the heating of the whole thing?

    Added after 4 [hours] 24 [minutes]:

    After soldering the module to the switch and closing the housing, the temperature jumped to 40-45*C within a few minutes.
    Evidently, it is not the LN882 chip itself that heats up, but the rest of it [mainly the power supply and the relay, and of course the casing also does its job].

    I doubt this can be corrected by firmware ;)
  • #163 20926594
    tarwirdur
    Level 4  

    >>20924029
    I've created PR: https://github.com/openshwprojects/OpenLN882H/pull/4

    Why powersave=1 is not the default option for OpenBK7231T_App?

    > Temperature is not a good measurement.

    @p.kaczmarek2, debatable. Power consumption is not constant and it is not very correct to estimate energy by what the ammeter shows at a moment in time. While temperature integrates consumption over time.
    ___

    @ksichu, how do you measure temperature? In the room? On the chip itself?
    With a thermal imager, I see ~50C on the chip with an external power supply (NO_BLE, MIN_POWERSAVE). Current consumption is between 50 and 65 mA.

    > Maybe it's a relay or a poor power supply that is responsible for the heating of the whole thing?

    According to the oscilloscope, the original power supply produces a normal output (3v3 with bursts not exceeding 150mV in amplitude). Checked with and without the board.
  • #164 20926814
    p.kaczmarek2
    Moderator Smart Home
    tarwirdur wrote:

    Why powersave=1 is not default option for OpenBK7231T_App?

    There have been up to 3 powersave-related issues reported so far:
    - BL0937 power metering sockets lose their precision on powersave devices because BL0937 works by BK counting pulses on CF/CF1 pins
    - IR send/receive is said to work worse on BL0937 for the similiar reasons
    - there have been also some kind of early report that PowerSave broke something for one particular user but I don't know much about it
    Related issue:
    https://github.com/openshwprojects/OpenBK7231T_App/issues/678
    Screenshot of a comment by user valekCN on GitHub reporting an issue with the BK7231N device freezing after activating power saving mode.
    Helpful post? Buy me a coffee.
  • #165 20929675
    ksichu
    Level 10  

    @tarwirdur
    The given temperature is read from the firmware.
    Screenshot of OpenLN88 interface displaying a temperature of 26.181103°C.
    I also tried contact measurement on the chip itself using ds18b20.
    It comes out a bit more [max 28.5°C].
    [Battery powered + AMS1117 LDO 3.3V]

    After assembly and power supply from 230V, the temperature quickly reaches 45°C.

    The difference is clear, the conclusions are quite obvious ;)
  • #166 20932703
    divadiow
    Level 35  
    >>20773678

    I have this device now too. Shall I make a new post with opening and flashing experience @p.kaczmarek2 or just post OBK template here when I have flashed it? I like adding to the device list, especially new LN882 😀

    Added after 13 [minutes]:

    Well, similar, mine is labelled BSD34 not LSPA9, but it does have WL2S.
  • #167 20932716
    p.kaczmarek2
    Moderator Smart Home
    If you can make single comprehensive guide (you can link to my tutorials there), then please open a separate topic.
    Helpful post? Buy me a coffee.
  • #168 20935013
    divadiow
    Level 35  
    >>20919413

    did anyone get any further with driver subsystem and BL0937 support?
  • #169 20935788
    divadiow
    Level 35  
    sweetlilmre wrote:
    The script will dump until it errors. I thought there was 4MB flash on these units, possibly it's wrapping or doing something strange.
    You can always specify a range parameter eg 0x200000 for the script.


    thinking about this again @sweetlilmre the flash size specified in the py is 0xFFFFFFFF. which is 4GB rather than 4MB. was that a high number you picked to be sure it got to the end of any flash size or was it to be 0x400000?

    anyway, I've used 0x200000 and the dump completes with an OK rather than an error.
  • #170 20935841
    sweetlilmre
    Level 9  
    divadiow wrote:

    Thinking about this again @sweetlilmre, the flash size specified in the py is 0xFFFFFFFF, which is 4GB rather than 4MB. Was that a high number you picked to be sure it got to the end of any flash size, or was it supposed to be 0x400000?

    Anyway, I've used 0x200000 and the dump completes with an OK rather than an error.


    Yes, exactly. 0xFFFFFFFF was "read until it breaks". 0x200000 is the correct value for these devices.
    I will amend the script to default to that and put it in GH.

    -(e)

    Added after 17 [minutes]:

    Updated flash dump tool now lives here:
    https://github.com/sweetlilmre/ln882h/blob/master/project/OpenBeken/LN882H_Flash_Dumper.py

    I will update the original post.

    -(e)


    Added after 21 [minutes]:

    tarwirdur wrote:

    >>20924029
    I've created PR: https://github.com/openshwprojects/OpenLN882H/pull/4

    Why powersave=1 is not the default option for OpenBK7231T_App?

    > Temperature is not a good measurement.

    @p.kaczmarek2, debatable. Power consumption is not constant and it is not very correct to estimate energy by what the ammeter shows at a moment in time. While temperature integrates consumption over time.
    ___

    @ksichu, how do you measure temperature? In the room? On the chip itself?
    With a thermal imager, I see ~50C on the chip with an external power supply (NO_BLE, MIN_POWERSAVE). Current consumption is between 50 and 65 mA.

    > Maybe it's a relay or a poor power supply that is responsible for the heating of the whole thing?

    According to the oscilloscope, the original power supply produces a normal output (3v3 with bursts not exceeding 150mV in amplitude). Checked with and without the board.


    Hi,

    Before I merge this, I'd like to find out what @p.kaczmarek2 thinks of completely disabling BLE.
    We can also implement the power saving option in the firmware and let users test, perhaps combining the BLE code with the wifi power save mode.

    FYI: My board is also rock solid at max 30C outside of circuit.

    -(e)
  • ADVERTISEMENT
  • #171 20935982
    p.kaczmarek2
    Moderator Smart Home
    Of course we can completly disable BLE, we are not using it currently. Why it was even on in the first place?

    We also need to add missing interrupts counter for BL0937 support, here:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/driver/drv_bl0937.c
    Here is the snippet that must be extended:
    C program code with GPIO interrupt handling for different platforms.
    I think I've found an enumeration for that:
    Code: C / C++
    Log in, to see the code

    It seems like we could use this code to support BL0937:
    Code: C / C++
    Log in, to see the code
    Helpful post? Buy me a coffee.
  • #172 20937215
    p.kaczmarek2
    Moderator Smart Home
    I have merged @tarwirdur 's PR:
    https://github.com/openshwprojects/OpenLN882H/commit/ac23d690a773d49a04ec526591b5822c3b8da7c8
    That's the one that disabled BLE clock.
    Helpful post? Buy me a coffee.
  • #173 20968262
    sithyoda
    Level 7  

    It seems that BL0937 driver was finally implemented and power measurement works now as well.
    So my LN882H based LSPA9 works with "all features".
    A big THX to all implementers and tester! Really awesome work.
  • #174 20970212
    anatoliymayorov
    Level 1  

    hello everyone! Kozilink has too crooked functionality in the on and off program compared to tuya. Is it possible to reprogram it for thuja?
  • #175 20972523
    p.kaczmarek2
    Moderator Smart Home
    Which device? Do you have a device with Tuya firmware with matching functionality and GPIO?
    Helpful post? Buy me a coffee.
  • #176 21168271
    Dark Man
    Level 13  
    Hi
    I too have come across a socket with an LN882HKI chip on a WL2S module.
    Elivco brand socket supposedly 20A and relay only 16A WL2S module on a circuit board with LN882HKI chip PCB board of Elivco socket with LN882HKI chip Close-up of an electronic module with PCB and relay. .

    I uploaded the firmware with the Chinese GUI software at a speed of 115200.

    The configuration is almost good (about that below):
    Code: JSON
    Log in, to see the code
    .

    The problem with the configuration is the Relay setting.
    In the REL setting, on relay on mode the red LED does not light, and on REL_n mode, the red LED lights up with the relay on but the status in OpenBeken is OFF (a status swap would be needed).
  • #177 21168472
    p.kaczmarek2
    Moderator Smart Home
    Or is it simply enough to replace the LED with LED_n?
    Helpful post? Buy me a coffee.
  • #178 21171167
    Dark Man
    Level 13  
    You're right, stupid me didn't realise I had a separate LED channel here for relay status information, because 99% of the sockets I had only had one LED channel, and the eventual LED was connected to the relay.
    A propo. Have you perhaps solved the situation of one LED simply, for WiFi status info and at the same time for relay status as it is on the Tasmota?
  • #179 21177081
    p.kaczmarek2
    Moderator Smart Home
    We have a script for this here:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    Does it meet your requirements?
    Script for LED acting like WiFi state LED during connecting to network but like Relay state LED when online .
    
    
    alias mode_wifi setPinRole 10 WifiLED_n
    alias mode_relay setPinRole 10 LED_n
    
    // at reboot, set WiFiLEd
    mode_wifi
    // then, setup handlers
    addChangeHandler WiFiState == 4 mode_relay 
    addChangeHandler WiFiState != 4 mode_wifi 
    
    Helpful post? Buy me a coffee.
  • Helpful post
    #180 21178840
    locky76
    Level 1  
    Hi all!
    My template, which completely repeats the functionality of the factory firmware. For ELIVCO LSPA9.
    
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Full Device Name Here",
      "model": "enter short model name here",
      "chip": "LN882H",
      "board": "TODO",
      "flags": "1024",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "0": "LED_n;0",
        "3": "Btn;0",
        "7": "BL0937CF1;1",
        "10": "WifiLED_n;0",
        "11": "Rel;0",
        "12": "BL0937CF;0",
        "19": "BL0937SEL;0"
      },
      "command": "backlog startDriver BL0937; PREF 1.2; VREF 0.124868; IREF 0.010548",
      "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }
    

Topic summary

The discussion revolves around flashing OpenBeken firmware on the ELIVCO LSPA9 module, which utilizes the WL2S microcontroller and the LIGHTNING LN882HK chip. Users share their experiences with UART and JTAG flashing methods, debugging issues, and the challenges of obtaining and compiling the necessary firmware. Several users successfully managed to flash the firmware, enabling functionalities such as WiFi connectivity and relay control. The conversation also touches on power consumption, temperature management, and the implementation of power-saving features. Additionally, users discuss the integration of the BL0937 power metering chip and the development of a comprehensive template for the device.
Summary generated by the language model.
ADVERTISEMENT