0

Help needed - Kaleidoscope Goggles with Ring - 24 x 5050.
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Help needed - Kaleidoscope Goggles with Ring - 24 x 5050.

by edzdeb on Thu Oct 12, 2017 5:06 pm

Hello,
I am working on a robot costume project for Halloween and I am using the kaleidoscope goggles as a template for the robots' eyes, but I am using the Ring - 24 x 5050 RGBW instead of the Ring - 16 x 5050 RGB to get the robot eyes to be the right size. I thought I could use the code kaleidoscope software to drive the Ring - 24 by merely updating the number of pixels from 32 (2 rings X 16 LED's) to 48 (2 rings X 24 LED's).

For example:
Code: Select all | TOGGLE FULL SIZE
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(48, PIN);   // 48 LES's instead of 32


I quickly realized that was not going to work and there are functions in the software that are built around the 16 LED rings and that the software would need to be updated to work with 24 LED's. I have tried many things to update the code, but I am afraid I am over my head and need some help. Is there anyone out there who has updated this code to work with the ring - 24 or does anyone have a suggestion that would allow my code to fiction correctly?

The following code aluminates only half of the LED's on the second ring, and the patters on both rings look to be completely random when they should look like a kaleidoscope effect.
I am using a Trinket Pro

Code: Select all | TOGGLE FULL SIZE
// Low power NeoPixel goggles example.  Makes a nice blinky display
// with just a few LEDs on at any time.

#include <Adafruit_NeoPixel.h>
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
 #include <avr/power.h>
#endif

#define PIN 18

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(48, PIN, );

uint8_t  mode   = 0, // Current animation effect
         offset = 0; // Position of spinny eyes
uint32_t color  = 0xFF0000; // Start red
uint32_t prevTime;

void setup() {
#ifdef __AVR_ATtiny85__ // Trinket, Gemma, etc.
  if(F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
  pixels.begin();
  pixels.setBrightness(85); // 1/3 brightness
  prevTime = millis();
}

void loop() {
  uint8_t  i;
  uint32_t t;

  switch(mode) {

   case 0: // Random sparks - just one LED on at a time!
    i = random(32);
    pixels.setPixelColor(i, color);
    pixels.show();
    delay(10);
    pixels.setPixelColor(i, 0);
    break;
 
   case 1: // Spinny wheels (8 LEDs on at a time)
    for(i=0; i<24; i++) {
      uint32_t c = 0;
      if(((offset + i) & 7) < 2) c = color; // 4 pixels on...
      pixels.setPixelColor(   i, c); // First eye
      pixels.setPixelColor(23-i, c); // Second eye (flipped)
    }
    pixels.show();
    offset++;
    delay(50);
    break;
  }

  t = millis();
  if((t - prevTime) > 8000) {      // Every 8 seconds...
    mode++;                        // Next mode
    if(mode > 1) {                 // End of modes?
      mode = 0;                    // Start modes over
      color >>= 8;                 // Next color R->G->B
      if(!color) color = 0xFF0000; // Reset to red
    }
    for(i=0; i<48; i++) pixels.setPixelColor(i, 0);
    prevTime = t;
  }
}


Source for Software: https://learn.adafruit.com/kaleidoscope ... a/software

edzdeb
 
Posts: 2
Joined: Thu May 25, 2017 11:27 pm

Re: Help needed - Kaleidoscope Goggles with Ring - 24 x 5050

by Disciple on Thu Oct 12, 2017 7:34 pm

Hi. Another hobbyist here. Hope you don't mind a short reply.
I shared a Trinket+rings sketch at https://forums.adafruit.com/viewtopic.php?f=47&t=121922&p=613430#p613430
It can do the kaleidoscope effect on two or more rings of 24. All you have to do is ensure the #define numbers at the top are right (and I think they already are, lucky). You're welcome to use and adapt it. Best of success.

Hallelujah!
Disciple

Disciple
 
Posts: 489
Joined: Tue Jan 06, 2015 8:13 pm

Re: Help needed - Kaleidoscope Goggles with Ring - 24 x 5050

by edzdeb on Thu Oct 12, 2017 10:03 pm

Disciple wrote:Hi. Another hobbyist here. Hope you don't mind a short reply.
I shared a Trinket+rings sketch at https://forums.adafruit.com/viewtopic.php?f=47&t=121922&p=613430#p613430
It can do the kaleidoscope effect on two or more rings of 24. All you have to do is ensure the #define numbers at the top are right (and I think they already are, lucky). You're welcome to use and adapt it. Best of success.

Hallelujah!
Disciple


Disciple, Thank you so much for your reply! I tried the code you suggested and was having the same issue I described above. Obviously, there is something I am doing differently than everyone else so went back to the beginning. After a few hours, it hit me, I ordered GRBW (W=White), not sure why I did that. I guess I wanted to be different. Well, I thought I remembered something from the uberguide about GRBW blinking in a weird way and boom there it was...

I changing "NEO_GRB" To NEO_GRBW and everything worked perfelcy.
Code: Select all | TOGGLE FULL SIZE
Adafruit_NeoPixel npchain = Adafruit_NeoPixel(RING_COUNT * RING_SIZE + WILD_PIXELS, NEO_PIN, NEO_GRBW + NEO_KHZ800);

I have no idea why it works but it does. I hope this can help someone else save some time.
Thanks again!

edzdeb
 
Posts: 2
Joined: Thu May 25, 2017 11:27 pm

Re: Help needed - Kaleidoscope Goggles with Ring - 24 x 5050

by Disciple on Fri Oct 13, 2017 5:13 pm

Erk! I missed that detail! Good job catching the fix I missed. Glad to hear it's working. (c:
It's at this point I always encourage sharing of project pictures, or even better, bringing it to Show-and-Tell. Happy creating!

Hallelujah!
Disciple

Disciple
 
Posts: 489
Joined: Tue Jan 06, 2015 8:13 pm

Please be positive and constructive with your questions and comments.