logo elektroda
logo elektroda
X
logo elektroda

W800-C400 WiFi/BT microcontroller programming - wm_sdk_w800 tutorial

p.kaczmarek2 12807 47
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #31 21385930
    p.kaczmarek2
    Moderator Smart Home
    https://github.com/search?q=repo%3Aopenshwprojects%2FOpenW800%20uart-wifi&type=code
    W800 SDK ethernetif (LWIP, to be more precise):
    Code: C / C++
    Log in, to see the code

    Same for W600:
    Code: C / C++
    Log in, to see the code


    I think we can easily fix it, we could even allow ourselves to just call obk config API to get device name... full name, that one here:
    Screenshot of device name change form with the full name BK7231T_WB3S_WhiteStripWindows highlighted.
    Just call CFG_GetDeviceName() there, we don't support non-BK APPs anyway, and even if so, we could do a #define check. What do you think, @max4elektroda ?

    DHT11 works:
    OpenW800 device web interface displaying DHT11 sensor data.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 21385985
    max4elektroda
    Level 20  
    Shure, fixing the name should be easily possible in this case.
    I always looked for the strange name when I forgot the DHCP address, but never thought of fixing it...

    Added after 4 [minutes]:

    I'll put it on my to-do list for the weekend ;-)
  • #33 21386162
    divadiow
    Level 34  
    apologies, I thought it weird I couldn't find in code search. I was transforming hyphen to underscore in my head. :/
  • ADVERTISEMENT
  • #34 21388417
    max4elektroda
    Level 20  
    max4elektroda wrote:
    I'll put it on my to-do list for the weekend

    So it's done - see https://github.com/openshwprojects/OpenBK7231T_App/pull/1508
    I didn't set the hostname in sdk code, but in hal_wifi.
    Reason: in lwip code the config seems not yet read (at least CFG_GetDeviceName() will always return NULL).
    So I went the easy way and (re-)defined the hostname just before connecting in "connect_wifi_demo()".
    I also added my approach for an uart driver - only tested with my preliminary NEO-6M driver:

    Screenshot showing system logs with GPS data and sensor status information.

    Looks promising, but lacks a meaningful use until the clock changes are merged and other sources than NTP are possible.
  • #35 21388432
    p.kaczmarek2
    Moderator Smart Home
    Seems acceptable. Merged, thank you.

    Btw I think we may don't need separate makefiles for W800 and W600 in App, or at least for the App-specific part, maybe we could just include sub-makefile from, let's say, WX00 dir from both of them.

    Just let me finish my "textarea startup command" PR first: https://github.com/openshwprojects/OpenBK7231T_App/pull/1506
    Helpful post? Buy me a coffee.
  • #36 21388445
    max4elektroda
    Level 20  
    One additional information / finding:

    Old host name as expected:
    max@max-PC:~$ nmap -sP 192.168.0.0/24 | grep uart
    Nmap scan report for uart-wifi.fritz.box (192.168.0.37)
    max@max-PC:~$ 


    New firmware:

    max@max-PC:~$ nmap -sP 192.168.0.0/24 | grep 0.37
    Nmap scan report for OpenW800-XXXXXXXX.fritz.box (192.168.0.37)
    max@max-PC:~$ 
    


    Please note: The underscore has been changed to a hyphen?!?

    Added after 10 [minutes]:

    Maybe @divadiow you finally want to make use of the additional item sent with the W801?

    https://github.com/MaxineMuster/OpenBK7231T_App/tree/W800_NEO-6M

    NEO-6M has to be connected to UART1 (PB7 is W800s RX and PB6 is TX)

    OpenW800 device user interface displaying sensor data and configuration options
  • #37 21388473
    p.kaczmarek2
    Moderator Smart Home
    A GPS driver? Very interesting, altough we may need to put that in a separate topic....

    However, can you change the name of the define? The rule is that entries from drv_main should have ENABLE_DRIVER_ prefix, and you just used ENABLE_NEO6M only.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #38 21388483
    max4elektroda
    Level 20  
    It should have been ENABLE_DRIVER_NEO6M, but it looks like in the code uploaded I forgot the #ifdef at all.
    So it works even with the wrong define...

    But that will be fixed tomorrow, I will call it a day now.

    Added after 2 [minutes]:

    And yes, I will open a separate topic, this was just a teaser for now (but it's also working with Beken, I didn't get uart working on LN882H (yet?)).
  • #39 21388505
    divadiow
    Level 34  
    nice.

    Information about a device connected to the network.

    Interface of Advanced IP Scanner showing a detected network device.

    Added after 2 [minutes]:

    max4elektroda wrote:
    Maybe @divadiow you finally want to make use of the additional item sent with the W801?

    sure.
  • #40 21395087
    divadiow
    Level 34  
    Had this email from WinnerMicro last night. new W80x SDK v2.x

    Spoiler:
    Code: Text
    Log in, to see the code


    original:
    Spoiler:
    Code: Text
    Log in, to see the code
  • #41 21527135
    divadiow
    Level 34  
    W800 Tuya kits

    Code: Text
    Log in, to see the code
  • ADVERTISEMENT
  • #42 21527547
    p.kaczmarek2
    Moderator Smart Home
    It's funny that they even included their GIT repository in the zip:
    Screenshot of the 7-Zip program with the w800_1.0.5.zip archive open and a list of files and folders visible.
    Toolchain is a separate archive (csky-abiv2-elf):
    Screenshot of WinRAR with the w800_1.0.5.zip archive open, showing files inside the archive.
    A file decompression program window showing the contents of an archive named w800.tgz.
    And there is only Tuya adapter, I can't see any W800 source code?
    Helpful post? Buy me a coffee.
  • #43 21537771
    divadiow
    Level 34  
    max4elektroda wrote:
    Maybe @divadiow you finally want to make use of the additional item sent with the W801?

    https://github.com/MaxineMuster/OpenBK7231T_App/tree/W800_NEO-6M

    NEO-6M has to be connected to UART1 (PB7 is W800s RX and PB6 is TX)


    im sorry I didn't acknowledge this. I'll give it a spin soon!

    Added after 1 [minutes]:

    I wonder how it'll fair with @insmod's updated SDK if the wifi ever gets fixed and change merged
  • #44 21538319
    max4elektroda
    Level 20  
    divadiow wrote:
    I wonder how it'll fair with @insmod's updated SDK if the wifi ever gets fixed and change merged

    Since uart is present, it should work, maybe I can update the PR to resolve the merge conflicts (it's exactly 100 commits behind).
    In the end it comes down to the point if the split between clock and NTP code is accepted.
    I mean, there might be situations where you simply don't know where you are, so GPS might help ;-), but I intend to use it as a network independent source of time and even latitude longitude for sunset/sunrise calculation.
    As long as you have GPS reception, no network is needed to do even challenging time based switching.
    But actually NTP is the only source of time.
    I would like NTP to be only one possible source to set the clock, allowing other sources, too.

    Added after 6 [hours] 43 [minutes]:

    Actual code with NEO6M can be found here:

    https://github.com/MaxineMuster/OpenBK7231T_App/actions/runs/14820927822

    will also work with @insmod _w800 branch.
    The RSSI shown looks better, but trying OTA always fails for me (after (long) restart, old version is present...)
    Version is attached, just in case you want to try ...
  • #46 21563104
    divadiow
    Level 34  
    yay. nice.
    Screenshot of the OpenW800 device control panel with Config, Restart, Launch Web Application, and About buttons.

    Code: Text
    Log in, to see the code

    GPS module and prototyping board connected to a purple microcontroller board with wires.

    Added after 5 [minutes]:

    surely some of these PRs are ready to merge...
  • #47 21563511
    max4elektroda
    Level 20  
    divadiow wrote:
    Info:DRV:Read GPS DATA:28.05.2025 - 18:51:22.00 (epoch=1748458282) LAT=41.902893N - LONG=12.454444E

    Greetings to the Pope ;-)
  • #48 21565991
    max4elektroda
    Level 20  
    As long as I use Chrome OTA usually works, so I included the "local clock" and NEO6M driver to @insmod _w800 branch so you might actually use the GPS data:
    The W800 image is build with (aditionally):

    #define ENABLE_CLOCK_DST                  1
    #define ENABLE_CALENDAR_EVENTS            1
    #define ENABLE_CLOCK_SUNRISE_SUNSET       1
    #define ENABLE_DRIVER_NEO6M               1



    If you start the driver with "setclock" and/or "setlatlong" it will set the values accordingly if GPS is locked. For me in Germany it's (with some slight hiding of my home ;-))

    backlog startDriver NEO6M setclock setlatlong fakelat=4190.5  fakelong=01245 ; CLOCK_setDST 0 3 1 2 60 0 10 1 3 0; clock_setTZ 1
    


    I recently reworked DST settings, so this version will use two "statements" with "CLOCK_setDST" for the two switching times. You can start with begin or end of DST, since the statement will include "how much DST offset after this point".
    Every entry is "nth week" "month" "weekday" "time" "minutes to add"
    In my case it can be "pseudo" read as
    "on/after last (0) Marchs (3) Sunday (1) at 2:00 (2) add 1h / 60 minutes (60 ) and on/after last (0) Octobers (10) Sunday (1) at 3:00 (3) add 0 (= set DST to 0)"

    OpenW800 control panel showing local time, GPS data, active drivers, chip temperature, and WiFi status.
    After this you can use the clock as usual without NTP or any other clock source:
    
    In summer time - next DST switch at 1761447600 (2025-10-26 03:00:00) 
    Info:DRV:Read GPS DATA:31.05.2025 - 16:51:22.00 (epoch=1748710282) LAT=42.508869N - LONG=12.762115E  (clock and lat/long set to GPS data)
    In summer time - next DST switch at 1761447600 (2025-10-26 03:00:00) 
    Info:DRV:Read GPS DATA:31.05.2025 - 16:51:27.00 (epoch=1748710287) LAT=42.508862N - LONG=12.762107E  (clock and lat/long set to GPS data)
    In summer time - next DST switch at 1761447600 (2025-10-26 03:00:00) 
    Info:DRV:Read GPS DATA:31.05.2025 - 16:51:32.00 (epoch=1748710292) LAT=42.508854N - LONG=12.762103E  (clock and lat/long set to GPS data)
    In summer time - next DST switch at 1761447600 (2025-10-26 03:00:00) 
    Info:DRV:Read GPS DATA:31.05.2025 - 16:51:38.00 (epoch=1748710298) LAT=42.508877N - LONG=12.762115E  (clock and lat/long set to GPS data)
    Info:NTP:CLOCK sunrise is at 05:33
    Info:NTP:CLOCK sunset is at 20:38
    Info:CMD:19980 74280
    Info:CMD:[WebApp Cmd 'echo $sunrise $sunset' Result] OK
    In summer time - next DST switch at 1761447600 (2025-10-26 03:00:00) 
    Info:DRV:Read GPS DATA:31.05.2025 - 16:51:43.00 (epoch=1748710303) LAT=42.508911N - LONG=12.762124E  (clock and lat/long set to GPS data)
    In summer time - next DST switch at 1761447600 (2025-10-26 03:00:00) 
    


    Seems o.k ;-)

    Website displaying sunrise and sunset times for Vatican City in May 2025.

Topic summary

The discussion revolves around programming the W800-C400 WiFi/Bluetooth microcontroller from WinnerMicro, particularly in the context of using it with IoT devices like RGB LED strip controllers. Users share experiences with various development boards, including HLK-W801 and HLK-W800-PLUS, and discuss challenges related to firmware flashing, debugging, and PWM functionality. There are mentions of tools like wm_tool and Upgrade_Tools, with some users seeking non-Chinese documentation. Issues with temperature sensors and power-saving modes are also addressed, along with updates on firmware improvements and community support for troubleshooting.
Summary generated by the language model.
ADVERTISEMENT