CorsairLightingProtocol icon indicating copy to clipboard operation
CorsairLightingProtocol copied to clipboard

Size limits when using multiple pins

Open tiburcillo opened this issue 1 year ago • 2 comments

Describe the problem I'm struggling to get more than 8 fans connected to an Arduino Pro Micro. I think I'm hitting the limits and looking for ways to optimize (mirror pins for example).

Screenshots image

System (please complete the following information):

  • OS: Windows 10
  • Board: Sparkfun Pro Micro
  • Device: Lighting Node PRO
  • Version of IDE: Arduino IDE 1.8
  • Version of CLP: 0.15.0
  • Version of CLP Boards: latest
  • Sketch: MultipleFans (modified)

Digital pin outputs Ideally I'd need all 12 pins to connect 12 fans, but it seems 7 pins is the maximum. The second set of fans is RGB wired instead of GRB. Without this change I can connect 8 pins maximum. Is this the absolute limit for one device?

Code changes

/*
   Copyright 2020 Leon Kiefer

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
#include <CorsairLightingProtocol.h>
#include <FastLED.h>

#define NUMBER_OF_LEDS_PER_FAN 15

//channel1
#define DATA_PIN_FAN_1 2
#define DATA_PIN_FAN_2 3
#define DATA_PIN_FAN_3 4
#define DATA_PIN_FAN_4 5
#define DATA_PIN_FAN_5 6
#define DATA_PIN_FAN_6 7

// channel2
#define DATA_PIN_FAN_1B 8
#define DATA_PIN_FAN_2B 9
#define DATA_PIN_FAN_3B 10
#define DATA_PIN_FAN_4B 14
#define DATA_PIN_FAN_5B 15
#define DATA_PIN_FAN_6B 16

CRGB ledsChannel1[90];
CRGB ledsChannel2[90];

CorsairLightingFirmwareStorageEEPROM firmwareStorage;
CorsairLightingFirmware firmware(CORSAIR_LIGHTING_NODE_PRO, &firmwareStorage);
FastLEDControllerStorageEEPROM storage;
FastLEDController ledController(&storage);
CorsairLightingProtocolController cLP(&ledController, &firmware);
CorsairLightingProtocolHID cHID(&cLP);

void setup() {
  CLP::disableBuildInLEDs();
  // LED Fans
  //                          FAN_PIN           CRGB array            offset             number of leds per fan
  FastLED.addLeds<WS2812B, DATA_PIN_FAN_1, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 0, NUMBER_OF_LEDS_PER_FAN);
  FastLED.addLeds<WS2812B, DATA_PIN_FAN_2, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 1, NUMBER_OF_LEDS_PER_FAN);  
  FastLED.addLeds<WS2812B, DATA_PIN_FAN_3, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 2, NUMBER_OF_LEDS_PER_FAN);
  FastLED.addLeds<WS2812B, DATA_PIN_FAN_4, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 3, NUMBER_OF_LEDS_PER_FAN);
  //FastLED.addLeds<WS2812B, DATA_PIN_FAN_5, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 4, NUMBER_OF_LEDS_PER_FAN);
  //FastLED.addLeds<WS2812B, DATA_PIN_FAN_6, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 5, NUMBER_OF_LEDS_PER_FAN);
  
  // LED Strips
  //                          FAN_PIN           CRGB array            offset             number of leds per fan
  //                          FAN_PIN           CRGB array            offset             number of leds per fan
  FastLED.addLeds<WS2812B, DATA_PIN_FAN_1B, RGB>(ledsChannel2, NUMBER_OF_LEDS_PER_FAN * 0, NUMBER_OF_LEDS_PER_FAN);
  FastLED.addLeds<WS2812B, DATA_PIN_FAN_2B, RGB>(ledsChannel2, NUMBER_OF_LEDS_PER_FAN * 1, NUMBER_OF_LEDS_PER_FAN);  
  FastLED.addLeds<WS2812B, DATA_PIN_FAN_3B, RGB>(ledsChannel2, NUMBER_OF_LEDS_PER_FAN * 2, NUMBER_OF_LEDS_PER_FAN);
  FastLED.addLeds<WS2812B, DATA_PIN_FAN_4B, RGB>(ledsChannel2, NUMBER_OF_LEDS_PER_FAN * 3, NUMBER_OF_LEDS_PER_FAN);
  //FastLED.addLeds<WS2812B, DATA_PIN_FAN_5B, GRB>(ledsChannel2, NUMBER_OF_LEDS_PER_FAN * 4, NUMBER_OF_LEDS_PER_FAN);
  //FastLED.addLeds<WS2812B, DATA_PIN_FAN_6B, GRB>(ledsChannel2, NUMBER_OF_LEDS_PER_FAN * 5, NUMBER_OF_LEDS_PER_FAN);
  
  ledController.addLEDs(0, ledsChannel1, 90);
  ledController.addLEDs(1, ledsChannel2, 90);
 
}

void loop() {
  cHID.update();
  
  if (ledController.updateLEDs()) {
    FastLED.show();
  }
}

tiburcillo avatar Apr 16 '24 10:04 tiburcillo

You need to reduce the number off LEDs, which are stored in memory. Then you can connect more fans by mirroring the LEDs to multiple fans or scale the LEDs from a lower number in icue.

Legion2 avatar Apr 16 '24 21:04 Legion2

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 01 '24 01:05 github-actions[bot]