High Efficiency Halogen Bike Light Dimmer
Source code is provided for personal / educational use only. Any commercial use of this code is prohibited without the express permission of the author.
|
*Microprocessor control of one 20 watt halogen lamp
*Three power levels (7 / 10 / 20 watts)
*Single pushbutton control for on/off and power level
The PIC16F84 chip is re-programmable, allowing unlimited changes to the basic code.
|
Schematic - Digital Bike Light Dimmer |
|
View Assembly Code
View Instruction Set
Download Assembly and Hex Code (free.zip)
This zip archive contains two files: freeware.asm and freeware.hex
The .asm file is the assembly language source file. You can view or edit the file using a text editor such as Notepad. It can also be compiled directly using MPLAB or MPASM, both of which are available for free from the Microchip website. I have provided this source file so you can easily edit and modify the code as desired.
The .hex file is ready for programming directly into a PIC16F84 processor. It is compatible with most popular PIC16F84 programming hardware and software. This file was created from the above assembly file using MPASM. There are an endless number of websites with details on PIC programming and related information.
|
IC1 | PIC16F84 Microcontroller | |
IC2 | 78L05 Voltage Regulator | |
Q1 | IRL530N HEXFET, Logic Level | |
Z1 | 4MHz Ceramic Resonator w/caps | |
R1 | 1K 1/4 watt resistor (5%) | |
R2 | 10K 1/8 watt resistor (5%) | |
C1 | 22uF, 35V Electrolytic Cap | |
D1 | 1N4001 Rectifier Diode |
Lamp | MR-16 12 volt, 20 watt halogen | |
Button | SPST, momentary, normally open | |
Battery | 12 volt, 3.0 AH sealed lead acid |
|
Connect a 12 volt 20 watt lamp and 12 volt battery to the circuit (observe battery polarity). Momentarily press and release the button to turn the lamp on. Repeatedly press the button to cycle through the power levels. Pressing and holding the button will turn the lamp off.
Approximate Power levels (20 watt lamp): 7 watt - - 10watt - - 20watt
I have provided commented assembly code as well as the hex code for programming. Feel free to modify or add to the code as you wish. The basic circuit can easily be expanded to control additional HEXFETs, additional buttons, etc. There are 11 more I/O lines open for use. Also, the EEPROM memory could be used to "remember" settings when power is turned off.
If you experience any instability problems, then install a .1uF capacitor (low ESR type) between the processor power pins.
|
PCB Artwork - Digital Bike Light Dimmer |
|
Parts Placement - Digital Bike Light Dimmer |
|
Microcontroller Pinout - Digital Bike Light Dimmer |