logo elektroda
logo elektroda
X
logo elektroda

BL0937 + MCU, why LED connected from SEL pin on MCU to another dedicated MCU pin?

fuxxy 342 3
ADVERTISEMENT
  • #1 21689243
    fuxxy
    Level 7  
    I'm attempting to replace the MCU on a smart plug with an ESP8266. I'd like to use the pin configuration for my existing 10 smart plugs, Kauf PLF10.
    Here's the pinout for the Kauf plug for reference:
    GPIO 0 – Red LED. The red LED will be lit when GPIO0 is output low, and off when GPIO0 is output high.
    GPIO 2 – Blue LED. The blue LED will be lit when GPIO2 is output low, and off when GPIO2 is output high.
    GPIO 4 – Relay output. When the GPIO4 output is high, the relay connects input power to output power. When GPIO4 is low, the relay opens and power is disconnected.
    GPIO 5 – CF pin for power monitoring.
    GPIO 12 – SEL pin for power monitoring.
    GPIO 13 – Button input.
    GPIO 14 – CF1 pin for power monitoring.

    I know on the ESP8266, GPIO 2 and GPIO 0 are bootstrap pins, and should both be pulled up to boot normally.
    My issue is with the board - it seems that on the board, the GPIO for the Red LED goes through a resistor, then the LED, then another resistor, then connects back to the GPIO for the BL0937 SEL pin. I'm wondering why the Red LED wouldn't have its own circuit?

    Ultimately, I'm trying to figure out if I connect the ESP8266 GPIO 0 to the cathode side of the red LED, will GPIO 0 be pulled down (and breaking normal boot)

    I've tried to be as faithful as possible creating the schematic using my multimeter and pictures of the board. I've attached an image of the schematic, as well as the GIMP image including all the image layers for inspection.
    Schematic of HLW8012 power sensor connected to a microcontroller and components
    AI: Could you provide either the schematic you created or a clear textual description of the exact connections and components (including how the red LED, resistors, and SEL pin are interconnected)?
    Image of schematic attached.
    AI: What are the values of the resistors in the circuit path between GPIO 0, the red LED, and the SEL pin?
    both resistors are 1k
  • ADVERTISEMENT
  • #2 21691118
    p.kaczmarek2
    Moderator Smart Home
    Interesting, where did you find a smart plug with BL0937, ESP8266 and MCU? Was it a TuyaMCU device? I only saw that in thermostats.

    I am suprised about LED on SEL, is this really a correct schematic? Were they running out of pins or something?

    GPIO 0 is used to select boot mode. When pulled down, it's bootloader, when high, it's flash. So, if you connect it to LED (with resistor) to GND, it pulls it low, so it enables bootloader. On the other hand, if you connect LED with resistor between GPIO 0 and VDD (3.3V), then it should be ok. Then, in your firmware, if you set GPIO0 low, the LED will be on.

    Can you show a photo of the device board?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21691519
    fuxxy
    Level 7  
    Sorry, I thought I described it better.

    The smartplug only has a Telink TLSR8258 and a BL0937
    I'm trying to replace the Telink SoC with an ESP8266.

    I've attached some overview pics - I've already removed the Telink and placed the ESP8266. There is a dedicated GPIO for both LEDs, I just don't understand the point of connecting an LED to two GPIOs, instead of sourcing from VCC or sinking to GND?

    Edit: added a third, better image of the solder side of the board.

    Two circuit boards: one larger with relay and capacitors, one smaller green module.
    Two printed circuit boards with electronic components on a black surface
    Green PCB with electronic components and conductive tracks

    Added after 9 [hours] 16 [minutes]:

    Looking at the schematic and the LED orientation, (anode to SEL, cathode to "R" pin)

    The LED wouild only light if "R" was pulled high, and SEL was low. It would block current if R was pulled low.
    This logic makes me think the circuit was designed to leave R floating unless pulled high by "R" pin

    I think I answered my own question
    https://tinyurl.com/yk974caq
  • #4 21692397
    p.kaczmarek2
    Moderator Smart Home
    I see, so you are doing a WiFi module swap. Now it makes sense.

    I still don't know what is the intention behind R logic, but it shouldn't be hard to desolder R5 (LED still has second resistor on schematic) and connect it to VDD.
    Helpful post? Buy me a coffee.
ADVERTISEMENT