Taking data from RGB strip lights for Neopixel

The project - capture data from off-the-shelf LED strip circuitry for its bluetooth, wifi and mobile application features, to replace the simple RGBCW strip with a Neopixel so that it could be controlled via mobile app.

The problem i am facing is that i think my approach is off. I am getting odd bouncy analog readings from the RGB outputs from the board.

My mindset was that i could solder in wires directly from the R G B ports to then use an arduino to implement within the FastLED library. Even with secure placement within the arduino and immovable solder joints, i get bouncy analog readings. I dont think loose connections are a problem. Is there something else i need to consider? Is there perhaps some coding within shopbought electronics that will stop me from getting any data?

Images of the circuit are below.

Below is the code ive been using to try siphon data:

#include <FastLED.h>
#define NUM_LEDS 25
#define LED_PIN 2

CRGBArray<NUM_LEDS> leds;

void setup() {
FastLED.addLeds<NEOPIXEL,LED_PIN>(leds, NUM_LEDS);
Serial.begin(9600);
}

void loop() {
int valG = map(analogRead(A0),0,1023,0,255);
Serial.println(valG);
}

Any insight would be much appreciated.

Welcome to the forum.

The link to the Google Drive can not be opened.

Why is a RGBCW ledstrip simple ? I assume that it is a Red-Green-Blue-ColdWhite-WarmWhite ledstrip.

Which off-the-shelf device is it ?
Do you know what kind of ledstrip it is or the brand ? to look up the specifications of the ledstrip.
Do you know what kind of signals they get ? It could be a 12V PWM signal that damages your Arduino board.

Do you have a oscilloscope or a multimeter ?

Split your project into separate parts. First try to read the signals, and show them to the Serial Monitor. Then make another sketch to try the FastLED library.

Hi Koepel,

Thanks for the speedy reply!

I do have a multimeter but no oscilloscope.

Thats a shame about the link, however they just show images of the circuit board of the Calex Smart Rgb Light Strip 2M (link to it here: https://www.calex.eu/en/products/product/DIGITAALLEDSTRIPLIGHT-SMART/ ). I haven't been able to find any specs or circuit diagrams referring to the board. However, there is a separate port on it with 12V labelled on it (partially viable to the bottom right of the image below) , though no markings suggest PWM, but that would explain the jumpy readings.

You are correct in saying that its Red-Green-Blue-ColdWhite-WarmWhite ledstrip and that i should definately focus on the reading signals section. It was a curious thought provoked project acted out on a whim.

What voltage is the power supply ? I assume 12V or 24V DC.
The processor in the middle probably runs at 3.3V. The gray block in the lower-left could a induction for a DC/DC-converter to make 3.3V. The Bluetooth antenna is at the top.

The 5 black components on the right are typical mosfets that drive the led channels with PWM (probably 12V or 24). I'm not 100% sure, it could also be the drivers for pulses for individual programmable leds.

The red and blue wire at the top-right is a input ?

Reading a PWM signal is easy with a RC filter. That is a resistor and a capacitor. You need 5 RC filters for 5 channels. However, if the signal is indeed 12V or 24V, then you have to bring that into a safe range for the Arduino board.
You also need to know the frequency of the PWM signal.

The two most important wires are the black GND wire above the channels and the unconnected 12V point below the channels.
Can you check if the black GND wire is connected to the GND of the power connector ?
Is there 12V at the 12V point ? Or should 12V be supplied there ?

Keep 12V away from the Arduino board. If you drop a wire with 12V on the Arduino board, then it is instantly broken and perhaps your computer as well.

I think that is labeled "W" for "Warm White". It may be unused or the wire may have broken off.

The top solder terminal is labeled 3.3V so perhaps the LED channels are driven with 3.3V? I think the one marked "IR" is the infrared remote control signal, so the sensor can be at the lights.

Yes, you are correct with the ir pins. The top three are for the remote receiver. The lower 6 pins were for the led strip which is what I wanted to try and get data from. I left the 12V (bottom pin) out of the arduino, because its obviously too much for the uno to handle.

This sketch might help with the analysis. Run it on an Arduino UNO or Nano. Connect the Ground connection to Arduino Ground and one of the output signals (G, R, B, C, or W) to Pin 8. The sketch will report the PWM frequency and duty cycle.

Note: I expect the output drivers ar N-Channel MOSFETS so HIGH is OFF and LOW is ON. As you increase brightness, the "duty cycle" should go down.

// Measures the HIGH width, LOW width, frequency, and duty-cycle of a pulse train
// on Arduino UNO/Nano Pin 8 (ICP1 pin).

// Note: Since this uses Timer1, Pin 9 and Pin 10 can't be used for
// analogWrite().

void setup()
{
  Serial.begin(115200);
  while (!Serial);

  pinMode(8, INPUT_PULLUP);

  // For testing, uncomment one of these lines and connect
  // Pin 3 or Pin 5 to Pin 8
  // analogWrite(3, 64);  // 512.00, 1528.00, 2040.00, 25.10%, 490.20 Hz
  // analogWrite(5, 64);  // 260.00, 764.00, 1024.00, 25.39%, 976.56 Hz

  noInterrupts ();  // protected code
  // reset Timer 1
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1 = 0;
  TIMSK1 = 0;

  TIFR1 |= _BV(ICF1); // clear Input Capture Flag so we don't get a bogus interrupt
  TIFR1 |= _BV(TOV1); // clear Overflow Flag so we don't get a bogus interrupt

  TCCR1B = _BV(CS10) | // start Timer 1, no prescaler
           _BV(ICES1); // Input Capture Edge Select (1=Rising, 0=Falling)

  TIMSK1 |= _BV(ICIE1); // Enable Timer 1 Input Capture Interrupt
  TIMSK1 |= _BV(TOIE1); // Enable Timer 1 Overflow Interrupt
  interrupts ();
}

volatile uint32_t PulseHighTime = 0;
volatile uint32_t PulseLowTime = 0;
volatile uint16_t Overflows = 0;

ISR(TIMER1_OVF_vect)
{
  Overflows++;
}

ISR(TIMER1_CAPT_vect)
{
  static uint32_t firstRisingEdgeTime = 0;
  static uint32_t fallingEdgeTime = 0;
  static uint32_t secondRisingEdgeTime = 0;

  uint16_t overflows = Overflows;

  // If an overflow happened but has not been handled yet
  // and the timer count was close to zero, count the
  // overflow as part of this time.
  if ((TIFR1 & _BV(TOV1)) && (ICR1 < 1024))
    overflows++;

  if (PulseLowTime == 0)
  {
    if (TCCR1B & _BV(ICES1))
    {
      // Interrupted on Rising Edge
      if (firstRisingEdgeTime)  // Already have the first rising edge...
      {
        // ... so this is the second rising edge, ending the low part
        // of the cycle.
        secondRisingEdgeTime = overflows; // Upper 16 bits
        secondRisingEdgeTime = (secondRisingEdgeTime << 16) | ICR1;
        PulseLowTime = secondRisingEdgeTime - fallingEdgeTime;
        firstRisingEdgeTime = 0;
      }
      else
      {
        firstRisingEdgeTime = overflows; // Upper 16 bits
        firstRisingEdgeTime = (firstRisingEdgeTime << 16) | ICR1;
        TCCR1B &= ~_BV(ICES1); // Switch to Falling Edge
      }
    }
    else
    {
      // Interrupted on Falling Edge
      fallingEdgeTime = overflows; // Upper 16 bits
      fallingEdgeTime = (fallingEdgeTime << 16) | ICR1;
      TCCR1B |= _BV(ICES1); // Switch to Rising Edge
      PulseHighTime = fallingEdgeTime - firstRisingEdgeTime;
    }
  }
}

void loop()
{
  noInterrupts();
  uint32_t pulseHighTime = PulseHighTime;
  uint32_t pulseLowTime = PulseLowTime;
  interrupts();

  // If a sample has been measured
  if (pulseLowTime)
  {
    // Display the pulse length in microseconds
    Serial.print("High time (microseconds): ");
    Serial.println(pulseHighTime / 16.0, 2);
    Serial.print("Low time (microseconds): ");
    Serial.println(pulseLowTime / 16.0, 2);

    uint32_t cycleTime = pulseHighTime + pulseLowTime;
    Serial.print("Cycle time (microseconds): ");
    Serial.println(cycleTime / 16.0, 2);

    float dutyCycle = pulseHighTime / (float)cycleTime;
    Serial.print("Duty cycle (%): ");
    Serial.println(dutyCycle * 100.0, 2);

    float frequency = (float)F_CPU / cycleTime;
    Serial.print("Frequency (Hz): ");
    Serial.println(frequency, 2);
    Serial.println();

    delay(1000);  // Slow down output

    // Request another sample
    noInterrupts();
    PulseLowTime = 0;
    interrupts();
  }
}

Amazing! Thank you. I'll compile in later and shall report back.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.