Serial / wired API?

Hi there,
I use wled on a NodeMCU in multiple projects and really like it! Thanks for your efforts!

However, now I’m working on a new project. It’s kind of a pixel LED matrix / wordclock with APA102. The current implementation is driven by a Microchip ATmega 8 bit microcontroller with self-written firmware.
However, to have better effects and to sync the matrix to my other wled devices, I wanted to add a wled NodeMCU to the setup.
Thus, instead of driving the apa102 directly from the ATMEL, I want to attach the apa to the wled and control wled from the ATMEL.
“control” would means: switch between presets, en- or disble specific leds.
Thus, I need an interface between the ATMEL and the wled.

TL;DR: is there a way to use some interface like UART, SPI, or the like to control wled instead of the well-known JSON-API or MQTT?

OK, after a little bit more reading, I found out that no such interface exists at the moment.

Funny thing: today here (Control WLED via USB? - #7 by kmatokov) someone needs the same thing as I do :slight_smile:

Maybe this? It’s from the Master branch, so…

Commits on Aug 26, 2021

  1. Added JSON API over serial support (#2156)

HI,

Is that mail or forum replay ? anyway…
it is somehow logical because changing scenes by serial is handy because i’m limited with programming knowledge
and working with pic basic pro mostly PIC18fxxx uC-s, using additional tools like nextion displays and similar UI tools
which allow me to make nice things in my house, but only way out to change scenes in WLED would be one simple mqtt “submitter”
so all WLEDs can hear that trough mqtt but it is more complicated than KIS(keep it simple)-way which would be if
a serial scene call would be possible. I will have some time after the new year, then I might be able to check in the source if
adding a serial command is not too complicated for my limited knowledge.

pet, 12. stu 2021. u 14:00 lugge86 via WLED <wled@discoursemail.com> napisao je:

Hi there,
just wanted to leave a conclusion to this topic.
There is indeed now a serial JSON API in WLED. But it’s nowhere documented except for the corresponding github issue (JSON API over Serial · Issue #1146 · Aircoookie/WLED · GitHub) and the related commit (Added JSON API over serial support (#2156) · Aircoookie/WLED@54f4658 · GitHub).

It is working, WLED accepts the following ASCII string over RX pin “’{“on”:“t”,“v”:true}’” @ 115200 bits per second (I could not figure out how to change baudrate but that’s OK for me).
The answer is a 890-character JSON string on the TX pin.
Parsing this is a little bit tricky on small 8 bit controllers with only a few kb of RAM but that’s another story :slight_smile:

1 Like