Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 35

Thread: octo 'basic test' give me all white

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19

    octo 'basic test' give me all white

    Hello,

    My setup is simple:-teensy 3.1
    -octo ws2811 adaptator
    -4 lines strip of 120 led each ( 8 =because of back and forth with Di Do connected,
    60 pcs/m, ws2812 or 2811 (not so clear on receipt) from wu's store))

    I use a power supply (dc output +5V 60 A) , the rj45 cable is cat 6a , arduino 1.0.5, and teensyduino 1.19.
    When I upload the example "octoWS2811/basic test" , it takes some time (latency) to update all the led, and also all led become white (no flickering).
    I follow the connection as shown on the site : http://www.pjrc.com/store/octo28_adaptor.html


    I've search in the forum, read a lost of posts, but can't find a solution for my problem.

    Does this 'all white' behaviour indicates you a way?

    I'm a beginner on the subject, or everyday I learn a little bit more.

    thanks

    p

    Click image for larger version. 

Name:	IMG_3301.jpg 
Views:	116 
Size:	75.1 KB 
ID:	2486Click image for larger version. 

Name:	IMG_3303.jpg 
Views:	128 
Size:	45.1 KB 
ID:	2487Click image for larger version. 

Name:	IMG_3304.jpg 
Views:	116 
Size:	108.5 KB 
ID:	2488
    Last edited by pamal; 08-07-2014 at 02:30 AM.

  2. #2
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    After cleaning all parts, redo solderings that were not perfect, control voltage....

    I felt like an empty bottle, maybe it's so simple that i can't see it !

    yes

    the last drop was to re-intall arduino + teensyduino.... ( so evident that I didn't do it !)

    everything is working perfectly, I can go further...

    next step is working with max/msp, but I've already seen some maxers in this place.

    thanks Paul for your products, and good is this forum!

    +P

  3. #3
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    The best strategy when working with Max is to use jitter to generate your pixel data.

    You then feed each frame to the serial object in Max and use Serial.readBytes() and read the of byte per frame (1440 in your case)

    Here's a small example:

    <pre><code>
    ----------begin_max5_patcher----------
    637.3ocuWtsaiBCDF9Z3ovhqyFgMGBzq59brppx.dSbDXiLlF1 V0280GfzDk
    lDRRgaXhMCC+ymGF67gqiWFuiz3AdB7GfiyGtNNlozS3zO1wqB 2kWhaLt4ky
    qpHLo2B68jjNoYdJ6MhPB3EEfRJSEydG9KmIY3JhwoeKn3xg6v ZqnrRhzDW3
    At2Pe23NDsz+Ke4sxAmGlkVXhJOa6uP96egh0YFm1+v0XY9FJa 8qBRtzlqvz
    .0sUlHsIEpuhTOA3E8i7oqq9xhQhDFYmRBmPjFhNaAXPZru+Th Czo3.lLDVq
    ex+USrYtZgRs3A77.ubA7jXHRPZp1rJcJvy6k.XXnOXsf2Va94 MxHzixnnyx
    nQCHjw.gASAg1RkKKnUU3Zvy8edAm65H3YYjRcuVgkBZ2UoU.J z90Vhwn4zz
    Pqp1RIstjzAdd+OUD7lw1iVZE+SPs9ZLDxziBFilrZLxAb6fA2 C4toBtfSIW
    zHI2syQXrskeR5TwQpjHlYbkb4VXisDKYk1DF+PjQif5cTVAe2 Ey0q90yp6u
    ubHxjCAgAKiTF6NW5s2uqLJqUJ4raHYfmlLgmMYxvr0iY0Y091 kSSYKiSaHf
    .P9Fr.D6CRl48XP+fMKgA8aHG8szxDAO64SO5LulHpm+XD1vaE 4CpouwNveu
    NJHMRJCKophju7Y0Q9rgVTPXGdp0BZCNqjX.f+2tTNV0nOAyUk i9nfyjdFCc
    lO0jLF3DMaxAMB4LepQevtqJG85IbVjSzQuoyrVAmM5DMR3LOp IbDpAcmpw1
    QDWWq96EM8gzHD01Ga4B8v3ElgTlcnocumf7FcveqCXgpmrT0P tUX2wnKI1y
    U+d9z8+.xeiywA
    -----------end_max5_patcher-----------
    </code></pre>

  4. #4
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    oh thank you Nathanael for this max strategy, I'll follow it.

    I test it with a simple sketch you share in the forum

    just changing "byte" for "int" in the test() : with "byte" it stops at the 256th led and turn in loop

    and the argument "== dimSerialArray " for the serialAvailable() blocks the loop
    if I delete it, it's better but not all the led update. mostly the first 408, and sometimes all, specially if I double click quickly to update jit.noise or send it a qmetro.

    I think I miss something in the protocole... and continue reading basics!

    have you got an idea?

    P

    thanks

    Code:
     
    /*  OctoWS2811 BasicTest.ino - Basic RGB LED Test
      Required Connections
      --------------------
        pin 2:  LED Strip #1    OctoWS2811 drives 8 LED Strips.
        pin 14: LED strip #2    All 8 are the same length.
        pin 7:  LED strip #3
        pin 8:  LED strip #4    A 100 ohm resistor should used
        pin 6:  LED strip #5    between each Teensy pin and the
        pin 20: LED strip #6    wire to the LED strip, to minimize
        pin 21: LED strip #7    high frequency ringining & noise.
        pin 5:  LED strip #8
        pin 15 & 16 - Connect together, but do not use
        pin 4 - Do not use
        pin 3 - Do not use as PWM.  Normal use is ok.
    
      This test is useful for checking if your LED strips work, and which
      color config (WS2811_RGB, WS2811_GRB, etc) they require.
    */
    
    
    #include <OctoWS2811.h>
    
    const int ledsPerStrip = 120;
    const int dimSerialArray = 1440; // 3 * number of leds
    
    DMAMEM int displayMemory[ledsPerStrip*6];
    int drawingMemory[ledsPerStrip*6];
    
    const int config = WS2811_GRB | WS2811_800kHz;
    
    OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
    
    char serial_array[dimSerialArray];
    
    void setup() {
      Serial.begin(9600);
      leds.begin();
      test();
    }
    
    void loop() {
      if (Serial.available()  == dimSerialArray ) { //
        Serial.readBytes(serial_array, dimSerialArray);
        for (int i = 0; i < dimSerialArray - 1 ; i++) {
          leds.setPixel(i, serial_array[i*3], serial_array[i*3+1], serial_array[i*3+2] );
        }
        leds.show();
      }
    }
    
    void test() {
      for (int i = 0; i < 480 ; i++){
        leds.setPixel(i, random(0,255), random(0,255), random(0,255));
        leds.show();
        delay(10);
        leds.setPixel(i, 0, 0, 0);
        leds.show();
      }
    }


    ps: chouettes réalisations sur ton site, notament pour 'roue vive' avec les cerceaux lumineux sur alim est impressionnant de légèreté.

  5. #5
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Quote Originally Posted by pamal View Post
    ps: chouettes réalisations sur ton site, notament pour 'roue vive' avec les cerceaux lumineux sur alim est impressionnant de légèreté.
    Merci

    You could adding Serial.println(Serial.available); before the if in the loop to see what size max is sending. I know there is a limitation in the serial object to how much data you can send at a single time.

  6. #6
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    ... I put "Serial.print(Serial.available());"

    when send some value from max , teensy + led reacts
    if I open serial monitor, got an error message '/dev/tty.usbmodem432311 already in use'
    (which is the port I use)


    maybe there is a way to bypass that...

    ... time for me to take a new lesson on serial!

    +p

  7. #7
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    ah yes you would need to check the output of the serial object from Max rather than the serial monitor..

  8. #8
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    effectively, the right outlet of serial give me 1024!

  9. #9
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Then the idea would be to send chunks of 1024 from Max.
    Normally since we do a readBytes(1440) in the Teensy code then it should display a frame only after it has received the correct amount of data.

    <pre><code>
    ----------begin_max5_patcher----------
    728.3ocyW1sbiBBEG+ZySACWmMCG7in6UceN1YmNnRSIihNH1l sc569Jno0N
    Y2D0jko2HgiD3O+3bNd30Ud3zpC7FL56neh77dckmm0jwf2PeO bI6PVAqwNL
    rj+bU5d759Wo4GzVyZTJp3n0Gpj5FwKbya.5Fxf4pVcAWq+cMu eAwoL4N7ZD
    Fi90vPjskBY2frqELXrloydTH2cuhmo6+qPLzMsn.Hwz3S2DtF QIaHimn9ky
    NSzAqhbqX61.eCHiUqjUZEE9GJAq.adwaqVYdr953xKEHHHffT 7cykNmgLz+
    MYnPrkLg9llsDyy4QlDmBllBQFGADZfa3yfmi+VqmCP1Ne.A2V .kUUVxk5SH
    jP9DWoQU44nBgrKJ8774A0tTiIx6VlbvTh0WARBMMIvEHB4ThP cSvTC2LgHF
    JIhPlq6hvf3qHWSXfMVp2uYlNLwNMjZmpps19S2FRE3aRCCf+B HTnSHzdgdS
    tnrjUitaH7BlKi5li6KYZk3vxbm7oA8Qa17z.cAYnAvYzprsPK pK3GP289O6
    H3+IrcYmLJ0ljBhnyGaQtyGiOhai5bCH2059MvQHpOme7kRm4e JGcWrpPyUK
    JG10fFZrslffn4SlabddCBpeVHyqdFufT1mYqFPiFkxdnXHyW9 mdzz1kriRa
    05JI9rWHXomaeTq6YO1fS2JA2X2VYkngi7QYOxTnHBJ10ei4XP teeCDN+jkz
    o4JamPbe8oe5VjVUYr+YD1T0pxNtMGtsA5CYkyazBISK5bR9XL l5mFMnGE44
    b43RQyEMrzBtU8j+5Y4Tki4ZgWTOItUNvWH7LkSKhSkCLgCKvM pIbJzwYvIX
    Bpg5L0LE1D4T0bwvJ2cTAvDoiabjoSPMgNCNwSIpxcxIZBxI9K kZ1tP0z+sc
    Vcc2EkaFlRqP5JDZekxzMZssqP120VRBVweRbb78Cfo5pPQ2Ud RqpuNhCwQc
    UQzsNus5OPDKsTO
    -----------end_max5_patcher-----------
    </code></pre>

    Not 100% it works but you can give it a try !

  10. #10
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    yes, it works! thanks your reply!

    I was just trying to take the output from jit.iter, and read readBytes(3)...

    Code:
    #include <OctoWS2811.h>
    
    const int ledsPerStrip = 120;
    
    DMAMEM int displayMemory[ledsPerStrip*6];
    int drawingMemory[ledsPerStrip*6];
    
    const int config = WS2811_GRB | WS2811_800kHz;
    
    OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
    
    char serial_array[3];
    
    void setup() {
      Serial.begin(115200);
      leds.begin();
      test();
    }
    
    void loop() {
      if (Serial.available() == 3) { 
      for (int j = 0; j < ledsPerStrip*4 ; j++) {
        Serial.readBytes(serial_array, 3);
          leds.setPixel(j, serial_array[0], serial_array[1], serial_array[2] );    
      }
        leds.show();
      }
    }

    I presume it is better to send 2 packets than 480?

  11. #11
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    It's much faster to send large chunks than small chunks.

  12. #12
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    ok then I'll follow your way with large chunks!
    ...
    tomorow maybe, it's quite late here (1:30 AM)

    thank you for your help.

  13. #13
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    hi

    I try to go further with 1800 leds on 6 strip.
    then I send from Max : 1800 x 3 =5400 bytes

    I split these datas in several chunks - try 900 for equal length chunks
    -and 1024 like a multiple of 64 , but have a end of different lenght ( 280) .... what is best?

    on the sketch, I use : Read.serialBytes (buffer , length )
    but I'm a bit confused on the length : is it for me the total of bytes or the length of a chunk, the exact length of the buffer?
    also I try to use the return value to wait for the 5400.. but I'm not sure of the syntax

    ( I try to find some documentation but navigate between easy fonction definition from arduino, and heavy material..)

    I post the code I use, but got some bad timing issue,
    when I speed things up, like a noise all in red, the color shift to a blue or green, and sometimes a pixel seperate on to adjacent leds.


    Code:
    
    #include <OctoWS2811.h>
    
    const int ledsPerStrip = 300; 
    
    DMAMEM int displayMemory[ledsPerStrip*6];
    int drawingMemory[ledsPerStrip*6];
    
    const int config = WS2811_GRB | WS2811_800kHz;
    
    OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
     
    void setup() {
      Serial.begin(115200); 
      leds.begin();
    }
    
    int ReturnVal = 0;
    int ReturnCount = 0;
    char serial_array[5400];
    
    void loop() {
      if (Serial.available() ) { 
        ReturnCount = Serial.readBytes(serial_array, 5400);
        ReturnVal += ReturnCount;
      }
      if ( ReturnVal >= 5400 ) {
        for (int i = 0; i < 1800; i++) {
          leds.setPixel(i, serial_array[i*3], serial_array[i*3+1], serial_array[i*3+2] );
        }
        leds.show();
        ReturnVal = 0;
      }
    }

    where I split in max

    Code:
    <pre><code>
    ----------begin_max5_patcher----------
    727.3oc0W00jZBCE8Y7WQl7rkII7gPeq+N5zYmfl5FGH3Dhasty9euIAwhJK
    AoJ61WvgqWRN2y8bu2jWm4AyJ2ypffuB9Nvy60YddVSFCdGe2CVP2uLmVYcC
    trrnfITv40+mhsWYsqJAULImlCJy1vVdxgsT0xm4h0OIMFsaDNNwmDMGDDtv
    W+CNB4iz+j3i.+33WI1UTtSkyT1MEcz5OKEpJ9AlwF17Q0l4qrHPuueIE1xU
    Asv5J7aFbcBPRVkN.nJdonKPUillGsQDWz.HbytHWmYAnOxX3sYyLOl+ORkE
    TkjuGDi.AZPD.1lSE5jjaBEGZIx6Hel3lOe.DSMT6KfCw9KrJHaDShZd5Hfa
    EYw8h+lTiwa3HhfBVUEcM6pT6g7k4LprmPaQhM4YiqvHGIRbWIRxoDYsmpeu
    kUu1P3o0oESPBtwjLYDDhdAxX8E2Db5QMbhONJNIVG9INBeR+53qBetoXC.y
    nh0cyD3Az9fJ01UL4SLAMKm0VdctTZLrD6WZbbkpIujtxnnzAGIbHbHgzvgK
    RFiDBcqRHxs1m3NVS4hTH0MGpqnVXoi3GKcfSmhJpt0JGxAADDBAxYB2rRcm
    y3v6bgloJqagB5CkYLREvZY4tstJkZlvfSsbSZ7TwPwjIfgduRo.mJFbDY5p
    iBQ+mTGgIASacTH9iiY1vU9bUuCyapdRC7iPoIXrVw35PoAigadO9AOECjre
    8P5gLrCohuoZiznNiCjiCvZWJXNWb4s9r32X+7.tpbmbYCPZ5OA9aHrhUo3B
    6koZ6zY97Le0JlnM5VwqLmcxFMceAggBG7PfioZ4yDdtfCej3wLv0IdLmWAf
    mF7fGJ+LQ3YH4KxzoeLWF6yj9IbH4Kyb5IJeMn1OWH5ej3wzF1c80XyW0cqo
    a29BSVcbMsPQOHZSoz7Z7b6qbQ8q1gHPI6Edi+KrVnR8zIkdzzNY8nv8wg54
    B584sY+AbLHiWB
    -----------end_max5_patcher-----------
    </code></pre>

  14. #14
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    You could probably simplify it like this:

    Code:
    void loop() {
      if (Serial.available() >= 5400 ) { 
        Serial.readBytes(serial_array, 5400);
        for (int i = 0; i < 1800; i++) {
          leds.setPixel(i, serial_array[i*3], serial_array[i*3+1], serial_array[i*3+2] );
        }
        leds.show();
      }
    }

  15. #15
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    In the sketch you would read 5400 bytes as you do, so in theory the sketch will wait until 5400 bytes has arrived from Max to set the pixels and display them. The size of the chunks from max is irrelevant but probably best to send them in 1024 chunks for best speed.

  16. #16
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    effectively I did too complicate.
    but also

    it is like the line :: if (Serial.available() >= 5400 )
    blocks the serial object who gives me in its right outlet : write -1 ,

    if I just put :: if (Serial.available() )
    it works but badly : when I speed things (like metro in jit.noise around 50ms ) sometimes I got the same 'write -1' very quickly and errors occurs in leds.

  17. #17
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    does it work if you change 5400 to something lower ?
    Serial.available might have a limit also...

  18. #18
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    yes , it seems that until 580 it works , above it begins to not.

  19. #19
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Hmm that's strange as I'm driving a 240 led strip here and it works (so that would be 720 channels)

    Here's the code I use:
    Code:
    /*  OctoWS2811 BasicTest.ino - Basic RGB LED Test
      Required Connections
      --------------------
        pin 2:  LED Strip #1    OctoWS2811 drives 8 LED Strips.
        pin 14: LED strip #2    All 8 are the same length.
        pin 7:  LED strip #3
        pin 8:  LED strip #4    A 100 ohm resistor should used
        pin 6:  LED strip #5    between each Teensy pin and the
        pin 20: LED strip #6    wire to the LED strip, to minimize
        pin 21: LED strip #7    high frequency ringining & noise.
        pin 5:  LED strip #8
        pin 15 & 16 - Connect together, but do not use
        pin 4 - Do not use
        pin 3 - Do not use as PWM.  Normal use is ok.
    
      This test is useful for checking if your LED strips work, and which
      color config (WS2811_RGB, WS2811_GRB, etc) they require.
    */
    
    #include <OctoWS2811.h>
    
    const int ledsPerStrip = 240;
    
    DMAMEM int displayMemory[ledsPerStrip*6];
    int drawingMemory[ledsPerStrip*6];
    
    const int config = WS2811_GRB | WS2811_800kHz;
    
    OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
    
    char serial_array[ledsPerStrip*3];
    
    void setup() {
      Serial.begin(115200);
      leds.begin();
      test();
    }
    
    void loop() {
      if (Serial.available() == ledsPerStrip*3) {
        Serial.readBytes(serial_array, ledsPerStrip*3);
        for (int i = 0; i < ledsPerStrip*3 ; i++) {
          leds.setPixel(i, serial_array[i*3], serial_array[i*3+1], serial_array[i*3+2] );
        }
        leds.show();
      }
    }
    
    void test() {
      for (int i = 0; i < ledsPerStrip * 2 ; i++){
        leds.setPixel(i, random(0,255), random(0,255), random(0,255));
        leds.show();
        delay(20);
        leds.setPixel(i, 0, 0, 0);
        leds.show();
      }
    }

  20. #20
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    in serial inspector , do you set the 'data chunk size' to 720 , and also the 'buffer size'?

  21. #21
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    These are left to default here: Data Chunk Size = 1 and Buffer size = 2048

  22. #22
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    ok, I try your config of 240 leds and it works fine.

    then I try to double : 480 leds with max always sending chunks of 720

    I see (right outlet of serial) :
    - several times "write 720" but no led reaction
    - one time "write 304"
    - and neverending "write -1" until I send a 'reset' message to serial and redo one time "write 304" and "write -1".....




    Code:
    #include <OctoWS2811.h>
    
    const int ledsPerStrip = 120; 
    
    DMAMEM int displayMemory[ledsPerStrip*6];
    int drawingMemory[ledsPerStrip*6];
    
    const int config = WS2811_GRB | WS2811_800kHz;
    
    OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
     
    void setup() {
      Serial.begin(115200); 
      leds.begin();
      leds.show();
    }
    
    char serial_array[1440];
       
    void loop() {
      if (Serial.available() == 1440 ) {   //
        Serial.readBytes(serial_array, 1440);
        for (int i = 0; i < 480; i++) {
          leds.setPixel(i, serial_array[i*3], serial_array[i*3+1], serial_array[i*3+2] );
        }
        leds.show();
      }
    }
    if I let "serial.available() " without argument it start working ,
    but with the same error than before (teensy begins to shift data )

  23. #23
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Then perhaps the thing to do would be to read fixed chunks of say 720 bytes from Max and fill a larger buffer in your sketch and wait for all the chunks to arrive before calling leds.show()

  24. #24
    Junior Member
    Join Date
    Aug 2014
    Location
    Paris
    Posts
    19
    work around and try things , but no good syntax for the moment!!

    but thanks, I got a better comprehension of the error.

    (then I go back to o'reilly's cookBook ! héhé )

  25. #25
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,498
    This chunk of code is a really terrible way to receive data.

    Code:
      if (Serial.available() == 1440 ) {   //
        Serial.readBytes(serial_array, 1440);
    USB transmits data arrives in packets, so the amount of data Serial is holding increases in packet-size amounts, not one byte at a time.

    Normally, the packets are 64 bytes, so it's quite possible the amount of available data can suddenly increase from 1408 to 1472, without ever appearing to be exactly 1440.

    This code also assumes Serial can hold 1440 bytes, which is usually true, but might not always be the case.

    Since all the data is being copied into the "serial_array", a much better way to accomplish this would involve always copying as much as possible, as soon as possible, with a variable to remember how much is in serial_array.

    For example, perhaps something like this:

    Code:
      int n = Serial.available();
    
      // first, check if there's anything available to read
      if (n > 0) {
    
        // if it's more than needed, read only enough to fill the array
        if (n > 1440 - serial_array_length) n = 1440 - serial_array_length;
    
        // actually read the data, adding to whatever is already in the array
        Serial.readBytes(serial_array + serial_array_length, n);
        serial_array_length = serial_array_length + n;
    
        // then check if this filled the array and use the data
        if (serial_array_length >= 1440) {
    
          // set serial_array_length back to zero in here....
    This style uses several more lines of code, but it's far more reliable. If Serial isn't able to hold 1440 bytes, this grabs the data without any assumption about how much Serial can hold. If extra data arrives, only the amount needed to complete fill serial_array is read.

Posting Permissions

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