Mint Tin Bike Light Continues

As the (normal) bicycling season draws to a close for my latitude, I’m nearing completion on my bicycle taillight project. I sent out a few weeks ago for some professionally fabricated pcbs and as usual, they look great. There were a few bugs that were entirely my fault, but nothing serious enough to stop the pcb from doing its job.

bicycle taillight pcb assembled

I added two “features” to the pcb before sending the design out, both of which were untested in the initial prototypes. The main feature I wanted to have was “motion detection”, so the taillight would shut down should the bike become idle for a period of time. No need to be wasting precious photons while the bike is leaned up against a tree or parked in a bike rack. Motion detection is provided by a roller ball switch, intended to replace the old fashioned mercury switch. A tiny gold plated ball rolls around in a plastic and metal cage, completing electrical circuits during its travel. The light’s micro-controller recognizes these impulses and continues to let the light function. As soon as the tilt switch stops changing state, resting as either a short or open circuit, the uC begins a count. When that count totals some arbitrary number, the light returns to a standby mode with the SMPS in shutdown. The uC then watches the tilt sensor for the state to change again and upon a change, resumes the previous operational mode.

The second feature is a battery minder circuit. Using a 2.5v precision reference, the micro-controller samples the battery voltage using its on board ADC. The idea is to detect a weak battery condition and operate the SMPS at a lower duty cycle, to make the most of the remaining power. The assumption here is that some light is better than no light in terms of safety. One of my pcb bugs lies in this circuit. The Microchip 12F683 uC I selected for this project is an 8 pin device. Its voltage reference pin is also multiplexed with the programming clock. In my design, I had made the error of connecting the vref pin directly to the voltage reference output, which is biased with a 1k resistor to the Vdd rail (bat +). So effectively, I have a very strong pull-up to 2.5v on that pin. This made programming the PIC impossible as it could not detect clock transitions. I will try salvaging these PCBs by changing to a 10k or 20k bias resistor on the reference, or cutting the trace leading to the Vref pin and soldering a 10k+ resistor in series, since we don’t need any current on that pin, just voltage.

Once I polish the code a bit more, I’ll be looking for a few folks to send a sample units to in exchange for reviews and feedback, down the road I would like to sell these either as a kit or a pre-assembled unit.

Fresh PCBs

I just received these FedEX on Tuesday, fresh from China via Colorado.

taillight stack small

headlight stack small

The first stack of boards is the prototype taillight driver, sporting a tilt switch for motion detection. The second board is a pretty similar design, with a bigger inductor and more compact layout. The intention here is to run a trio of Lumiled’s Rebel leds at 0.5 to 1w each off 4AA batteries, for a compact self contained headlight. More details on that idea later!

Mint Tin Bike Light 3

I completed PCB revision three of the mint tin bike light on Tuesday, but due to lack of batteries for the camera, no pictures were taken! Luckily I’ve found and recharged a second set of batteries and the camera is once again operational.

Feature-wise, this revision adds nothing over the previous light, all the changes are in board design. Firstly, the artwork was redone using polygon pours instead of straight point to point wiring (traces). The revision two switcher was running pretty warm, mostly because it didn’t have much copper to dump the heat into.

The switcher’s ground pin is now tied directly into a very large copper pour, as are the Vin and Switch pins. Using a burning finger temperature probe, the chip remained at or below Tbody even operating in constant on mode at full power. Compared to the revision two board which saw the switcher running quite hot in constant on mode.

The current sensing resistor was moved a lot closer to the feedback pin. With a feedback voltage of 190mV, the tiny resistance of the trace was actually affecting output. Shortening the trace to roughly 1mm has helped a great deal.

Finally, the layout for the battery clips was fixed, and generous polygon pours were drawn around the pads. The spring clips are now soldered down very firmly and hold the batteries quite well. I have yet to take this unit on the trail, so we’ll see if a rubber band is required or not to retain the batteries while bouncing along.

I plan on making one more prototype before sending the design off to Custom PCB or Gold Phoenix. I think I’ll eliminate the battery clips on the chance excessive force could cause one to separate from the laminate and severely damage the pcb. I also want to try a board that hosts both driver circuit and LEDs. Additionally, I plan to add a tilt / vibration sensing switch (roller ball switch), so inactivity of the bike can be detected and the light switched off to save on batteries.

Thanks for reading!

Mint Tin Bike Light

I started this project a little more than a year ago, but shelved it because it wasn’t working right and I didn’t have the correct components. It was a seasonal project that would have little use over the winter, so I sort of forgot about it.

This year I’ve been going on a lot of bike rides with friends, sometimes on public roadways, sometimes after dark. My bike has a nine watt 500 some odd lumen headlight, which makes it easy to see where I’m going, and definitely makes me visible head on. The tail of my bike however still has the stock reflector, plus the little reflector stripes in my shoes, not exactly high visibility. Not wanting to pale in comparison to the headlight, the taillight is a three watt 140 lumen beast powered by three AA rechargeable batteries.

The light is based on a boost converter from National Semiconductor, the LM3410. I’m using the 525kHz SOT-23 version, the LM3410Y. Originally I had trouble with the chip self destructing, as discussed on the Linear1 forums. It was hypothesized either the inductor was underrated or the diode was too slow. Ordering parts for another project later in 2008, I bought some better inductors and diodes, which more closely resembled the specs of parts used in National’s web bench simulator. So, lacking sufficient rear light, I rekindled this project and have a “working prototype” that’s gone on two rides with me so far.

bike taillight schematic small

The basic function is fairly simple. The 3410 is a constant current boost (step-up) driver. A small inductor is used to ramp up the input voltage, from 3.6vdc nominal to 15.4v at approximately 200mA. The current is monitored by a one ohm resistor. A pair of output capacitors help smooth out the ripple and an input capacitor helps the batteries cope with the high demand current (as high as 1.5a in some cases). I’m using nickle metal hydride batteries, which have a rather low internal resistance – they’re designed for high demand applications and when fresh, barely sag at all under the load.

bike taillight pcb layout small

Originally I had planned on carrying the batteries directly on the PCB, using some through-hole spring clip battery holders I found in the Sparkfun library. However, AA batteries must be bigger in Colorado than they are in Michigan, because using Sparkfun’s layout gave me about a quarter inch gap between the spring and the battery. The pads were also woefully undersized for physically mounting the clip and holding it securely enough to survive the stress of batter insertion and extraction. So I dropped their layout and drew my own that looks exactly like it, but is based on measurements from a real AA battery.

Along for the ride is a Microchip PIC microcontroller, the 12F683. It provides a bit of user interface for the light, creating different blink patterns as well as putting the light into a “stand by” mode, with the switcher shut down. I’ve programmed several blinking patterns, and somewhat organized them into “modes” which I can select using the little button.

A year ago, I didn’t have any sort of enclosure in mind. The led array was assembled on a ‘standard’ sized protoboard, so I probably thought about using a plastic or aluminum prototype enclosure. However, this year, I was thinking it would be a nice fit for a large mint tin. After printing out some mock-ups and messing around with battery configurations, I settled on using three batteries and having the electronics crammed into one side of the tin with the led array mounted in the lid of the tin. This setup might have worked, except for the battery snafu. I’m using a plastic three cell holder right now, and the extra thickness it adds is preventing the lid from completely closing. It closes enough that the light is easily held shut by some big rubberbands, and it survived bouncing around under my seat for two short rides. The next revision will have the battery situation resolved and I might have a better mounting solution by then too.

Overall I’m very pleased with the outcome of this project. I have more parts on order to make a few more lights for my other bikes and friends, and I want to experiment with other array configurations and colors. There are a two videos of the light on my youtube channel, but they’re nothing to get excited about.

Thanks for reading!

Big Ugly SMPS

Usually my designs strive to create tiny boards, and I often obsess for days fine-tuning, shaving a fractions of an inch at a time. However, this design goal was get it done, get it working, then make it pretty.

I’ve been trying to build a switcher to provide a portable power source for PDA’s, cell-phones, etc. Not just enough to trickle charge said gizmo for hours, but to charge it as fast as possible, like the cradle or wall plug would do. This requires quite a bit of power. Packaging portable power is proving very tricky. There’s two main design goals I’m trying to meet. My primary goal the past week has been recharging the power-source, and the easiest way to do this is parallel cells. There’s oodles of charge management chips out there designed to handle charging of single lithium-ion cells (or parallel cells). The complexity knob gets turned WAY up once you start talking series cells. So rather than spin my wheels on this problem, I chose to move forward with goal number two. My secondary design goal is to get the power out. Putting the cells in series opens a wide door for easy to use switchmode converters and controllers. I’ve got a bin full of samples from all the big names, and I’m close to settling on a chip. First to prototype is the TPS5430 from Texas Instruments. This chip claims to have a three-amp switch on board, and it’s pretty easy to use. The switcher is internally compensated, eliminating an RC network often needed to compensate high frequency switchers. The 5430 comes in fixed voltage models, but I went with adjustable this time.


tps5430 schematic

Using TI’s SwiftDesigner to generate a reference design, I drew that up in Eagle. Their reference design specified solid tantalum capacitors, which have properties that lend themselves well to switchmode applications. However, having priced 100+ uF tantalum caps, I’ve decided to use aluminum electrolytic instead. To offset some of the short-comings of aluminum caps, I have connected several in parallel. The main disadvantage is ESR, and wiring caps in parallel cuts the ESR dramatically.

tps5430 printed circuit board

Loosely following TI’s reference layout, I came up with this design. I drew the design using the top layer, and ended up flipping it over when I assembled it. It doesn’t really make a big difference, just as long I remember to solder everything in a mirror image of what’s shown on the screen. For example, the screen shows the input stage on the right, but on the prototype, the input stage is on the left. The reference design called for a single 100uF solid tantalum capacitor rated at 25 volts (I spec’d 14v as VinMax). It also called for a 47uF tant as a bypass cap for the IC. So instead, I went with two 100uF 25v electrolytic caps and one 47uF 16v cap. I realize 16v is cutting it a bit close, but it’s all I could come up with, and this is only a first pass. The output stage called for a single 220uF 10v tant, instead, I drew room for three 100uF caps but only installed two for now. The chip needs a bootstrap cap to help it start-up with low input voltages. The datasheet called for 10nF, so thats what I used. The voltage divider is a 10k resistor coupled with a 10k pot. A resistor and LED were added to show “power on”. The three pin terminal at the bottom is tied to the enable line. Enable should float for normal operation and be pulled low for shutdown. I used a big ‘ol coil I had laying in the parts bin, it was labeled 22uH but the actual inductor is not marked. Looking at the size of the bobbin and heft of the wire, I’d say this inductor can handle some serious current. A three amp schottky diode completes this bit of kit.

With one set of fingers crossed, I hooked the switcher up to a wimpy 200mA 12v wall-wart, used for charging a screwdriver. To my relief the LED came on, nothing started smoking, and the ammeter read 10mA on the 10a scale (later I re-read 13.59mA on the 20mA scale). The datasheet claims 3-4mA of quiescent current, so the switcher is taking 10mA at 12v to supply 20mA at 5v. Although I haven’t done the algebra in the datasheet, comparing watts in to watts out puts the efficiency in the not-bad to pretty good range. (100mw / 120mw = 83%). Better still, when I connected my Dell PDA to the switcher, it was able to supply as much current as the Dell could ask for, without raising above ambient temperature. With a low internal battery, cpu set to 400mhz, external wifi card inserted, backlight full-on, the Dell peaked at 1.1 amps. I left it laying on the bench and watched a movie for a few hours. Coming back, the dell was completely charged, and the output had dropped to about 170mA.

My next goal will be to miniaturize this circuit as best I can, hopefully to fit it into an altoids tin which holds my lithium cells so very nicely.

Switchmode LED Driver

This is the second incarnation of my tps61040 based LED driver (here and here). As I wrote just a few posts ago, I’m trying out a new layout strategy to make my gizmos more breadboard friendly.

The 300 mil (thanks Dave) DIP16 package proves to be very small, so small I had trouble trimming it completely while depanelizing.

tps61040 dip16 boost switchmode led driver

Another problem I ran into is a high voltage output cap. Seeing that this circuit generates upwards of 28 volts, the typical inexpensive ceramic or tantalum capacitors just don’t have the dielectric strength to work well. So, that leaves few options. Option one involves parallel smaller value high voltage caps. I ordered a bunch of 50v 1uF 0603 caps, so we’ll see how that goes. Second option is electrolytic. Sure I’ll incur some losses in the capacitor, dipping the efficiency a bit, but hey, it’s not a perfect world. I found some 10uf 4.3mm x 4mm caps that should do nicely. Third option is expensive ceramic … weighing in at $1 to $5 ea, these caps must be made of lunar rock. I have not ordered any of these, but I will look into harvesting some from dead / old electronics.

Notice the cute little inductor. That baby is 10uH, 1 amp, shielded and only 6mm square. Designed for high power applications, it has a generous saturation current, and rather low resistance. Even better, it’s only like 2mm tall, and to top it off is the cost; 59 cents each at quantity 10. In case you’re looking for an easy to use and flexible inductor, the digi-key catalog number is 587-1707-1-ND.

This time, in order to have a simple board layout, I chose to permanently enable the chip, so they’re be no dimming on this version. I’m not sure if the chip supports a hot load disconnect, I did manage to kill my earlier prototype somehow, one of the output leads broke off the pcb while I was holding it, in a dark room. After repairing the damage, I only get a very low output. Perhaps my capacitor or diode was fried.

tps61040 dip16 boost switchmode led driver

Here are the breadboard compatible pins. The three pins are the output area, with the one inboard pin being the led sink, where the current sensing resistor is attached. This layout required two ground pins, and an external jumper to connect them. I’ll remedy that in the next iteration.

This is the little critter doing it’s thing. Do you like that battery brand? SHAZZAM – it just screams power. I bought a BUNCH of these at a traveling tool sale show, 99 cents for 16. They’re not half bad for light loads, this little switcher sucks ’em dry in a mater of hours however!

Fun new pcb layouts.

Testing SMD devices on a breadboard requires some sort of carrier. You can use the dead-bug method, affixing the smd to something, and using bits of wire to solder its tiny pins to larger ones that fit into a breadboard. Another method is using SMD converters, which is fine, but really limits what you can do with the chip, it’s not very portable, and it takes up a LOT of room for very little gain. So, I decided to try re-drawing some of my designs to fit in the footprint of a DIP style package, but be more or less self contained. These self contained modules will work on a breadboard, protoboard or where-ever.

Today’s theme is switchmode power supplies. To start, here is a ‘single cell’ to +5v boost regulator, based on National LM2698. This circuit should accept as little as 2.2 volts and provide a solid five volt output. With 3.6 volts in, it should provide over one amp of current. Thanks to the large capacitors, this module resembles a 28 pin ‘wide’ dip, approximately 600 mil across.

This module is also a ‘single cell’ to +5v boost regulator, based on the petite TPS61040 from Texas Instruments. The chip claims to support voltages as low as 0.9v, but I plan to use it with a single 1.5v AA. The amount of current it will provide is somewhere around 100mA. It can provide up to 500mA using a higher input voltage. This module resembles a 20 pin ‘narrow’ dip, or approximately 300 mil across.

Lastly, this is the smallest design yet. This module resembles a 16 pin ‘narrow’ dip. Also based on TI’s tps61040, this switcher is configured in constant current mode. My prototype design sources 50mA at 23 volts into a string of white LEDs, powered by two AA batteries.

Few new drawings

I’ve been working with a new design these past few days … I’m trying to build a portable power supply / charger for mobile usb devices. Inspired by Lady Ada’s Minty Boost, I set out to build something a bit more powerful. Perhaps I can call it the Minty XL? Alas, that is not the topic of this article. The charger is based on two “modules” which are discussed here. I felt it was a good idea to build these modules as separate units, so I can breadboard them and test out their design, before committing to have a PCB professionally fabricated for the actual charger.

The first module is a boost converter based on the National Semiconductor LM2698. This converter takes 3.6v from the batteries and boosts it to 5v. The converter should supply at least one amp and perhaps as much as 1.3 amps under ideal conditions. To test the design and layout, I’ve designed a small single sided PCB that will plug into a breadboard using a four pin header.

lm2698 boost converter schematic

National supplies the LM2698 as a mini-so8 package, so it’ll be some challenging soldering to do with an iron! Although a 4 pin header was used, there are really only 3 connections. Vi will connect to the batteries or current limiting circuit simulating batteries. Vo is the boost output, which is also indicated by an LED. Two low esr tantalum capacitors provide input and output filtering and some smaller ceramic caps provide decoupling for the IC and a filter for loop compensation. Two resistors form a voltage divider, supplying 1.25v to the feedback circuit of the chip. The coil is a two amp 7mmx7mm shielded ferrite core inductor and the switching diode is just some schottky I picked out of the Digikey catalog.

lm2698 boost converter pcb

What good is a powerful portable charger if its own batteries wear down? The second module for my project is a battery charger based on Maxim’s MAX1811 Li+ Charger. The MAX1811 is designed to be a USB powered charger, which seems a fitting complement to a portable USB charger. In fact, if you visit a dimension were conventional physics don’t apply, the device may be able to recharge itself! Anyway, the MAX1811 based circuit is very simple – the chip does all the heavy lifting of monitoring the cell health, temperature and state of charge.

max1811 usb lithium ion charger schematic

Two capacitors, neither strictly required provide filtering on the input and output of the chip. An on-board LED indicates the charging mode. When the LED is on, the charger is bulk charging the cell, up to 500mA. When the LED is off, the charger is either preconditioning the cell (for severely discharged cells), maintaining the cell, or off. I would have preferred a little more information, but hey, I like simple and this chip is that, the blocking diode is even built in!

max1811 usb lithium ion charger pcb

Thankfully Maxim supplies the MAX1811 in an so8 package, so it should be fairly easy to solder. This small circuit board also plugs into a breadboard using a three pin header. V+ supplies the charger with roughly four to six volts. B+ is the charger output to the battery, and both the battery and supply share a common ground.

Hopefully this weekend I’ll be able to fabricate these circuit-boards and will toss up a few pictures of the finished product.

MintLite Part I

MintLite – The Luxeon Powered Mint Tin Flashlight!

This idea has been rattling around in my head for more than a month now, and I finally have thought it out enough to do some doodling in Eagle. The basic idea is built around a six watt Luxeon K2. I plan to use a pair of 2.5aH lithium batteries to provide approximately eighteen watt-hours of power. The Luxeon will be controlled by a microcontroller, providing different brightness levels, as well as protecting the luxeon from excessive current when the batteries are fully charged. The microcontroller will also monitor the battery voltage; dimming the light as needed and eventually shutting down completely to prevent over-discharge. The light will contain it’s own battery charger, powered by USB using the MAX1811. The MAX1811 will charge a single lithium cell (or cells in parallel) at up to 500mA off a self-powered USB port. The 1811 allows charging from a bus-powered port as well, but for sake of simplicity, I will ignore that option.

mintlite schematic diagram luxeon max1811 pic microcontroller

The circuit keeps things fairly simple. Switch Q1 provides pwm control of the luxeon. Header SW1 will connect to some sort of switch, for turning the light on and off, and changing brightness. The MAX1811, IC2, takes 4.3 to 6.5 volts as input, and regulates it to 4.2 volts for charging the lithium cells. Charging status is indicated by LED2, which will light when the charger is in bulk charging mode (current mode).The microcontroller, IC1, is a PIC12F683. The 683 provides a lot of bells and whistles for such a small chip. I will be using analog input 0 to monitor the battery voltage. General purpose input 2 will monitor the charging status, perhaps to disable charging when the batteries are in bulk charging mode. General purpose input 4 will use an internal pull-up resistor to monitor the switch. General purpose output 5 is controlling a mosfet transistor responsible for PWM of the led.

The pcb layout is in it’s early stages, and designed mainly around parts I have on hand. I don’t think I’ll actually prototype this PCB, since it’s much too large, and the wrong shape. Whether it gets printed or not, it was fun to draw. There are two main things I want to change. First the FET (Q1) in the TO252 package is rated at something like sixty amps – way more than I need for this project. ON Semiconductor has some nice SOT23 fets rated at 4 amps that should fit the bill nicely, and save a lot of space. Secondly, I need to find a smt version of the usb connector, perhaps a mini usb instead.

Hopefully this weekend I’ll be able to breadboard this circuit and see how it all goes together. Stay tuned for “Part II”.

TPS61040 Constant Current Driver

I’m already up past my bedtime, so just a few pictures for now. Write-up coming soon!

Specs: Input 2v to 6v DC … Output constant current 50mA up to 28v DC
Efficiency: Initial measurements, somewhere around 75%
Chip Texas Instruments TPS61040

tps61040 boost converter constant current led driver
size comparison, american quarter dollar piece


circuit detail – design is one-sided PCB with two through-hole jumper wires and the diode, everything else is smt



twin 1uF tantalum capacitors … the output capacitor I had originally selected was limited to 16v, so this was the best I could come up with on a Sunday. Note the top of the coil is missing – these things are fragile!