Hotwire Regulator Design Collaboration Project

Status
Not open for further replies.

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
Back from vacation. Spent some time working on this, have some new designs. At this time the variation I like best is to drive a high side N channel 4.5V gate FET using a capacitor, resistor and diode from the PWM pin of the IC. Not sure this will work, need to do some calculations, but it appears to be sound. Anyone want to breadboard and test that? Apply a 5V square wave to the circuit and see if the FET stays cool??

The high side driver allows the voltage divider chain to be lower impedance since it is on the bulb side and not energized when the light is off. This is important to keep the off-current from draining the batteries. The lower impedance divider chain is required to get good accuracy from the on-chip ADC and still keep the parts count low.

Based on the small size of the C KIU socket I would propose that the first design be made for M*G D size. The design should be set up to work with the KIU socket without drilling a bunch of new holes in the KIU unit.

I received my KIU socket but have not found the instructions. I presume the Mag tower must be milled off and the KIU screwed to it. How is the assembly located in the M*G tube?

I have read pretty much the entire PIR1 thread. I can see a couple of common issues that need to be dealt with.

Calibration is one. I am considering calibration schemes that make it much easier for the end user to calibrate it without complicating the design.

-- Alan
 

That_Guy

Enlightened
Joined
Feb 5, 2005
Messages
310
Location
Canberra, Australia
The high side driver allows the voltage divider chain to be lower impedance since it is on the bulb side and not energized when the light is off.
Wouldn't it be easier to just use a FET to disconnect the voltage divider?


I've finished tidying up my source code, so if you're interested I can release it. All I need is somewhere to host it. There's sites like Rapidshare, but being forced to wait 5 minutes in a queue to download a 2kB file is rather stupid, the page telling you to wait in a queue is larger than the file itself! Since it's just text I could post it directly in this thread, but that would be rather messy.
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
One of the lowest Rds(on) MOSFETs I've found at 4.5V is the IRLR7843, but that is 5V ABOVE the MOSFET source pin. You can't do that without a high side driver.
My suggestion would increase the parts count by 3, but would properly enhance the gate of a power MOSFET.
Use a dual channel LDO (5V for the microcontroller, 12V for MOSFET driver) instead of a single channel to just drive the controller.
The Infineon
TLE4484 is an SOT-223 package that outputs 5V & 15V, If the pack voltage is under 15V, the 15V side is in LDO mode and just passes pack voltage to the LTC4440 (high side gate driver in an SOT-23 package). It will boost the gate voltage by that amount.
The maximum Vcc of the LTC4440 is 15V so it would be close.
This will fully enhance the gate of ANY N channel mosfet resulting in lower Rds(on) and faster switching times, both reduce heat and increase power handling.
I know it increases component count, but I think it results is a better, more flexible design. Input voltages can be as high as 45V with the TLE4484, and choice of MOSFET is wide open. The IRLR7843 for 6-30V operation with moderate to high current or the IRF2804 for very high current up to 40V or the IRF3206 for up to 60V operation.
A variety of "standard" boards could be possible.
Version "A" is smallest with a single SOT-23 regulator on board with the IRLR7843 good up to the maximum input voltage of the LTC4440 (15V).
Version "B" is a D size KIU only, with dual regulator good up to 45V with the IRLR7843 (30V) or IRF2804(40V).
Version "C" is a larger square board with dual LT3014B regulators and any 1 or 2 MOSFETs up to 80V.
If I'm given schematics I can build the PCB designs for "A" smallest possible, "B" 30mm OD, "C" smallest possible rectangular with provision for 2 MOSFETs.

Just my 2 cents.
 

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
Jimmy, sounds like good suggestions. Have to look into drivers, though I'm not sure we need them for our low frequency switching. How much power do these LDO regulators draw. They are powered all the time, even if the micro goes to sleep. Are they low enough to leave on?

Here is a schematic showing a low parts count hi-side N channel driver variant.

http://www.akbeng.com/flash/hwreg/attic/20080129 hiside 0.0.pdfhttp://akbeng.com/flash/hwreg/2008_01_29_16_58_45 hwreg hiside driver.pdf

The above schematic is not fully detailed, but shows a low parts count approach to driving an N channel FET using capacitive coupling and a simple DC offsetting circuit. The upside is simplicity. The downside is it cannot be driven at DC, the duty cycle must be slightly less than 100%. I have not tried this technique, but with the proper component values it should work. One upside is that the ADC divider is not drawing power from the battery all the time, only during bulb on pulses.

Perhaps someone else has tried this technique and can comment on it, we would like to hear that.

Tim, I'm wondering if the best way to share your design is for you to start a separate thread or web page for that. We can link to it from this thread to tie it together. That is how other external designs are referenced, and it would keep your design separate from this thread and give you direct credit for it. It is a bit early for sourcecode in this thread, and this design may not work with your stock code. It would really be neat if your code was the first to work on the collaboration's hardware, but it would require some modifications depending on how the hardware goes.

One thing I learned from reading the PIR1 thread was the difficulty of calibrating the setup was a stumbling block. I have been thinking about a calibration design for the past week. There are three things to calibrate. One is the voltage divider. The other two are the ADC gain and offset. They can be combined into a gain and offset pair. My current thinking is to select two calibration voltages. One should be near the nominal battery voltage. This one is used to determine overall gain. The second calibration voltage should be significantly less - half the first or thereabouts. It is used to determine offset. Calibration is generally done once when the board is new.

Required Equipment:

Variable DC power supply
DC meter of sufficient accuracy
Programming cable and software (not required if the calibration voltages are already set)
Calibration jumper
LED/resistor load

The procedure might then be:

1) remove regulator from flashlight (if necessary)
2) connect to programmer
3) program the two calibration voltages into the nonvolatile parameter memory (the code and parameter memory should already have been programmed)
4) remove power (and the programmer) from the board and install the calibration jumper and install the resistor/LED into the bulb output
5) set the power supply to the first calibration voltage and apply power to the board
6) observe the LED which will be partially on. When the LED goes off the first part of the calibration is done, and the overall gain value will have been saved into parameter memory
7) (optional, go to step 9 if offset is not to be changed) set the power supply to the second calibration value and apply power to the board
8) observe the LED as in step 6, this time the ADC offset will be measured and saved into parameter memory
9) remove the calibration jumper
10) reinstall the board

-- Alan
 
Last edited:

That_Guy

Enlightened
Joined
Feb 5, 2005
Messages
310
Location
Canberra, Australia
I'll say it again: why not just use a FET to disconnect the voltage divider? I can't see any problem with it, and it's much simpler than using a high side MOSFET.

The quiescent current of the regulator JimmyM suggested is 500uA, although in reality it would be lower because it is spec'd at a 1mA load. Not great, but not high enough to be much of a problem with most setups. There are LDO regulators designed specifically to have a low quiescent current (<50uA) if such a thing is really needed.

Why do you want to use a software on off button? While it has the advantage of being able to use a momentary switch to convey extra information for things like dimming, it significantly complicates both the design and operation. For the first version at least a hard switch is more suitable: zero standby current, minimum parts count and can be used with standard toggle switches.

The biggest problem that I can see with winny's PIR was that it was too complicated. It required a momentary switch which meant modding or replacing the stock switch and it was difficult to adjust the voltage. One button programming is very inconvenient, and plugging it into a computer isn't much better and requires an expensive programmer.

Despite being vastly inferior and having a fixed low voltage cut-off AWR's Hotdriver was much more popular. It could be used with standard toggle switches, no modifications required, and the output voltage could easily be adjusted with a pot. Its popularity can't all be attributed to its simplicity, his name and his slick BS sales pitch also had a lot to do it (this really annoyed me, and I do feel for winny who didn't enjoy the success that he deserved, but that's a story for another time), but its simplicity was certainly a big factor. So the aim for my design, for the first version at least, was to keep it as simple as possible. Standard toggle switch, a pot to adjust the voltage, and a pre-programmed low voltage cut-out. Similar to the Hotdriver, but with the advantages of higher efficiency and the high input output differential that goes with it, user chosen LVC instead of the fixed 80% of Vin, and the ability to plug it into a computer to change things like the LVC for the more advanced users.

So if you want to make something that will benefit the greatest number of CPFers my advice would be to initially make something simple and straight forward like the Hotdriver, not something as advanced and feature packed as possible. That can come later.

Regarding calibration, the biggest source of error isn't the ADC itself but the internal reference voltage which has an accuracy of +/- 10%. So all you need to do is measure the actual voltage on the Aref pin and use that in all the calculations. The ADC itself is quite accurate, I can't really see any need to calibrate it unless the specs given in the data sheet are overly optimistic.

I can't really see much point starting a new thread for my code, I doubt anyone outside this thread would be interested. This is meant to be a collaboration, not a number of different designs, so I don't see why it should be kept separate. The software is by far the most important part, so a significant chunk of the work is already done. I don't see how it is too early for source code. The hardware is trivial, there really is nothing to it. The hardware should be built around the software, doing it the other way round doesn't make much sense, although since it's so simple it doesn't really make much difference in this case. The only challenge is selecting the best MOSFET, taking into account both switching and resistive losses, and selecting the best MOSFET driver to go along with it for higher power versions.

I'll post my code tomorrow with an explanation of how to use it. This should accomplish the core aims of this project: a DIY regulator with open source code. All that is left after that is designing the production surface-mount PCB to sell since most people aren't interested in DIY, and the more advanced features such as one button programming.
 

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
Tim raises some good points here. Can we get some input and comments from others?

How many folks want on/off with a single output voltage using a hard power switch. This would require disassembly of the flashlight and removal/reprogramming with a computer to make any parameter changes.

How many would be willing to set up a soft switch (mod the M*g switch) and get more possible features, with a greater upgrade path?

My feeling is that we design the hardware to handle the simple case as well as the more complex case, and the user can decide when they install the PCB. Then software and installation can choose. The soft switch input pin can be left open, and the software configured to regulate whenever power is applied. Then we can make a different configuration of the software that uses the soft switch input for more features.

(One quick thought here is that disconnecting power "hot" to the high side design may need to be analyzed to insure that the gate-source voltage limit is not exceeded).

FET disconnect of the ADC divider - not easy. Low side would allow high voltage to the micro, and would not break the current drain, high side is not low in component count.

Using a low quiescent current regulator - I am in favor of this. I don't like electronics that is always discharged when you need it. I might put a tailcap switch in anyway for full off, but would prefer that to be optional.

Calibration - I don't believe Vref is readily available to measure externally on an 8 pin part (I would like to stay with an 8 pin part to make the smaller size boards more feasible), and this would not take the voltage divider component values into account, so it does not really meet the requirements. If you read the PIR1 thread they seemed to have significant problems with adequate calibration, perhaps because folks are pushing some of these bulbs hard to the edge. I would like a simple calibration procedure that gets gain and offset and takes into account the components on the board, and something that anyone with minimal equipment can do. Suggestions?

-- Alan
 

petrev

Flashlight Enthusiast
Joined
Jun 12, 2005
Messages
1,535
Location
SW England
Hi

Non expert input !

Power-on regulated system is good for both traditional Mag switch and also tail switch designs (SF-M6 etc. and Mag Mods). That's why I liked Willie Hunts design (but it's not re-programable! ) and the JM-SST. However the famous PIR was also great for easy(ish) re-programming.

How about Power-On regulation and a two-pin push-button programming option so that a push switch could be added (or optionally fitted with an acces hole in the Kiu say) for reprogramming or greater features ? Could be active if a jumper were fitted to make the board a Constant-On version with Blip-Switch functionality or if no jumper then programming only function and Power-on regulation ? Just an idea ! Does this make sense to people who know.

On the "little pot" front . . . AWR's were useless as they kept breaking when actually used ! (mine did on the HD anyway). JM-SST much better and useful. Personally don't mind the regulation setting being by programming (as long as it is fairly easy to redo somehow - see above) but an external 20% to 100% pot can be a real boon to some of the bigger Mods as I have found with the JM-SST(special) and adds great functionallity to those "BIG" ones eg. Larry12K, Blitz, Sleepers etc. (not made any yet just hoping . . .)

Hope this helps (?)
Pete
 

cnjl3

Enlightened
Joined
Jan 22, 2006
Messages
723
Location
Deep in the heart of Texas
Mod the MAG switch is my vote.
Removing and reprogramming with disassembly sounds ugly.
One button programming or "durable/reliable" adjustment trim pots would be my choice.
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
My vote is to use 1 pot for voltage adjustment, and another for low voltage cut off. Use the stock switch to turn control power on/off. Batteries would be connected directly to the PCB/Bulb.
Let's get a working design schema before we start getting fancy and asking for the moon.

Use the stock switch to control power to the onboard regulator or some enable/disable pin that pulls low to shut off. Having an automatic LVC based on a percentage of battery voltage is useless. It would have to know what a full pack voltage is. Just use 1 1M pot across the battery to sample voltage as an input to the processor. Don't forget to put a 5V zener on the wiper to prevent it from blowing the processor and a small cap to even things out as the voltage shifts because of switching. Program it to disable output if voltage falls below 2.8V and re-enable above 3V. That's a ~7% off/on hysteresis.

This is getting too complicated and will never get built if we're looking for a regulator that will do everything.

By the way, my PWM regulation design is working pretty well on the bench. 300Hz. I just need to work on the linearity of the sample circuit.
If I set Vbulb to 7.2VRMS it starts at 7.2V at Vin=7.2V then falls to 6.6VRMS as I increase voltage to 15V. The output is a super sharp square wave with nearly un-detectable ramp unless I really crank down the sec/Div.
 

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
Great comments, folks! Keep them coming. I'm not going to reply on the comments at this time.

Here is an update of my draft schematic.

http://www.akbeng.com/flash/hwreg/attic/20080130 hiside 1.0.pdf

I refined things a bit in the draft schematic from yesterday, specified a few parts and pinouts. 5.2 - 40V range, 6.5 milliOhms FET, about a dozen parts. About 50 uA standby current drain. Protection for the FET gate. Programming connector. Control input (which can be used or ignored, depending on software). There are a couple possible ways to use jumpers on the programming connector to communicate with the software, which can be used for calibration or operation mode selection.

This design measures bulb voltage. The ADC is synchronized with the PWM so this will be loaded battery voltage, so battery protection can be monitored.

The simplest way to program this design is to set nonvolatile parameters in the chip using the programming cable. This inexpensive USB programmer plugs on to a six pin connector on the board (Atmel AVR-ISP mkII). Install firmware and set parameters like battery cutoff voltage and bulb output RMS voltage(s) in the chip. Do a calibration to determine the ADC versus DC voltage levels. Install in the flashlight and go.

This hardware is pretty simple and can still meet the design requirements, and has a lot of code space for improvement. It can be operated on simple code, and more advanced software can be done later.

-- Alan
 
Last edited:

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
Nice and simple. What is the duty cycle limit? 95%? 99%? What is the switching frequency?
Is there any way to get me a simply programmed chip to breadboard the design?
I found a nice N-FET from Fairchild: FDD8444L, 40V, 50A continuous, Rds(on)=3.8mOhm @ 5V Vgs. Perhaps an alternative
 
Last edited:

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
Jimmy,

If you have a 5V square wave generator the output stage can be breadboarded. That will give a pretty good idea if the FET drive circuit is going to work. If you can vary the duty cycle, even better, but if not still it would show if the capacitor coupling is going to work.

For the initial test microprocessor, I think we should follow in your pattern. Program a chip to sweep from 0% to full% in say 10 seconds, a soft start chip. Make the ramp slow so the behavior of the circuit can be examined. Check the FET for heating, try different loads, etc. Perhaps the zero-eth version of the production software should be a soft-start setup, that would be a useful setup to wring out the system in real flashlights before the regulated software. Just a few parameters to set in the nonvolatile memory such as PWM start, PWM end, PWM rate of change.

As to your questions. I have not programmed this chip's PWM system, so Tim may be able to speak from his experience with his similar chip. The frequency is programmable, there are some limits, but we should be able to do 300 hz or somewhere near there.

The max duty cycle is theoretically 255/256. This needs to be tested to verify that there is no issue. A narrow off-time could possibly heat the FET depending on how things switch, but it should be okay. There are things we can do if needed to improve it.

The Fairchild FET sounds good. We should collect a candidate FET list and check availability/pricing at some point. One spec we need to watch on the FET is input capacitance. If it gets too high it may affect the drive circuit. The FETs I looked at were under 5kPF, and the drive cap is 200x that, so it is not likely a problem.

I have not tried to calculate the effect of this drive setup on the output of the micro. I should look at that a bit. I doubt it is a problem.

-- Alan
 

That_Guy

Enlightened
Joined
Feb 5, 2005
Messages
310
Location
Canberra, Australia
JimmyM said:
Let's get a working design schema before we start getting fancy and asking for the moon.
My thoughts exactly. Start with something simple, get it working, then build on it from there. The most important part of a regulator is the regulation, the rest is just icing on the cake!

Alan B said:
FET disconnect of the ADC divider - not easy. Low side would allow high voltage to the micro
Didn't think of that. What about putting the FET in the middle, after the first resistor, but before the micro? With a 1.1V ADC reference and 5V input to the micro Vgs would be 3.9V at maximum input voltage, enough to fully turn it on. If a 2.56V reference is used Vgs will only be 2.44V - are there FETs out there designed to operate that low?

Alan B said:
Calibration - I don't believe Vref is readily available to measure externally on an 8 pin part.
That's a nice thing about the Tiny85 - one of the pins can be configured as Aref. After looking at the data sheet it is quite a nice chip you've found. It also has a second timer which should come in handy for the more advanced features, and differential inputs and programmable gain on the ADC. Really the only thing it is lacking compared to the bigger chips is the multiply instruction.

In my case the actual output voltage is 8% lower than what I programmed - it'll be interesting to see how much of this is due to Vref, and if calibration of the ADC will still be needed.



My code is here and a simple schematic for breadboarding or DIY using strip board or whatever is here.

It is set up to use the AtTiny13 with pin 3 as the ADC input and pin 5 as the PWM output. It is very bare bones - it only regulates and has no LVC or soft start. Feel free to edit or add to it. All the different things that are likely to be changed are at the top of the code for easy access. The variable names for the math routines are very long because I have difficulty remembering the abbreviated names. The code is designed for ease of use so it isn't the most compact or efficient, but this shouldn't matter since it is so small anyway.

Accuracy of the regulation itself is decent. Output is highest when Vin = Vout, and steadily drops as Vin increases. On the bench with Vout set to 10V and a Vin of 30V light output drops by around 5 - 10% according to my budget light meter. That works out to a RMS voltage drop of around 1.6 - 3.2% with a Vin to Vout range of 3 to 1.

My first priority is to add a low voltage cut-out, it should only take a few lines of code so it shouldn't take much more than an hour if I stop being slack and get to work, assuming no one else wants to give it a try. After that is the soft start, which is a bit more difficult but should still be fairly easy if it works as planned. After that there is porting the code to the Tiny85, and adding the ability to change the output voltage with an external pot.

I can't be bothered going through the code and how to use it right now, I've written enough already, I'll go into more detail next post.
 

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
Tim, very elegant small design and low parts count, and the source file looks pretty small and clean, too, though I didn't try to grok the code at all.

One possibility for Jimmy to breadboard the driver is to use one of your programmed chips to generate the PWM.

-- Alan
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
I do have a PWM source running at 300Hz. I can at least breadboard the output stage. I have IRLR7843's to test.
 

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
I do have a PWM source running at 300Hz. I can at least breadboard the output stage. I have IRLR7843's to test.

Excellent.

Another thing occurred to me this morning. We can have a POT input option, or a switch input, or possibly even both inputs at once, or of course neither for those DC switch only designs. I will look into that, and other configurations of the I/O pins such as an LED output. That would allow a lot of flexibility.

NOTE - I have updated the first post in this thread to include reference links to a lot of stuff. Please post suggestions to expand this so we can use this as a central repository of links for this project.

EDIT - added new schematic with POT interface option, as well as two more I/O lines useable for serial, jumpers, or boolean I/O.

http://www.akbeng.com/flash/hwreg/attic/20080131 hiside 1.3.pdf


-- Alan
 
Last edited:

That_Guy

Enlightened
Joined
Feb 5, 2005
Messages
310
Location
Canberra, Australia
I've added a low voltage cutout. Here is the latest version of the software. Rather than triggering as soon as the input drops below the minimum it increments a counter and only triggers after a certain number of low readings to prevent transients from triggering it. When the LVC is triggered the micro goes to sleep, but this can easily be changed.

I also made an Excel spreadsheet for calculating the values for Vout and LVC from the resistors used for the voltage divider and the voltage of the ADC reference. It is included in the zip file containing the code.
 

JimmyM

Flashlight Enthusiast
Joined
Aug 30, 2006
Messages
2,853
Location
Boston, MA, USA
I've had some success in my own, non-microcontroller design.
I've got a design breadboarded that will maintain 7.5V to a bulb as the input is swept from 8-13 volts. It uses a 40kHz PWM controller that is 100% duty cycle capable and has softstart built in.

I am noticing something odd however. Perhaps because the bulb I'm using is a 12V automotive bulb and is really underdriven in testing.
My fluke 189 measures 7.5V and 1.8 amps the during the whole sweep. I mean it doesn't vary by more than a few hundredths. But the bulb increases in brightness as I increase input voltage. Not a lot, but you notice it. I'll be redesigning the wiring to reduce resistance and make sure everything is wired properly.

My next step is to purchase slightly different parts that have a better voltage range.

Do you guys/gals have any idea what may be causing this brightness variation?
 

Mr Happy

Flashlight Enthusiast
Joined
Nov 21, 2007
Messages
5,390
Location
Southern California
My fluke 189
Wow, nice multimeter! :wow:

Do you guys/gals have any idea what may be causing this brightness variation?
Yes, I have an idea. What about the difference between average voltage and RMS voltage? Which one are you controlling to and measuring with the meter?

The bulb will only remain at constant brightness if you provide a constant 7.5 V RMS to it. If you provide a constant average voltage of 7.5 V, the power supplied to the bulb will change with the duty cycle of the PWM wave.

You do have a true RMS meter, so I'm wondering if you are using a true RMS mode when reading the voltage?
 

Alan B

Flashlight Enthusiast
Joined
Nov 19, 2007
Messages
1,963
Location
San Francisco Bay Area
Hi Jimmy.

To maintain constant RMS voltage on the bulb requires a feedback circuit that is sensitive to RMS, not average voltage. There is a difference (related to the square root of the duty cycle, as I recall). I did the math earlier in this thread, and I later noted it in the PIR1 thread.

The microprocessor can compensate for this, but doing it without a micro would require a square law circuit.

Did you ever get a chance to try a capacitive FET driver?

-- Alan
 
Status
Not open for further replies.

Latest posts

Top