Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: A little help with Teensy

  1. #1
    Join Date
    Nov 2016
    Location
    Washington State
    Posts
    179
    Post Thanks / Like

    Default A little help with Teensy

    I am very new to working with LED controllers and have been able to figure out some of the very basics but would like to begin upscaling as I begin to further understand some of the intermediate concepts.
    I would like to start working with a teensy 3.2 and an OctoWS2811 adaptor to control a mix of WS2811 and WS2812b lights using vixenlights.
    I am having a hard time with getting started with a sketch as I am unsure on how to work with multiple pins/channels.
    Does anybody have a sample sketch and a basic diagram of how pin connection setup?
    Fore the most part I will be working with a lot of single strings (WS2811) and on a separate controller a mega tree fifty pixels high and 28 - 32 strips wide. (WS2812b)
    Thanks in advance.

  2. #2
    Join Date
    Nov 2009
    Location
    Morrisburg, On, Canada
    Posts
    2,540
    Post Thanks / Like

    Default Re: A little help with Teensy

    There appears to be a few users here working with the Teensy 3. I have not yet used my Teensy3.1.
    Have you looked at this link to get started? https://www.pjrc.com/teensy/td_libs_OctoWS2811.html
    It has a sketch to drive 8 strips, if I understood it right.

  3. Thanks tecnageek thanked for this post
  4. #3
    Join Date
    Nov 2016
    Location
    Washington State
    Posts
    179
    Post Thanks / Like

    Default Re: A little help with Teensy

    Edited for Duplicate posts
    Last edited by tecnageek; 01-12-2017 at 02:49 PM.

  5. #4
    Join Date
    Nov 2016
    Location
    Washington State
    Posts
    179
    Post Thanks / Like

    Default Re: A little help with Teensy

    Edited for Duplicate posts
    Last edited by tecnageek; 01-12-2017 at 02:49 PM.

  6. #5
    Join Date
    Nov 2009
    Location
    Morrisburg, On, Canada
    Posts
    2,540
    Post Thanks / Like

    Default Re: A little help with Teensy

    Sorry, I wasn't of more help.
    I don't have any WS2812b strings, but I thought they used the same protocol as the WS2811. The wiring may be slightly different.
    The OctoWS2811 board must be used since the Teensy 3x library uses 8 (octo) lines, or rows of pixels. From this I gather that the setup is for video or pixel arrays, but it can also be used in a non-video project. It is the addressing that tells the Teensy which LED to turn on or off.
    See http://www.pjrc.com/teensy/td_libs_OctoWS2811.html and the section "LED Addressing & Different Strip Lengths" for the concept. You don't need to connect all 8 lines with pixel strings, as long as you use the addressing scheme with the pixel strings you do attach.

    EDIT:
    I looked at this site; https://learn.sparkfun.com/tutorials...t-hookup-guide to see how they wired the WS2812b. The sample sketch uses the same Adafruit library that I used for my WS2811. So code wise I don't see the difference. You could use the WS2811 on line 1 of the Teensy 8 lines and wire a WS2812b on line 2. Then noting how many pixels you have on each line you use the addressing scheme to code the setPixelColor() array.
    Last edited by LightUp; 12-20-2016 at 11:36 AM.

  7. #6
    Join Date
    Nov 2016
    Location
    Washington State
    Posts
    179
    Post Thanks / Like

    Default Re: A little help with Teensy

    Sorry about all the extra posts. Didn't realize they had to be admin approved. Thought they were deleted
    The wiring is exactly the same for both types of lights. I thought you have to tell the library what type of lights you are using for each output.
    Your edit comment looks like it should be helpful.
    Thank again. I will be receiving my teensy shortly and I will do some testing then.

  8. #7
    Join Date
    Nov 2009
    Location
    Morrisburg, On, Canada
    Posts
    2,540
    Post Thanks / Like

    Default Re: A little help with Teensy

    OK.
    The concept could also be tried on an Arduino UNO, or MEGA with the Adafruit neo-pixel library.
    The Teensy 3.1 allows control of more pixels, but requires a voltage translator since the Teensy 3x uses 3.3V while the pixel data line uses 5V.
    The UNO and MEGA are "5V ready".

  9. #8
    Join Date
    Nov 2016
    Location
    Washington State
    Posts
    179
    Post Thanks / Like

    Question Re: A little help with Teensy

    OK. I have my Teensy 3.2 soldered to an OCTOWS2811 (5V translator) I have a small string of 25 test lights on the strip 1 position, and when I load a rainbow test sketch all is working and all the pixels light up and change color per sketch.
    My current hurdle is controlling light via Vixen lights. I have loaded the following sketch onto my teensy-octo combo, created a generic numbered group of 25, used RGB color handling (75 patch point) patched them to a generic serial controller (75 outputs) matched the serial speed of the sketch @ 115200 and added VIXStart to the header. open a sequence and turn on preview select a simple effect like "Set Level" and nothing.
    PS Yes. the lights are connected to a separate power supply 5v 30a converter, that I have used to power other projects and powers the pixels fine using a test sketch.
    Any words of wisdom would be greatly appreciated.


    Code:
    /*
    ************************  Heinz Doessegger  -  www.technikfreak.ch  ******************************
    
    Vchristmas v1.0 - January 2015
    Documentation for the project:
    Http://www.technikfreak.ch/category/technik-elektronik/technik-elektronik-projekte/technik-elektronik-projekte-weihnachtsbeleuchtung/
    
    HARDWARE: TEENSY 3.1 / 3.2
    
    ARDUINO PLUGIN: TEENSYDUINO with OctoWS2811 library
    Http://www.pjrc.com/teensy/td_download.html
    
    LED: WS2811
    
    SOFTWARE: Vixen Lights 3.x
    Program to control WS2811 RGB LED by Vixen Lights 3.x http://www.vixenlights.com/
    DISPLAY CONFIGURATION - COMx (x = COM port of Arduino) 115200, None, 8 One
    SEND A TEXT HEADER: VIXStart
    Channels: Pro LED requires 3 channels (red / green / blue)
    Color Handling: RGB
    
    TIP: For beginners
    Start with a 50 series LED. LedsPerStrip and PixelCount to 50.
    In Vixen Lights, create 50 LED elements and map to 150 outputs via the Color Handling RGB.
    
    ************************  Heinz Doessegger  -  www.technikfreak.ch  ******************************
    */
    
    #include <OctoWS2811.h>
    
    const int ledsPerStrip = 25;              // Maximum number of pixels per string
    int   PixelCount = 200;                      // Effective number of pixels
    float hell = 0.50;                          // Dimmer 1.00 = 100% brightness - 0.50 = 50% brightness 
    
    DMAMEM int displayMemory[ledsPerStrip*6];
    int drawingMemory[ledsPerStrip*6];
    const int config = WS2811_GRB | WS2811_800kHz;
    OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
    int pixelValue = 0;
    
    void setup()
    {
      delay(300);
      Serial.begin(115200);                     // Speed of data transmission from Vixen Lights 3 to the Arduino
    
      leds.begin();
      for (int i=0;i<PixelCount;i++)            // Initialization - Once all LEDs light up blue
         {
           leds.setPixel(i, 0, 0, 200*hell);
         }
           leds.show();   
         delay (5000);  
      for (int i=0;i<PixelCount;i++)
         {
           leds.setPixel(i, 0, 0, 0);
         }
         leds.show();   
    }
    
    void loop() 
    {                    
     
        if (Serial.available()>5)                // Wait for data transmission from Vixen Lights
      {
         waitForVixenHeader();                   // Call function: Waiting for start string
    	
      	for (int pixCount=0; pixCount<PixelCount;pixCount++)       // Do this for as many Pixels defined in PixelCount
        {
          int RGB[3];                             // Array for the three RGB color valuesArray for the three RGB color values                   
          for (int color = 0;color<3;color++)     // Three values each form one RGB LED
          {                       
            while (Serial.available() < 1)        // Wait for the next number
            {
              delay(10);
            }
            RGB[color] = int(Serial.read()*hell); // Assign color value to the array with brightness correction
          }                                       // Repeat until all three values are read
              
            leds.setPixel(pixCount, RGB[1], RGB[0], RGB[2]);
          
        }                                         // Repeat until all LEDs are read
        leds.show();                              // Activate color patterns                             
      }                                           // Get the next color pattern
    }                                             // Loop end
    
    void waitForVixenHeader()
    {
        char *header="VIXStart";
        char buffer[8];
        int index = 0;
    
        while (true) 
        {
            int inByte = Serial.read();
            if(inByte==-1)
            {
              continue;
            }
            
            buffer[index] = inByte;
            if(buffer[index]!=header[index])
            {            
                index=-1;                     
            }
            
            buffer[index+1] = 0;              
            index++;
            if(index==8)
            {
              return;
            }
        }
    }
    Last edited by tecnageek; 01-12-2017 at 02:49 PM.

  10. #9
    Join Date
    Nov 2009
    Location
    Morrisburg, On, Canada
    Posts
    2,540
    Post Thanks / Like

    Default Re: A little help with Teensy

    Well, for starters, why is your buffer only 3 characters while your header is 8 characters?

    char *header="VIXStart";
    char buffer[3];

  11. #10
    Join Date
    Nov 2016
    Location
    Washington State
    Posts
    179
    Post Thanks / Like

    Default Re: A little help with Teensy

    Quote Originally Posted by LightUp View Post
    Well, for starters, why is your buffer only 3 characters while your header is 8 characters?

    char *header="VIXStart";
    char buffer[3];
    So would you recommend my header be the max number of pixels and the buffer the number of digits in the header?

Page 1 of 3 123 LastLast

Tags for this Thread

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
  •