Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Flexible Digitally Controlled RGB LED strips (HCOPTO0028) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 667
Post Flexible Digitally Controlled RGB LED strips (HCOPTO0028)
Image

Image

A flexible full colour RGB LED light strip (HCOPTO0028). Each LED within the strip can be individually controlled to display any one of over 16 million colours. Each LED is connected in a serial chain meaning that each LED can be controlled with only one digital pin on a microcontroller. The strips are based on the WS2812 addressable RGB LEDs and are sold in with 30 LED strips or 5 meter reels.

What's more, to make controlling these LED's from an Arduino as simple as possible we have written our own exclusive library what will handle all the complicated bits. See our forum or blog for more information on this library and requirements.

Image


Image

Product code: HCOPTO0028
Working voltage: 5V
Max current: 60mA per LED
Length per 30 LED strip: 50cm
Length per reel: 500cm



Image

+5V.......5V Supply
DI..........Serial data in
DO.........Serial data out
GND.......0V



Image



Image

Code:
/* FILE:    HCWS2812_Cylon_Example
   DATE:    26/03/15
   VERSION: 0.1
   AUTHOR:  Andrew Davies

11/03/15 version 0.1: Original version

This is an example of how to use the HCMAX7219 library to control one or more
RGB LEDS. The example will set each LED to a random colour.

To use this example connect one or more LEDs in series (Dout --> Din) and connect
the first LED's Din pin to digital pin 8 of your Arduino.

By default the library is set to control 100 LEDs. You can change this by editing the
following line in the MCMAX7219.h header file:

#define NUMBEROFLEDS 200 <--- Change this number to match the number of LEDS connected

You can download the library from the software section of our support forum here:
http://forum.hobbycomponents.com/viewforum.php?f=58

Or from Github here:
https://github.com/HobbyComponents/HCWS2812


You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/

/* Include the HCWS2812 library */
#include "HCWS2812.h"

/* Create an instance of the library */
HCWS2812 HCWS2812;

void setup()
{
  /* Set the R,G,B background colours to zero */
  HCWS2812.SetBG(0, 0, 0);
  /* Clear the output buffer */
  HCWS2812.ClearBuffer();
}


/* Main program */
void loop()
{
  int index;
 
  /* Step forward through each LED */
  for(index = 0; index < NUMBEROFLEDS; index++)
  { 
    HCWS2812.ClearBuffer();
    RGBBuffer[RED][index] = 255;
    HCWS2812.Refresh();
    delay(100);
  }
 
  /* Step backward through each LED */
  for(index = NUMBEROFLEDS; index; index--)
  { 
    HCWS2812.ClearBuffer();
    RGBBuffer[RED][index - 1] = 255;
    HCWS2812.Refresh();
    delay(100);
  }
}



Code:
/* FILE:    HCWS2812_Random_Example
   DATE:    26/03/15
   VERSION: 0.1
   AUTHOR:  Andrew Davies

11/03/15 version 0.1: Original version

This is an example of how to use the HCMAX7219 library to control one or more
RGB LEDS. The example will set each LED to a random colour.

To use this example connect one or more LEDs in series (Dout --> Din) and connect
the first LED's Din pin to digital pin 8 of your Arduino.

By default the library is set to control 100 LEDs. You can change this by editing the
following line in the MCMAX7219.h header file:

#define NUMBEROFLEDS 200 <--- Change this number to match the number of LEDS connected

You can download the library from the software section of our support forum here:
http://forum.hobbycomponents.com/viewforum.php?f=58

Or from Github here:
https://github.com/HobbyComponents/HCWS2812

You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/

/* Include the HCWS2812 library */
#include "HCWS2812.h"

/* Create an instance of the library */
HCWS2812 HCWS2812;

void setup()
{
  /* Set the R,G,B background colours to zero */
  HCWS2812.SetBG(0, 0, 0);
  /* Clear the output buffer */
  HCWS2812.ClearBuffer();
}


void loop()
{
  int index;
 
  /* Fill the output buffer with random colours */
  for(index = 0; index < NUMBEROFLEDS; index++)
  { 
    RGBBuffer[RED][index] = random(0,255);
    RGBBuffer[GREEN][index] = random(0,255);
    RGBBuffer[BLUE][index] = random(0,255);
  }
 
  /* Send the output buffer to the LEDs */
  HCWS2812.Refresh();
 
  /* Wait a moment before doing it again */
  delay(100);
}





Image

The library files can be downloaded from github here:

https://github.com/HobbyComponents/HCWS2812

Or directly from this forum:

viewtopic.php?f=58&t=1799


Datasheet:

Attachment:
WS2812.pdf



Disclaimer: Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.


You do not have the required permissions to view the files attached to this post.


Fri Mar 27, 2015 2:31 pm
Profile

Joined: Mon Apr 14, 2014 7:56 pm
Posts: 9
Post Re: Flexible Digitally Controlled RGB LED strips (HCOPTO002
Both the shop description and the above post state that the length of a 30 LED strip is 50mm. Are they really this small?


Sun Apr 12, 2015 9:31 am
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 677
Post Re: Flexible Digitally Controlled RGB LED strips (HCOPTO002
That's a typo. It should be 50cm not 50mm. I've corrected it in both places. Thanks.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Mon Apr 13, 2015 9:25 am
Profile

Joined: Fri Jul 17, 2015 6:33 am
Posts: 1
Post Re: Flexible Digitally Controlled RGB LED strips (HCOPTO002
I'm having some issues setting up my [LINK REMOVED BY ADMIN]. I downloaded the library and uploaded the code to my Arduino Mega with no problems. I then connected the LED strip to PIN 12, Ground and 5V on the Arduino. Upon connecting and providing power, I noticed a few random LEDs blinking for a split second, then everything went dark and nothing else happened. The same random blink happened whenever I plugged the strip to Arduino's 5V.


Sun Jul 19, 2015 2:36 am
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 677
Post Re: Flexible Digitally Controlled RGB LED strips (HCOPTO002
Quote:
I then connected the LED strip to PIN 12, Ground and 5V on the Arduino


The Din of the strip needs to be connected to digital pin 8 on your Arduino.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Sun Jul 19, 2015 2:23 pm
Profile

Joined: Mon Apr 14, 2014 6:10 pm
Posts: 1
Post Re: Flexible Digitally Controlled RGB LED strips (HCOPTO002
Hi, Has anyone tried running the HCOPTO0028 strip on a ATTiny85 such as found on the Adafruit trinket? I am guessing that the library HCWS2812.h will need to have the port modified from B0 (D8/pin14 on the 328p) to B4 (D4/pin5 (QFN chip)) if CLK is important, along with maximum driven LEDs value (although I nothing about writing library stuff) or can you just hook up to Digital pin 0 (Port B0-Pin11 QFN chip) instead of Digital pin 8 if not. Reason I ask is I have a small project I want to use the LEDs in and haven't the space to fit a 328p, which would also be over kill, as I need only the LED output pin and no other I/O.


Tue Apr 05, 2016 6:32 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 677
Post Re: Flexible Digitally Controlled RGB LED strips (HCOPTO002
Although I can't say for sure without doing some sums, I think it is unlikely that a Tiny85 would be up to the job. The problem is the HCWS2812 requires very precise timings on the data signal (they must be with +/- 150ns if I remember correctly, that's 0.00000015s). This is just about doable on the ATMega328/2650/32u4 devices this library was written for but at best an ATTiny85 will only run at half the clock rate of these devices and I think it just wouldn't be fast enough to generate the data signals within the timing constraints.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Thu Apr 07, 2016 12:24 pm
Profile

Joined: Thu Jul 20, 2017 1:00 pm
Posts: 3
Post Re: Flexible Digitally Controlled RGB LED strips (HCOPTO002
Has anybody had any success getting this strip to work with the Adafruit Huzzah Feather?

The library suggests it is ESP2866 compatible, however it would not compile against the ADAFRUIT HUZZAH FEATHER board in Arduino IDE. "D2 not declared in this scope", I changed the line to #define DOUT_PIN 13. This then compiled, I connected the strip to pin 13 through a 74AHCT125 level shifter, but could not get the strip working.

I have proven all the components work - LED strip (using Arduino), level shifter and feather. Do I need to use a different pin? Or am I missing anything else?

Thanks

Dave


Thu Jul 20, 2017 1:16 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 677
Post Re: Flexible Digitally Controlled RGB LED strips (HCOPTO002
I'm not able to test this right now but can you try changing it from:

Code:
#define DOUT_PIN D2


to:

Code:
#define DOUT_PIN 2

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Sat Jul 22, 2017 9:27 am
Profile

Joined: Thu Jul 20, 2017 1:00 pm
Posts: 3
Post Re: Flexible Digitally Controlled RGB LED strips (HCOPTO002
Hi, thanks for the response - I did not see it had fallen onto 2nd page.

I tried setting the line as suggested to
Code:
#define DOUT_PIN 2


This compiled, but after upload only the on board blue LED (on pin2 on Huzzah feather) would light up. The LED strip itself gave nothing.


Fri Aug 04, 2017 12:12 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD