PWM Regulator for Lantern bodies, JM-PhD-X1

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
This is another project following the work Alan b, wquiles, and I have been doing to build a microcontroller based PWM regulator for incandescent lights.

The original project threads and their follow-up parts.
Part 1
http://candlepowerforums.com/vb/showthread.php?t=186291

Part 2
http://candlepowerforums.com/vb/showthread.php?t=209098

Part 3
http://candlepowerforums.com/vb/showthread.php?t=220475

Alan's project
http://candlepowerforums.com/vb/showthread.php?t=218506

Will's project
http://candlepowerforums.com/vb/showthread.php?t=215806

My project for the Mag D body
http://candlepowerforums.com/vb/showthread.php?t=216160

This version will extend the capabilities of the JM-PhD-D1. It's will be larger and be targeted specifically at the 1000+ watt crowd.

Thus far I have the following design criteria in mind. Some is already working in the JM-PhD-D1.
1) 10 bit ADC (analog to digital converter) reads voltage of batteries, etc.
2) 10 bit PWM. This allows 1023 levels of regulation versus 8-bit which will give only 255.
3) 60V maximum input voltage. Combined with 10-bit regulation yeilds ~0.06V accuracy.
4) Dual on board FETs (I found an awesome one)
5) FET driver to drive the large gate capacitance of the FETs.
6) multiple inputs/outputs for buttons or LEDs.
7) Copper "buss bars" for high current paths.

A few questions are still outstanding.
In the JM-PhD-D1, the output voltage and low voltage shutdown are set by the user using onboard pots. How should these values be set in this version?
Output voltage: External pot? Up/Down buttons? Programmed in absolute maximum voltage that external adjustments can't exceed?

Low voltage safety: Programmed in value? onboard pot?

Low voltage behavior: Right now, the JM-PhD-D1 is set up to dim and pulse the light when the low voltage safety has been hit. But this version will have the capability to driver external LEDs as warnings, etc.
For lights in this power range (since it is hardly an EDC) I would suggest having the light shut off and flash an LED for the user.

I was thinking if using an RGB LED that could be programmed to do different things with different colors depending on what condition is present.
Flashing Yellow = Low Voltage
Flashing Red = Over Temp
Steady green for power on or maybe a variable level dependendent on output power. It could flicker when 100% duty has been reached.
Blue for Charging maybe? that would have to be figured out.
The chip I'm using has plenty of I/O pins.

One warning that must be adhered to... The bulb cannot be functional while programming the chip. I'll supply a jumper on the board to isolate the FET drive during programming so that the user does not have to physically disconnect the bulb itself. But there is the possibility of blowing the bulb while programming, if the battery voltage is significantly higher than what the bulb can take.

Anyway, so let's have it.
 

Starlight

Enlightened
Joined
May 25, 2002
Messages
680
Location
Florida
Jimmy, here are my thoughts.

Output voltage: External pot? Up/Down buttons? Programmed in absolute maximum voltage that external adjustments can't exceed? Pot or pushbuttons would be fine, but don't these small pots have short life cycles on number of twists? I would prefer buttons or programming changes.

Low voltage safety: Programmed in value? onboard pot? Once again, I think programming is better.

Low voltage behavior: Right now, the JM-PhD-D1 is set up to dim and pulse the light when the low voltage safety has been hit. But this version will have the capability to driver external LEDs as warnings, etc.
For lights in this power range (since it is hardly an EDC) I would suggest having the light shut off and flash an LED for the user. Dim and pulse at the low voltage is my preference. The option for external LED's and the option of the RGB LED won't help me. I don't plan to mount any external LED's. My driver will be buried inside the light and only accessable when the light is opened.

So, I want a self contained driver with adjustments by programming (1st choice), buttons (2nd choice), or on board pots (3rd choice). We need to be able to program the driver. It could be by software and connected to a computer, or by buttons to select to function, then scroll through choices or scroll up and down (like voltages).

I know you started this thread to keep working while you determine how to produce the other drivers. I wouldn't mind the extra cost of having the boards fabricated. You might see what others think.
 
Last edited:

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
Jimmy, here are my thoughts.

Pot or pushbuttons would be fine, but don't these small pots have short life cycles on number of twists? I would prefer buttons or programming changes.
An external pot would be a regular duty pot, not a little trimmer. Their cycle life is much greater. It would be an external Knob to adjust output voltage.
Low voltage safety: Programmed in value? onboard pot? Once again, I think programming is better.
OK. One vote for programming.
Dim and pulse at the low voltage is my preference. The option for external LED's and the option of the RGB LED won't help me. I don't plan to mount any external LED's. My driver will be buried inside the light and only accessable when the light is opened.
The LEDs would be externally mounted, not on the board. In your instance, you would just not use them. Disable in software.
So, I want a self contained driver with adjustments by programming (1st choice), buttons (2nd choice), or on board pots (3rd choice). We need to be able to program the driver. It could be by software and connected to a computer, or by buttons to select to function, then scroll through choices or scroll up and down (like voltages).

I know you started this thread to keep working while you determine how to produce the other drivers. I wouldn't mind the extra cost of having the boards fabricated. You might see what others think.
I'll look into it some more. You have to supply overages for parts. So I would have to supply 5% extra Tiny44s, not to mention all the other parts. For the smaller ones, I'd have to supply 10% more, up to a certain amount.
I'll see about a quote though.
 

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
An external pot would be a regular duty pot, not a little trimmer. Their cycle life is much greater. It would be an external Knob to adjust output voltage.

...

Rather than an external pot, I would suggest a detented rotary encoder (at least as one option). Can be interfaced with 2 binary pins (rotary only) or 3 binary pins (encoder with push-switch). These encoders can be had in various models, some rugged enough to last a lifetime on a flashlight.

I can show you how to program for these.

-- Alan
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
Rather than an external pot, I would suggest a detented rotary encoder (at least as one option). Can be interfaced with 2 binary pins (rotary only) or 3 binary pins (encoder with push-switch). These encoders can be had in various models, some rugged enough to last a lifetime on a flashlight.

I can show you how to program for these.

-- Alan
I had been looking at those and did a little research at AVRfreaks. I really like the idea of the encoder. We'll see how things work out. If it's a pot they want, it's a rotary encoder they'll get!
 

SafetyBob

Enlightened
Joined
Oct 20, 2007
Messages
766
Location
Yukon, Oklahoma
Jimmy, I have not built one of these 400, 600 or 1000 watt lights yet.

The parts, however, may be one the way (the Emoli's arrived today and are charging as we speak for they other project)....

Pushbuttons that would adjust at 0.1 or 0.2 volts (or whatever) I could see as easy to set, also the detented encoder would also be killer. Either one would be excellent.

A single encoder would no doubt take up less room or perhaps encoder with push button with onboard lights that flash during setup to tell us low voltage set, high voltage set, blink lite on low volt warning or flash external led at low volt warn. (thinking out load here)

Ultimately, we need the guys who have built the big lights that you have already helped or how have completed a couple of these to chime in.

Also recommend you add appropriate led into kit (for us to wire up) or give specific part number so we don't have to go through hundreds of pages of electronics catologs trying to find the right one.

That's all that I can think of right now.

Bob E.
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
I've got some time to think about all of this stuff.
During programming mode the led can repeat back the settings by flashing different colors/patterns. green flashes are 10s, yellow are 1s, red is 0.1s. Or something like that.
I would include the LED as well as the little board it mounts on. The chip I'm using has a 2nd PWM output. I could use that for some Eye Candy with the LED.
I like the encoder idea too. Enter programming mode by some neat click/press sequence, Push to select mode, LED tells you what mode you're in, turn to change setting, push to confirm, LED repeats setting back to user.
 

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
The heck with flashling LEDs. Small LCD displays are pretty inexpensive. It takes 6 pins to interface one. No reason to stick to an tiny84 in a lantern, either. Make a really nice UI with an LCD and a push/turn encoder. 9 pins. plus pwm and battery 11 pins. Maybe one more pin for backlite on the LED. So choose a 16 pin chip. Probably would fit in the 84, barely. The LCD can share pins with the ISP.

-- Alan
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
The heck with flashling LEDs. Small LCD displays are pretty inexpensive. It takes 6 pins to interface one. No reason to stick to an tiny84 in a lantern, either. Make a really nice UI with an LCD and a push/turn encoder. 9 pins. plus pwm and battery 11 pins. Maybe one more pin for backlite on the LED. So choose a 16 pin chip. Probably would fit in the 84, barely. The LCD can share pins with the ISP.

-- Alan
You're really upping the ante on this. Why not use the Mega8? or something really fancy?
 

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
You're really upping the ante on this. Why not use the Mega8? or something really fancy?

Of course! Lotsa room here, why not?? The Mega8 is a very old chip, may not be as nice as some of the newer ones. You have to look into the fine details. It is mostly about pin count, and hardware features, and adequate memory. Having a lot of extra pins is pointless and costs $ here and there. But if there is a lot of room, and it is a small volume app so cost is not the issue, no problem. The real issue is a good user interface, and a small LCD would really solve that nicely. It could keep track of Ampere Hours (don't forget a shunt to measure current), show percent battery remaining, runtime at this setting, etc. Very useful! Maybe we can back-fit an LCD into the D M@g later!!

-- Alan
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
Of course! Lotsa room here, why not?? The Mega8 is a very old chip, may not be as nice as some of the newer ones. You have to look into the fine details. It is mostly about pin count, and hardware features, and adequate memory. Having a lot of extra pins is pointless and costs $ here and there. But if there is a lot of room, and it is a small volume app so cost is not the issue, no problem. The real issue is a good user interface, and a small LCD would really solve that nicely. It could keep track of Ampere Hours (don't forget a shunt to measure current), show percent battery remaining, runtime at this setting, etc. Very useful! Maybe we can back-fit an LCD into the D M@g later!!

-- Alan
True the Mega8 is old, I'll have to look at the different chips.
As far as LCDs go....
There was this little number at Matrix Orbital I found while looking for LCDs for my reflow oven.
http://www.matrixorbital.com/lcd0821gw-p-121.html
 

SafetyBob

Enlightened
Joined
Oct 20, 2007
Messages
766
Location
Yukon, Oklahoma
Jimmy and Alan, we are on the right track here.

Yes we can find/make room on the side of any latern for an LCD display with or with out buttons and what not.

Anything to help monitor battery voltage would be cool to.

Bob E.
 

SafetyBob

Enlightened
Joined
Oct 20, 2007
Messages
766
Location
Yukon, Oklahoma
Alan and Jimmy, a small LCD like is on cell phones (the Motorola Razor's come to mind) would be good, especially if it was encased in a plastic case or cover we could either screw from behind or through in order to install would be even better.

That way we could simply drill a couple of holes, run our cable or wire loom and be done.

Bob E.
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
I'm thinking about focusing my development on the ATMega168. Or the ATxmega16A4
Is there something they're missing?
Multiple PWM channels, ADC channels, etc.
The ATxmega is a 3.3V chip, but the X1 will use a proper FET gate drive, so it would not need to drive the gate of a logic level FET with 5V anyway.
Soooo.
The Xmega has the advantage of 12-bit ADCs, that would mean 12-bit PWM and a 0.02V theoretical voltage resolution over 80 Volts.
The ATMega168 would be easier to implement, I think, and would have 0.08V resolution over an 80V range.
They both could drive pretty much any LCD out there.
I'm going to have to investigate, but they may be directly addressable by USB.
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
I've been doing a little snooping around.
I like the ATMega2561, it may be overly capable, but who cares.
Lots of memory for LCD messages.
I want to use a rotary encoder + an LCD ScreenKey.
Dual PWM outputs for the dual filament landing lights. One set of FETs would be onboard and another set would be an add-on.

80V capable.

Anyway. No real development yet, but I'm building a shopping cart at Digikey to do some more development in the future.
 

mpf

Enlightened
Joined
Oct 2, 2005
Messages
228
If you have an LCD available and a capable uC, what about adding GPS and a compass to display location and direction on the LCD.
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
If you have an LCD available and a capable uC, what about adding GPS and a compass to display location and direction on the LCD.
The mega2561 has plenty of capability. I chose it because it has tons of memory and a boat load of pins. But some further research and some hand sketched schematics shows that I might be able to use the Tiny84. I found some code that allows me to dynamically generate text for the LCD instead of using stored graphics array data sets. This DRAMATICALLY reduces memory requirements. And I should still have enough pins to allow the LCD, Rotary encoder, and dual PWM outputs. However, I think GPS and compass is out.
 
Top