How to 'hack' this LED light with Arduino?

Hello!

I'm making a strobe light based on this project:

I have an existing LED panel that I would like to use as the light source. It has DC power in on the back, though I'm not sure what is running to the LED's off the board. (Pictures Below).

I'd like to use similar code, and have a mosfet switch the panel on and off.

How would you approach using integrating this panel in this kind of project? Thank you!

The pictures tell me nothing. Where is the code You want to use? Post it here.

That looks like it has switching supplies to power the LEDs. It's going to be difficult to strobe that, probably the pulse won't be very short, or it will just flat out fail.

As an update...

I see they are already using MOSFET's to dim the panel. Can I just wire another mosfet in between this led driver and the led panel itself? I... think I can... but not sure.

Here is where I'm at currently. You can see the green circles, these are where I am really unsure of. For example, where would the existing connection to negative from the board go?

Is cutting into negative not the way to go?

You don't dim the panel, You pulse it. What is the pulse width used?
Why do You think of adding another MOSFET?
Post the wiring diagram of the board. Do You think any power supply is needed to be connected somewhere?

Railroader:
You don't dim the panel, You pulse it. What is the pulse width used?
Why do You think of adding another MOSFET?
Post the wiring diagram of the board. Do You think any power supply is needed to be connected somewhere?

// Stroboscope with 4-digit 7-segment display
// The display can be directly soldered to the Arduino Nano on pins A0-A5, D4-D9
// the frequency can be changed with two push-buttons
// the pulselength can be changed by pressing both buttons simultaneously

//for common anode display
#define DIGON  HIGH
#define DIGOFF LOW
#define SEGON  LOW
#define SEGOFF HIGH

//for common cathode display
//#define DIGON  LOW
//#define DIGOFF HIGH
//#define SEGON  HIGH
//#define SEGOFF LOW

const byte ndig=4;
const byte nseg=8;

//breadboard setup 
//const byte digs[ndig] = { 9, 6, 5,A5};             // digs 1 2 3 4
//const byte segs[nseg] = { 8, 4,A3,A1,A0, 7,A4,A2}; // segs ABCDEFGH
//nano setup
const byte digs[ndig] = { 4, 7, 8,A0};             // digs 1 2 3 4
const byte segs[nseg] = { 5, 9,A2,A4,A5, 6,A1,A3}; // segs ABCDEFGH
const byte button_up=12;
const byte button_dw=11;

//translate number into corresponding segements
const byte val2seg[12]={
  B11111100, //0
  B01100000, //1
  B11011010, //2
  B11110010, //3
  B01100110, //4
  B10110110, //5
  B10111110, //6
  B11100000, //7
  B11111110, //8
  B11110110, //9
  B00000000, //nothing
  B01001110, //mu
};

int freq=200; //frequency in units of 0.1Hz
byte len=1;   //pulselength in units of 64 microseconds

void setup() {
  
  //setup TIMER1B for fast PWM with (output on pin D10)
  TCCR1A=B00100010;
  TCCR1B=B00011000;
  setfreq(freq,len);
  pinMode(10,OUTPUT);

  // set to output and switch off all digits
  for (byte idig=0; idig<ndig; idig++){
    pinMode(digs[idig], OUTPUT);
    digitalWrite(digs[idig],DIGOFF);
  }
  // set to output and switch off all segments
  for (byte iseg=0; iseg<nseg; iseg++){
    pinMode(segs[iseg], OUTPUT);
    digitalWrite(segs[iseg],SEGOFF);
  }

  //set the pushbuttons to input with pull-up
  pinMode(button_up,INPUT_PULLUP);
  pinMode(button_dw,INPUT_PULLUP);


}

//set frequency in Hz, pulse length in units of 64mus
void setfreq(int f, int len){

  //calculate what to put into the timing registers
  long unsigned int ticks=(160000000+f/2)/f; // f_clock/0.1f
  unsigned int ps=1;
  if (ticks>    0xFFFF)ps=   8;
  if (ticks>  8*0xFFFF)ps=  64;
  if (ticks> 64*0xFFFF)ps= 256;
  if (ticks>256*0xFFFF)ps=1024;
  unsigned int val_ICR1=ticks/ps-1;
  unsigned int val_OCR1B=len*(1024/ps)-1;
  unsigned int val_TCCR1B=B00011001;
  if (ps==   8) val_TCCR1B=B00011010;
  if (ps==  64) val_TCCR1B=B00011011;
  if (ps== 256) val_TCCR1B=B00011100;
  if (ps==1024) val_TCCR1B=B00011101;

  //set the actual values in the timing registers
  //noInterrupts();
  if (TCNT1>val_ICR1)TCNT1=0;  //do not allow timer to exceed 'top'
  ICR1=val_ICR1;
  OCR1B=val_OCR1B;
  TCCR1B=val_TCCR1B;
  //interrupts();
}

//set a digit to a certain value
void setdig(byte dig, byte val, bool dot){
  //switch off all digits
  for (byte idig=0; idig<ndig; idig++){
    digitalWrite(digs[idig],DIGOFF);
  }
  //set the segments
  for (byte iseg=0; iseg<nseg; iseg++){
    if ((val2seg[val]&(1<<(nseg-1-iseg)))>0){
      digitalWrite(segs[iseg], SEGON);
    } else {
      digitalWrite(segs[iseg], SEGOFF);
    }
  }

  // set the decimal dot if needed
  if (dot){
    digitalWrite(segs[7], SEGON);
  } else{
    digitalWrite(segs[7], SEGOFF);    
  }

  //set the digit
  digitalWrite(digs[dig],DIGON);
 
}


byte dispdig=0;

byte prevbutstat=0;

unsigned long millis_butchanged=0;
unsigned long millis_valchanged=0;

void loop() {

  //check for buttons
  long unsigned millis_current=millis();
  bool change=false;
  byte butstat=(digitalRead(button_up)==LOW)*1+(digitalRead(button_dw)==LOW)*2;
  if (butstat!=prevbutstat)millis_butchanged=millis_current;

  int dt=200; int df=1;
  if (millis_current-millis_butchanged>1000)dt=100;
  if (millis_current-millis_butchanged>2000)dt=50;
  if (millis_current-millis_butchanged>3000)dt=20;
  if (millis_current-millis_butchanged>4000)dt=10;
  if (millis_current-millis_butchanged>5000)dt=5;
  if (millis_current-millis_butchanged>6000)dt=2;
  if (millis_current-millis_butchanged>7000)dt=1;
  if (millis_current-millis_butchanged>8000)df=2;
  if (millis_current-millis_butchanged>9000)df=5;
  if (millis_current-millis_butchanged>10000)df=10;
  if (butstat==3)dt=1000;
  if(millis_current-millis_valchanged>dt){
    if(butstat==1) freq=freq+df;
    if(butstat==2) freq=freq-df;
    if(butstat==3) len++;
    if(butstat>0){
        change=true; millis_valchanged=millis_current;
    }
  }
  prevbutstat=butstat;

  //keep frequency and pulselength wihin allowed domain
  freq=max(freq,3);    
  freq=min(freq,9999);
  if (len>15)len=1;
  if (len*freq>15625)len=1; //corresponds to 0.1 duty cycle
  
  if (change) setfreq(freq,len);

  //display a digit
  byte val=10; // by default nothing
  
  if (butstat==3){
    if (dispdig==0 and len>1)val=((len*64)/100)%10;
    if (dispdig==1)val=((len*64)/10)%10;
    if (dispdig==2)val=(len*64)%10;
    if (dispdig==3)val=11; //the symbol mu
  } else {
    if (dispdig==0 and freq>999)val=(freq/1000)%10;
    if (dispdig==1 and freq>99)val=(freq/100)%10;
    if (dispdig==2)val=(freq/10)%10;
    if (dispdig==3)val=freq%10;
  }
  
  setdig(dispdig,val,(dispdig==2 and butstat!=3));
  delayMicroseconds(100);
  dispdig=(dispdig+1)%ndig;
    
}

Railroader, it looked like my reply was lost, just the code was added.

Thank you, I do understand the concept of PWM as pulsing. This is why I am unsure if I can 'hack' into it as is and add another mosfet to control the led's myself. I would keep the existing potentiometers all the way up, I don't know if this would stop the pulsing and keep them in a constant 'on', or exactly how this works.

What I am looking to do is rapidly turn the entire panel on and off, using the code posted above, as seen in this project:

aarg:
That looks like it has switching supplies to power the LEDs. It's going to be difficult to strobe that, probably the pulse won't be very short, or it will just flat out fail.

https://www.amazon.com/Neewer-Professional-Bi-Color-Photography-3200-5600K/dp/B01NCJSK5V/ref=pd_lpo_421_t_2/130-1787728-6213323)

Thank you!

What is it You want to "hack"?

"another mosfet to control the led's". Do You mean "the panel" or the frequency showing LED display?

I don't find any analogRead at all, no pots are being read in that code.
Reading pots gives a value between 0 and 1023 and it can be replaced by buttons stepping that value up or down.

I still don't get what the issue is, what the difficulty is.

You really need to scope the LED drive. I think you will discover that it is PWM driven with a constant current. You should know the voltages before you do any "hacking" of it. I believe you can not make a strobe from this kind of device, because the short pulse that is necessary, is not compatible with that kind of driving circuit. Even if you manage to reverse engineer or "hack" it.

You ask, "how to approach it?". I suggest the real answer is to ditch the existing drive board and design a new drive board that can produce the correct pulses.

Railroader:
What is it You want to "hack"?

"another mosfet to control the led's". Do You mean "the panel" or the frequency showing LED display?

I don't find any analogRead at all, no pots are being read in that code.
Reading pots gives a value between 0 and 1023 and it can be replaced by buttons stepping that value up or down.

I still don't get what the issue is, what the difficulty is.

Railroader:
What is it You want to "hack"?

"another mosfet to control the led's". Do You mean "the panel" or the frequency showing LED display?

I don't find any analogRead at all, no pots are being read in that code.
Reading pots gives a value between 0 and 1023 and it can be replaced by buttons stepping that value up or down.

I still don't get what the issue is, what the difficulty is.

Hi Railroader, thanks for bearing with me, many of these concepts are new to me!

What I'd like to do is to be able to adjust the frequency of the LEDs to blink at precise hz (down to a range of 8-40hz)

I'd like to display the hz on a 7-segment display, and adjust the frequency using two buttons.

The pots was in reference to the existing board that is driving the led panel right now (the one in the pictures).

I'd like to be able to use the existing power supply / driver / board that is pictured, but then add my own arduino / MOSFET solution in between the existing board and the LED's, so that I can control the frequency with the Arduino.

I'm not sure if I can think of the existing board (from the pictures) as just a power supply, and wire in between the board and the LED's or not, and if I can, if I need any extra components.

I hope that helps clarify, thank you!

I'm not sure if I can think of the existing board (from the pictures) as just a power supply

I'm saying, this is not correct. For one thing, if it's PWM driven, any of your strobe pulses that occur during an "off" portion of the PWM cycle, will not fire. There are lots more possible problems too.

The other thing is, you could just try it. Let us know. #3 probably won't toast the light, only the Arduino components if it fails.

Your questions about the board assume some magic general knowledge that electronics people have. We often can't tell what is really going on without PCB layouts and schematics. Lacking those, we have to reverse engineer it with testing. Such as scoping it to begin with.

I've been designing and using multiplexed/pulsed/PWM LED displays. Varying the PWM will effect the brightness of the LED. Varying the frequency looks strange to me. Keep it fast to awoid flickering. Comment?

"I'd like to display the hz on a 7-segment display, and adjust the frequency using two buttons." Is it Your mystery LED display updating frequency You want to display? I don't see the point in that. Try a few different frequencies and choose the one giving You the experience You want.

The board You are picturing tells me nothing. It looks like a rat nest without any understandable information. Impossible to give any advice regarding connections to that board. Post specifications/data/wiring of that board.

As I replied, there's no reading of pots in that code.

If you want more eyeballs on the project, post the code. Not a link. Many forum members will not open websites or download files.

SteveMann:
If you want more eyeballs on the project, post the code. Not a link. Many forum members will not open websites or download files.

Thanks, Steve! Here's the code:

[ltr][color=#222222][code]// Stroboscope with 4-digit 7-segment display
// The display can be directly soldered to the Arduino Nano on pins A0-A5, D4-D9
// the frequency can be changed with two push-buttons
// the pulselength can be changed by pressing both buttons simultaneously

//for common anode display
#define DIGON  HIGH
#define DIGOFF LOW
#define SEGON  LOW
#define SEGOFF HIGH

//for common cathode display
//#define DIGON  LOW
//#define DIGOFF HIGH
//#define SEGON  HIGH
//#define SEGOFF LOW

const byte ndig=4;
const byte nseg=8;

//breadboard setup
//const byte digs[ndig] = { 9, 6, 5,A5};             // digs 1 2 3 4
//const byte segs[nseg] = { 8, 4,A3,A1,A0, 7,A4,A2}; // segs ABCDEFGH
//nano setup
const byte digs[ndig] = { 4, 7, 8,A0};             // digs 1 2 3 4
const byte segs[nseg] = { 5, 9,A2,A4,A5, 6,A1,A3}; // segs ABCDEFGH
const byte button_up=12;
const byte button_dw=11;

//translate number into corresponding segements
const byte val2seg[12]={
  B11111100, //0
  B01100000, //1
  B11011010, //2
  B11110010, //3
  B01100110, //4
  B10110110, //5
  B10111110, //6
  B11100000, //7
  B11111110, //8
  B11110110, //9
  B00000000, //nothing
  B01001110, //mu
};

int freq=200; //frequency in units of 0.1Hz
byte len=1;   //pulselength in units of 64 microseconds

void setup() {
 
  //setup TIMER1B for fast PWM with (output on pin D10)
  TCCR1A=B00100010;
  TCCR1B=B00011000;
  setfreq(freq,len);
  pinMode(10,OUTPUT);

  // set to output and switch off all digits
  for (byte idig=0; idig<ndig; idig++){
    pinMode(digs[idig], OUTPUT);
    digitalWrite(digs[idig],DIGOFF);
  }
  // set to output and switch off all segments
  for (byte iseg=0; iseg<nseg; iseg++){
    pinMode(segs[iseg], OUTPUT);
    digitalWrite(segs[iseg],SEGOFF);
  }

  //set the pushbuttons to input with pull-up
  pinMode(button_up,INPUT_PULLUP);
  pinMode(button_dw,INPUT_PULLUP);


}

//set frequency in Hz, pulse length in units of 64mus
void setfreq(int f, int len){

  //calculate what to put into the timing registers
  long unsigned int ticks=(160000000+f/2)/f; // f_clock/0.1f
  unsigned int ps=1;
  if (ticks>    0xFFFF)ps=   8;
  if (ticks>  8*0xFFFF)ps=  64;
  if (ticks> 64*0xFFFF)ps= 256;
  if (ticks>256*0xFFFF)ps=1024;
  unsigned int val_ICR1=ticks/ps-1;
  unsigned int val_OCR1B=len*(1024/ps)-1;
  unsigned int val_TCCR1B=B00011001;
  if (ps==   8) val_TCCR1B=B00011010;
  if (ps==  64) val_TCCR1B=B00011011;
  if (ps== 256) val_TCCR1B=B00011100;
  if (ps==1024) val_TCCR1B=B00011101;

  //set the actual values in the timing registers
  //noInterrupts();
  if (TCNT1>val_ICR1)TCNT1=0;  //do not allow timer to exceed 'top'
  ICR1=val_ICR1;
  OCR1B=val_OCR1B;
  TCCR1B=val_TCCR1B;
  //interrupts();
}

//set a digit to a certain value
void setdig(byte dig, byte val, bool dot){
  //switch off all digits
  for (byte idig=0; idig<ndig; idig++){
    digitalWrite(digs[idig],DIGOFF);
  }
  //set the segments
  for (byte iseg=0; iseg<nseg; iseg++){
    if ((val2seg[val]&(1<<(nseg-1-iseg)))>0){
      digitalWrite(segs[iseg], SEGON);
    } else {
      digitalWrite(segs[iseg], SEGOFF);
    }
  }

  // set the decimal dot if needed
  if (dot){
    digitalWrite(segs[7], SEGON);
  } else{
    digitalWrite(segs[7], SEGOFF);   
  }

  //set the digit
  digitalWrite(digs[dig],DIGON);
 
}


byte dispdig=0;

byte prevbutstat=0;

unsigned long millis_butchanged=0;
unsigned long millis_valchanged=0;

void loop() {

  //check for buttons
  long unsigned millis_current=millis();
  bool change=false;
  byte butstat=(digitalRead(button_up)==LOW)*1+(digitalRead(button_dw)==LOW)*2;
  if (butstat!=prevbutstat)millis_butchanged=millis_current;

  int dt=200; int df=1;
  if (millis_current-millis_butchanged>1000)dt=100;
  if (millis_current-millis_butchanged>2000)dt=50;
  if (millis_current-millis_butchanged>3000)dt=20;
  if (millis_current-millis_butchanged>4000)dt=10;
  if (millis_current-millis_butchanged>5000)dt=5;
  if (millis_current-millis_butchanged>6000)dt=2;
  if (millis_current-millis_butchanged>7000)dt=1;
  if (millis_current-millis_butchanged>8000)df=2;
  if (millis_current-millis_butchanged>9000)df=5;
  if (millis_current-millis_butchanged>10000)df=10;
  if (butstat==3)dt=1000;
  if(millis_current-millis_valchanged>dt){
    if(butstat==1) freq=freq+df;
    if(butstat==2) freq=freq-df;
    if(butstat==3) len++;
    if(butstat>0){
        change=true; millis_valchanged=millis_current;
    }
  }
  prevbutstat=butstat;

  //keep frequency and pulselength wihin allowed domain
  freq=max(freq,3);   
  freq=min(freq,9999);
  if (len>15)len=1;
  if (len*freq>15625)len=1; //corresponds to 0.1 duty cycle
 
  if (change) setfreq(freq,len);

  //display a digit
  byte val=10; // by default nothing
 
  if (butstat==3){
    if (dispdig==0 and len>1)val=((len*64)/100)%10;
    if (dispdig==1)val=((len*64)/10)%10;
    if (dispdig==2)val=(len*64)%10;
    if (dispdig==3)val=11; //the symbol mu
  } else {
    if (dispdig==0 and freq>999)val=(freq/1000)%10;
    if (dispdig==1 and freq>99)val=(freq/100)%10;
    if (dispdig==2)val=(freq/10)%10;
    if (dispdig==3)val=freq%10;
  }
 
  setdig(dispdig,val,(dispdig==2 and butstat!=3));
  delayMicroseconds(100);
  dispdig=(dispdig+1)%ndig;
   
}

[/color][/ltr]
[/code]

UPDATE:

I cut the negative cable and fired it up, I can complete the connection and it lights right up, no warm up. So physically, using a relay I could accomplish the timed flashing I'm after.

However, at 40hz, for example, that's switching every 12.5ms, which isn't a sustainable solution with a relay.

Also, to clarify, when I am saying frequency and hz, I'm referring to the flashing of this led like a strobe, so 40hz would be: 12.5ms ON, 12.5ms OFF. The frequency is flashing of light, here 40 times per second, or 40hz.

I'll test using a mosfet as a switch next. I have some logic level mosfets on the way soon and will report back with the answer. As aarg pointed out, there is already a mosfet in the mix, so it could throw things off, we will know soon!

SteveMann:
If you want more eyeballs on the project, post the code. Not a link. Many forum members will not open websites or download files.

The cide was posted in repky #5.

SteveMann:
If you want more eyeballs on the project, post the code. Not a link. Many forum members will not open websites or download files.

The code was posted in repky #5.

Railroader:
The code was posted in repky #5.

Oops. Sorry.

aarg:
I'm saying, this is not correct. For one thing, if it's PWM driven, any of your strobe pulses that occur during an "off" portion of the PWM cycle, will not fire. There are lots more possible problems too.

The other thing is, you could just try it. Let us know. #3 probably won't toast the light, only the Arduino components if it fails.

Your questions about the board assume some magic general knowledge that electronics people have. We often can't tell what is really going on without PCB layouts and schematics. Lacking those, we have to reverse engineer it with testing. Such as scoping it to begin with.

aarg:
I'm saying, this is not correct. For one thing, if it's PWM driven, any of your strobe pulses that occur during an "off" portion of the PWM cycle, will not fire. There are lots more possible problems too.

The other thing is, you could just try it. Let us know. #3 probably won't toast the light, only the Arduino components if it fails.

Your questions about the board assume some magic general knowledge that electronics people have. We often can't tell what is really going on without PCB layouts and schematics. Lacking those, we have to reverse engineer it with testing. Such as scoping it to begin with.

So I tried it... and it works! The dimmers still work as well, which makes sense as the MOSFET is just opening and closing the gate rather slowly (0-40hz).

I cut into the negative led line and put the MOSFET in between it with the gate running to a digital pin.