Page 1 of 4 123 ... LastLast
Results 1 to 10 of 39

Thread: Ws 2812b pixels to control Dc motors

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2011
    Posts
    6,073
    Post Thanks / Like

    Default Ws 2812b pixels to control Dc motors

    Have many of you taken on this endeavour ?

    After a few weeks of playing with this idea , I have finally figured this out so I can be simply sequence motors along with the rest of the display .

    I had originally thought motors used in displays would be common place and that folks would be using a something directly related to this hobby in doing so .

    Not being a coder and tutorials related to this are minimal at best .

    I have enjoyed the learning curve in doing this , though it would be nice to see via e1.31 for pixel control .

    Cheers

  2. #2
    Join Date
    Dec 2012
    Location
    Hudson MA
    Posts
    3,892
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    lots of people do motor control via e1.31. FYI: ws2812 does not have the outputs connected in a way you can use them. WS2811 gives you want you want. In this case you get three PWM outputs to use as you please. But most motor controls cant make use oof PWM outputs. There is a project that takes WS2811 output and binds it to some triacs to make a ws2811 driven ssr which could be used to drive a motor


    2019 - Just moved into a new home (yet another change of plans). Will be dim but not dark. Too much to do at the new place to leave time for a show.
    https://www.youtube.com/channel/UCyX...ttrsZNARkUce0Q

  3. #3
    Join Date
    Dec 2011
    Posts
    6,073
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    You are correct in the hardware I used a 5v ws2811 pixel board . I have sequenced using the ws2812b selection just as the pixels being used.
    My mistake for the poor clarity
    The excitement of getting it working via trial and error clouded my post , sorry for that .


  4. #4
    Join Date
    Oct 2009
    Posts
    712
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    Check this out - it might be what your looking for.
    https://www.youtube.com/watch?v=UijLGeUGpOk
    https://www.pixel2things.com/

  5. #5
    Join Date
    Dec 2011
    Posts
    6,073
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    Quote Originally Posted by covewi View Post
    Check this out - it might be what your looking for.
    https://www.youtube.com/watch?v=UijLGeUGpOk
    https://www.pixel2things.com/
    Thank you for posting this .
    I posted this as an interest thread to see what others are doing .
    The links are exactly what this thread needs

    So far I am content in using the nodemcu which works well and permits pixel level control wirelessly .
    As a test setup , I used LedFx on an android and nodemcu to prove my thoughts .
    All works as suspected so implementing into any sequencer of choice ( in my case HLS ) will be a breeze .

  6. #6
    Join Date
    Nov 2015
    Location
    The Netherlands
    Posts
    77
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    i'd like to control a stepper motor from e1.31 to make a kind of dmx-winch. I'd like absolute control meaning 1 in the channel is position 1 and 254 in the channel is position 254. I tried this half a year ago and got some rudimentary movement. I have to call in my neighbour to help (he's a programmer)....
    Errors for fun only.

  7. #7
    Join Date
    Dec 2012
    Location
    Hudson MA
    Posts
    3,892
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    You will need some sort of controller to translate desired position to motor pulses and track the current motor position. There is a bit more to it than saying 1 is al the way to the left and 255 is all the way to the right.


    2019 - Just moved into a new home (yet another change of plans). Will be dim but not dark. Too much to do at the new place to leave time for a show.
    https://www.youtube.com/channel/UCyX...ttrsZNARkUce0Q

  8. #8
    Join Date
    Dec 2011
    Posts
    6,073
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    Quote Originally Posted by kockie View Post
    i'd like to control a stepper motor from e1.31 to make a kind of dmx-winch. I'd like absolute control meaning 1 in the channel is position 1 and 254 in the channel is position 254. I tried this half a year ago and got some rudimentary movement. I have to call in my neighbour to help (he's a programmer)....
    Hi kockie
    I have managed to get stepper motors working now with code that can be simply added to the espixel firmware .
    If you are looking for something functional to test with .

    Cheers

  9. #9
    Join Date
    Nov 2015
    Location
    The Netherlands
    Posts
    77
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    Quote Originally Posted by angus40 View Post
    Hi kockie
    I have managed to get stepper motors working now with code that can be simply added to the espixel firmware .
    If you are looking for something functional to test with .

    Cheers
    iI'm interested for sure!
    Errors for fun only.

  10. #10
    Join Date
    Dec 2011
    Posts
    6,073
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    Quote Originally Posted by kockie View Post
    iI'm interested for sure!
    I am happy to report , you have your winch !!

    forward , reverse .

    on/off-energize and ramp from 0-255

    Simple control via color intensity .


    Code:
    /* 
    Stepper Motor Control
    with L293D ic & 1 x ws2811  pixel boards
    */
    
    #include <Stepper.h>
    
    
    
    
    // Set steps per revolution
    const int stepsPerRevolution = 32;  //<< Set to 1/2 of your stepper's rating if using stepper.h library for normal speed , or increase for faster speeds
    const int PWM_PIN = 14;  // PWM INPUT.   red  channel 
    const int PWM2_PIN =  12;  // PWM INPUT  blue channel      
    
    /* Motor >>>>> in pins 15-5  Pins from motor to L293D
    connection order on ic 4,3,2,1    */  
    Stepper motor1(stepsPerRevolution, 15,13,4,5);
    
    
    void setup() {
     
    
    
        // Initial pin states
        pinMode(PWM_PIN, INPUT); // pin 14 red channel sensor
        pinMode(PWM2_PIN, INPUT); // pin 12 blue channel sensor
        int Bsensor = 0;
    
    void loop() {
        
        }
        // MOTOR 1 CONTROL
        int speed = 0;
        int direction = 1;
      
        int position = analogRead(14);  // forward position sensor 
        int Bsensor = analogRead(12);  // reverse position sensor
      
      
        /*
        Forward steps
        */
        if (position > 0 ) {
        speed = map(position, 0, 1023, 0, 255);        
        }
        /*
        Reverse steps
        */
        if (Bsensor > 0 ) {
        speed = map(position, 0, 1023, 255, 0);      
        direction = -1;
        }
        //  Movement 
        if (speed > 0) {
        motor1.setSpeed(speed);
        motor1.step(direction);
    
      }
    }
    Last edited by angus40; 07-27-2019 at 05:14 AM. Reason: Simplified to 2 input pins for ez control

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •