Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Output options for multiple, seperate, chaser LED strips.

led strips chaser netduino output ports

Best Answer Juzzer, 11 September 2013 - 09:03 AM

Juzzer,

 

Thank you.   Quick question.  Could you possibly show(or explain) what the wires would look like using this, netduino, and two led strips?   Thank you so much, btw.

 

Here you go...

So all the strips share SCK (Pin13), MOSI (Pin 11), GND and +5v (I have only shown the Go Juice going into the bottom board)

Then each board has a digital pin for chip select (CS) and your away and laughing......

Go to the full post


  • Please log in to reply
19 replies to this topic

#1 justified777

justified777

    Member

  • Members
  • PipPip
  • 14 posts

Posted 03 September 2013 - 03:02 PM

Hey community.  This is my first time here.   I'm a tinker, programmer, triathlete gone chubby, type of guy.

 

I want to know how many seperate chaser LED strips I can run off of one netduino plus 2 and how would I go about doing it? I get the whole external power adapter thing and I have read the posts about SPI, but my understanding i can only have one SPI device per netduino plus 2 card(in reality there are 2 spi but one is used for the microSD card I believe). Ideally I would like the SPI that is available to be used to talk back and forth with my PC.  I have read that I could have 4 PWM 'outputs' but can each of these power and LED strip that could be 2-5m long and I need to have the LED strips be able to chase...meaning the whole data, timing thing, unless you have a different idea.   Also, I would ideally like to have 6-8 LED chaser strips and I'm okay with getting an addon to the netduino, if you know of one, or running two netduino plus 2 cards.

 

I'm going to have one PC that will set the LED light byte arrays(or whatever the data format for each of the outputs so i can do this) for 4 seperate chaser LED lights. I will send these over(SPI) to the .net micro framework code that will put the data on the microsd for storage and there will be .net micro framework c# code that sends this data to the led chaser strips....so one strip might chase blue, another strip would chase red, and another stirp would chase white, and then lets say the 4th strip may or may not chase but might be a fade in/out between colors. 

 

My big unknown...is there 'outputs' on the netduino plus 2 that can power multiple led CHASER(digital) strips.  PWM?  UART? I'll dive in more on knowing the details to make this work if someone out there can confirm what I want is doable and what type of 'output's on the netduino plus 2 would be best and how many per card?

 

Thanks,

 

Ken



#2 remotewizard

remotewizard

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 04 September 2013 - 12:17 PM

I'm obviously no expert, but I believe you can control multiple SPI devices by maintaining multiple SPI configurations (each with a different SS pin); you switch control by loading the appropriate configuration into the single usable SPI device. 

 

Would that work for you?  Or did I misread your question.



#3 Juzzer

Juzzer

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts
  • LocationHertfordshire, UK

Posted 04 September 2013 - 12:18 PM

Hi Ken,

 

With a little hardware you can run quite a few SPI LED strips that use something like the WS2801/3 LED driver or WS2811/12 LEDS

The issue is they don't have a CS pin but by adding a simple AND gate you can hook up multiple strips.

 

In the video i am running 4 WS2803 LED drivers off the one SPI channel - it's Gadgeteer but is exactly the same with the Netduino.

 

http://www.youtube.c...h?v=YE5GcKw-SSQ

 

Cheers

Justin 

Attached Files



#4 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 04 September 2013 - 12:47 PM

With a little hardware you can run quite a few SPI LED strips that use something like the WS2801/3 LED driver or WS2811/12 LEDS

I'm pretty sure you can run the WS2801's using NETMF but has anyone tried the same with the WS2811's?  I thought the WS2811's needed precise timings.

 

Regards,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#5 Juzzer

Juzzer

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts
  • LocationHertfordshire, UK

Posted 04 September 2013 - 01:06 PM

:)

 

http://www.youtube.c...h?v=GSizyAQ7zd4



#6 justified777

justified777

    Member

  • Members
  • PipPip
  • 14 posts

Posted 05 September 2013 - 11:56 AM

I'm obviously no expert, but I believe you can control multiple SPI devices by maintaining multiple SPI configurations (each with a different SS pin); you switch control by loading the appropriate configuration into the single usable SPI device. 

 

Would that work for you?  Or did I misread your question.

 

My question there is if I am sending new byte's to the LED's constantly(chasing), then lets say I have 4 LED strips and each one has a different chase sequence will I be able to switch between the 4 quick enough since it is synchronous, isn't it?



#7 justified777

justified777

    Member

  • Members
  • PipPip
  • 14 posts

Posted 05 September 2013 - 12:34 PM

Hi Ken,

 

With a little hardware you can run quite a few SPI LED strips that use something like the WS2801/3 LED driver or WS2811/12 LEDS

The issue is they don't have a CS pin but by adding a simple AND gate you can hook up multiple strips.

 

In the video i am running 4 WS2803 LED drivers off the one SPI channel - it's Gadgeteer but is exactly the same with the Netduino.

 

http://www.youtube.c...h?v=YE5GcKw-SSQ

 

Cheers

Justin 

Thanks for your reply. I'm a bit lost when you say "CS pin" and how you added the 'AND' gate. I see your image you attached but, yeah, i'm a bit lost by it. Your youtube video is cool but I was hoping there was a little explanation and showing of pins/hardware on what was going on. Also, can I assume you wrote software to control those LED strips? That's def a requirement...have to be able to write software against it to run the LED strips.



#8 Juzzer

Juzzer

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts
  • LocationHertfordshire, UK

Posted 05 September 2013 - 01:02 PM

When you use SPI it is a shared bus so when you squirt data down the bus multiple devices might be connected to it so you need a way for the devices that are connected to either use the data or ignore it.

 

Most SPI devices have a CS (chip select) or SS (Slave select) pin when means when it is low the device will ignore any data coming in, so when you want the device to listen to the data you drive it high.

 

A lot of the chips used in the RGB LED strips and the chips they use don't have a CS pins so all the LED's will listen to the data and you will have a mess, so by using the AND gate it mimics a CS pin so you can wire up lots of strips to the same bus and control them individually.

 

Yes i wrote the software for driving the strips and LED levels in the first vid - it's actually quite simple.

 

So you need me to fire up the electronic crayons and do you a diagram?



#9 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 05 September 2013 - 01:21 PM

Most SPI devices have a CS (chip select) or SS (Slave select) pin when means when it is low the device will ignore any data coming in, so when you want the device to listen to the data you drive it high.

 

I guess you've inadvertently switched the logic levels - the CS/SS signal is active low (so it works in exactly the opposite way).



#10 Juzzer

Juzzer

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts
  • LocationHertfordshire, UK

Posted 05 September 2013 - 01:21 PM

Here's so code (not tested) that would allow 3 strips of RGB LEDS using the WS2801 LED driver.

The expect 3 8 bit bytes of data per chip.

 

using System.Threading;
using Microsoft.SPOT.Hardware;
 
namespace SpiTest
{
    public class Program
    {
        private static SPI.Configuration _config1;
        private static SPI.Configuration _config2;
        private static SPI.Configuration _config3;
        private static SPI _spi;
        private const int NumLeds = 100;
        private static byte[] _ledData;
 
        public static void Main()
        {
            _ledData = new byte[NumLeds*3];
 
            _config1 = new SPI.Configuration(Cpu.Pin.GPIO_Pin0, false, 0, 0, false, false, 4000, SPI.SPI_module.SPI1);
            _config2 = new SPI.Configuration(Cpu.Pin.GPIO_Pin1, false, 0, 0, false, false, 4000, SPI.SPI_module.SPI1);
            _config3 = new SPI.Configuration(Cpu.Pin.GPIO_Pin2, false, 0, 0, false, false, 4000, SPI.SPI_module.SPI1);
            _spi = new SPI(_config1);
 
            Blink();
            Thread.Sleep(Timeout.Infinite);
        }
        private static void Blink()
        {
            for(; ;)
            {
                for (int j = 0; j < 255; j++)
                {
                    SetAllLeds((byte)j, 0, 0); // set all LEDS to shade of red
                    _spi.Config = _config1; // set strip1 to be active
                    _spi.Write(_ledData); // fire the data at the strip
 
                    SetAllLeds(0, (byte)j, 0); // set all LEDS to shade of green
                    _spi.Config = _config2; // set strip2 to be active
                    _spi.Write(_ledData);
 
                    SetAllLeds(0, 0, (byte)j); // set all LEDS to shade of blue
                    _spi.Config = _config3; // set strip3 to be active
                    _spi.Write(_ledData);
                    Thread.Sleep(10);
                }
                SetAllLeds(0, 0, 0); // all leds off
                _spi.Config = _config1; // set strip1 to be active
                _spi.Write(_ledData); // fire the data at the strip
                _spi.Config = _config2; // set strip2 to be active
                _spi.Write(_ledData); // fire the data at the strip
                _spi.Config = _config3; // set strip3 to be active
                _spi.Write(_ledData); // fire the data at the strip
            }
        }
        private static void SetAllLeds(byte red, byte green, byte blue)
        {
            for (int i = 0; i < _ledData.Length; i+=3)
            {
                _ledData[i] = red;
                _ledData[i + 1] = green;
                _ledData[i + 2] = blue;
            }
        }
    }
}


#11 Juzzer

Juzzer

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts
  • LocationHertfordshire, UK

Posted 05 September 2013 - 01:22 PM

I guess you've inadvertently switched the logic levels - the CS/SS signal is active low (so it works in exactly the opposite way).

 

Good catch - the coffee is running low today  :wacko:



#12 justified777

justified777

    Member

  • Members
  • PipPip
  • 14 posts

Posted 05 September 2013 - 09:17 PM

When you use SPI it is a shared bus so when you squirt data down the bus multiple devices might be connected to it so you need a way for the devices that are connected to either use the data or ignore it.

 

Most SPI devices have a CS (chip select) or SS (Slave select) pin when means when it is low the device will ignore any data coming in, so when you want the device to listen to the data you drive it high.

 

A lot of the chips used in the RGB LED strips and the chips they use don't have a CS pins so all the LED's will listen to the data and you will have a mess, so by using the AND gate it mimics a CS pin so you can wire up lots of strips to the same bus and control them individually.

 

Yes i wrote the software for driving the strips and LED levels in the first vid - it's actually quite simple.

 

So you need me to fire up the electronic crayons and do you a diagram?

YEAH! I understand what you are saying here. does the hardware 'auto control' the 'AND' gate so all you have to do is set the SPI configs for each strip and run with it?

 

Most important question before I humbly ask for a electro crayon drawing(if you were serious, heh)....It seems like the SPI is fast enough in your video that even though you are constantly switching between four SPI devices it doesn't seem like you notice. Do you think when I'm sending non stop(figuratively) chaser data to each strip via sequential SPI(config/write), that it will be noticeable or not noticeable? Each strip will be no more than 5 meters.

 

Thanks so much for your help, Jazzer...it's been invaluable. I googled for a couple days to understand how this would work, or could work, and couldn't find the answers that you have kindly provided so far...thx.



#13 Juzzer

Juzzer

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts
  • LocationHertfordshire, UK

Posted 06 September 2013 - 07:55 AM

How fast are you trying to go?

 

Here is 5m of WS2801 - it's not being updated as fast as possible.

http://www.youtube.c...h?v=4sB9ITj9nIg

 

Here is 4m of WS2811 and a 4 seg display running off the same SPI bus both using AND gates so you can see they happily co exist

http://www.youtube.c...h?v=cXQ-eUZaLlM

 

So the first value in the constructor [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Cpu.Pin.GPIO_Pin0 is what toggles the AND gate which allows the device to listen[/color]

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]_config1 = new SPI.Configuration(Cpu.Pin.GPIO_Pin0, false, 0, 0, false, false, 4000, SPI.SPI_module.SPI1);[/color]

 

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Clear as mud?[/color]

 

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]I'm not sure how many strips you can drive - it will depend on your desired refresh rate i guess. The most i have ever tried to drive is 5m of WS2801 which from memory is 160 LEDS and 4m of WS2811 which is 240 LEDS.[/color]

 

The WS2801 are easier to drive so i would use those even tho they are more expensive...

 

Cheers

Justin



#14 justified777

justified777

    Member

  • Members
  • PipPip
  • 14 posts

Posted 06 September 2013 - 04:09 PM

How fast are you trying to go?

 

Here is 5m of WS2801 - it's not being updated as fast as possible.

http://www.youtube.c...h?v=4sB9ITj9nIg

 

Here is 4m of WS2811 and a 4 seg display running off the same SPI bus both using AND gates so you can see they happily co exist

http://www.youtube.c...h?v=cXQ-eUZaLlM

 

So the first value in the constructor [color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Cpu.Pin.GPIO_Pin0 is what toggles the AND gate which allows the device to listen[/color]

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]_config1 = new SPI.Configuration(Cpu.Pin.GPIO_Pin0, false, 0, 0, false, false, 4000, SPI.SPI_module.SPI1);[/color]

 

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]Clear as mud?[/color]

 

[color=rgb(40,40,40);font-family:helvetica, arial, sans-serif;]I'm not sure how many strips you can drive - it will depend on your desired refresh rate i guess. The most i have ever tried to drive is 5m of WS2801 which from memory is 160 LEDS and 4m of WS2811 which is 240 LEDS.[/color]

 

The WS2801 are easier to drive so i would use those even tho they are more expensive...

 

Cheers

Justin

 

Thx for the demonstration vid of two things running on the SPI being updated.

 

Okay, so, lets say I have 4 WS2801 strips, a netduino 2 plus, a powersupply(5v and big enough to cover all 4 strips).

 

I understand I need some additional hardware(AND gate) to turn the signal off to the other SPI connected LED strips while I talk to the other SPI connected LED strip separately and go down the line of LED strips updating them. What would be the ideal AND gate hardware for my objective? Also, you say Cpu.Pin.GPIO_Pin0 causes the AND gate switch so that we are talking to the right SPI device and not the others. This is dual purpose, right?  Meaning, giving it Cpu.Pin.GPIO_Pin0 and the way we wire between the netduino and the AND gate, the AND gate detects when we are 'communicating/sending signals' to the GPIO_Pin0 and then switches to that SPI interface alone. Am I understanding this correctly?

 

So, what 'AND gate' would be best, and do you have a clear example of wiring more than one WS2801 LED up to this type of scenario(NETDUINO plus 2,'AND GATE', and of course external powersupply pins/lines)?

 

Thanks,

 

Ken



#15 Juzzer

Juzzer

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts
  • LocationHertfordshire, UK

Posted 06 September 2013 - 07:35 PM

I'll fire up Eagle over the next few days and layout a little board...

Might even get a few made :)



#16 Juzzer

Juzzer

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts
  • LocationHertfordshire, UK

Posted 09 September 2013 - 09:29 AM

This is how i would do it.....

Attached Files



#17 justified777

justified777

    Member

  • Members
  • PipPip
  • 14 posts

Posted 10 September 2013 - 10:16 PM

This is how i would do it.....

Juzzer,

 

Thank you.   Quick question.  Could you possibly show(or explain) what the wires would look like using this, netduino, and two led strips?   Thank you so much, btw.



#18 Juzzer

Juzzer

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts
  • LocationHertfordshire, UK

Posted 11 September 2013 - 09:03 AM   Best Answer

Juzzer,

 

Thank you.   Quick question.  Could you possibly show(or explain) what the wires would look like using this, netduino, and two led strips?   Thank you so much, btw.

 

Here you go...

So all the strips share SCK (Pin13), MOSI (Pin 11), GND and +5v (I have only shown the Go Juice going into the bottom board)

Then each board has a digital pin for chip select (CS) and your away and laughing......

Attached Files



#19 justified777

justified777

    Member

  • Members
  • PipPip
  • 14 posts

Posted 11 September 2013 - 03:57 PM

Juzzer, wow, exactly what I needed! Thank you so much! ...laughing? definitley smiling :)



#20 Juzzer

Juzzer

    Advanced Member

  • Members
  • PipPipPip
  • 135 posts
  • LocationHertfordshire, UK

Posted 11 September 2013 - 04:47 PM

If you want any made or the eagle files ping me a pm. good luck with the led madness :)





Also tagged with one or more of these keywords: led strips, chaser, netduino output, ports

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.