Go Down

Topic: WS2803 example (Read 2 times) previous topic - next topic

CrossRoads

The datasheet says you pick the resistor to control the current of every channel, it doesn't know or care that you have an RGB LED connected to 3 pins.
You will have to send data controlling the PWM for each channel to control the average current going to a particular color.


Adjusting the output current

The output current of each channel can be set by an external resistor, Rext, the output current can be set by the following formula:
Iout = (VRext/Rext) x 22

Where, Rext is the resistance of the external resistor connected to Rext terminal [pin 2 on a DIP, labelled confusingly IREF], and VRext is the voltage of Rext pin [labelled Iref] VRext=1.25V.
[Put a meter on it - see if it measures 1.25V]

To set the output current at 20mA, a resistor with 1.25Kohm resistance should be connected from Rext [labelled Iref] to GND. The relationship between IOUT and REXT shown in the following figure. [where as  no such figure is shown - guess that's whi its preliminary]

So: (1.25V/1250ohm) x 22 = 22mA
so their formula is not quite correct.

Rearranging & solving for R with current at 20mA:
1.25V x 22 / 20mA = 1375 ohm

Maybe the 22 factor is wrong, and it should be 20.

"So 3 leds in series also use a total of 20mA."  >> Yes.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Danton

I think I'm having a small problem.
All the schematics don't use a Arduino Leonardo, so I can't find the exact pins to connect the CKI and SDI to.

James C4S


I think I'm having a small problem.
All the schematics don't use a Arduino Leonardo, so I can't find the exact pins to connect the CKI and SDI to.

The example I looked at defined the pins to use in the code, so it wouldn't matter what board it is.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Danton

#13
Jan 14, 2013, 10:41 pm Last Edit: Jan 15, 2013, 12:01 am by Danton Reason: 1
It still doesn't work, tried three WS2803's.

I connected everything and tried the following code:
Code: [Select]

// 8 CLK
const int pinCLK = 5 ;

// 9 CLK Data
const int pinDATA = 6 ;


void setup() {
   Serial.begin( 57600 );  
 pinMode(pinCLK, OUTPUT);
 pinMode(pinDATA, OUTPUT);

 digitalWrite(pinCLK, HIGH);
 digitalWrite(pinDATA, LOW);
}

byte val = 0 ;

void loop () {

 byte c;
 int digit;
 
 delayMicroseconds( 600 );

 val+= 2 ;
 
 for (c= 0 ; c<= 17 ;c++) {
   for (digit= 7 ;digit >= 0 ;digit--) {
   if (val & ( 1 << digit)) {
      digitalWrite(pinDATA, HIGH);
   } else {
    digitalWrite(pinDATA,LOW);
   }
   digitalWrite(pinCLK, HIGH);
   digitalWrite(pinCLK, LOW);
   }
 }

}

James C4S

Sometimes it is good for your comments and code to match. Are you connecting the right pins?
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Go Up