Hi-intensity 4-channel bike tail light

I know, it is a long name for such a ‘simple’ project, it would be better if I just called it HIBL (Hi-Intensity Bike Light) but it would create some confussion, you will never knew if it is front or rear light…


Anyway, as you may know (or maybe not) I wrote previously an article about a bike rear light using the electrical signal of a chinesse manufactured light, this one worked quite well: using the batteries and the button of the manufactured light I was able to drive hi-intensity 5050 red LEDs copying the patterns of the former.

However, driving such electrical load with 2xAAA batteries implied recharging them after each night trip. Also, it supposed to maintain two set of batteries, one for the front light and one for the rear.

Then, the motivation for this project was to electrify the bike using only one energy source: a 5 volts, 10800mAh power bank.


It was having a bad time sharing the triangle bag with the other tools, so a PU leather was a great idea:


The power bank is stored in the triangle bag of the bike frame, from there, one end of a Y cable goes to the seat post and the other end goes to the handlebar, where it splits again to power the front light and in the other end, with a micro-usb connector, charging the smartphone acting as GPS.

DSC03262 - copia_cr.png

On the rear side is were the real project starts. Lets begins with the LEDs.


These are the little beasts (tailgaters know why are they called so):

descarga (1)

Theirs maximum nominal forward voltage is 2.4 volts, so setting 2 of them on series gives a forward voltage pretty near to the source USB voltage: 4.8 volts against the USB’s 5 volts. This is not enough for avoid burning them though.

If we want to squeeze the last bit of brightness from the LEDs, we need to look into the luminic intesity vs current:

2017-03-19 12_25_54-5050 SMD LED.pdf - Adobe Acrobat Pro

A forward current between 80-90 mA would give the maximum light intensity. For driving this current it is needed a look to another graph:

2017-03-19 12_29_26-5050 SMD LED.pdf - Adobe Acrobat Pro
A forward current of 80-90mA is get by applying a 2.2 to 2.3 volts. Now this gives a more realistic powering value for the LEDs, 2×2.25 volt = 4.5 volts, which implies a needed voltage drop of 0.5 volts. Also, this voltage drop will be reduced even more after considering the Vsat of the driving transistor.

It was intended a parallel branch in the same LED channel, so the driving current would be the double: 160-180mA. Then, the electrical definition of the actuator is finished:

4 channels x 180mA @ 4.5 V.

The LED strip are manually made using double side tape and strips of copper tape:



The mayor research in this field was digging into the scrap box for finding one transistor capable of driving the load and finding it in quantity enough for 4 channels. The choosen was PH2222A, a NPN transistor capable of driving 600mA .

For driving 180mA the VCEsat would be a little higher than 0.3 V, decreasing even more the voltage drop needed in the LEDs branch: 4.8V against 5V of the source. The resistance needed for this voltage drop is (5 – 4.8 V)/0.180A = 1.1 Ohm, wasting a power equal to 0.2 V * 0.180A = 0,036 W, therefore a 1/4W resistor is able to bear with it.

Finally, the required current on base to allow 180mA on collector is 18mA, which is perfecty capable to be driven by a microcontroller.


One last subject before selecting the microcontroller: a little push button switch is needed, this is used for selecting the power mode and choosing the blinking patterns.

Only 5 GPIO will be needed for this project, just as the number that is available in Atmel ATTiny13A. I met this microcontroller first time in a LED flashlight; after looking at its detail price, found for even less than 40 cents, and watching at its specs, I felt forced to buy a dozen of them.

It is able to drive till 40mA per port, and provides maximum battery saving while in power mode: 2uA. What more could one desire?

Ending the shopping list, it is time to write the recipe:

2017-03-20 20_33_28-1 Schematic - E__Documents_Dropbox_eagle_Projects_Tail_Light_TailLight.sch - EAG

The push button is the little constraint in the design, as it needs to be connected to a port that is able to wake up the microcontroller from deep sleep and this is PB0.

As you see, there are a SPI port in the schematic, at least this is what you may expect when seeing a bunch of pins named as MISO, MOSI and SCK, actually it is the Serial Programming Interface that, as a Tag-Connect®, I designed a cheaper version of needle connection programming port, so I’m able to program the board once it is installed. The needles are inserted into a 1.27mm pitch pin header.


The board is made saving the maximum space, just a little more than 1 sq.in, 8 cm²:

2017-03-20 21_12_16-2 Board - E__Documents_Dropbox_eagle_Projects_Tail_Light_TailLight.brd - EAGLE 6

The big out-of-place  capacitor resolves an electrical bug: powering up the system with the LEDs was causing microcontroller resets, so now it stabilizes the voltage at the input.

I won’t detail the copper etching process, as it have been done in previous post, so the board is depicted as finished:


The programming port is almost invisible:


Although I haven’t taken any close photo of it, the board is isolated by a epoxy resin bath, only SPI has been left semi-unprotected, using a blu-tack patch to avoid the resin filling the gap.


The SW design is quite simple, basically it is focused on timer and GPIO:2017-04-22 22_09_18-TailLightArch.pptx - Microsoft PowerPoint

The timer is used as task synchronization point, providing a real time environment.

2017-04-22 22_55_03-TailLightArch.pptx - Microsoft PowerPoint.png

Input of the system is controlled by Switch task, which provides debouncing of button and mode management by a simple state machine.2017-06-04 19_02_43-• StarUML (UNREGISTERED)

Outputs of the system are the four independent LED channels.

You can see the final result in the below animations:

Blink pattern 2

Focused on medium-low power consumption and high visibility.

Blink pattern 3

Focused on lowest battery consumption.




Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s