Radio Shack LED strip + spark core = difficult

I met you guys at RobotsConf 2013 (which frickin rocked) and really enjoyed speaking with you about the spark core. I’ve started my first spark core project but have gotten a little stuck and could use some help if possible.

I bought this (http://www.radioshack.com/product/index.jsp?productId=22128606) led strip from Radio Shack and am trying to get it to work. The idea is to get this little thing working with the spark core so that I can light my desk up with different colors for event-based notifications. That being said, this is the only library that works really well for interacting with this led strip: https://github.com/pololu/pololu-led-strip-arduino/blob/master/PololuLedStrip/PololuLedStrip.h . However, there are a ton of things that don’t work with it (like asm(), etc). I’m still somewhat new to C but am very ambitious and have been experimenting with this over the past week or so…

The spec’s for this led strip can be found here: http://www.radioshack.com/graphics/uc/rsk/Support/SoftwareDownload/2760249.zip (please note that their example code doesn’t work.)

I would LOVE to get this working if possible!

Is there anyway I can use this code with spark somehow? If not, how can I translate it to work with spark?

This looks to be almost exactly like the NeoPixels, except even slower timing (aka easier).. and I just got that working on the Spark Core without assembly code the other day:

Assembly would be the best to keep the timing rock solid, but that's not super difficult to do either... just gotta figure out all the commands... and I just found my new best friend asm volatile("nop");

So once we're done with NeoPixel, should be a simple thing to support this polulu strip.

1 Like

That rocks! I flashed that code to the spark and I got it to do this: https://vine.co/v/hYWOwdwdOJ6 which is way farther than I had gotten. The timing seems a little off and I think we could clean up some of the code a little but it’s sweet! Great job man!! How can I help you complete this faster?

1 Like

Are you in IRC anywhere? Would love to talk with you!

I imagine there are a lot of these type of LED strips that have their own timing… It would be really cool to have a function that’s called something like this:

setValue( 'high', 1.55 ) - where high is the value being written and 1.55 is the number of microseconds (us) needed by the shift register to receive the bit.

also, would work for setValue( 'low', 0.78 ), etc, etc.

I think it would help me to make more sense of the code (remember, I’m new to C hardware stuff).

Btw, you made my day with this!! I’m so pumped that you’ve written something that works!

Will this work better? http://www.adafruit.com/products/1138 vs. http://www.radioshack.com/product/index.jsp?productId=22128606 . If so, I’ll return my ratshack led’s and order the adafruit’s.

I’m shooting to build something like this: http://d.pr/i/zS0C.

Awexome! I’m surprised my NeoPixel code did anything at all with your Ratshack strip as is… did you adjust the timing at all?

The timing of the NeoPixels are:
Bit = 1 ( high for 700ns, low for 600ns )
Bit = 0 ( high for 350ns, low for 800ns )

The Ratshack timing is:
Bit = 1 ( high for 780ns, low for 1550ns )
Bit = 0 ( high for 1550ns, low for 780ns )

Should be easier to make your strip work since it’s a little slower timing, but if I’m going through the trouble of writting inline assembly for the NeoPixel, it will be easy to support the Ratshack strip as well. I would rather support Adafruit than RadioShack these days, but they are trying to get back into the Maker spirit so it’s up to you which way you go :wink:

My gtalk is technobly (at) gmail (dot) com … I’m usually on the computer A LOT, but it might take a bit to respond depending on what’s going on over here… but I will!

Problem with the setValue() code is the overhead of calling function. I started with that for just the delay part of things… and it wasn’t working worth a damn. Best way is going to be inline assembly! :smile:

If you really want to get the LED strip working fast, just grab some NeoPixel strip and a 5V Trinket http://www.adafruit.com/products/1501 ($7.95). Setup for the Trinket in the arduino environment is a little tricky, I suggest just downloading their ready to go IDE. Then once we get this library working for the NeoPixel and Spark Core… you can unplug the Trinket and plug in some WiFi connectivity :smile:

Every desk needs to have a keyboard, a breadboard, and a power drill on it.

2 Likes

@BDub Any more luck getting this going with your library? Radio Shack is running a sale on these 1 Meter strips, 50% off! ($14.99)

I went ahead and bought a strip (couldn’t resist) so if you need me to do any testing, let me know! I’ve been sick as a dog the last few days, finally getting back on my feet.

Hey Tim! Sorry to hear you’re down and out… man I was sick and miserable for two weeks right around Xmas. So much better not being sick, so welcome back!

I never had one of these strips, and @carldanley returned his and bought some WS2812B LED strips from Adafruit instead. That said, I’m sure I can dial in the timing to make the library I put together for neopixels work for this! If you are willing to test it, I’ll put something together. Give me a little time I’ll try to get to it tonight. :wink:

1 Like

@timb please give this a try!

Spark Core library to control RadioShack Tricolor LED Strip: https://gist.github.com/technobly/8469105

EDIT: FYI Tim https://community.spark.io/t/compiler-changes/2142

1 Like

Okay, I can see the whole strip slowly fading through the spectrum, but they’re flickering like a Pokemon Cartoon at a Dubstep Rave!

1 Like

Cool. If you are powering off of Vin (5V) then maybe the 0.7 x VCC spec on these is more rigid than the NeoPixels that work.

Maybe try level shifting D0 up to 5V? The timing is good IMHO. The pulse between bursts of 24 bits maybe be more susceptible on this strip due to the slower bit speed… I can play with that tomorrow.

1 Like