Managing mixed LED pixels and non-LED (DC motors)

I’m working on a project that mixes WS2812B with WS2811-driven DC motors. The PWM signal from the WS2811 chip’s output channel(s) is used, either directly or through switching transistors, to drive small DC motors, on a custom PCB. Think of pixel lights playing on a spinning mirror ball.

The project comprises a single string of 25 instances of (1 ‘motor pixel’ followed by 12 LED pixels).

My question is how this could be approached in WLED. The driving pin is shared of course, and I believe segments must be used to get the motors running on a different effect than the LEDs. And maybe mapping to make it a little more manageable. (I’m not clear on how segments and mapping interact.)

Considering the 25 instances => 25*(Motor,LED)=50 segments (if mapping doesn’t help), is this feasible in WLED? I’d appreciate any feedback or advice.

Wasn’t exactly clear how you’ve got this laid out, how does

Translate into “25 instances”?
What’s the total # of ‘motor pixels’ vs LED pixels?

That many segments may get you into trouble, if I recall correctly there’s an internal (memory?) limit of 32 segments on ESP32’s (less on 8266). You certainly can try, but don’t be surprised if things get "less than stable " as you push up there.

Ledmaps should give you much better alternatives.
I don’t know exactly what effects/scenarios you’re going to address, but I imagine the motor type ‘effects’ are going to be much more limited (read slower) compared to the LED effects. In my mind that lends itself well to subdividing the motors into their own section or segments.

Sounds interesting :smiley:

More concretely, I will have 25 spheres, each comprising 1 motor pixel and 12 WS2812Bs, arranged in a daisy chain, like this 0(M),1,2,…12,13(M),14,15,…,26(M), 27,28,…, 312(M),313,314,…324, where the (M) are motors.
On motor ‘effects’: PWM signals are ideally suited for simple DC motors, where all you can control are speed and direction. For now, speed is the only variable I plan on controlling, and abrupt changes really don’t work. Servos (which give rotary positioning capability) also use PWM, but the devil is in the details. I might look at that later.

I’ll look at the approach of segments over mapped pixels.

if you want same “effect” on all motors and same effect on all LEDs, you can ledmap motors together and create a single segment for it, ledmap the LEDs similarly and use segment grouping

1 Like

WS2811> servo with an ATtiny85 inbetween

Also WS2811>stepper probbaly use a more modern driver module though.

For the simple DC motors (2 wire, speed control only) , PWM is all you need. I’ve successfully breadboarded it. The prototype PCBs should arrive next week.

But on the sexier motors: the same project is going to have 4-wire stepper motors to move the spheres up and down to specified positions. I’m using RS485 to link a bunch of quad driver boards comprising a ATMega4 (for the large number of pins), the required H-bridges, and a piggyback MAX485 bus driver module. Those boards are planned to support positioning, speed control, and a simple homing function, over a ModBus interface. Those prototype PCBs are also on their way, but programming is still in progress. And the issue of combining the sphere (WLED motor/led) stuff with the YoYo motors into a beautiful harmony is an issue I haven’t thought about yet.

But this is a little more than planned on getting into on this post. Apologies for the digression.

The motor segment effect will likely be Solid White with varying brightness (probably correlated to the dynamism of the LED effect), to control the speed for all the motors. I think it would be visually nauseating to have wildly different random rotation speeds. But a moving fade (=>motor wave) type of effect might be interesting. Who knows, but I’m excited to find out. The prototype PCBs arrived today.

if you use PWM output (analog 1 channel) you have direct PWM control on GPIO port
No additional HW required.

Individual PWM to 25 motors interspersed with 300 WS2812B pixels (with their embedded 3 channel PWM) on a WS2811 bus. One pin does indeed do the job, but not by using PWM directly. I am not sure what you are saying.

I’m just trying out ledmaps now, attempting to follow your suggestion. It works as hoped, segments apply to the mapped pixels.

I think the target is then to map all the motors together, and put them in their own segment, and each sphere (its 12 LEDs) goes in a seperate segment, yielding 1 + 25=26 segments. So the motors have one effect, and each sphere’s LEDs can have their own effect,which is perfect for what I have in mind.
We’ll see how performance goes once I’ve got the hardware ready.

It would be nice bulletproofing if the segment’s LED capabilities (info.leds.seglc) could be set to match this rather odd setup, but as far as I can see it is populated only from the bus settings.

Im I missing something but I thought that the two signals (Motor PWM) had a different protocol and the wS control is serial data (24 Bits) with stop bits like the RS 485/232 system to address each motor via a decoder/driver or am I on the wrong (old fashed frack). But if you built a WS Led Decoder as in each WS (single LED) that would work as a simple control. This is just a quick thought but I have not tried any of this as I kept my two different signals (protocols, voltage signal levels) separate

Let me explain. In a WS2812B addressable LED strip, each pixel LED is actually 3 LEDs (R,G,B) and a controller. That controller in each pixel handles the serial data (including outputting it to the next pixel), and picks off the data that applies to the pixel. It takes that data and turns it into PWM signals for each of the three LEDS (R,G,B). That’s how each of these addressable pixel works.

Now that controller is also available packaged in its own IC chip, the WS2811, without any LEDs. So the WS2811 can be used as a LED-less ‘pixel’ that can substitute for a regular WS2812B pixel (physical size will be different of course) anywhere in your WS2812B led strip.
Then you can connect the 3 PWM outputs of that LED-less ‘pixel’ to do what you want. I’m usng it to control a simple DC motor, but people are using the WS2811 to control bigger lights, or relays, etc.

The way the conversation was going I thought he was using the WS2812B to control but the LEDs and the motors the 2811 was not spoken of just PWM control
Yes I know that this is why I said you needed a decoder for the 2812 B is inbuilt and the controller for the ws 8211is a 12 volt system unless they do a 5 volt one? not sure, not used the 2811 5V or needed one but it is a surfaced mounded 8 pin chip, so all fine apart from if they only do 12/24 volt would that reliably decode without a level shift? and a 12 v supply voltagea Its a matter of checking So please let me know, Thanks but no one stated thats what they were going to use only 2812b was talked about and Im not going to take the top of the chip/Led UNIT to connect to the PWM outputs have you seen the wires by the way the cheapest way for the 2811 chip is to pull one from a strip 8 pin surface mount, simple with the right gear if you can’t make up a PCB use a piece of the strip even use the inbuilt LEDs as a a indicator (if you take the PWM control voltage from the right place, straight from the chip outputs.
Just an Idea so sorry if I jumped in out of place, But like I said he was talking about mixing the two in my mind which I knew would not work. I have done a lot of series control RS 2328 Bit ± 10 volt signal l20 volt difference using a max 232 IC but these could run on the right 5v for short runs and the receiver for one way where I have also had to bit bash the codes and the timing but that was 40 years ago using a PIC chip running at 4mhz
Regards Jack
Ps let me know about the 12 volt thing