Announcement

Collapse
No announcement yet.

Energy Monitoring Smart Plug for under $10

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael McSharry
    replied
    You are correct about the objective.

    The easiest way to get the desired SSID setup in that plug is to have an environment that has a default/default SSID/pw. Your spare router would be easier than setting up a RPi or ESP8266 as a temporary router. If you are successful at this step then the BL-LINK should stop blinking to indicate that it is not connected to the default wifi network.

    A browser is then used from a device (phone/laptop) that is also connected to default/default so it can talk to the BL-LINK plug and then change the SSID to one you really want to use. After this step you can decommission the temporary router with default/default.

    Next step would be to go to your main router, or some other device that can tell you what IP the DHCP server gave to the BL-LINK. With this IP you can connect and finish the setup and put the plug into service.

    I'm not certain what protocol Tasmota uses when trying to connect to the SSID. The source has references to WPA2, WPA and WEP. I use WPA2 on my router and never tried other modes to see was Tasmota does.

    When you flashed the Luntak plug you likely had an image that had no SSID setup so Tasmota did not use station mode, but directly into access point mode. I was not aware until now that is what it did. When a SSID is defined then it goes into station mode and tries to connect to it. The 4 short button press causes it to go to AP mode, but if the module is not configured to map the GPIO pin to the button function then no way to do the 4 presses that it will recognize except if GPIO0 does the short presses. This is because the Sonoff Basic is the default module on a Tasmota build and it uses GPIO0 for the button.

    When in station modeTasmota continues to try to connect to the defined SSID(s). I believe the core Arduino 2.5.0 has the lower level logic that actually makes the connection attempts and would have the WPA/WEP logic.

    Leave a comment:


  • taylormia
    replied
    Thanks Michael for the flashing procedure for my remaining plugs. I'm good here. I use a Ubuntu VM with a USB Wifi adapter and an old Android phone to do the flashing with tuya-convert. Have done this on the Luntak plugs successfully.
    I'm not clear yet on the setting up of the default network:
    What is the purpose of the RPI Router? I have a spare RPI Clone and a spare wifi router. Am I trying to get the mcsTasmota flashed BL-LINK to connect to the default wifi SSID and get an IP address to which I can open a web page to configure the actual SSID the plug needs to connect to? If I use the wifi router, do I use WEP since I cannot use WPA? Sorry for being dense.
    Thanks

    Leave a comment:


  • Michael McSharry
    replied
    The method I use is option 3. Connect to the Sonoff AP. Connect laptop wifi to Sonoff AP SSID. Setup WiFi credentials to network with browser url 192.168.4.1. Look at DHCP server to find IP assigned and connect to it with browser. Firmware upgrade to desired image. Configure image to be BL-LINK module and other configuration as desired.

    Make your RPi a router so you can create the default network. You could flash a new SD or backup and update your current one. I have never done it, but google search has many hits. I also saw one at https://www.mysensors.org/build/esp8266_gateway to do it with an ESP8266. See if a neighbor or friend has a spare router to use temporarily.

    The configuration that comes up by default is for a Sonoff Basic. It expects button on GPIO0. GPIO0 is available on the digital card of the plug, but quite hard to get access to the board and then the pin. I also would not want to play with it after it is plugged into the mains. 3.3V and Gnd are available on the connection between the mains circuit and digital circuit cards. The digital edge connector contains the following signals. Only the backside edge and a pad on the backside for GPIO0 are needed.
    From left to right - 3.3v, gnd, Rx, Tx, GPIO12, GPIO14 on the back side of the digital.
    RST, A0, GPIO13, GPIO4, GPIO5 on the front side.

    This is a long way to go and much easier to get a default network setup.

    Leave a comment:


  • taylormia
    replied
    The four short press method does not work. I tried to set up "default" as the Guest SSID on my existing AP..but WPA requires an eight character password and "default" is 7. I tried no password but the plug does not connect. Any ideas?
    What is correct method to flash your binary on the plug. Should I flash option 3 (flash 3) first..then what? thanks for the assist.

    Leave a comment:


  • Michael McSharry
    replied
    I have always used option 3 (flash3) as the first image with tuyaconvert. I think you have my Tasmota image flashed and now trying to get wifi connection.

    Two suggestions.
    1. The image has default/default for ssid & password so setup an old router to provide this access point.
    2. Four short presses of a standard module will put device in AP mode where you can connect via 192.168.4.1. I think the problem will be that the button pin on this device is not what Tasmota is expecting so it will not know that you are pressing the button. Give it a try.

    Leave a comment:


  • taylormia
    replied
    I attempted to flash the BN-LINK with your mcsTasmota641B.bin using the
    curl "http: //10.42.42.42/flashURL?url=http: //10.42.42.1/files/mcsTasmota641B.bin"

    I see this in the log:
    [I 190314 12:01:37 web:2246] 200 GET /files/mcsTasmota641B.bin (10.42.42.42) 15026.23ms

    It is supposed to reboot and give me a sonoffxxxx SSID to connect to - but it does not. The power switch LED keeps blinking blue even after disconnecting and reconnecting power. Holding the power button down for 5 sec does not change LED blinking behavior. Did I brick the plug? what do you think went wrong?
    Was I supposed to flash with the sonoff-basic.bin first and then upgrade via web page to your binary?

    Leave a comment:


  • Michael McSharry
    replied
    Thanks for letting me know about the hyperlink. It just spanned too many words. It has been corrected.

    I find the energy plug in concert with Tasmota rules to be the easiest way to notify when activity completes such as a load of laundry. Thinking about it, I installed a new dishwasher last year and used a j-box and plug so I could put one on it to provide dishes done notification. Thinking again, I really do not want to pull the dishwasher just for this reason. Microwave may be good. Just need to check amperage requirements.

    Leave a comment:


  • taylormia
    replied
    Thanks for the effort in this characterization. I plan on working on my plugs in the next few days. Btw, the link to the binary tasmota file on pg.193 gets a Not Found 404 error.

    Leave a comment:


  • Michael McSharry
    replied
    I finished the characterization. It is documented in http://mcsSprinklers.com/mcsMQTT.pdf Section 14.12.5. It contains the links to the binary and source based on Tasmota 6.4.1.

    Tasmota has functions that are user-selectable and functions that are programmer-selectable. The relay, for example, can be selected for a Generic template pin use by user. The CF1 pin for energy monitoring is a programmer-selectable one. New builds are needed to map programmer-selectable functionality.

    Since I did not know for certain which power monitoring chip was being used and so many combinations would be needed I decided to pop the top off of the plug. I was able to confirm the BL0937 was used and able to make a reasonable guess on pins based upon the marking and an ohm meter.

    Leave a comment:


  • taylormia
    replied
    Thanks Michael. Great info. What do you mean by "new builds needed for each attempt"?

    Leave a comment:


  • Michael McSharry
    replied
    Got my plug today and did the easy part of the characterization. Now I need to figure out the mapping of the three pins for the energy device BL0937. New builds needed for each attempt. I will continue tomorrow

    Here is what I have so far.
    Code:
      { "BN-LINK Energy",   // BN-LINK Energy Monitoring model BNC-60/U133TJ (ESP8286 - BL0937 or HJL-01 Energy Monitoring)
                          // https://www.amazon.com/gp/product/B07CX5KLXN/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1
    
         0,                // GPIO00 
         GPIO_LED2_INV,    // GPIO01 Red Led (1 = On, 0 = Off)
         0,                // GPIO02 
         GPIO_KEY1,        // GPIO03 Button                                     GPIO_NRG_SEL_INV BL0937 or HJL-01 Sel output (0 = Voltage)  GPIO_USER, 
         0,                // GPIO4 
         0,                // GPIO05                                            GPIO_HJL_CF,      BL0937 or HJL-01 CF power
                           // GPIO06 (SD_CLK   Flash)
                           // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
                           // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
         0,                // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
         0,                // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
                           // GPIO11 (SD_CMD   Flash)
         0,                // GPIO12 
         GPIO_LED1_INV,    // GPIO13 Blue Led plug 1(1 = On, 0 = Off)
         GPIO_REL1,        // GPIO14                                            GPIO_NRG_CF1 BL0937 or HJL-01 CF1 current / voltage
         0,                // GPIO15 
         0, 0
      }

    Leave a comment:


  • taylormia
    replied
    Thanks so much. Your mcsMQTT.pdf is very useful. Thanks for the info on the lightning deals too.

    Leave a comment:


  • Michael McSharry
    replied
    It is detective work. I have done two dual energy plugs documented in http://mcsSprinklers.com/mcsMQTT.pdf. They both used the same GPIO for the energy module and varied in button and LED use. I started with Blitzwolf SHP config which used GPIO12 for BL0937 while same pin was Relay1 for the WS212 and NX-SP201. I typically start with generic module and pin by pin find the inputs best starting guesses are based upon a similar function module. Leave GPIO0 & 2 until I find some missing function at the end. These are special boot mode pins that could brick the device if done wrong. If that happens then need to open the device for serial flashing. Next is the relay. Then change to an energy module type and if it does not work then need to change source. For this one I will start with the WS212 template that I added to source.

    Once I charactize it I will update document and post.

    Leave a comment:


  • taylormia
    replied
    I just successfully flashed the Luntak plug today with tuya-convert. I'm going for the 4 pack of the BN-LINK since it looks like a great deal. How do I figure out the GPIO assignments if I'm able to flash it?

    Leave a comment:


  • Michael McSharry
    replied
    That is how I expect to do it. I done about 1/2 dozen different brands and all with success. Of course don't know for certain until I try

    Leave a comment:

Working...
X