needed: Microcontroller help

Status
Not open for further replies.

iONic

Member
The attached schematic shows a "buck puck' LED driver with control and reference pins. Essentially changing the resistance value change the % of the available 700mA current applied to the attached LED's(Luxeon III's in my case).

Instead of manually changing the brightness I want a chip to do the work.
For Example: Beginning at 40% initially and each step (aprox 1 min.) increasing 5% until 100% is reaches. Once 100% is reached it should stay at 100%.

Any suggestions on what type of chip I would need to accomplish this?
My friend has a "MicroChip" Programmer board so it would be good to use something I can program.

Essentially I want the LED's to begin at 40% brightness and work their way up to 100% within about
15 minutes.
 

Attachments

  • 14569-auto-controller-needed-buckpuckreg.gif
    39.7 KB · Views: 178
audioguru said:
The module you have uses a pot for dimming.
A different circuit uses pulse-width-modulation for dimming. Then a microcontroller can control the dimming.

--------------------------------------------------------------
 
Not sure if this means it can or not!

External Pulse/Strobe Control

Figures 13 and 14 show two methods for low speed pulsing or high speed flashing operation. In Figure 13, a TTL/CMOS logic signal is applied to the control(Ctrl) input of the 3021. The output current will be zero when the control signal is high. Note that the input needs to source a minimum of 4.75VDC into a 1Kohm input impedance. Also, as is also the case with a dc control signal, the logic input ground to be common to the LED-output terminal.

Figure 14 shows an inverted input configuration using a 2N4403 or other PNP switching transistor. In this case, a logic high will cause the output to be "on". In either configuration, the rise and fall times of the output will be 25micro sec or less. A pulse frequency up to 10kHz may be used.
 

Attachments

  • 14585-auto-controller-needed-pwm.gif
    32.2 KB · Views: 218
audioguru said:
10kHz is fine. You can't see it blink when the frequency is higher than about 50Hz unless it is moving or you are moving your head.
------------------------------------------------------------------
 
Then, assuming 10KHz is 100%, It would be possible to get the desired effect from a freq range of 40KHz - 100KHz. Yes?
 
audioguru said:
You vary the duty cycle with pulse-width-modulation, not with the frequency.
------------------------------------------------------------------
 
So are there any PIC people out there that can give me some help with automatic PWM incrementation?
 
Mike said:
What do you need to do? I can't quite figure it out by your posts.

The circuit will essentially be a brightening light source. I'll be using 6 Luxeon Star 1W LED's
whose current will be held in check by a BuckPuck Current Regulator. The regulator allows a TTL/CMOS
control. I also have a timer that will turn the entire circuit on at a set time and stay on for 2 hours, then turn off.

In order to brighten the LED's (in my case from about 40% to 100% current within 15 min.) the TTL/CMOS control
comes into play. This is where I need a chip to implement PWM to step up the current in 5% increments, minute by minute till
the current is at 100%, at which point it should remain at 100% for the remainder of the 2 Hrs.

I am clueless on where to find the right chip as well as program it. My friend however has a MicroChip
programmer and this might be my best choice if I were to tackle this alone.

Hope this helps!
 
Not much.

Do you have specifications for the PWM period and pulse width duty cycle required to control the device?

Mike
 
Last edited:
Mike said:
Not much.

Do you have specifications for the PWM period and pusle width duty cycle required to control the device?

Mike


I'm hoping I did this all right. You can see my results below. I had to spent some time on Wikipedia learning about PWM, Duty Cycle, Period...etc.

Here are a couple of links for the Luxeon LED's and the LED Driver.

**broken link removed**
**broken link removed**

==================================================================

pulse freq - 60Hz (60 cycles per second)


STEP 1:
on - 6.68ms
off - 10.02ms
Period - 16.7ms
Duty Cycle - 40%
Duration - 60 sec

STEP 2:
on - 7.515ms
off - 9.185ms
Period - 16.7ms
Duty Cycle - 45%
Duration - 60 sec

STEP 3:
on - 8.35ms
off - 8.35ms
Period - 16.7ms
Duty Cycle - 50%
Duration - 60 sec

STEP 4:
on - 9.185ms
off - 7.515ms
Period - 16.7ms
Duty Cycle - 55%
Duration - 60 sec

STEP 5:
on - 10.02ms
off - 6.68ms
Period - 16.7ms
Duty Cycle - 60%
Duration - 60 sec

STEP 6:
on - 10.855ms
off - 5.485ms
Period - 16.7ms
Duty Cycle - 65%
Duration - 60 sec

STEP 7:
on - 11.69ms
off - 5.01ms
Period - 16.7ms
Duty Cycle - 70%
Duration - 60 sec

STEP 8:
on - 12.525ms
off - 4.175ms
Period - 16.7ms
Duty Cycle - 75%
Duration - 60 sec

STEP 9:
on - 13.36ms
off - 3.34ms
Period - 16.7ms
Duty Cycle - 80%
Duration - 60 sec

STEP 10:
on - 14.195ms
off - 2.505ms
Period - 16.7ms
Duty Cycle - 85%
Duration - 60 sec

STEP 11:
on - 15.03ms
off - 1.67ms
Period - 16.7ms
Duty Cycle - 90%
Duration - 60 sec

STEP 12:
on - 15.865ms
off - 0.835ms
Period - 16.7ms
Duty Cycle - 95%
Duration - 60 sec

STEP 13:
on - 16.7ms
off - 0.00ms
Period - 6480sec (108 min)
Duty Cycle - 100%
Duration - 6480sec
 
Last edited:
Ok, we may be getting closer. That period and those duty cycles will be relatively easy to do even on a small 8 pin PIC microcontroller.

I would like to check out the controller data sheet but neither of those pdf file links are bringing up my Acroread program. Let me investigate. I may have a problem with some ad-ware on my laptop (argh!!!)...
 
Mike said:
I would like to check out the controller data sheet but neither of those pdf file links are bringing up my Acroread program. Let me investigate. I may have a problem with some ad-ware on my laptop (argh!!!)...

They are located on my personal domain and may be asking you if you want to open or save the file, instead of opening Acroreader automatically.
 
If you setup a basic interrupt to count seconds and minutes, then your 90% through the battle.

EG;
Code:
Device = 18F452
Clock = 20

Dim TMR2IE As PIE1.1,         // TMR2 interrupt enable
    TMR2IF As PIR1.1,         // TMR2 overflow flag
    TMR2ON As T2CON.2,        // Enables TMR2 to begin incrementing
    mS As Word,               // mS register
    S As Byte,                // Seconds register
    M As Byte                 // Minutes register

    
    
Interrupt TMR2_Interrupt()
    Save(0)                   // Back up system variables
    If TMR2IF = 1 Then        // Check if the interrupt was from TMR2
        TMR2IF = 0            // Clear the TMR2 interrupt flag
        Inc(mS)               // Increment the mS counter
        If mS = 1000 Then
            mS = 0
            Inc(S)
            If S = 60 Then
                S = 0
                Inc(Min)
            EndIf
        EndIf
    EndIf                     //
    Restore                   // Restore system variables
End Interrupt

Private Sub TMR2_Initialize()
    TMR2ON = 0                // Disable TMR2
    TMR2IE = 0                // Turn off TMR2 interrupts    
    T2CON.0 = 1               //  00 = Prescaler is 1
    T2CON.1 = 0               //  01 = Prescaler is 4
            	              //  1x = Prescaler is 16 
    PR2 = 249                 // TMR2 Period register PR2   
    T2CON.3 = 0               //  0000 = 1:1 postscale
    T2CON.4 = 0               //  0001 = 1:2 postscale
    T2CON.5 = 1               //  0010 = 1:3 postscale...
    T2CON.6 = 0               //  1111 = 1:16 postscale    
    TMR2 = 0                  // Reset TMR2 Value    
    TMR2IE = 1                // Enable TMR2 interrupts
    TMR2ON = 1                // Enable TMR2 to increment
    Enable(TMR2_Interrupt)
End Sub

// Start Of Program...
mS = 0                        // Reset Timer registers
S = 0
M = 0

TMR2_Initialize               // Setup and enable TMR2
 
Last edited:
The above program will provide an interrupt driven timer. Very useful tool for countless applications, for your use, perhaps the "main program" could consist of;



Code:
Include "PWM.bas"

// local duty variable...
Dim Duty As Word

// main program...
Duty = 40
PWM.SetFreq(10000, 40)          // Initialize the Duty output (10Khz @ 40% Duty)

While Duty < 100                // Create loop to reach 100% duty
     While M < 1                // Wait for 1 minute to occur
     Wend
     M = 0                      // Reset the Minute register
     Inc(Duty, 5)               // Increase the Duty Cycle by 5%
     PWM.SetDuty(Duty)          // Set the new duty cycle
Wend

While True                      // 40-100% has finished, loop for ever here
Wend
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…