logo elektroda
logo elektroda
X
logo elektroda

Extending DS18(B)20 driver - multiple GPIOs and multiple sensors per GPIO

max4elektroda 2433 108
ADVERTISEMENT
📢 Listen (AI):
  • #91 21622509
    max4elektroda
    Level 20  
    Your logs/tests look good, so why not!
    Thanks for testing again

    Added after 14 [minutes]:

    Compiled this time ;-)
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #94 21622586
    max4elektroda
    Level 20  
    Wow, looks quite good, only 20us is a bit short with 16us in real:

    500 479
    200 193
    100 97
    50 49
    20 16
    10 9
    6 6
    4 4

    Thank you so much!
  • ADVERTISEMENT
  • #96 21622795
    max4elektroda
    Level 20  
    I almost forgot: is PowerSave possible for BK7525?
    Then we should try if we need adjustments here, too.
    And the same for BK7238. Did I miss something about PowerSave? Should it work?
  • #97 21623607
    divadiow
    Level 35  
    max4elektroda wrote:
    I almost forgot: is PowerSave possible for BK7525?


    appears to. powersave 0 = 0.11A. Powersave 1 = ~0.2A

    these higher-latency pings are powersave 1

    Screenshot showing two power save modes with current values: powersave 0 (0.11A) and powersave 1 (~0.2A), plus info on higher ping delays for powersave 1.
  • #98 21623698
    max4elektroda
    Level 20  
    Sorry, bad question: will powersave change timing, if it's available?

    Added after 6 [minutes]:

    Do you recall if/how PowerSave works for BK7238?
    I didn't get it to work but probably only missed how it works there...
  • #99 21623703
    divadiow
    Level 35  
    max4elektroda wrote:
    Sorry, bad question: will powersave change timing, if it's available?

    will check

    max4elektroda wrote:
    Do you recall if/how PowerSave works for BK7238?

    not sure it does! https://www.elektroda.com/rtvforum/topic4127149.html

    unless fixed since. can check

    Added after 41 [minutes]:

    good timing @insmod

    Code: Text
    Log in, to see the code


    https://github.com/openshwprojects/OpenBK7231T_App/pull/1745
  • #100 21624160
    max4elektroda
    Level 20  
    BK7238 will need some powersave-adjustment, added the code.
    As soon as @insmod s PR fixing powersave is merged, it should work after syncing this PR


    Extending DS18(B)20 driver - multiple GPIOs and multiple sensors per GPIO
    Extending DS18(B)20 driver - multiple GPIOs and multiple sensors per GPIO

    I saw some timeouts and a few CRCs, but generally its working o.k. with powersave:
    
    Info:SENSOR:DS1820[9] - Temp=25.00
    Info:MAIN:Time 667, idle 61945/s, free 115104, MQTT 0(42), bWifi 1, secondsWithNoPing 601, socks 2/24 POWERSAVE
    Info:MAIN:Time 668, idle 64117/s, free 113928, MQTT 0(42), bWifi 1, secondsWithNoPing 602, socks 2/24 POWERSAVE
    Info:MAIN:Time 669, idle 57772/s, free 115088, MQTT 0(42), bWifi 1, secondsWithNoPing 603, socks 3/24 POWERSAVE
    Info:SENSOR:DHT start, pin is 7
    Info:MAIN:Time 670, idle 55622/s, free 123992, MQTT 0(42), bWifi 1, secondsWithNoPing 604, socks 2/24 POWERSAVE
    Info:SENSOR:DS1820[9] - Starting conversion
    Info:MAIN:Time 671, idle 61380/s, free 115688, MQTT 0(42), bWifi 1, secondsWithNoPing 605, socks 2/24 POWERSAVE
    Info:SENSOR:DS1820[9] - Temp=25.00
    Info:MAIN:Time 672, idle 64249/s, free 123408, MQTT 0(42), bWifi 1, secondsWithNoPing 606, socks 3/24 POWERSAVE
    Info:SENSOR:DHT start, pin is 7
    Info:MAIN:Time 673, idle 49489/s, free 115688, MQTT 0(42), bWifi 1, secondsWithNoPing 607, socks 2/24 POWERSAVE
    Info:MAIN:Time 674, idle 61657/s, free 115688, MQTT 0(42), bWifi 1, secondsWithNoPing 608, socks 2/24 POWERSAVE
    Info:MAIN:Time 675, idle 27978/s, free 115688, MQTT 0(42), bWifi 1, secondsWithNoPing 609, socks 2/24 POWERSAVE
    Info:SENSOR:DHT start, pin is 7
    Info:SENSOR:DHT timeout waiting for start signal high pulse.
    Info:SENSOR:DS1820[9] - Starting conversion
    Info:MAIN:Time 676, idle 51902/s, free 114016, MQTT 0(42), bWifi 1, secondsWithNoPing 610, socks 2/24 POWERSAVE
    Info:SENSOR:DS1820[9] - Temp=25.00
    Info:MAIN:Time 677, idle 68400/s, free 115600, MQTT 0(42), bWifi 1, secondsWithNoPing 611, socks 2/24 POWERSAVE
    Info:MAIN:Time 678, idle 60156/s, free 115584, MQTT 0(42), bWifi 1, secondsWithNoPing 612, socks 2/24 POWERSAVE
    Info:SENSOR:DHT start, pin is 7
    Info:MAIN:Time 679, idle 59934/s, free 115600, MQTT 0(42), bWifi 1, secondsWithNoPing 613, socks 2/24 POWERSAVE
    Info:MAIN:Time 680, idle 69868/s, free 115688, MQTT 0(42), bWifi 1, secondsWithNoPing 614, socks 2/24 POWERSAVE
    Info:SENSOR:DS1820[9] - Starting conversion
    Info:MAIN:Time 681, idle 62448/s, free 115688, MQTT 0(43), bWifi 1, secondsWithNoPing 615, socks 2/24 POWERSAVE
    Info:SENSOR:DHT start, pin is 7
    Info:SENSOR:DS1820[9] - Temp=25.00
    Info:MAIN:Time 682, idle 64128/s, free 115080, MQTT 0(43), bWifi 1, secondsWithNoPing 616, socks 2/24 POWERSAVE
    Info:MAIN:Time 683, idle 60101/s, free 114056, MQTT 0(43), bWifi 1, secondsWithNoPing 617, socks 2/24 POWERSAVE
    Info:MAIN:Time 684, idle 62179/s, free 115688, MQTT 0(43), bWifi 1, secondsWithNoPing 618, socks 2/24 POWERSAVE
    Info:SENSOR:DHT start, pin is 7
    Info:MAIN:Time 685, idle 62701/s, free 110968, MQTT 0(43), bWifi 1, secondsWithNoPing 619, socks 3/24 POWERSAVE
    Info:SENSOR:DS1820[9] - Starting conversion
    Info:MAIN:Time 686, idle 67751/s, free 111352, MQTT 0(43), bWifi 1, secondsWithNoPing 620, socks 3/24 POWERSAVE
    Info:SENSOR:DS1820[9] - Temp=25.00
    Info:MAIN:Time 687, idle 60005/s, free 114144, MQTT 0(43), bWifi 1, secondsWithNoPing 621, socks 2/24 POWERSAVE
    Info:SENSOR:DHT start, pin is 7
    Info:MAIN:Time 688, idle 60500/s, free 114016, MQTT 0(43), bWifi 1, secondsWithNoPing 622, socks 2/24 POWERSAVE
    Info:MAIN:Time 689, idle 64545/s, free 115688, MQTT 0(43), bWifi 1, secondsWithNoPing 623, socks 2/24 POWERSAVE
    Info:MAIN:Time 690, idle 45499/s, free 115088, MQTT 0(43), bWifi 1, secondsWithNoPing 624, socks 3/24 POWERSAVE
    Info:SENSOR:DHT start, pin is 7
    Info:SENSOR:DS1820[9] - Starting conversion
    Info:MAIN:Time 691, idle 101536/s, free 115688, MQTT 0(43), bWifi 1, secondsWithNoPing 625, socks 2/24 POWERSAVE
    Info:SENSOR:DS1820[9] - Temp=25.00
    Info:MAIN:Time 692, idle 58883/s, free 115104, MQTT 0(43), bWifi 1, secondsWithNoPing 626, socks 3/24 POWERSAVE
  • #101 21624172
    p.kaczmarek2
    Moderator Smart Home
    Hey is @insmod PS fix tested and ready to merge?
    Helpful post? Buy me a coffee.
  • #102 21624381
    insmod
    Level 25  
    >>21624172
    I guess? The only untested thing is spi on BK7231U/T_ALT and BK7238/N_ALT.
    I don't have anything to test it with.
    Though it can be merged even if it's not working.
  • #103 21624798
    max4elektroda
    Level 20  
    Updated PR #1727, BK2738 now also works with powersave (tested DS18B20 and DHT11) .
    Maybe @divadiow can check with DHT22, too?
  • ADVERTISEMENT
  • #104 21624810
    divadiow
    Level 35  
    powersave 1
    Extending DS18(B)20 driver - multiple GPIOs and multiple sensors per GPIO

    chip temp isn't quite right on BK7238
  • #105 21624824
    max4elektroda
    Level 20  
    You also recognized it "freezing" from time to time??

    I only saw this with powersave, but must admit I didn't try too long without ...
  • #106 21624828
    divadiow
    Level 35  
    not noticed any freezing. chip temp is the same with 1.18.145 and no powersave
  • #107 21624835
    max4elektroda
    Level 20  
    Sorry, meant as a joke: temp below -40°C --> "freezing" ;-)

    Extending DS18(B)20 driver - multiple GPIOs and multiple sensors per GPIO

    Extending DS18(B)20 driver - multiple GPIOs and multiple sensors per GPIO
  • #109 21626918
    divadiow
    Level 35  
    insmod wrote:
    The only untested thing is spi on BK7231U/T_ALT and BK7238/N_ALT.


    dug this out
    Extending DS18(B)20 driver - multiple GPIOs and multiple sensors per GPIO

    4m/60 WS2812B. OTA to latest _ALT
    Extending DS18(B)20 driver - multiple GPIOs and multiple sensors per GPIO

    SPI/PixelAnim works but the colours are off. Less noticeable when the animation, especially rainbow, is running, but here's the starting RGB at power-on.

    Extending DS18(B)20 driver - multiple GPIOs and multiple sensors per GPIO
📢 Listen (AI):

Topic summary

The discussion centers on extending the DS18(B)20 temperature sensor driver in the OpenBeken IoT firmware to support multiple GPIOs and multiple sensors per GPIO. The original OneWire protocol timing was stable, so the focus shifted to refactoring the driver by separating basic OneWire functions into a shared file for reuse between simple and extended drivers. Key challenges include managing flash memory size, maintaining backward compatibility, and deciding whether to maintain two separate drivers (simple and full) or merge them with conditional compilation. The extended driver increases memory footprint due to more general and debug-capable code. Flash size impact varies by platform, with Beken-N showing no visible change and others like W800 and BL602 increasing by about 130-150 bytes. The multiline command feature requires enabling OBK scripting and is currently limited to Beken platforms but may be extended. User interface considerations include possibly using a Web App for configuration. Issues with sensor behavior on certain channels (notably channel 1) were noted, linked to external commands referencing channels (e.g., Tasmota commands). The discussion also touched on DST offset parsing improvements for timezone commands, balancing user-friendliness and code size. Overall, the consensus leans toward merging the extended driver with careful size optimization and backward compatibility, while keeping the option for a simpler driver for users with minimal sensor needs.
Summary generated by the language model.
ADVERTISEMENT