Basic LED strip chasing sequence - All sorts of help required

Hello there Arduiners,

Have to admit - I'm a first time poster here and a complete electronics novice as well. So please go easy on the lingo :] I have the task of creating a chasing LED strip sequence (say, one diode at full brightness and the two adjacent at half, and this pattern moving along the strip). I have figured my best bet is going with Arduino as it so wonderfully open source and leaves me room for further tinkering. I can get my hands on some 50cm SMD 3528 or SMD 5050 strips (I can connect multiples of them up without problem, right?) and I recon I will should get an Arduino Uno board (my local Arduino dealer has quite poor stock mostly Uno or Mega boards). My question is - am thinking along the right lines? Also, how easy would this be to pull off for someone who has never done any soldering? :] Would the code be easy to write? (I have some coding experience, but nothing to boast about). Where do I start with this? (I know this is quite a stupid question, but I've had trouble determining what is relevant and what isn't for my basic project, while reading the documentation.)

Or maybe I'm way off with the whole approach?

Any comments would be appreciated.

Much Love, S.

I guess the first question is how many separately controlled light sources do you intend to control? Then, how much power will it take to drive them? This will determine what needs to go between your Arduino and your LEDs.

I’m thinking about 4 strips of 30 SMD3528. Each strip is 2.4 W. However only a fraction of them would be lit at any one time.

Try project Blinkenlight (http://www.blinkenlight.net/), specifically, this looks like something you're after: http://blog.blinkenlight.net/experiments/basic-effects/knight-rider/

Ok, thanks. That looks pretty close to what I want, except I need to control a LED strip and there's probably going to be about 120 leds on it. As far as I can tell it only does fun things with the LED that are already soldered on? The light paintings that guy does are very cool, although I have no idea how he has done them. His website has made me all kinds of confused.

I think I am not getting something fundamental about how arduino works... Can someone help me out?

I just had a quick look at those strips, I couldn't see that the LEDs are addressable (aka individually controllable). Do you have a data sheet?

I think I am not getting something fundamental about how arduino works... Can someone help me out?

Got anything specific you need help with?

Basically it's a processor with 20 pins that (sometimes with extra hardware) can be made to perform just about any task you can imagine, subject to your coding ability.

The light paintings that guy does are very cool, although I have no idea how he has done them.

Dark room (or night time), open camera shutter, wave lights around, close camera shutter. Oldest trick in the photographic book.


Rob

hey Greynomad, thanks for the reply.

See, I didn't know that some LED strips are not, as you say, "adressable". Right, let's start here. How do I know that a LED strip has individually adressable diodes? Can you give a few examples? RGB is not necessary for my purposes.

Second, I was just wondering how much know-how one needs to tinker with a simple project like this. The forums, manuals and tutorials present me with quite a few unknown terms. I am ready to delve deeper, but my lack of electronics knowledge has me at a loss of where to start. Say, how many of those pins would a need to control a strip of 120 LED? Does that mean I need 120 pin setup? How does the interface determine there's something connected to a pin? Can you give me an example of a very basic setup, say, with one LED light blinking every 3 seconds?

Regarding the lightpaintings - yes I know how they are done, I'm just at a loss of how the ones in the blinkenlight URL (couple posts above) are created and how the blinkenlight shield (which I gather is some sort of arduino add-on) is used in that process.

Much love, S.

How do I know that a LED strip has individually adressable diodes?

Until reading your post I had never even looked at LED strips, so I'm not really the guy to ask about them but normally you'd get a data sheet and have a look.

So let's Google "addressable LED strip" and see what we find.

The first item is

http://littlebirdelectronics.com/products/rgb-led-strip-32-led-m-addressable-1m

The data sheet for the strips themselves is useless, but they use the WS2801 driver chip and the DS for that is good.

Notice that the chip has a CKI and SDI pins, this is clock and data, so we know that you can shift data into the chip using either the Arduino's SPI hardware or the shiftOut() function.

As there doesn't seem to be a latch pin I guess the LEDs will ripple as the data is written down the chain (this would mean to me that another strip might be better), this means that you probably want to shift the data as fast as possible so the SPI option would be best.

They have some Arduino code as an example, as it happens they don't use shiftOut() or the SPI hardware, they bit-bang the data themselves. I don't know why because there are 32 LEDs per strip and as that's a multiple of 8 you can use the standard Arduino features.

Second, I was just wondering how much know-how one needs to tinker with a simple project like this

This is pretty simple, with help from here I'd say you'd have it working pretty quickly.

how many of those pins would a need to control a strip of 120 LED?

Just looking at those strips it appears that they can be hooked up in series (in a row), if that's the case you can drive a 1000 LEDs or more using just 2 pins (with provisos).

How does the interface determine there's something connected to a pin?

Normally you can't detect the presence of stuff connected to an output pin. It can be done but that's out of the scope of this discussion I think.

Can you give me an example of a very basic setup, say, with one LED light blinking every 3 seconds?

One of the Arduino basic examples does just that, I can never find the playground page so here's the code

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

This flashes the Arduino on-board LED with 1 second pulses every second, change the 1000s to 3000s to get 3 seconds. With some modification this will work for a LED strip as well.

I'm just at a loss of how the ones in the blinkenlight URL (couple posts above) are created

Same as I described, but I think he set the LEDs to flash at the same time.

how the blinkenlight shield (which I gather is some sort of arduino add-on) is used in that process.

The blinkenlight is a "shield", it plugs onto the top of an Arduino and is controlled by some of the 20 pins I mentioned earlier. My guess is that he simply started a program to flash the LEDs then waved the lot around in a dark room.


Rob

Graynomad, thanks for a wonderful reply. You certainly cleared up a few matters. (Can't find a thumbs-up smiley in this forum though).

I am going to do a bit more research on what strip I need exactly, bearing the things you said in mind. But in the meantime, could you tell me what's a proviso?

The blinkenlight lightpaintings don't seem that relevant in this topic, but I was refering to the one's that contain words or shapes in them. I've seen things like that done with smart phone apps, but doing it with a 20LED shield only is pretty awesome. There's an explanation on how it is done, but I am too much of a newbie to get it: http://blog.blinkenlight.net/experiments/basic-effects/pov-generator/

what's a proviso?

Conditions, in theory you can drive 1000 LEDs from two pins but there are conditions or caveats, for example there may be timing and power supply issues. That's all.

I was refering to the one's that contain words or shapes in them

Ok, that's pretty clever. He is writing bit patterns to the LEDs at a frequency appropriate to the speed he is moving the display. The PoV of your eye (or the camera) remembers the bit patterns even after they have gone. If the bit patterns happen to be vertical "slices" of characters you see letters and words.

It's a similar principle to a TV.


Rob

@PPiratasKoldunelis: what could I improve to not confuse beginners like you? What exactly was confusing? If you can be specific I can fix it. In my opinion you should not start with strips but with 20 LEDs. The reason is that this is much simpler. Once you get the hang of programming you can tackle larger projects. The secret is to move in small steps and only progress one step after another. Directly trying to control 120 LEDs may be to much for your current experience.

As Graynomad pointed out, that particular LED strips uses a W2801 to drive an RGB LED. I'm doing the same thing. It's fairly easy and you can either do it by bit-banging your way there, or using a library such as FastSPI to get the job done. The datasheet basically says you can drive up to about 6 meters of cable length at 2MHz clock frequency. The thing to keep in mind, that's one WS2801 PER LED. So if you have a string of 100 LEDs, that's 100 WS2801 as well - that's how you control each LED separately.

Now, you said you only care to have white LEDs. You could still do it with an WS2801, just use one channel (it has 3). This still allows you to drive the whole string with just 4 wires: VCC, GND, DATA, CLOCK. You can have multiple strings driven individually, each require two pins from your Arduino.

The advantage of using an IC such as the WS2801 is that you don't have to worry with the current draw from the LED itself, the IC takes care of that. It only draws about 1.5mA (normal operation). Internal OpAmps will drive the RGB LED (in my case, the ones I'm using draw upwards of 108mA at 100% duty cycle, something an Arduino pin can't handle.)

It shouldn't be too hard to do some minor rewriting on Udo's code (from Blinkenlights) to achieve what you want using either bit-banging or SPI with one of those addressable RGB strings.

As the ws2801 is a tough chip to find affordably, I'll say that Ray Wu on aliexpress sells them very affordably. I buy them from him by the hundred.

I get them from http://www.winsunhk.cn/ - they're cheap, very pleasant to work with and I've gotten my orders within a week, even with regular airmail. They also carry 5050 RGB LEDs (you have to buy 1,000), as well as the larger WS2803 (18 channels versus 3 on the WS2801.)

KirAsh4:
I get them from http://www.winsunhk.cn/ - they’re cheap, very pleasant to work with and I’ve gotten my orders within a week, even with regular airmail. They also carry 5050 RGB LEDs (you have to buy 1,000), as well as the larger WS2803 (18 channels versus 3 on the WS2801.)

Awesome! Thanks for the recommendation!

Udo: there was probably nothing confusing per se. Perhaps it is I, who should probably buy "Electronics for Dummies". :] Heck, I am even getting confused in this thread. All these ICs, VCCs, clocks, etc. I am having to look a lot of the things up :]

Quick question. If I couldn't get those WS2801 chips, would SMD5050 (not RGB) work as well?

Anything works, as long as it's within your project parameters and you can make it work, sure. But you're going to need some way to individually address each one. The Blinkenlight shield only has 20 LEDs on it. If you want something much larger, you need a controller for the LEDs. This is where the WS2801 comes into play.

One WS2801 has 3 channels: red, green, blue. You can either put one single RGB LED on it, or put three white LEDs, one on each channel. Then, by controlling each individual channel, you can turn on/off an individual LED (same thing happens with the RGB one anyway.)

The bigger brother of that is the WS2803, which has 18 channels instead, so you could drive 18 white LEDs with that.

Both can be daisychained/cascaded for longer strings. They're designed to do that, whether you like it or not. :)

Neither of them are particularly hard to get. SparkFun sells the WS2801 but they're also trying to make money on them, so at 75 cents, I consider them to be at a premium (they're paying for shipment to the US as well, plus a markup). So you can do what I do and buy them from a distributor like the one I posted earlier. They're 15.5 cents (under 1,000) and with airmail it's still cheaper. Heck, my last order of 500, with UPS shipping, was still cheaper than buying the same amount from SparkFun and me driving there to pick it up (they're about 10 minutes from my house.)