logo elektroda
logo elektroda
X
logo elektroda

Reversing PWM Output Logic for P-Channel MOSFETs on WB8P (BK7231T) Module

apsis 36 4
ADVERTISEMENT
  • #1 21586592
    apsis
    Level 6  
    Hello,

    I created my own Night light with all custom parts and wb8p (BK7231T) module.

    However I selected P-channel mosfets for the led control.

    Can anyone advise me on how to reverse PWM so LOW (0v) is the on state?
    I really prefer not to build level inversion circuit, as it just seems dumb.

    There are some additional questions on how to read the Light sensor connected to ADC, but this is not as urgent.

    Added after 44 [minutes]:

    Chat GPT told me to go OpenBeken 1.19.x i did find compiled thing and it was horrible.

    Guess i either spend time soldering or wait.

    I am amazed such simple thing is not there yet...

    Added after 9 [minutes]:

    I use SOT-23 mosfets, so this is another hell to solder with no PCB, well i guess i have to,
  • ADVERTISEMENT
  • Helpful post
    #2 21586648
    p.kaczmarek2
    Moderator Smart Home
    I think there is already PWM_n role in OpenBeken, exactly for this purpose.

    Added after 37 [seconds]:


    Reversing PWM Output Logic for P-Channel MOSFETs on WB8P (BK7231T) Module
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21586683
    apsis
    Level 6  
    >>21586648 Well, turns out me and ChatGPT both did not find this - THANKS!!!

    Now will look for a way to make the light sensor (photo-resistor in voltage divider setup) work.
    Any advice is welcomed!
  • ADVERTISEMENT
  • #4 21586692
    p.kaczmarek2
    Moderator Smart Home
    Did you point ChatGPT towards our docs? It should be able to open few pages. I will check this in a moment.


    Well, BK7231 chips has one ADC pin that you can use in OBK. WB8P seem to have it marked on the silkscreen. OBK has ADC role that can read ADC value to channel. Then you can process it with scripting, depending on what you want to achieve..

    Btw, how your current board looks like? I also did some DIY dimmers in the past so I am curious.
    Helpful post? Buy me a coffee.
  • #5 21586729
    apsis
    Level 6  
    >>21586692
    There is NO board, it's a SMD wire web held up with UV resin.
    I use custom Led arrays (one made from orange car blinker leds (PWM5), and one from cold white solar lamp(PWM1)) with appropriate current limiting (22 ohm resistor for cold white and just diode to drop 0.2v for orange).
    Do not worry they run well under 50% rated current, yellow ones are even on ALU PCB even though they are running at 60mA for 5 5730 leds.
    all leds are running off same power as MCU : 3.3v : https://www.aliexpress.com/item/1005006368811....order_list.order_list_main.69.38c61802S4btol

    I use si2301 as led control led with 20k pull up.
    The body is Chinese night lamp.

    Light sensor is photo resistor i gt from who knows where...
    seems 1.5Mohm resistor was nice match match for it /or highest i had/ so now i read 3000lux at very dark at 2700 at dark when i configure the ADV as lux sensor.

    Still no idea what script i need

    Added after 23 [minutes]:

    Here are some pictures.
    Last two are original board.

    Reversing PWM Output Logic for P-Channel MOSFETs on WB8P (BK7231T) Module
    Reversing PWM Output Logic for P-Channel MOSFETs on WB8P (BK7231T) Module
    Reversing PWM Output Logic for P-Channel MOSFETs on WB8P (BK7231T) Module
    Reversing PWM Output Logic for P-Channel MOSFETs on WB8P (BK7231T) Module
    Reversing PWM Output Logic for P-Channel MOSFETs on WB8P (BK7231T) Module
ADVERTISEMENT