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!

Import Mouser Invoices into Excel

It would be nice if online parts vendors gave you csv or excel files of your order or invoice. Mouser for example gives you the option of html files or pdf files. Future lets you download a plain text file, but it’s next to useless, there’s no part numbers or anything! I’ve created an excel spreadsheet that will convert a mouser html file into an excel format. It’s not a magic single button click macro or anything fancy, but as long as mouser doesn’t mess with their page layout too much, it should work.

To start, log into “My Mouser” and go to your order history (not invoice history). Click on an old order, and after it opens up, click on “print view”. Print view strips out the form elements that just make things more complicated. Now go to File, Save As and save the web page as a compiled page (MHT format). Sorry firefox, I do love thee as my browser of choice, but this only works in IE as far as I know.

Now open your mht file in excel, you should see that excel properly parsed the order table into neat little rows and columns. Now, open the excel file I’ve provided at the end of this post. Right click on the worksheet tab and choose “Move or copy…”. Copy the worksheet to the mouser workbook. After you have the two worksheets together, rename the mouser worksheet into “Web”. You’re almost done!

At the top of my worksheet there are two cell fields, starting row number and starting cell reference. The row number is where the parts table starts, it has been row 31 on all my orders so far. Starting cell reference is the worksheet reference for the first cell containing parts data, this has been B31 for all my orders so far. Be sure to include the sheet reference as well, so you want that to read “Web!B31”. If your order history is like mine, you may not need to change either of these. Once you get it right, you’ll see the rest of the spreadsheet fill in with your parts data. Now you can save this as an excel file, or export it as CSV, or whatever.

Download the excel spreadsheet