I am going to maintain and update this log as I add material on building these.
UPDATE 20170716: fixed library and PCB to produce correct solder stencil
UPDATE 20170713: added more info about the battery holder and inductor substitutions, with links to the original parts, and info about the case screws.
UPDATE 20170712: added assembly instructions
UPDATE 20170712: added the 3D printed case design
I should have done this months ago - V2.2 fixed the reversed MOSFET of V2.1, and is basically a complete design, so here it is.
I was going to re-do this in KiCAD, but I got frustrated with it again (third or fourth time), and just paid the $100 for a years worth of Eagle. The hardware and software design is in the GitHub repo.
You can order TritiLED V2.2 boards and V2.x programmer boards from OSH Park. If you have an SOIC-8 programming socket, an SOIC-8 test clip, or don't mind temporarily soldering wires to the ICSP pads on the boards for programming, you don't need the programmer boards - they just let you connect the ICSP lines with pogo pins.
The V2.2 circuit adds a 100-ohm resistor in the battery supply before the reverse-protection MOSFET as discussed in a previous log:
Here's an assembled one with a Chanzon 3W cyan LED (right) next to a V1.0 with a Luxeon Z cyan LED:
The light output from the V2.2 is much more than that of the V1.0, even though the surface of the LED on the V1.0 looks brighter - this is due to the smaller apparent area of the Luxeon LED. The V1.0 will run for a little over a year, while the V2.2 will run for over 2.5 years with the full software program. This full software includes blinking modes selected with the switch, as well as code which periodically re-initializes the PIC to re-write any RAM values that may become corrupt over time (e.g. from cosmic rays). A separate "barebones" software image can be loaded that dispenses with mode switching and periodic re-initialization, and runs at a slower 32 Hz blink rate to achieve an estimated run-time of over 5 years on a CR2032 cell. This software produces a somewhat dimmer output with noticeable flicker, but it is very usable as a marker. Both software versions are in the GitHub repo, and can be tuned to produce brighter output at the expense of run-time.
Bill of Materials
I need to add a BOM in the GitHub repo, but here are the components listed out
- (1) PIC12LF1571 8-SOIC DigiKey part # PIC12LF1571-I/SN-ND $0.57 each
- (1) Wurth 744062102 1mH inductor. DigiKey part # 732-3676-1-ND $1.57 each
- (1) 10uF 25V 1206 X7R MLCC capacitor. DigiKey part # 1276-1804-1-ND $0.26 each
- (1) 0.1uF 25V 0805 X7R MLCC capacitor. DigiKey part #311-1141-1-ND $0.10 each
- (1) 100 ohm 1206 resistor. DigiKey part # 311-100FRCT-ND $0.10 each
- (1) ZXMN3B01FTA N-channel SOT23 MOSFET. DigiKey part # ZXMN3B01FCT-ND $0.60 each
- (1) DMG2305UX P-channel SOT23 MOSFET. DigiKey part # DMG2305UX-13DICT-ND $0.44 each
- (1) CR2032 Battery retainer. Digikey part # BK-912-G-TR $0.63 each
- (1) Switch E-Switch #TL3305BF260QG. Digikey part # EG5354CT-ND $0.21 each
- (1) CHANZON 3W LED (cyan is best). Find them on Amazon : $9.52/10, AliExpress : $7.90/10, or Ebay (various sellers/prices)
- (1) PCB. Order from OSH Park. $6.15 for 3.
The inductor and battery retainer are substitutions from the original parts I used. The battery retainer is a slight upgrade, being gold instead of nickel. The original nickel part is also available:
(1) Linx BAT-HLD-001-TR CR2032 battery holder. DigKey part # BAT-HLD-001-TRCT-ND $0.73 each.
I have not received any of the gold battery holders yet; from the datasheets they appear to be exactly the same except for finish material.
The inductor is simply more expensive, but with the same size and specs: the old one is not stocked at DigiKey anymore. They are in-stock at Mouser:
(1) Bourns SRR6028-102Y 1mH inductor Mouser part #652-SRR6028-102Y $0.68 each
Again, I haven't tried the Wurth inductor on boards yet, but they appear to be identical parts from the datasheets.
This adds up to $8.35 in materials for single-unit quantities (battery not included: add $0.29 for that). If you build 100 of them, you can get it down to around $6.27 (batteries included :) The older inductor was only $0.68, but DigiKey has 0 in stock with a 22-week lead time - that would save almost $1. The MOSFETs could probably be substituted with cheaper parts, too.
You could save some money by removing the P-channel MOSFET. Reversing the battery might harm the PIC then, but wouldn't cause anything to overheat because of the 100R resistor. You could substitute a shunt diode as a reverse-battery protector, too. After the resistor, it would conduct with a reversed battery to spare the rest of the circuit. You just need a diode with low reverse leakage - even the 1N4148 has a 50uA maximum leakage! The B-E junction of BJTs is supposed to make a better diode for this kind of thing. Still, maybe you shave 10% off the parts costs, not that impressive.
Here's where all the parts go on the board. There are only a few you can screw up: the two MOSFETs, and the 1206 R and C, so watch out for those.
You could probably hand-solder most of the parts: I haven't tried to hand-solder the inductor; I think you'd need to make the pads larger to be able to do that. I assemble them by applying solder paste with a 22ga blunt needle, then placing the components with tweezers. I reflow the boards on an electric skillet by letting the skillet warm up to around 180C (measured with an IR thermometer), then place the boards on the skillet. As the skillet continues to warm past 220-230, the solder melts, and I take them off.
The battery holder is hand-soldered on the back of the board after reflow.
(20170716) I fixed the components in the library to produce a correct solder stencil (removed paste from the ISCP pads and added it to the inductor footprint). I have ordered a stencil (for $7.75 with shipping) from OSHStencils, as shown below, but haven't tried it yet - I'll update this log when I have. The gerber file (GTP extension) is in the github repo as well as the updated Eagle files. OSHStencils doesn't seem to have a sharing option like OSH Park, but it's very easy to upload the GTP file and have a stencil made.
This is my first solder stencil, so we'll see how it goes...
You can check out this other log for ways to program the PIC. You need a programmer (PICkit3's are available cheap on ebay), and some way to attach to the IC or board.
I put together an experimental case design in OpenSCAD. A case is important to protect users and the environment from the battery. Without a case, the battery might become loose and be a hazard to children or pets, or the contacts could short on nearby conductors. You must not leave these devices anywhere as markers if the battery is not secured in an inaccessible manner. The case uses screws to keep the battery where it belongs.
Here is what it looks like in OpenSCAD. You can see the details better in the rendering, because I usually print them in black, which doesn't photograph well:
And here is a printed one next to a bare board
The switch I used comes in various actuator lengths. If you choose a short one, it will end up recessed in the case. This will keep you from accidentally changing the mode: a toothpick or similar instrument is required. If you choose a longer length, it can protrude from the case and be easily accessible.
The OpenSCAD and resulting STL file for this design are in the GitHub repo.
The case requires (6) screws. I used #2-28 x 5/16" plastic thread-forming screws available on Amazon.
The V2.2 design works well, and I think 5 years on a CR2032 is probably "good enough." What I'd like to see is smaller and/or cheaper designs. I can imagine forking the design to move in both directions: a cost-is-no-object tiny version, and a cost-reduced, but maybe bulkier one.
Moving back to a chip-on-board LED would help with the size, although the Luxeons I like (Z and C) are $2.74 each in single quantities.
Using a smaller inductor would reduce size and cost and increase efficiency. The problem is that the PIC, in its lower-power 500 kHz oscillator mode, isn't fast enough to produce the short current pulses required of low-value inductors.
What I'd like to try next is using the PIC running at 31kHz, which is the lowest-power clock it can do, still waking from sleep periodically using the WDT. This should dramatically reduce the PIC overhead current drain. To shape the short pulses for the MOSFET drive, I'll try using the 74AUP1G14/differentiator trick from the previous log. That part of the circuit had negligible current drain even with a 3V supply. Moving to an external pulse shaper will allow shorter current pulses than the PIC can do at low clock speeds. Shorter current pulses will, in turn, allow lower valued inductors which are cheaper, more efficient, and physically smaller. In this way, you still retain the flexibility of a programmable part but may be able to reduce the current overhead.
I think I feel a V3.0 coming.