Elektroda.com
Elektroda.com
X

Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N

Ipn00tic 2445 11
  • 54 / 5 000
    Resultados da tradução
    Hello friends,

    I know very little about programming and linux but I have some skills with soldering components but I decided to build a smart house that works locally without internet access, so I started researching and ordered the first product: Smart Plug GIRIER 16A JR- PM01 16A Energy Monitoring.
    I was going to put the Tasmota firmware because it was the only one I knew but the equipment came with the CB2S / BK7231N chip and I had to research better until I reached this magnificent project.

    As I'm a beginner I'll try to explain what I managed to do in a beginner's language, I apologize to the experienced ones.

    I bought this smart plug on aliexpress from this seller: Link

    It was the first one I opened and it was difficult to open because it seems that in addition to the fitting it is closed with some glue.
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N


    We need to use the hid_download_py program to write to CB2S: Link
    To use this program it is necessary to install Python first.
    We need "OpenBK7231N_QIO_1.15.70.bin" or newer firmware from this link: Link
    Create a folder named "py" in c: and copy the files from
    hid_download_py to root of "py" folder.
    Run the install.bat file to install some necessary dependencies.
    Copy the new firmware file "OpenBK7231N_QIO_1.15.70.bin" also to the root of the "Py" folder

    I used this programmer PL-2303HX:
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N
    connect the programmer to the computer and install the drivers, ensure the correct drivers are installed.
    I use windows 10 and I had problems with the drivers, it is necessary to install the 3.3.2.105 driver manually as shown in these videos:
    https://www.youtube.com/watch?v=vsb2k1etImg
    https://www.youtube.com/watch?v=Y7JmCKCovMI

    I powered it directly from the computer's USB port using the programmer, I connected +5v and GND from the programmer's USB port to the Smart Plug at the points labeled +5V and GND as in the pictures.
    The red +5v power wire should be able to connect and disconnect easily, I recommend using an ON/OFF switch
    (I used an alligator clip as shown in the photo) because it will be necessary during the procedure to cut the power supply and reconnect.

    I connected it with the white and green wires
    TX from programmer to RX from chip (White wire)
    RX from programmer to TX from chip ( Green wire)
    ( the yellow wire that appears in the photo was not used in this case )
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N

    After all the connections have been made and the programmer is connected to the computer, open the Windows CMD and point to the "C:\py" folder and execute the command:
    python uartprogram C:\py\OpenBK7231N_QIO_1.15.70.bin --unprotect -d com4 -w --startaddr 0x0
    ( attention, see which port is being used by the programmer and change the command, if yours is port 3 change the command from "com4" to com3 )
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N
    When the message "Getting Buss.. : |" appears
    you have to disconnect (or use a button) the +5v power supply and reconnect, when you do that the program continues and will program the chip.
    Example of successful programming:
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N

    If it went well, you can unsolder and disconnect the wires from the board.
    Mount the smart plug and connect it to the electrical plug, a wifi network similar to the SSID OpenBK7231xxxxxx will appear, connect to that network and open the configuration by pointing the browser to 192.168.4.1
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N
    go to "config" then "configure wifi" and configure your wifi (don't make the mistake of writing your SSID and Password).
    Once configured, connect to your network that you just configured and try to find out which IP was assigned to the smart plug.
    Enter the assigned IP to access the settings again and go to "launch app Application" then in devices chipset choose "BK7231N" and in device choose ELIVCO LSPA9 Power Metering Plug (it was compatible with my GIRIER)
    Add in PIN 8 "LED" and "1"
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N

    I don't know if the sensors are all working properly but I was able to install this magnificent firmware and connect to the Home assistant and control the relay remotely without internet access.

    I will buy one more device, wall switch and try to do the same.

    A big thank you to everyone who develops the project and helps to develop it by sharing your knowledge.
    I'm sure this project will grow a lot and I want to help with what I can.

    Thanks to all participants, it was thanks to tips from several topics in this forum that I was able to make this work.

    Despite having been successful, I had many difficulties, I realize that it is a mature project and there are not many tutorials, what exists is very technical for beginners but I see a great future here !!


    PS: excuse my english, I'm using a translator. I am Portuguese

    Thanks

    Cool? Ranking DIY
    About Author
    Ipn00tic
    Level 7  
    Offline 
    Ipn00tic wrote 17 posts with rating 5. Been with us since 2020 year.
  • #2
    p.kaczmarek2
    Moderator Smart Home
    Thank you for your report, it turned out great, even with the use of translator. Translators are very good these days.

    By the way, have you looked into using more advanced stats of power consumption?
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N
    For those starts you need to get NTP running as well. "startDriver NTP" in short startup command (use backlog if you want to have multiple commands there, eg. backlog commandA; commandB; commandC;)
  • #3
    Ipn00tic
    Level 7  
    p.kaczmarek2 wrote:
    Thank you for your report, it turned out great, even with the use of translator. Translators are very good these days.

    By the way, have you looked into using more advanced stats of power consumption?
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N
    For those starts you need to get NTP running as well. "startDriver NTP" in short startup command (use backlog if you want to have multiple commands there, eg. backlog commandA; commandB; commandC;)


    When I select the equipment from the compatible list included in the "ELIVCO LSPA9 Power Metering Plug" firmware, it should have done this configuration automatically.

    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N

    The values for voltage, amperage and consumption appear without any further configuration needed, but the values are a little out of line with the actual values. it is not calibrated to 100% but it is very close to the real one.
    I don't know how to calibrate the BL0937

    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N

    I didn't find information about "NTP" but I don't think it will be necessary because the smart plug is working correctly, it just deserved a better calibration on the BL0937
  • #4
    p.kaczmarek2
    Moderator Smart Home
    NTP time and extra power metering functionalities are not necessary, so they are not enabled by default.

    It is strongly advised to calibrate the plug. You are using default values which are not perfect for your exact device.

    Please get a reliable power meter, plug the 60W bulb into the socket, and use following commands to adjust readings:
    - VoltageSet [RealVoltageFromReliableMeter]
    - CurrentSet [RealCurrentFromReliableMeter]
    - PowerSet [RealPowerFromReliableMeter]
    Just like in Tasmota.

    With the latest update, the calibration results will be autosaved in device memory. You don't need to manually enter them in autoexec.bat anymore
  • #5
    Ipn00tic
    Level 7  
    I already enabled NTP in autoexe.bat
    I'm able to calibrate through the backlog using VoltageSet ; Power set ; CurrentSet but when I restart or disconnect the smart plug and reconnect it loses calibration.
    Firmware is updated via OTA to the latest available.
  • #6
    p.kaczmarek2
    Moderator Smart Home
    You most likely have the old commands for setting calibration in "Short startup commands" and they overwrite your calibration. Please remove "VRef" etc etc commands from "Short startup command" and from "autoexec.bat"
    I mean, those commands:
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N
  • #7
    enbollo
    Level 2  
    Good afternoon.
    Thank you for your input, it was very helpful in flashing my device. It worked perfectly.
    Now I would be interested in being able to activate my device through Echo Alexa.
    I have other devices flas with Tasmota and on them I simply have to enable the "Belkin WeMo Emulation" option.
    Evidently this option is not available in OpenBeken, but I have tried through the console using the command "Emulation 1".
    It has not worked, would you know any way to activate this option to be able to control my device through Echo Alexa.
    Thank you, best regards.

    Translated with www.DeepL.com/Translator (free version)
  • #8
    p.kaczmarek2
    Moderator Smart Home
    Hello @enbollo ,
    I have looked at the Belkin protocol and it seems relatively simple.
    I think I could add it for you.
    However, can you specify two things:
    1. do you need that protocol only to turn off/on devices, or does it also can control color?
    2. Do you know any way or guide how to quickly test that Belkin protocol? I have never used it before and I will have to do my research about that, but maybe you can show me the good direction.
  • #9
    enbollo
    Level 2  
    Good morning.
    Thank you for your quick response.
    As you say, I would only use it to turn the device off and on. I don't know any guide that can help you, sorry, my thing is electronics, I don't have much idea about programming.
    I just followed your guide I worked the first time.
    Thanks and regards.
  • #10
    xenonscrinium
    Level 3  
    Hello I have tuya plug like in the first post.
    Smart Plug GIRIER JR-PM01 16A Energy Monitoring CB2S / BK7231N
    My config:
    {
    "vendor": "Tuya",
    "bDetailed": "0",
    "name": "Full Device Name Here",
    "model": "enter short model name here",
    "chip": "BK7231N",
    "board": "TODO",
    "flags": "1024",
    "keywords": [
    "TODO",
    "TODO",
    "TODO"
    ],
    "pins": {
    "6": "BL0937CF1;0",
    "7": "BL0937CF;0",
    "8": "Rel;0",
    "10": "WifiLED;1",
    "11": "BL0937SEL;0"
    },
    "command": "",
    "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
    "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }
    But hard button doesn't work. I tried pin 10 with channel 0 and 1 and no result.
    What pins should I try?
  • #11
    p.kaczmarek2
    Moderator Smart Home
    If Relay is on channel 0, then you should set button on channel 0.

    The only question is - which GPIO is the button?

    You can try guessing, checking one by one, or maybe check some other templates. Also, do you have 2MB flash backup?
  • #12
    xenonscrinium
    Level 3  
    p.kaczmarek2 wrote:


    The only question is - which GPIO is the button?

    You can try guessing, checking one by one, or maybe check some other templates. Also, do you have 2MB flash backup?


    If you mean original stock firmware backup, I don't have it

    Added after 3 [minutes]:

    It was pin 24 on channel 0, now all seems working
    This full config for tuya smart plug 16a
    {
    "vendor": "Tuya",
    "bDetailed": "0",
    "name": "Full Device Name Here",
    "model": "enter short model name here",
    "chip": "BK7231N",
    "board": "TODO",
    "flags": "1024",
    "keywords": [
    "TODO",
    "TODO",
    "TODO"
    ],
    "pins": {
    "6": "BL0937CF1;0",
    "7": "BL0937CF;0",
    "8": "Rel;0",
    "10": "WifiLED;1",
    "11": "BL0937SEL;0",
    "24": "Btn;0"
    },
    "command": "",
    "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
    "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }