Page 39 of 46 FirstFirst ... 293738394041 ... LastLast
Results 381 to 390 of 459

Thread: RGB LED's Now Consumer Grade - Hackable?

  1. #381
    Join Date
    Nov 2010
    Location
    San Jose, California
    Posts
    39
    Post Thanks / Like

    Default Re: RGB LED's Now Consumer Grade - Hackable?

    Quote Originally Posted by Entropy View Post
    Nope, the processor isn't going to get a nice steady regulated 5 volts in this case. However, it probably isn't going to matter. The chip is actually rated to run off of 3.3 volts at lower clock speeds, however feeding it 3.3 and running it at 16 MHz is technically "overclocking" it (no risk of damage here, but a small risk of glitches). If you change the crystal to 8 MHz the chip will be running well within its ratings, but there's a good chance this isn't necessary - quite a few people have undervolted AVRs like this before.
    I believe that the AVR chips can run at 16MHz at as low as 4.5 volts and still be in spec. While you probably won't get 5 volts from the regulator with 5.6 volts input, I'm pretty sure you will get at least 4.5 volts.

    In other words: don't worry about it. Its fine.
    darco
    [url]http://www.deepdarc.com/[/url]

  2. #382
    Join Date
    Jan 2008
    Location
    Malden MA
    Posts
    972
    Post Thanks / Like

    Default Re: RGB LED's Now Consumer Grade - Hackable?

    There are quite a few LDO regulators that will work with less than 0.6V headroom. I did a quick search on Digikey; ADP3338 looks like a good choice.
    /mike

  3. #383
    Join Date
    Dec 2010
    Posts
    22
    Post Thanks / Like

    Default Re: RGB LED's Now Consumer Grade - Hackable?

    Quote Originally Posted by pmcpa View Post
    Snowmen are not the same patterns, and no remote.... but I suspect the same RGB Nodes
    I had a snowman... briefly... then some lowlife stole it right outta my yard. *sigh*

    the eight patterns it had were a match to the ones of the strings/snowflakes, it just didn't have as many modes, and no remote... the nodes are the same as on the snowflakes.

  4. #384
    Join Date
    Dec 2009
    Location
    Royersford, PA (Philly)
    Posts
    1,383
    Post Thanks / Like

    Default Re: RGB LED's Now Consumer Grade - Hackable?

    Agreed... I think all the nodes and codes are the same

  5. #385
    Join Date
    Dec 2010
    Posts
    22
    Post Thanks / Like

    Default Re: RGB LED's Now Consumer Grade - Hackable?

    Quote Originally Posted by pmcpa View Post
    Agreed... I think all the nodes and codes are the same
    and, ya know, after coming up with such a genius generic easily adaptable system, it'd be incredibly stupid of them to make each one different, except a somewhat generic controller (the controller board has markings for different light counts).

    oh, wait, GE... forget what I said about stupid.

  6. #386
    Join Date
    Dec 2009
    Location
    Royersford, PA (Philly)
    Posts
    1,383
    Post Thanks / Like

    Default Re: RGB LED's Now Consumer Grade - Hackable?

    Remember, they aren't GE, they are just GE Branded.... They are a china design, imported by an American company, who pays GE to use their logo :-)

  7. #387
    Join Date
    Dec 2010
    Posts
    22
    Post Thanks / Like

    Default Re: RGB LED's Now Consumer Grade - Hackable?

    Quote Originally Posted by pmcpa View Post
    Remember, they aren't GE, they are just GE Branded.... They are a china design, imported by an American company, who pays GE to use their logo :-)
    so, what you're saying is that they are less likely to do something stupid?

  8. #388
    Join Date
    Dec 2009
    Location
    Royersford, PA (Philly)
    Posts
    1,383
    Post Thanks / Like

    Default Re: RGB LED's Now Consumer Grade - Hackable?

    well... there are just more steps to do stupid things!

  9. #389
    Join Date
    Dec 2010
    Posts
    22
    Post Thanks / Like

    Default Re: RGB LED's Now Consumer Grade - Hackable?

    Quote Originally Posted by pmcpa View Post
    well... there are just more steps to do stupid things!
    heh, well, after getting my snowman jacked from my front yard, I did have some niceness on xmas day... *three* more 50 light sets showed up under the tree.... now to just figure something to do with 'em. I'm thinking mood lighting around the periphery of the ceiling in the den, for starters. maybe wire 'em up to do the color organ thing to music too. . *scheme scheme*

  10. #390
    Join Date
    Dec 2010
    Location
    Atlanta, GA
    Posts
    1
    Post Thanks / Like

    Default Re: RGB LED's Now Consumer Grade - Hackable?

    I just wanted to say thanks to everyone who has figured these lights out. I've never done anything with my Arduiono besides blink pin 13 since I got it years ago, but I have just completed (for me) an ambitious project to use two 50 light sets to make a scoreboard type clock / New Year's Eve countdown timer.

    Here's some photos (sorry for the quality...it's not so blurred in real life):







    In case the images don't work, they are also on Picasa

    Not sure if you can tell, but I mounted these onto a 2x4 plywood frame, built sides out of 1x4's, the covered it with plexiglass covered in privacy film. I'm not happy with the privacy film (I never have good luck with that), so I may try something else...you can still see the guts inside.

    I'm mostly sharing this in case anyone, like myself, is looking for any and all code examples. I've borrowed code from just about anyone who has posted something on the internet in the last few weeks. Understand I am complete beginner, but the code for generating letters given the constraints of how the light strands are connected may be useful for someone.

    Code:
    #include "delay_x.h"
    #include "digitalWriteFast.h"
    #include <Time.h>  
    #define TIME_MSG_LEN  11   // time sync to PC is HEADER followed by unix time_t as ten ascii digits
    #define TIME_HEADER  'T'   // Header tag for serial time sync message
    #define TIME_REQUEST  7    // ASCII bell character requests a time sync message 
    #define TIME_OFFSET  0     // Adjust the time in seconds for testing
    
    #define XMASPINSA 2 // Strand 1
    #define XMASPINSB 3 // Strand 2
    
    #define xmas_color_t uint16_t
    #define XMAS_CHANNEL_MAX     (0xF)  
    #define XMAS_COLOR(r,g,b)    ((r)+((g)<<4)+((b)<<8))  
    #define XMAS_COLOR_WHITE     XMAS_COLOR(XMAS_CHANNEL_MAX,XMAS_CHANNEL_MAX,XMAS_CHANNEL_MAX)  
    #define XMAS_COLOR_BLACK     XMAS_COLOR(0,0,0)  
    #define XMAS_COLOR_RED       XMAS_COLOR(XMAS_CHANNEL_MAX,0,0)  
    #define XMAS_COLOR_GREEN     XMAS_COLOR(0,XMAS_CHANNEL_MAX,0)  
    #define XMAS_COLOR_BLUE      XMAS_COLOR(0,0,XMAS_CHANNEL_MAX)  
    #define XMAS_COLOR_CYAN      XMAS_COLOR(0,XMAS_CHANNEL_MAX,XMAS_CHANNEL_MAX)  
    #define XMAS_COLOR_MAGENTA   XMAS_COLOR(XMAS_CHANNEL_MAX,0,XMAS_CHANNEL_MAX)  
    #define XMAS_COLOR_YELLOW    XMAS_COLOR(XMAS_CHANNEL_MAX,XMAS_CHANNEL_MAX,0)  
    
    #define DIGITASTRAND 2
    #define DIGITBSTRAND 2
    #define DIGITCSTRAND 3
    #define DIGITDSTRAND 3
    
    const int bulbCount = 50;
    const int defaultIntensity = 0xBB;
    const int broadcastBulb = 63;
    
    /* The digits array below accomodates the layout of the strands so that they come
     together at the bottom in the middle.  The array is a map so that
     the bulbs map to an ordinary left to right, top to bottom order, EG:
     
     29<28<27<26<25 <  24<23<22<21<20        20>21>22>23>24 >  25>26>27>28>29
     |                             |         |                             |
     30>31>32>33>34    15>16>17>18>19        19<18<17<16<15    34<33<32<31<30 
                  |     |                                 |     |            
     39<38<37<36<35    14<13<12<11<10        10>11>12>13>14    35>36>37>38>39
     |                             |         |                             |
     40>41>42>43>44    05>06>07>08>09        09<08<07<06<05    44<43<42<41<40
                  |     |                                 |     |
     49<48<47<46<45    04<03<02<01<00<-    ->00>01>02>03>04    45>46>47>48>49
                                |  |  |    |  |  |
                               Strand A    Strand B
                                |  |  |    |  |  |
                              +5v  |  |    |  |  +5v
                                 Data |    | Data
                                   |  |    |  |
                                   |  Ground  |
                                   |     |    |
                                   >--Arduino<-
                                       |   |
                                       +9v |
                                           USB (just to set time at start)
     
     It basically just made drawing characters less of a headache
     */
    
    const int digits[][26] = {
      {2,29,28,27,26,25,30,31,32,33,34,39,38,37,36,35,40,41,42,43,44,49,48,47,46,45},
      {2,24,23,22,21,20,15,16,17,18,19,14,13,12,11,10,5,6,7,8,9,4,3,2,1,0  },
      {3,20,21,22,23,24,19,18,17,16,15,10,11,12,13,14,9,8,7,6,5,0,1,2,3,4  },
      {3,25,26,27,28,29,34,33,32,31,30,35,36,37,38,39,44,43,42,41,40,45,46,47,48,49  }
    };
    
    /* Describes each character of the alphabet with a byte for each row,
     although each row is actually only 5 pixels wide.
     I've not gotten around to creating all the oddball characters yet, so
     they'll just show up as a space for now
     */
    
    const byte alphabets[][5] = {
      {0,0,0,0,0  },      // space
      {0,0,0,0,0  },      // !
      {0,0,0,0,0  },      // "
      {0,0,0,0,0  },      // #
      {0,0,0,0,0  },      // $
      {0,0,0,0,0  },      // %
      {0,0,0,0,0  },      // &
      {0,0,0,0,0  },      // '
      {0,0,0,0,0  },      // (
      {0,0,0,0,0  },      // )
      {0,0,0,0,0  },      // *
      {0,0,0,0,0  },      // +
      {0,0,0,0,0  },      // ,
      {0,0,0,0,0  },      // -
      {0,0,0,0,0  },      // .
      {0,0,0,0,0  },      // /
      {31,19,21,25,31  }, // 0
      {4,12,4,4,14  },    // 1
      {30,1,14,16,31  },  // 2
      {31,1,14,1,31  },   // 3
      {18,18,31,2,2  },   // 4
      {31,16,30,1,30  },  // 5
      {31,16,31,17,31  }, // 6
      {31,1,2,4,4  },     // 7
      {31,17,31,17,31  }, // 8
      {31,17,31,1,31  },  // 9  
      {0,0,0,0,0  },      // :
      {0,0,0,0,0  },      // ;
      {0,0,0,0,0  },      // <
      {0,0,0,0,0  },      // =
      {0,0,0,0,0  },      // >
      {0,0,0,0,0  },      // ?
      {0,0,0,0,0  },      // &
      {31,17,17,31,17  }, // A
      {31,17,30,17,31  }, // B
      {31,16,16,16,31  }, // C
      {30,17,17,17,30  }, // D
      {31,16,30,16,31  }, // E
      {31,16,30,16,16  }, // F
      {31,16,19,17,31  }, // G
      {17,17,31,17,17  }, // H
      {31,4,4,4,31  },    // I
      {3,1,1,17,31  },    // J
      {17,18,28,18,17  }, // K
      {16,16,16,16,31  }, // L
      {17,27,21,17,17  }, // M
      {17,25,21,19,17  }, // N
      {14,17,17,17,14  }, // O
      {30,17,30,16,16  }, // P
      {31,17,17,31,4  },  // Q
      {30,17,30,17,17  }, // R
      {31,16,31,1,31  },  // S
      {31,4,4,4,4  },     // T
      {17,17,17,17,31  }, // U
      {17,17,10,10,4  },  // V
      {17,17,21,21,10  }, // W
      {17,10,4,10,17  },  // X
      {17,17,10,4,4  },   // Y
      {31,2,4,8,31  },    // Z
    };
    
    // I forgot why I made this global
    String fullMessage = "    ";
    
    void setup()
    {
      delay(5000); // give lights time to come on
      // The fast pin writing library was out at Google Code and pretty
      // straightforward to add.  After reading the documentation, I'm
      // not convinced that stuff is actually being written fast--something
      // about the pin needing to be hard coded, and in multiple places
      // below I pass that into functions.  But, it works and I'm happy.
      pinModeFast(XMASPINSA, OUTPUT);
      digitalWriteFast(XMASPINSA, LOW);
      // It took a while to figure out how to get the delay_x library
      // I had to register for an account at AVR freaks, then add the library
      // but also then delete the "test.c" that came with it.
      // That said, it was worth it because there are far less stray bulb
      // errors.
      _delay_s(1);
      pinModeFast(XMASPINSB, OUTPUT);
      digitalWriteFast(XMASPINSB, LOW);
      _delay_s(1);
      //Enumerate the bulbs.  This should be done for each strand.
      fillString(XMASPINSA,bulbColor(0,0,0));
      fillString(XMASPINSB,bulbColor(0,0,0));
      delay(500);
      setCharacter(0, 'B', XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
      setCharacter(1, 'O', XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
      setCharacter(2, 'O', XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
      setCharacter(3, 'T', XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
      // I'm using the Time library for this project, which is pretty
      // well documented.  Since I don't have a DS1307, I'm using the
      // included Processing sketch to set the time.  Once the Processing
      // sketch has set the time, I disconnect the USB plug (without
      // stopping the sketch first), and the time stays set.  If you stop
      // the Processing sketch first, the time resets to 0.  I'd just as soon
      // not leave my laptop hooked up to the this thing in a bar.
      Serial.begin(9600);
      requestSync();
    }
    
    // Main loop
    void loop() {
      // This is the time handling stuff, in case it's being sent
      // from the Processing sketch.
      if(Serial.available())
      {
        time_t t = processSyncMessage();
        if(t >0)
        {
          // The TIME_OFFSET can be set for testing
          setTime(t+TIME_OFFSET);          
        }
      }
    
    
      // Now the fun stuff
      // Before midnight....
      if (hour() > 0) {
        // Between 11p and midnight, display is in countdown mode
        if (hour() == 23) {
          int minRemaining = 59-minute();
          int secRemaining = 59-second();
          // Between 11p and 11:59
          if (minRemaining > 0) {
            // Pad the seconds with a 0. I'm sure there are better ways.
            fullMessage = " " + String(minRemaining);
            setCharacter(0, fullMessage.charAt(fullMessage.length()-2), XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
            setCharacter(1, fullMessage.charAt(fullMessage.length()-1), XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
            fullMessage = "0" + String(secRemaining);
            setCharacter(2, fullMessage.charAt(fullMessage.length()-2), XMAS_COLOR_GREEN, XMAS_COLOR_BLACK);
            setCharacter(3, fullMessage.charAt(fullMessage.length()-1), XMAS_COLOR_GREEN, XMAS_COLOR_BLACK);
            delay(200);
          } 
          // Between 11:59 and midnight
          else {
            // Hide the minutes, and just show seconds
            if (secRemaining > 9) {
              fullMessage = "  ";
              setCharacter(0, fullMessage.charAt(fullMessage.length()-2), XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
              setCharacter(1, fullMessage.charAt(fullMessage.length()-1), XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
              fullMessage = "0" + String(secRemaining);
              setCharacter(2, fullMessage.charAt(fullMessage.length()-2), XMAS_COLOR_GREEN, XMAS_COLOR_BLACK);
              setCharacter(3, fullMessage.charAt(fullMessage.length()-1), XMAS_COLOR_GREEN, XMAS_COLOR_BLACK);
              delay(200);
            } 
            // Last 10 seconds, no zero padding of the seconds
            else {
              fullMessage = "   ";
              setCharacter(0, fullMessage.charAt(fullMessage.length()-3), XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
              setCharacter(1, fullMessage.charAt(fullMessage.length()-2), XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
              setCharacter(2, fullMessage.charAt(fullMessage.length()-1), XMAS_COLOR_GREEN, XMAS_COLOR_BLACK);
              fullMessage = " " + String(secRemaining);
              setCharacter(3, fullMessage.charAt(fullMessage.length()-1), XMAS_COLOR_GREEN, XMAS_COLOR_BLACK);
              delay(200);
            }
          } // last minute
        } // 11pm hour
        // Between 1am and 11pm, behave as a giant clock 
        else {
          // Not military time style
          if (hour() > 12) {
            fullMessage = " " + String(hour()-12);
          } 
          else { 
            fullMessage = " " + String(hour());
          }
          setCharacter(0, fullMessage.charAt(fullMessage.length()-2), XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
          setCharacter(1, fullMessage.charAt(fullMessage.length()-1), XMAS_COLOR_BLUE, XMAS_COLOR_BLACK);
          fullMessage = "0" + String(minute());
          setCharacter(2, fullMessage.charAt(fullMessage.length()-2), XMAS_COLOR_GREEN, XMAS_COLOR_BLACK);
          setCharacter(3, fullMessage.charAt(fullMessage.length()-1), XMAS_COLOR_GREEN, XMAS_COLOR_BLACK);
          delay(1000);
        } // 1am to 11pm
      } // 1am to 12midnight
      // Midnight hour...crazy display 2011
      else {
        int r = random(255);
        int g = random(255);
        int b = random(255);
        setCharacter(0, '2', XMAS_COLOR(r,g,b), XMAS_COLOR_BLACK);
        setCharacter(1, '0', XMAS_COLOR(r,g,b), XMAS_COLOR_BLACK);
        setCharacter(2, '1', XMAS_COLOR(r,g,b), XMAS_COLOR_BLACK);
        setCharacter(3, '1', XMAS_COLOR(r,g,b), XMAS_COLOR_BLACK);
        delay(250);
      }
    }
    
    
    // The only change I made here was to handle multiple strands,
    // so lightPin is a variable passed in
    void writeStart(int lightPin)
    {
      digitalWrite(lightPin, HIGH);
      delayMicroseconds(7);
    }
    
    void writeBit(int lightPin, int b)
    {
      switch (b)
      {
      case 0:
        digitalWrite(lightPin, LOW);
        delayMicroseconds(3);
        digitalWrite(lightPin, HIGH);
        delayMicroseconds(17);
        break;
    
      case 1:
        digitalWrite(lightPin, LOW);
        delayMicroseconds(17);
        digitalWrite(lightPin, HIGH);
        delayMicroseconds(3);
        break;
      }
    }
    
    void writeStop(int lightPin)
    {
      digitalWrite(lightPin, LOW);
      delayMicroseconds(32);
    }
    
    /*
     * Functions to set an individual bulb
     */
    
    int bulbColor(int r, int g, int b)
    {
      return (r+(g<<4)+(b<<8));
    }
    
    void setBulb(int lightPin, int bulb, int intensity, int color)
    {
      writeStart(lightPin);
    
      for(int i=5; i>=0; i--)
        writeBit(lightPin, bitRead(bulb, i));
    
      for(int i=7; i>=0; i--)
        writeBit(lightPin, bitRead(intensity, i));
    
      for(int i=11; i>=0; i--)
        writeBit(lightPin, bitRead(color, i));
    
      writeStop(lightPin);
    }
    
    //If no inensity is specified, use the default
    void setBulb(int lightPin, int bulb, int color)
    {
      setBulb(lightPin, bulb, defaultIntensity, color);
    }
    
    /*
     * Functions to set a series of bulbs or the entire string
     */
    
    void fillBulbs(int lightPin, int start, int count, int intensity, int color)
    {
      while(count--)
        setBulb(lightPin, start++, intensity, color);
    } 
    
    //If intensity is not specified, use the default
    void fillBulbs(int lightPin, int start, int count, int color)
    {
      fillBulbs(lightPin, start, count, defaultIntensity, color);
    } 
    
    //Fill the entire string
    void fillString(int lightPin, int intensity, int color)
    {
      fillBulbs(lightPin, 0, bulbCount, intensity, color);
    } 
    
    //Fill the entire string with the default intensity
    void fillString(int lightPin, int color)
    {
      fillBulbs(lightPin, 0, bulbCount, defaultIntensity, color);
    }
    
    /* This is the character drawing function.  This is based on several 
     samples I found of drawing letters on a LED matrix, but I've lost
     which this was from.  Basically, though, the function reads the
     character definition, then using the digit map defined up front,
     sets each bulb to particular color based on the digit definition
     */
    void setCharacter(uint8_t position, char letter, xmas_color_t fgcolor, xmas_color_t bgcolor) {
      int pixelCount = 1;
      letter = letter - 32;
      for (int row = 0; row < 5; row++)
      {
        for (int col = 4; col > -1; col--)
        {
          if (bitRead(alphabets[letter][row],col)) {
            setBulb(digits[position][0], digits[position][pixelCount], defaultIntensity, fgcolor);
          } 
          else {
            setBulb(digits[position][0], digits[position][pixelCount], defaultIntensity, bgcolor);
          }            
          pixelCount++;
        }
      }
    }  
    
    // This code came from the TimeSerial example in the Time library
    long processSyncMessage() {
      // if time sync available from serial port, update time and return true
      while(Serial.available() >=  TIME_MSG_LEN ){  // time message consists of a header and ten ascii digits
        char c = Serial.read() ; 
        Serial.print(c);  
        if( c == TIME_HEADER ) {       
          time_t pctime = 0;
          for(int i=0; i < TIME_MSG_LEN -1; i++){   
            c = Serial.read();          
            if( c >= '0' && c <= '9'){   
              pctime = (10 * pctime) + (c - '0') ; // convert digits to a number    
            }
          }
          return pctime;   // Sync Arduino clock to the time received on the serial port
        }
      }
      return 0;  
    }
    
    
    time_t requestSync()
    {
      Serial.print(TIME_REQUEST,BYTE);  
      return 0; // the time will be sent later in response to serial mesg
    
    }
    Again, thanks everyone for all the tips. I own a bar, so I'll be putting this up tomorrow to ring in the New Year.

Page 39 of 46 FirstFirst ... 293738394041 ... 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
  •