Practical PIC Projects


3 LED Bike Light
for PIC10F200 

  • Description
  • Schematic
  • Circuit Description
  • PCB Layout
  • Construction photos
  • Firmware



This project is a multi-function LED bike (cycle) light using 3 LEDs.

It is based on a PIC10F200 baseline microcontroller, running from a supply voltage of 2 to 5 volts.  In standby mode it consumes a current of less than 1A making it perfect for battery powered operation.

It uses three individually driven high brightness LEDs, and a single push button switch for turning the light on/off and changing operating modes when on.

The features written into the program for this project address what I consider to be three shortcomings of LED bike lights on the market today.

  1. they can easily be turned on accidentally
  2. they require you to cycle through all the modes to turn them off
  3. you may have to cycle though several modes to get the one you want after switching it on

To deal with point 1 this light requires the mode button to be held for >2 seconds to enter / exit standby mode. This helps prevent it from being accidentally turned on when removed from the bike and stowed in a pocket or bag.

When the light is powered-on, a short press of the mode button cycles through all available modes. The default firmware supplied features seven modes and as long as the power to the circuit isn't removed, it will come out of standby and run the last selected mode.

The legality of this bike light for on-road use depends on the laws and regulations in the  country of use.  It should be assumed it is not legal to use it on the road unless you have establish yourself that the use of such a device is permitted.


Two schematics are shown, one for the PIC10F20x 8-pin PDIP package, the other for the 6-pin SOT-23 package.  The two parts have different pin outs.

Resistor values are shown as 100R and these are conservative values for use from a 3 to 4.5 volt battery supply and high brightness red LEDs.  The actual value used should be selected based on the supply voltage, the type of LEDs used and if powered from a battery the desired battery life. 

Running from a 3 volt supply (2 x AAA batteries) you could use 68R resistor with red LEDs and 10R with white LEDs.  

  Resistor value notation.
100R means 100 ohms, 4K7 would be 4,700 ohms

Download schematic in PDF

Circuit / Firmware Description

There are two functionally identical versions of the project presented on this page; a small easy to assemble version using the 8-pin PDIP version of the PIC10F20x and a very small version based on the SOT23 package PIC and surface mount components. 

The circuit drives 3 LEDs from the I/O pins of the PIC microcontroller.  A single push button switch provides standby/power-on function as well as mode selection.

The circuit can operate from a voltage in the range 2 to 5 volts although you will need to take into account the forward voltage drop of the LEDs used; red LEDs typically need at least 2 volts, white LEDs 3 volts.  Current consumption in operation depends on the LEDs used and the choice of current limiting resistors.  Typically it will be in the range of 10 to 30mA.  In standby current consumption drops to less than 1A making it well suited to battery operation.  The 100nF capacitor is used for decoupling of the power supply to the PIC.

The LED functions are defined by a lookup table in the PIC's program firmware.  If you have access to a PIC programmer and want to edit or modify these you can download the source code (see bottom of this page).

The default modes supplied are:

  1. All LEDs constant on - power save mode
  2. All LEDs constant on - full brightness mode
  3. All LEDs blink at 2.5Hz - power save mode
  4. Single LED walking
  5. All LEDs strobe mode 40mS on / 600mS off
  6. All LEDs short flash, long hold
  7. All LEDs burst strobe mode 6 x 20ms on / 60mS off followed by 1 second off.

To reduce power consumption the firmware can drive each LED sequentially at very high speed so only one LED is on at a time; because it does this around 1300 times per second persistence of vision makes all the LEDs appear to be on at the same time.  This reduces power consumption to that of a single LED, increasing battery life.  This feature can be selectively disabled, providing slightly higher brightness at the expense of increased power consumption when all LEDs are on.  The operating mode is defined in the mode sequence data table so if you're creating your own sequences you can pick and choose how this feature is used.

LED / current limit resistor calculation

To calculate the resistor needed for a particular LED/ current requirement check out the website below. 

PCB Layout

There are two sets of artwork provided for the bike light.

a) Through hole design for the PDIP version of the 10F20x
b) Part-surface mount design for the SOT-23 version of the 10F20x

The SOT-23 package has a small laser etched dot in the corner nearest pin 1.   You'll need exceptional eyesight or a good bench magnifier to see it.

   Download PCB artwork in PDF

The artwork here is just a starting point.  You can design alternative layouts, assemble it onto strip-board, or even take an existing bike light and hack it to use the PIC from this project to control it.

Construction photos

DIP and SOT PCB's straight from etching before the boards have been separated or drilled.

It's tiny!
 The PIC SOT-23 package measure 2mm x 3mm

Both the DIP and SOT-23 version of the bike light are very simple to build with minimal number of components.  The PDIP version while less compact is the easier to construct.  Use the photo's here and reference the PCB overlay and schematic diagram during assembly.  Click on the photos for hi-resolution versions.

The switch can be bought from Rapid Electronics and is supplied with a number of different button lengths.  The one shown in the photo's is the 9.5mm type.

Description and Rapid part # are listed below:

DIP Version

Buy 3 x programmed 10F200 PDIP PICs for 2.75 - visit the online store here

You can fit the switch to either side of the PCB depending on how you intend to use the bike light and the case you want to fit it in. 

Switch mounted on front of PCB

Switch mounted on underside of PCB

The resistor used are 1/8 (0.125) watt carbon film, 5%, making them a bit smaller and shorter than the regular 1/4 watt resistor.  Rapid Electronics sell them and the 100R resistor is part # 64-0044 for a pack of 100 resistors.  If you can't get them then you can just about squeeze a 1/4 watt resistor in.

The PIC is fitted with pin 1 at the end nearest the switch.

I've used a socket for the PIC on this prototype so I could swap the PIC when testing the code.  If you're building this into a light I would suggest you leave the socket and solder the PIC directly to the PCB.  This keeps the profile of the finished board lower.

To keep the PCB as compact as possible, the battery wires are soldered directly to the solder pads of the PICs power supply pins.  Pay careful attention to the polarity when connecting the wires. Red wire + / Black wire -

SOT-23 Version

Fit the surface mount components first.  The resistors and capacitor are 0805 package size.

You'll need to pay careful attention when placing and soldering the PIC to make sure it is aligned over the solder pads.  Also check that it is oriented correctly (with pin 1 top left in photo below)


Program the PIC before the LEDs are fitted.

Programming the SOT23 version of the PIC is not easy because of its size.  I've tacked some short wires to the PCB then hooked them up to the PICkit2 programmer.  Once the PIC is programmed the wires are removed.

Take note when fitting the LEDs on the SOT-23 version of the bike light. The square copper pad is the LED cathode connection and the LED nearest the switch is fitted the opposite way round to the other two LEDs.


On the SOT23 version, two solder pads are provided for the connection of the battery leads.



The HEX file is ready to program straight into the PIC 10F200.  The asm file is the source code which you can modify or just view to see how it works. 

See the Programmed PICs section in the Picprojects On-line store now.

Description Filename Download link
Source code for 10F200 / 10F202 bikelightv2.asm download
HEX file ready to program into the PIC
for use with 10F200 only
bikelightv2.HEX  V1.0.0 17/09/2009 download
Checksum 402B

If you found this project useful, please consider making a donation, thanks.        

If you need a PIC Programmer I strongly recommend the Microchip PICKit 2, this is available from suppliers world wide or direct from Microchip.  It's reasonably cheap to buy and reliable. 

Contact us: