logo elektroda
logo elektroda
X
logo elektroda

Configuring P8 (PWM2) to DoorSnsrWSleep on BK7231N Chip, Firmware Version 1.15.665

oded00 1482 17
ADVERTISEMENT
  • #1 20531963
    oded00
    Level 3  
    Hello all

    Have a simple door sensor without tuyamcu
    The chip is BK7231N and the firmware version 1.15.665
    When I configure the P8 (PWM2) to DoorSnsrWSleep it works and starts to 60 sec every time I move the sensor but if the device goes to deep sleep it never resumes
    I also didn't figure out how to config battery power measure and to activate the led on the device

    Thank you for support

    Oded
  • ADVERTISEMENT
  • #2 20531974
    p.kaczmarek2
    Moderator Smart Home
    Hello,
    let's try to debug this issue.
    So you are saying that it detects open/closed state correctly?
    Quote:

    DoorSnsrWSleep it work and start to 60 sec every time I move the sensor


    Does your door sensor have a button? Can you try setting button role to Btn? Does the Button then at least wakes up the sensor?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #4 20531991
    p.kaczmarek2
    Moderator Smart Home
    Please configure that reset button to Btn role. I want to know if at least Btn is able to do a wake up.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20531994
    oded00
    Level 3  
    I'm sorry but I don't know how
    Do I need to try it on each PWM?
  • #6 20531999
    p.kaczmarek2
    Moderator Smart Home
    Do you have original flash dump?
    How device looks like?
    Can you look at the traces and follow them to the Button to see which GPIO is used?
    Helpful post? Buy me a coffee.
  • #7 20532228
    oded00
    Level 3  
    p.kaczmarek2 wrote:
    Do you have original flash dump?
    How device looks like?
    Can you look at the traces and follow them to the Button to see which GPIO is used?

    I don't have the original dump
    Adding picture of my device
    When I look at the log after short press on the reset button:
    Info:GEN:7 Button_OnInitialPressDown
    Info:GEN:7 key_short_press
  • #8 20532298
    p.kaczmarek2
    Moderator Smart Home
    Good, so P7 is a RESET button, now, does this button wake up the device after it goes to sleep?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #9 20532759
    oded00
    Level 3  
    p.kaczmarek2 wrote:
    Good, so P7 is a RESET button, now, does this button wake up the device after it goes to sleep?

    Yes
    Pushing the button when the device is in sleep wakes up the device
    One more strange thing that I notice is that the device also wakes up when it goes to sleep when the channel is on 1 (door open) and then it changes to 0 (door close)
    So the only state that does not wake up the device is when the device goes to sleep when the channel is on 0
  • #10 20532769
    p.kaczmarek2
    Moderator Smart Home
    Do you have a multimeter? Can you power off the device and then check the resistance first between sensor GPIO (pad on CB3S) and ground, and then between sensor GPIo and VDD?

    Maybe IOR_DoorSensorWithDeepSleep_NoPup can work for you?
    Helpful post? Buy me a coffee.
  • #11 20533478
    spin55
    Level 17  
    This is mine configuration:
    "pines": {
    "7": "dInput;0",
    "14": "Rel;3",
    "8": "dInput;1",
    "23" : "ADC;4",
    "26": "LED;2"
    }

    And autoexec,bat:

    setChannel 3 1
    addRepeatingEvent 30 -1 publishFloat "4" $CH4
    delay_s 60
    PinDeepSleep
  • #12 20533481
    p.kaczmarek2
    Moderator Smart Home
    @spin55 it looks like you have configured that sensor manually. It's a nice approach, but it's not needed if you are using DoorSnsrWSleep functionality. The new door sensor driver does the things you have scripted automatically.

    For me, it looks like OP has an extra pull up/down resistor on sensor and it breaks wake up for him.
    Helpful post? Buy me a coffee.
  • #13 20533489
    spin55
    Level 17  
    p.kaczmarek2 wrote:
    @spin55 it looks like you have configured that sensor manually. It's a nice approach, but it's not needed if you are using DoorSnsrWSleep functionality. The new door sensor driver does the things you have scripted automatically.


    True. I have left it like this for the convenience of varying the delay.

    Added after 6 [minutes]:

    One is stuck in his box with a battery to see how much is discharged without work.
  • #14 20533497
    p.kaczmarek2
    Moderator Smart Home
    Which delay would you like to change? Maybe I can add that option.
    Helpful post? Buy me a coffee.
  • #15 20533501
    spin55
    Level 17  
    p.kaczmarek2 wrote:
    Which delay would you like to change? Maybe I can add that option.


    So that the time to go to sleep can vary it at will. But you don't need to modify it. That's fine for most people. Thanks.

    Added after 46 [minutes]:

    spin55 wrote:
    One is stuck in his box with a battery to see how much is discharged without work.


    Surprise. Alkaline batteries discharged even though it hasn't worked.
    I have put two well-charged lithium batteries in it. I'll write down the date.
  • #16 20533598
    p.kaczmarek2
    Moderator Smart Home
    There is still very imporant thing left to do. The perfect system should shut down as soon as MQTT confirms reception of the update. Constant delay is not desired here.

    There is still a lot of room to improve.

    Okay, to get back on topic - @oded00 is the version without pull up working for you?

    I had very similar problem as your described here when I tried to wake by GPIO that had also external pull up resistor on PCB.
    Helpful post? Buy me a coffee.
  • #17 20533620
    spin55
    Level 17  
    p.kaczmarek2 wrote:
    Okay, to get back on topic - @oded00 is the version without pull up working for you?


    At the moment it is in the box for the battery discharge test, but in the tests I did after flashing I did not notice anything strange. Maybe someone who uses it regularly can confirm it better than me.
  • #18 20543519
    p.kaczmarek2
    Moderator Smart Home
    oded00 wrote:

    So the only state that not wake up the device is when the device go to sleep when the channel on 0

    The problem has been solved.
    See:

    https://www.elektroda.com/rtvforum/topic3971140.html

    The solution is to update the firmware, and then try out DSEdge options, first try DSEdge 1 and then DSEdge 0. Default one is DSEdge 2 and may not work with your device.
    Helpful post? Buy me a coffee.

Topic summary

The discussion revolves around configuring the P8 (PWM2) pin for a door sensor using the BK7231N chip with firmware version 1.15.665. The user reports that while the sensor detects open/closed states and resets correctly, it fails to resume from deep sleep. Suggestions include configuring the reset button as a wake-up mechanism and checking GPIO connections. The user confirms that the reset button can wake the device, but the sensor does not wake when the channel is in a specific state. Further troubleshooting involves checking resistance with a multimeter and considering firmware updates. A solution is eventually found by updating the firmware and adjusting DSEdge settings.
Summary generated by the language model.
ADVERTISEMENT