is there a 2channel driver for single liion?

Hello blf

I had the idea of making a camping Flashlight. Therefor I had the idea of using a white xp-g2 and a red xp-e in the same reflector. i know the Beam will look ultra bad cuz the leds will not be centered but if I use a OP reflector and some type of defuser film it can’t be that bad.

But if i want This to work out i will need a driver capable of driving both leds. They don’t need to run at the same time. But I’d like to have all modes on both leds.

Any ideas? Or do I maybe have to design my own driver?

DenTilloZie

You could use the Star FW for 105c drivers. (Dual PWM feature, mainly used for moonlight mode)

You would have to adopt the modes to your needs. But I guess it is possible.

Hardware:

If you have enough space:

Get yourself two drivers, then use the second one as slave board on 2nd PWM pin of the first board.
Red LED’s have less forward voltage, I’m not sure how hard you can drive them. Noctigon is essential.

If you don’t have enough space:

Get one 105c and cut the PWM trace, connect the 2nd PWM pin to one of the AMC PWM pins not connected.

In both cases you could connect as many 7135s to the LEDs as you like, depending on where you cut the trace or how many you use per LED.

This is the “hard” part for coming up with a driver. There are some drivers that guys on this forum have made to separately control multiple LED emitters. Have a look around, especially in the Oshpark Projects thread. Also, if you give more specific information about exactly what you’re trying to accomplish with modes, etc. then you may get better help than me to come along.

One thought I just had about the beam/centering issue: Use either a triple or a quad board and optics. Then, each emitter will have its own focus, and the beam(s) will look fine. Dale (DBCstm) has been making some triples in an Eagle Eye X6 host and says it is pretty easy to accomplish. Others have started doing the same now. You can use one white and two reds or two whites and one red, depending on your needs.

Good point DavidEF. A triple with 2x XP-G2 in parallel and a separate red XP-E2 might be the thing to do!

In terms of the physical driver RMM & Mattaus’s Moonlight Special V2 (post #1447). should work fine with a single trace cut.

The software is a different trick, but a simple one. You can modify the current, dual-PWM version of STAR offtime with a case structure in order to make a sequence of modes such as:

  1. White high
  2. White medium
  3. White low
  4. Red high
  5. Red low

Take a look at Werner’s STAR mods in post #61 and earlier over in this thread. - What you need isn’t the same, but it’s similar.

Alright a tripple would indeed be the easiest and prettiest solution. So if I understand correctly, if I just buy 2 105c drivers, remove a uc on one of the 2 drivers making it a slave driver and flash the master driver with a dual pwm firmwire and then connect the 2nd pwm to the slave it would work?

It would work but probably wouldn’t fit in the light. :wink:

Instead consider putting the second set of 7135’s on a purpose-made slave board such this 16mm one by Mattaus:
https://oshpark.com/shared_projects/ASrNWWhu
via Rufusbduck’s Oshpark Projects thread.

EDIT: (You’re still going to have to do some cutting/drilling to get all the wiring forward of course!)

Could it work of i took 1 105c driver and cut a trace so I have 2separate banks of 7135chips and then connect the each pwm pin to a bank? That way I can keep it as small as possible. If I need more power I can add more chips to 1or both banks.

Int’l Outdoor has the XML RGBW on a 16mm mcpcb, and a 20mm driver to match. Gets around having to do a triple, and might fit the flashlight you are contemplating? That driver is only high mode though, so it’s always going to be some sort of hurdle, compromise, or extra work on software to get what you want. Some here on BLF have built RGW custom drivers, like Cereal_Killer and ?? that could fit the bill.

I did look into that but output of the driver isn’t high enough. I could flash the driver an combine channels but that would still only give me 1.4a per led.

Sounds fine to me. I guess you are trying to avoid having to assemble an entire driver? (otherwise I’d build a Moonlight Special V2 like I recommended above)

For trace cutting with a stock Nanjg 105c I’d take a look here to get a better idea of what you’ll need to do. Notice the via location on the stock PWM trace. AVR Drivers - Flashlight Wiki.

In my opinion the amount of challenge involved really depends on how many 7135’s you want for that red LED.

Yeah soldering a whole driver is something I’m not really willing to do. My smd soldering skills at not good enough to do that.
I took a look at traces and I could easily cut a trace so I have a bank of 2 chips and a bank of 6 chips. I could easily stack a chip or 2 on both banks to push more amps. 1.4A for the red channel and 3A for the white channel.

Thanks for the info BTW looks like a very handy page!

I recently did a mod for a forum member here that’s exactly what you’re describing. I modded a star board to hold an XP-L with a red XQ-E next to it, and wrote firmware that includes red modes. It runs on a pic10f322 and uses AMC7135s to drive the leds. I’ll make the source code available if you’d like to try building your own

[video:lhttp://youtu.be/dlBPG4cpoKU]

I would be very interested for the code. How did you connect the red led to the ledboard?

I’ll post the code up tonight when I get home. For the red, I used one of my XP star boards that has a large thermal pad and cut a slot into it. This separates the pad into two sections which connect to the anode and cathode of the red XQ-E.

Here's a two-XP emitter PCB... Reflow your Red emitter replacing the blue... Not Copper, not DTP though:

http://www.fasttech.com/products/1609/10009748/1855501-cree-xp-e-r2-wb-xp-e-d4-16-200-230lm-cool-white

That’s really awesome tterev3. I like how the main LED is perfectly centered in that configuration.

yeah i know this is what gave me the idea to do this.

I had to come back and look at this picture again. I think I looked at it on my phone before (but maybe even on a PC as well).

I’d been misinterpreting the photograph: I saw the cuts as small wires. Oops. I’ve got it now. Neat!

Here's the code for the two channel light. It's a bit more complicated than necessary for red+white because it also implements battery monitoring and a user-configurable medium level. I realize PIC equipment is less common for forum members, so if anyone wants to use this I'm happy to provide programmed chips

//v0 9/9/2014 by Everett
    //initial version
    //simple flashlight controller. mode change on power cycle
//version with red 12/3/2014
    //added red channel for low red and safety flasher modes

#include <htc.h>
#include <pic10f322.h>
#define _XTAL_FREQ 8000000
__CONFIG(CP_OFF & BOREN_OFF & LVP_OFF & MCLRE_OFF & WDTE_OFF & PWRTE_OFF & FOSC_INTOSC & WRT_HALF);

#define pwm PWM1DCH
#define red_pwm PWM2DCH

persistent unsigned char mode;
enum mode{
max=0,
low,
lower,
low_red,
strobe,
ramp,
ramp_save,
};
#define max_mode 4
#define default_mode 0

#define safe_level 63 //25%

#define ramp_rate 15 //4 second ramp
#define ramp_save_min 33 //minimum time in ramp before it will be saved. in counts of ramp_rate (33*15=500ms)
#define ramp_pause 500 //milliseconds

persistent unsigned int password;
persistent unsigned char cycle_count;
persistent unsigned char level;

unsigned int ramp_save_timer;
unsigned int ramp_timer;
unsigned int v_timer;
bit v_sample;
#define voltage_rate 50 //milliseconds
unsigned char strobe_position;

persistent unsigned int on_timer;

bit direction;

#define storage_location 0x1f0
const unsigned char nvm[16] @storage_location={100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

void delayms(int milliseconds);
void configure(void);
unsigned char read_voltage(void);
void initialize_mode(void);
void save_level(unsigned char input);
unsigned char read_level(void);
unsigned char lookup(unsigned char input);

void interrupt isr(void)
{

if(TMR0IF){ //fires at 1kHz
    TMR0IF=0;
    if(++v_timer==voltage_rate){v_timer=0; v_sample=1;}
    if(ramp_timer){ramp_timer--;}
    if(on_timer){
        on_timer--;
        if(on_timer==0)cycle_count=0;
    }
}

}

void main(void)
{
configure(); //set up hardware peripherals

delayms(25);

if(password==12345){
    if(mode==ramp_save){
        save_level(level);
        mode=low;
        cycle_count=0;
    }
    else{   
        cycle_count++;
        if(on_timer) mode++;
        if(mode&gt;max_mode) mode=0;
        if(cycle_count&gt;=12){
            mode=ramp;
            ramp_save_timer=0;
        }   
    }   
}
else{
    cycle_count=0;
    mode=default_mode;
    password=12345;
}   
initialize_mode();  
on_timer=500;   //if left on longer than this, stop counting cycles to enter ramp

ramp_timer=0;
direction=1;

GIE=1;  //turn on interrupts

while(1){
    
    
    switch(mode){
        case lower:
        case low_red:
            break;
        case max:
        case low:
            if(v_sample){
                v_sample=0;
                    if(read_voltage()&gt;87){
                        if(pwm&gt;safe_level) pwm--;
                    }
            }   
            break;
        case strobe:
            if(ramp_timer==0){
                strobe_position++;
                if(strobe_position&gt;5) strobe_position=0;
                if((strobe_position&amp;1)==0){
                    red_pwm=255;
                    ramp_timer=35;
                }
                else{
                    red_pwm=0;
                    ramp_timer=75;
                }       
                if(strobe_position==5) ramp_timer=900;
            }
            break;      
        case ramp:
        case ramp_save:
            if(ramp_timer==0){
                ramp_timer=ramp_rate;
                if(++ramp_save_timer&gt;ramp_save_min) mode=ramp_save;
                if(direction){
                    level++;
                    if(level==255){ direction=0; ramp_timer=ramp_pause;}
                }
                else{
                    level--;
                    if(level==0){ direction=1; ramp_timer=ramp_pause;}
                }
                pwm=lookup(level);
            }
            break;
    }                   
        
}   

}

unsigned char lookup(unsigned char input)
{
unsigned int temp = input*input;
temp>>=8;
return (temp&0xff)+1;
}

void initialize_mode(void)
{
pwm=0;
red_pwm=0;
switch(mode){ //initialize current mode
default:
break;
case max:
pwm=255;
break;
case low:
pwm=lookup(read_level());
break;
case lower:
pwm=5;
break;
case low_red:
red_pwm=25;
break;
case ramp:
level=0;
pwm=lookup(level);
direction=1;
break;
}
}

unsigned char read_voltage(void)
{
//fvr is at 1.024V. ADRES = 1.024/Vin*255. Vin = 1.024/(ADRES/255). voltage limit set to 3.0V -> 87. values below this correspond to voltage above 3.0V
GO_nDONE=1;
while(GO_nDONE);
return ADRES;
}

void delayms(int milliseconds)
{
while(milliseconds!=0){ __delay_ms(1); milliseconds–;}
}

void configure(void)
{
INTCON=0b00100000; //tmr0 only

T2CON=0b00000100; //on, no prescale
PR2=255; 
TMR2=0;
    
LATA=0;
TRISA=0b11111100;   //GP0,1 output
ANSELA=0b11110000;  //
WPUA=0b11111100;

OSCCON=0b01100000;  //8MHz

OPTION_REG=0b00000010;  //8 prescale for 1ms interrupts

FVRCON=0b10000001;  //1.024v to adc
ADCON=0b10111101;   // fvr

PWM1DCH=0;
PWM1DCL=0;
PWM1CON=0b11000000; //on, output
PWM2DCH=0;
PWM2DCL=0;
PWM2CON=0b11000000; //on, output

}

void save_level(unsigned char input)
{
GIE=0;
PMADR=storage_location;
PMCON1=0b00010100; //FREE and WREN
PMCON2=0x55; PMCON2=0xAA;
#asm
bsf PMCON1,1
nop
nop
#endasm //erased
PMADR=storage_location;
PMCON1=0b00100100; //LWLO and WREN
PMDATH=0x34;
PMDATL=input;
PMCON2=0x55; PMCON2=0xAA;
#asm
bsf PMCON1,1
nop
nop
#endasm //write to latch
PMCON1=0b00000100; //WREN
PMCON2=0x55; PMCON2=0xAA;
#asm
bsf PMCON1,1
nop
nop
#endasm //write
PMCON1=0; //clear WREN
GIE=1;
}

unsigned char read_level(void)
{
PMADR=storage_location;
PMCON1=0b00000001; //RD
#asm
nop
nop
#endasm
return PMDATL;
}