Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 37

Thread: Ws 2812b pixels to control Dc motors

  1. #21
    Join Date
    Nov 2015
    Location
    The Netherlands
    Posts
    72
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    Quote Originally Posted by kockie View Post
    I am definitely going to try this... when my to-do list is a little shorter.
    I'm over my ears in work for "die Zauberflöte", when it is over and i have shortened the misses' todo list i will defenitely have a look at it
    Errors for fun only.

  2. #22
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    Quote Originally Posted by kockie View Post
    I'm over my ears in work for "die Zauberflöte", when it is over and i have shortened the misses' todo list i will defenitely have a look at it
    That may be a good thing ! I have since learned a few interesting things about stepper motors, their setup and using the stepper.h library .
    I will test some more re-defined code based on this and the stepper I am testing with .
    This may prove more precise over time/usage .
    Will post when done .

  3. #23
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    Stepper script is updated and simplified to use 2 channels of a single rgb ws2811 pixel board .
    Full range of movement forward and reverse from color intensity of 1 - 255 with 0(black) = stop

    Verified in Sequencer and with esPixelStick built in effects .

    Cheers

  4. #24
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    I dug out a servo today and gave it my fullest effort to make it work with this method .
    If you want finite control and a very easy method in doing so , a stepper is best .
    My experience with the servo concludes that they are not remotely capable .
    Unstable , over heat and not worth the effort for their limited capabilities .
    I plan on having a functional skeleton >> jaw , eyes and neck rotation the go to motor is definitely the stepper .
    The limited coding required combined with the perfect functionality make it a synch .
    cheers

  5. #25
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    I may have posted in haste ! After some reading and a little more testing , I have discovered that the addition of microseconds to write relieves the jitterbug effect . Also rather than a mapping of the read , instead dedicate the position using 3 channels to 0,90 and 180 .
    This will keep the code simple ,stable and sequenceable .

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

    Default Re: Ws 2812b pixels to control Dc motors

    Simple Servo control via 28** input tested and works
    Ok , I got this figured out .


    This surmises simplistic ways of motor control for me now woot
    Have fun with this !

    Code:
    #include "Servo.h"  // include the servo library
    
    Servo servo1; // create servo object 
    
    const int PWM2_PIN = D5;  //GPIO 14
    const int PWM3_PIN = D6;  //GPIO 12
    int val = 0;
    int val1 = 0;
    int position = 0;
    
    void setup() {
      
     // Serial.begin(115200);
      {
        //assign & attach channels to pins
        pinMode(PWM2_PIN, INPUT);
        servo1.attach(D4); //GPIO 2
        position = (90);
        servo1.write(position);
      }
    }
    
    void loop() {
      // servo1 test
    int val = digitalRead(D5);
    int val1 = digitalRead(D6);
     if (val == HIGH && val1 ==HIGH)  // No illumination data from sequencer
       position = (90);  //  value adjustable for your true center ( i required 80)
       servo1.write(position);
     if (val == LOW) //  Yes sequence Data
       position = (180); //  value adjustable for proper end point ( i required 170)
       servo1.write(position);
     if (val1 == LOW && val == HIGH) //  Yes sequence Data
       position = (0);
       servo1.write(position);
       
     }
    Last edited by angus40; 08-19-2019 at 02:43 PM.

  7. #27
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    I figured I should test this a little more thoroughly .
    While using a level effect to move the servo I found it best not to use 100%.
    A value between 80 - 95 % allowed the end points to remain stable while data is present .
    This code deafluts the servo to center position while no sequence data .
    I have updated the code for the 3 positions fully working .
    Cheers

    NOTE: I used 2 ws 2811 outputs for this .
    Last edited by angus40; 08-19-2019 at 01:54 PM.

  8. #28
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    may be re-written to hopefully eliminate the need of ws 2811 circuit boards .
    Last edited by angus40; 08-26-2019 at 01:47 AM.

  9. #29
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    Done
    Last edited by angus40; 08-26-2019 at 01:48 AM.

  10. #30
    Join Date
    Dec 2011
    Posts
    5,878
    Post Thanks / Like

    Default Re: Ws 2812b pixels to control Dc motors

    With much thanks to Barnabybear for sharing and pointing me in the right direction .
    Also Mr Cook for expounding on and sharing .

    Works a treat !
    Last edited by angus40; 08-26-2019 at 07:28 PM.

Page 3 of 4 FirstFirst 1234 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
  •