Controlling shiftbars with arduino uno

Hi, I bought 4 led strips, 4 shiftbar and an arduino uno in order to build an ambilight clone. I'm currently trying to learn how to control the LEDs using the shiftbar+arduino. I've tried using the sample code from the shiftbar documentation (@macetech) but all I get is flashing lights... definitely not 2 alternating red/blue strips (I tried with 2 and 4 shiftbars on the chain).
Can someone help me get the shiftbars to output just a single RGB combination for a set time? I think I can figure out the rest from there...

My guess is a wiring problem somewhere. Are you sure you have Common Anode RGB strips? The shiftbar only works with Common Anode strips.

I did buy common cathode leds first... :blush:
Now I have common anode leds.
Could it be some problem with the data wires?

I've tried using the sample code from the shiftbar documentation

So post the code or a link to the code you used.

Could it be some problem with the data wires?

Yes but as you have not described how you have wired up it is hard to say.

The system I built can be seen here: Ambilight clone | Lothas85 | Flickr
The demo code from macetech is here: shiftbar [macetech documentation] (see section Code Example)
Finally, the project that I'm doing is described here: fun3's little projects: How to build your own AtmoLight setup

I don't see a ground connection from the Arduino to the ShiftBars. Are you using a ShiftBrite Shield and the 6 pin cables, or did you wire up something on your own? The ground definitely needs to be connected between the Arduino and the ShiftBars.

macegr:
The ground definitely needs to be connected between the Arduino and the ShiftBars.

I didn't use a shiftbrite shield, everything is connected directly to the arduino. Since I connected the 12V supply to each shiftbar I didn't think that I'd need to connect the V+ or Gnd terminals... (the relevant term being "I didn't think" :roll_eyes:)

I'll get some cables and connect the Gnd terminals of the shiftbars on the chain and one end to the Gnd on the arduino. Should I get cables for the V+ pins as well?

You shouldn't need to connect the V+ back to the Arduino...the main question being where would you connect it? Your diagram has the Arduino being powered by the computer, so there's no good reason to connect 12V to the Arduino at this point.

Connecting the grounds will solve your problem. It's more general than just ShiftBars: if you're connecting something digital to an Arduino, you need to connect the grounds or it won't work. This follows from the understanding that current flows in a loop.

See this on why you need to connect the grounds together:-
http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html

As I stated on my previous post, I didn't think it through... I should be ashamed, considering that I'm the teaching assistant for the Electric Actuators course at my University :blush:

What's confusing is that there are 2 loops on the system: one low voltage (arduino) and one 12V for the shiftbars. I connected a ground for the second one but not for the arduino.

And while we're at it, should I use the Gnd pin next to the I/O pins? Are the 2 Gnd pins on the arduino connected?
Also, I'm guessing that it doesn't matter which side of the daisy-chain I connect to the ground (assuming they're all grounded along the chain), is that right?

The two ground pins are connected together on the arduino PCB.

Electrically it will not matter which end you use to attach the ground to but one way might be prone to picking up more interference than the other. But without seeing it it is hard to tell.

Thanks for all the help guys! Everything is working great now that I added the ground cables XD

[UPDATE] Nevermind the text below, I figured out one way of doing it (by multiplying the output color by a percentage). Still, it would be nice to know how to control the current individually (if possible).

The only thing that I'm still trying to figure out is how to change the intensity of each color. Part of the code writes to the current control registers:

//sample code from macetech
void SB_SendPacket() {
  
   if (SB_CommandMode == B01) {
     SB_RedCommand = 127;
     SB_GreenCommand = 127;
     SB_BlueCommand = 127;
    }
 
    SPDR = SB_CommandMode << 6 | SB_BlueCommand>>4;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_BlueCommand<<4 | SB_RedCommand>>6;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_RedCommand << 2 | SB_GreenCommand>>8;
    while(!(SPSR & (1<<SPIF)));
    SPDR = SB_GreenCommand;
    while(!(SPSR & (1<<SPIF)));
}

I tried changing the 127 value but didn't notice any difference...

Typically you don't need to adjust the current control registers. They are there so you have some ability to color balance the output. The parameters you usually control are the PWM registers, in the LEDChannels array. Instead of 0-127, those registers go from 0-1023 for each color.

In reality you could use the ArduinoAtmo project to directly control your ShiftBars...it's already designed to use them. Has the protocol and gamma adjustment all built in.