Time to test the MCP1630V board with something practical, a power LED torch with Cree XLamp CXA1507.

The pwm drive and current control is up to the MCP1630V module, the battery voltage check, emulated PWM

dimming and other stuff are inside the PIC12F683 firmware with the addition of 2 resistors voltage divider for the battery check.

Source code here 12F683 board here

Current output calculation and other details here


Software explanation: the button on GP4 changes from max power to low power, and vice versa.

The analog input on GP0 reads the battery voltage, you should change values in the source code according to the cells number

and technology used to build your specific project, for example if the NI-MH cells goes to 1.1 volt i want the software to automatically change

to low power to ensure a better autonomy, and when the voltage x cell goes to 0.8V it shuts off the system, anyway before every change

it show what is going on with a strobo effect, so we don't need any display or led indicator, next image helpd you find the basic settings.

BatteryLow is 11 because the last torch has a package of 10 NI-MH cells so 1.1V*10=11V so BatteryWarning is 0.8V*10=8V.