# SCT2210-how to use?

Status
Not open for further replies.

#### fezder

##### Well-Known Member
http://www.tme.eu/fi/Document/d1c1b57e60747734605b44d3a0b2c99a/sct2210.pdf

So, I found these parts quite cheaply, don't have them yet but I'll order few today. For some odd reason, I couldn't find example on how to use these with arduino. I know basic Idea; OE/ pin controls all pins as pwm fashion, but what that serial data controls?
From dataflow chart, I see that clock is stable, and data is then just strobed according to clock-line (goes each output one-by-one in sweeping fashion)
when SDI is high on rising edge of CLOCK, then that output is ON (open collector output?)

also other similar chip, only this one doesn't have invidual control for led, all leds are dimmed at same time?
http://www.tme.eu/fi/Document/a58f7eca2b8087196ca10940f4ae20cc/SCT2016STSG.pdf
Thanks for support!

#### ChrisP58

##### Well-Known Member
The serial data for that chip is a very common standard known as SPI (Serial Peripheral Interface) Often pronounced "spy"

I don't know for sure, but I expect that Arduino has a library function for SPI.

SPI is a synchronous data stream usually consisting of four lines. (some parts don't have SDO)
- CLK Clock (The drum beat that the data marches to as it goes through the shift register)
- SDI Serial Data In. (The input to a shift register)
- LA Latch (Transfers data from the shift register to the data latches)
- SDO Serial Data Out (Output of the shift register. Follows the input but delayed by x clock pulses) Can be fed back to the uC for readback, or fed on to the next chip.

To use SPI for the SCT2210, you start with LA low, then move 16 bits of data, one bit at a time, on the rising edge of 16 clock pulses. Then you drive LA high, then low. This latches the data on each bit of the shift register into the 16 holding latches, which drive the outputs.

If you want to control more LEDs without using more uC pins, you can cascade two (or more) SCT2210s. Connect the CLKs together, and the LAs together, and connect SDO from chip 1 to SDI of chip 2. You now have a 32 bit shift register, so you'll need 32 clock counts. So you strobe LA once after 32 clock pulses. This can be extended about as far as you want to go, although there are practical limits on ho many CLK and LA input pins can be driven by you uC output pins.

#### fezder

##### Well-Known Member
Ah, so this was SPI afterall, I thought it was basic 2-wire....but, that doesn't have separate clock/data line. For single chip, SDO can be omitted right? And cascading sounds fun, I've cascaded 74595's (that also can be used in PWM fashion by hard-code) According to tracking, I should get them by wednesday, end of day....but, by mistake I took UPS as service, and they don't bring here, instead they give package to local postal service and this delays package about 1-2 days.....DHL on the other hand, which I prefer more, brings stuff all the way here.

Oh, and arduino does have SPI library, I might use these with teensy too, should have plenty of chips to play with, ordered 200pcs....if they are in stock still in next month, and I like 'em, I'll probadly buy even more for future's sake.

#### fezder

##### Well-Known Member
Got the Ic's now smaller than I expected. Oh well, time to fabricate breakout board/s.

#### fezder

##### Well-Known Member
If you want to control more LEDs without using more uC pins, you can cascade two (or more) SCT2210s. Connect the CLKs together, and the LAs together, and connect SDO from chip 1 to SDI of chip 2. You now have a 32 bit shift register, so you'll need 32 clock counts. So you strobe LA once after 32 clock pulses. This can be extended about as far as you want to go, although there are practical limits on ho many CLK and LA input pins can be driven by you uC output pins.
according to datasheet, when daisy-chaining, clock and LA are paraller in all chips, so no more needed than if there would be just one ic, just like controlling 74595; data,latch,clock are shared. I made breakout now, so I'll can start playing in evening or tomorrow.
Thanks for good explanation on post #2

Last edited:

#### fezder

##### Well-Known Member
I got it working, will post stuff tomorrow!

#### fezder

##### Well-Known Member
Moderators, could you please change this topic to microcontrollers section, as this is more UC stuff. Thanks!
OK, here's code, didn't use SPI yet, but this worked for testing purposes. I noticed that one difference between this and 74595 is that 595 is much faster, but I've never needed even 16mhz from arduino....except when using ILI9341 and such. I use Teensy 3.2 when I need more horsepower & space.
C:
int data = 2; //what is sent, HIGH=1
int latch = 3; //latch data, LOW=latch, HIGH= pass on data
int clock = 4; //clock for marching data onward

void setup()
{
pinMode(data, OUTPUT);  //normal pinmode settings at setup
pinMode(latch, OUTPUT);
pinMode(clock, OUTPUT);
}

void loop()
{
digitalWrite(latch, HIGH);  //latch high when receiving data
for (int i = 0; i < 16; i++)
{
digitalWrite(data, HIGH);  //first data
digitalWrite(clock, HIGH);  //then clock
delay(100);
digitalWrite(clock, LOW);
}
digitalWrite(latch, LOW);  //data received, latch low

digitalWrite(latch, HIGH);
for (int i = 0; i < 16; i++)
{
digitalWrite(data, LOW);
digitalWrite(clock, HIGH);
delay(100);
digitalWrite(clock, LOW);
}
digitalWrite(latch, LOW);

}

Status
Not open for further replies.