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

SPI, Netduino, and RGB LED Strip


  • Please log in to reply
63 replies to this topic

#41 iukpo

iukpo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 20 October 2011 - 07:12 PM

Hi Mike! Welcome to the debate! ;)

Let me give some replies:


You could try running the strip at Vcc=4V or less.


I had originally set the outputs to the strip straight from the Netduino @ 3.3V, but I was not getting the desired effect. I brought in a logic level converter to convert the 3.3V to 5V (while cleaning up my code and making other changes suggested): same effect. I checked the incoming and outgoing voltages when that was in use, and they seemed fine. So, I went back down to just taking the 3.3V, and I seem to be getting a "little" improvement: the last LED often turns the proper color, but the others remain white. I don't know if what I just said resolves the logic hi level issue. But now that we're at it, if it were the case, wouldn't the strip not react at all?

Are you using the latest firmware? 4.1.0.6 or 4.2?

I am currently using 4.1.0.6. I have not jumped to 4.2 yet because I hear it is still in testing...or has it been released? Supposed to be this week I think...

Just something out of left field. Could you have clock and data reversed? That would explain a lot of 0xFFs. Clock should be on pin 16. MOSI should be pin 14.


I double checked for that, but thanks for reminding me...:)

As for your code suggestion, I will give it a shot when I get home and post my results.

#42 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 20 October 2011 - 08:08 PM

Posted ImagePosted Image

Okay, something odd. To the left is my netduino+, to the right my regular netduino, same code, both 4.1.0.0 if I can trust the VS output ("Assembly: Secretlabs.NETMF.Hardware.Netduino (4.1.0.0) ...").
The regular netduino has the additional clock pulse before CS goes down ... I don't have a mini, so I can't check that.
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"

#43 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 21 October 2011 - 12:03 AM

So, I found out that I can't trust the VS output, because I just updated and the pulse went away, but it still says 4.1.0.0 ;) Found out the proper way to find the version out now but it's too late ... and iukpo uses 4.1.0.6 as well so he shouldn't have the pulse.
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"

#44 Mike P

Mike P

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • LocationAuckland, New Zealand

Posted 21 October 2011 - 12:56 AM

You need to look at the output from MF Deploy

#45 iukpo

iukpo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 21 October 2011 - 07:08 AM

Mike, I tried your code exactly as you had written it, and I seemed to have made some progress. What happens is, the third LED changes to blue, it pushes the value down to the next LED, which then turns a lighter shade of blue. Eventually, green and blue appear. It's just odd that a) the colors go out of sequence, B) sometimes, other colors appear before the proper one does. For example, the third LED will go from blue to purple to yellow before the color is pushed over to the other LED. I've heard that these ICs have a built in PWM, so their brightness can be adjusted as well. Might this be affecting things? Anyone have any suggestions on how to slow down writing speed as well?

#46 Mike P

Mike P

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • LocationAuckland, New Zealand

Posted 21 October 2011 - 07:28 AM

Just to be clear, when you say it pushes it down do you mean that the 4th led comes on or do you mean that the colour keeps moving on down the string of LEDs all the way to the end? Also what if anything is showing on the first two LEDs? The code should be resetting the first 3 LEDs to Red, Green, Blue respectively about 10 times a second. Either way, if you are seeing anything on the 4th or subsequent LEDs then the string is receiving spurious clock pulses. Can I confirm some things about your power supply arrangements? Do you have the LED strip connected to a separate 5V supply that is capable of supplying at least 1.8A and NOT the 5v pin on the netduino? Do you have the ground for the LED strip connected to both the 5v high current PSU and the netduino mini ground pins? Sorry if these questions are basic to you but I don't want to assume anything.

#47 iukpo

iukpo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 21 October 2011 - 07:55 AM

No, I don't mind at all Mike. I appreciate it. :)


when you say it pushes it down do you mean that the 4th led comes on or do you mean that the colour keeps moving on down the string of LEDs all the way to the end?


The color keeps moving down the strip, but even then, it does not get to the end: there are 32 LEDs, and with the code, it seems to stop at the sixth LED. Moreover, there are inconsistencies: 4th LED may be purple, then when pushed down to 5th, the color on the 5th is blue, not purple.

Also what if anything is showing on the first two LEDs?

Nothing. They just stay white and intermittently flicker.

Do you have the LED strip connected to a separate 5V supply that is capable of supplying at least 1.8A and NOT the 5v pin on the netduino?


Yes, I do. The PSU supplies 2000ma (2A) @ 5V.

Do you have the ground for the LED strip connected to both the 5v high current PSU and the netduino mini ground pins?


This might be the problem, but here's the situation: there are two connectors on my LED strip. One has four pins (5V, Gnd, SDI, Clk), the other is for power (simply a positive and negative lead). On the side that goes to another LED strip, there are four pins. On the other side (where data and power feed in), there are three pins: CLK, GND, and SDI.

Should I connect the GND on this side to the GND pin on the Netduino?

#48 Mike P

Mike P

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • LocationAuckland, New Zealand

Posted 21 October 2011 - 09:38 AM

What you are describing sounds very much like some false triggerring on the clock pin. Between the write transactions the MOSI line goes high. That explains why you are gettin white LEDs at the start. You are getting a number of clock pulses being detected while the clock is supposed to be low. Try increasing the thread.sleep to 500ms. You should see the LED states change instantaneously every 1/2 a second and be stable between changes. A couple more questions. The 2A @ 5V power supply, is it a Switch mode power supply or a plug-pack or wall-wart type power supply? Some of these have very little smoothing and ripple on the supply line might be causing the unwanted clock triggers You definitely need the gnd pin from the data connector connected to the netduino. The gnd pin of the power connector should already be connected to the ground pin of the data connector internally on the LED strip Perhaps if you can take a photo of the setup.

#49 iukpo

iukpo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 21 October 2011 - 06:11 PM

Sure! Here are some pictures of my setup. In the meantime, I am going to go ahead and get that GND pin on the strip connected to the one on the Netduino. I really think that that is the cause of the stray clock pulses: because perhaps the electrons have nowhere to go, they are winding back up in the clock line? The PSU is just a wall adapter.

Attached Files



#50 iukpo

iukpo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 21 October 2011 - 06:44 PM

BINGO!!!!! I GOT IT! :D Mike P, thanks for your suggestion about the ground wire! Now that I have it plugged in with the Netduino, the colors came out perfect! The first three LEDs show red, green, and blue! I'm glad that we got this all settled. Thank you all for your help. This is for a Halloween costume I am building. Once the dust is settled, I will write up a tutorial to go step by step on this so others don't get my headaches. :) Thanks again all! :)

#51 SirPoonga

SirPoonga

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 21 October 2011 - 07:15 PM

What? A giant simon says game?

#52 iukpo

iukpo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 21 October 2011 - 07:25 PM

Very funny SirPoonga :D You'll see, and no, not a giant Simon Says game...but you're giving me ideas for next year. ;)

#53 SirPoonga

SirPoonga

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 21 October 2011 - 08:42 PM

Actually, that just gave me an idea. I might have to do a rush order to sparkfun.... See if I can get something in before Halloween. I've always wanted an excuse to get a LilyPad.

#54 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 21 October 2011 - 08:53 PM

As a rule of thumb, you always want to connect the grounds of circuits you connect, unless you use something like optocouplers or relays. You also want to connect ground first, supply voltage second, and then the data lines.
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"

#55 iukpo

iukpo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 21 October 2011 - 09:05 PM

@Stefan W.: Duly noted. I will be sure to reflect this in my tutorial. Thank you. :)

#56 Mike P

Mike P

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • LocationAuckland, New Zealand

Posted 21 October 2011 - 09:08 PM

If you have time I would be very interested to see if the LED strip works without the level conversion chip. I mean with the SDI , SCLK and GND connnected directly to the netduino. Regards, Mike Paauwe

#57 iukpo

iukpo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 21 October 2011 - 09:17 PM

Mike P, I actually removed the level converter from the picture...it's no longer in use, so yes, the pins are connected directly to the Netduino. I doubted I really needed it at all because in the beginning, I was getting a reaction. But my one question remains: if the level were not high enough, wouldn't the strip not react at all?

#58 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 21 October 2011 - 09:38 PM

No, that's not given. if you are between 0.2*VDD and 0.8*VDD (that is, 1V and 4V) it's neither "high" or "low", you're in unspecified territory - so it could be a 0 on a cold day, but a 1 on a warm day for example.
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"

#59 Mike P

Mike P

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • LocationAuckland, New Zealand

Posted 21 October 2011 - 10:02 PM

If you look at Stefan W's oscilliscope images you will see why an "almost high enough" voltage level could cause multiple clock triggers. look at the spike at the leading edge of the clock pulse. If you looked at the signal even closer you would see a decaying oscillation that could cause several false clock pulses to be received.

#60 SirPoonga

SirPoonga

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 24 October 2011 - 05:01 PM

No, that's not given. if you are between 0.2*VDD and 0.8*VDD (that is, 1V and 4V) it's neither "high" or "low", you're in unspecified territory - so it could be a 0 on a cold day, but a 1 on a warm day for example.

And that is why you see pull down or pull up resistors in circuits (I finally figured out what those are for ;) ).




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.