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.
On the rear side is were the real project starts. Lets begins with the LEDs.
DEFINITION OF ACTUATOR: LEDs STRIPS
These are the little beasts (tailgaters know why are they called so):
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:
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:
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:
DEFINITION OF THE DRIVING BLOCK: TRANSISTORS
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.
DEFINITION OF THE CONTROL BLOCK: 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:
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²:
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.
DEFINITION OF THE LOGIC: STATE MACHINE AND PROGRAM CYCLE
The SW design is quite simple, basically it is focused on timer and GPIO:
The timer is used as task synchronization point, providing a real time environment.
Input of the system is controlled by Switch task, which provides debouncing of button and mode management by a simple state machine.
Outputs of the system are the four independent LED channels.
You can see the final result in the below animations: