How to implement 10...
 
Notifications
Clear all

How to implement 100 null pixels?

68 Posts
11 Users
0 Reactions
10.8 K Views
Barnabybear
Posts: 1583
(@barnabybear)
Noble Member
Joined: 15 years ago
1pet2_9 wrote:Thanks BB,

If it's breadboardable, I'll be happy to order whatever I lack on the the BOM and do it as well. Although not as soon as Tom can.

Screenshot Pixelsplitter Schematic

Hi, the principal is pretty well proven. Renard Plus sold this in their shop for a couple of years.
RichieNorthcott milled his own boards bwinter has a couple of PCB’s using this. The only thing that is not proven is this PCB.


// THIS CODE IS FOR USE WITH THE 74HCT126 IC ONLY
// THE 74HCT125 USES A DIFFERENT CODE

void setup() {

//****** PIXEL SETUP ***
int Output_1 = <number of pixels on output 1>; // Replace < --- > with the number of pixels connected to output 1.
int Output_2 = <number of pixels on output 2>; // Replace < --- > with the number of pixels connected to output 2.

//*** PORTS ***
DDRD &= ~(1 << DDD3) & ~(1 << DDD5); // set PD3 & PD5 as inputs.
DDRB |= (1 << DDB1) | (1 << DDB2); // set PB1 & PB2 as outputs.
PORTB &= ~(1 << PORTB1) & ~(1 << PORTB2); // set PB1 & PB2 low.

//*** INTERRUPT 1 ***
EICRA = 0; // clear EICRA register.
EICRA |= (1 << ISC10) | (1 << ISC11); // set interrupt on rising.
EIMSK |= (1 << INT1); // enable interrupt.

//*** TIMER 2 *** 
TCCR2A = 0; // clear TCCR2A register.
TCCR2B = 0; // clear TCCR2B register.
TIMSK2 = (1 << OCIE2A); // enable interrupt.
OCR2A = 255; // set OCR2A (count to) value about 280uS inc int.

//*** TIMER 1 ******
TCCR1A = 0; // clear TCCR1A register.
TCCR1A |= (1 << COM1B0) | (1 << COM1B1) | (1 << COM1A0) | (1 << COM1A1); // set OCR1A/B WGM to set high on compare match.
TCCR1B = 0; // clear TCCR1B register.
TCCR1B |= (1 << CS11) | (1 << CS12) | (1 << WGM12); // set ext input, CTC mode & falling trigger.
TCNT1 = 0; // set TCNT1 counter register to zero.
OCR1B = (Output_1 * 24) - 1; // set OCR1B (1st count to value).
OCR1A = ((Output_2 + Output_1) * 24) - 1; // set OCR1A (2nd count to value).
}
//****** ISR interrupt 1 **
ISR (INT1_vect) {
  TCCR2B |= (1 << CS21); // start timer 2 & set prescale to 1/8 clock.
  TCNT2 = 0; // reset timer 2 counter to zero.
  OCR2A = 255; // set OCR2A (count to) value about 280uS inc int.
}
//*** ISR timer 2 ******
ISR (TIMER2_COMPA_vect) {
  TCCR2B = 0; // stop timer 2.
  TCNT1 = 0; // reset timer 1 counter to zero.
  TCCR1A &= ~(1 << COM1B0) & ~(1 << COM1A0); // timer 1 WGM to set low on compare match.
  TCCR1C |= (1 << FOC1A) | (1 << FOC1B); // timer 1 force compare match (set outputs low).
  TCCR1A |= (1 << COM1B0) | (1 << COM1A0); // timer 1 WGM to set high on compare match.
}

void loop() {
}

EDIT: Code should now be correct 05/01/2022
EDIT: Generally tidied up, standardized syntax, removed old lines from development and added **PIXEL SETUP**11/01/22


Reply
Posts: 6728
(@p-short)
Illustrious Member
Joined: 20 years ago

FWIW, this is the sort of board that I had in mind to mount right at the beginning of each pixel string. It's a bit bigger than what I mentioned before (it's 1.5" x 0.5"), although in practice I'd probably make it bigger than that to include more silkscreen. The two jumpers on the board are to select the number of pixels to be passed over. The 3-pin part is an MCP1703-50 LDO regulator from Microchip.

pixel splitter

Reply
Posts: 1420
Topic starter
(@1pet2-9)
Noble Member
Joined: 6 years ago

Wouldn't the CLC and TMR1 features of the PIC mean it could handle longer pixel strings than the Nano?


Reply
Posts: 6728
(@p-short)
Illustrious Member
Joined: 20 years ago
1pet2_9 wrote:Wouldn't the CLC and TMR1 features of the PIC mean it could handle longer pixel strings than the Nano?

What are the limits for the Nano?

I'd have to consider it more, but I think that the maximum pixel count until the widget starts to pass data is roughly 2730 pixels (65536/24), and that this widget would not limit the number of pixels that it would pass after that. But I also suspect that any limits to the Nano implementation are sufficiently large that they wouldn't matter, that other considerations would be the limiting factor.


Reply
Posts: 1420
Topic starter
(@1pet2-9)
Noble Member
Joined: 6 years ago

In BB's code, he set count_B to 479, which I thought a bit low. Also, although I haven't stepped through every line yet, it looks like he uses 40u timers on both ends, which seems like would accumulate roundoff error on the input end. I'm a bit surprised to see ISR's in Arduino code at all, given how I keep hearing the timing windows are so tight. But this is all new to me, and I'm drinking from a firehouse (and...honestly...it's great). I still haven't wrapped my head around how ws2811 is NRZ yet. It sure looks RTZ to me.


Reply
Page 6 / 14
Share: