Category Archives: Electronics

Braun Type 5417 Hair Trimmer Repair

I keep my facial hair like I keep the lawn – I let it grow naturally (on its own), then trim it down every week or so and clean up the edges every other time. I do so with an electric lawnmower; not battery-powered, because I don’t mind the inconvenience of a power cord tether and I don’t want to have to replace another rechargeable battery every few years. Wait, I started this post to talk about my hair trimmer…

The Braun 5417 “cruZer6 beard&head” hair trimmer has been running well for me over the past 7+ years I think I have had it. The NiMH battery stopped holding a charge, unfortunately. Like anything I own that has stopped working correctly, I opened it up to investigate, knowing full-well that I was probably just going to replace the batteries (I have done this with countless electric toothbrushes over the years). I was impressed with the build quality, and the gasket design to keep the electronics ingress-protected; that attention to detail is likely why it has lasted so long on its own. The gasket is a molded-rubber concave profile in the lid that provides a very satisfying fit, and is secured with six ramped securing tabs that are just perfectly aligned; some high quality plastics engineering went into this electronics enclosure. There is even an expanded-PTFE breather port to equalize pressure differentials due to heat dissipation!

I cut the tabs off the old batteries and removed them, then sanded the ends of some EBL 1100-mAh low-self-discharge NiMH AAA cells and soldered them in place. I hit the power button, and… it just blinked the red LED for 5 seconds.Hmmm… maybe it just needs to be charged. Nope! After repeated charging cycles until the internal timer cutoff, it still did the same thing. I desoldered the batteries, discharged them, and put them back in to charge again; afterwards, the battery voltage confirmed that the trimmer’s circuitry is charging the batteries just fine, it is just refusing to operate!

The mistake I made was just throwing out the original batteries, because now I have no idea what is wrong and cannot test if it still operates correctly with them re-installed. Most likely, the internal battery health detection circuitry is tuned to the original batteries’ performance, and the new batteries’ low internal resistance and longer charge-profile is being rejected by the firmware. But… what if it is actually something more nefarious?

Was my modification being defeated, maybe?  I was suspicious of two small ceramic, non-conductive (potentially ferrite) beads inserted into the plastic molding (under the motor wires seen in the picture), but I’m still not sure what they are for. One theory might be a kill-switch in the microcontroller programming somehow related to disassembly; if that’s the case, then I am impressed with the level of evil effort they put into keeping the life-cycle of this product down! If not, then I honestly have no clue what they are supposed to be there for; one contacts a single ceramic capacitor (C2, maybe it is supposed to damage that component on removal?) and the other is centered on three test pads (TP17, TP18, and TP20, maybe that acts as an air-gap resonator between two pads and is coupled to the third pad for removal detection?). I want to know, but I also want to put this back together and give myself a haircut.

Whatever the case, the trimmer is in good condition since I keep it clean and lubricated, so I just located the motor drive transistor, and ran some 32-AWG magnetwire leads to a slide switch that I mounted to the outside. Now I just use a different button to operate it, and I can move on with my shorn life. :P


I began this project with the intention of creating a Theremin for my Mom, who has also been fascinated by the instrument but never had one. I have seen a lot of designs ranging from very simple to very complex, but I wanted to make something something… different. I intended to approach this project with a structured mindset in order to test my engineering abilities to follow through on a  design from inception to completion.

The final product – the Theremean!

Concept: I wanted a straightforward design with off-the-shelf components and easily-fabricated sub-assemblies, a controlled BOM with a minimum number of vendors and short lead-times. I settled on making a modified version of the Open.Theremin.Uno, in my own plastic case and using a custom PCB with my own design flare. I designed in all the standard/extra features: volume control, waveform selection, a calibrate button, power LED, calibrate LED, CV output, MIDI output, and an internal speaker tied to a switched headphone/line output. I decided to power the unit with a shielded (so it doesn’t interfere with the antennae) line power plug connected to an internal DC power supply module. I used banana plugs to make the antennae easily removable, and, finally, added the unique feature of a built-in distortion output stage, which inspired the puntastic name of Theremean!

Guts Shot

BOM: The Bill of Materials below shows all of the components that went into the final build (but not any tweaks that were made post-production). I broke the cost-per-unit down into 1/10/100 quantities to show how much it might cost if I had chosen to build these in a larger quantity; I ended up building 3 units at a cost of around $85/ea, knowing that I could build 100 units at a noticeably lower cost of $58/ea. These numbers are just for reference, though, because it does not account for any capital costs (equipment, solder paste mask), labor (I like to value my time at around $0.00/hr for personal projects; I’m doing this for fun, after all), design time, troubleshooting time, extra parts, electricity, lack of sleep, and anything else I can’t remember (due to lack of sleep?).

ManufacturerManufacturer Part NumberVendorVendor Part NumberDescriptionQuantityCost @ 1Cost @ 10Cost @ 100
PolycaseJB-35R*0000Instrument Case 5.00 x 3.80 x 1.50 in1.00$7.54$6.25$4.97
PolycaseSCREW-MBR-100PCB Mounting screws4.00$0.04$0.04$0.04
*OSH ParkTheremean V1Blank PCB - Custom Design1.00$15.59$9.37$9.37
K&S Precision Metals103McMaster-Carr7237K15Antenna Metal2.00$1.01$1.01$1.01
VishayVJ0805G106KXQTW1BCMouser77-VJ0805G106KXQTBCMultilayer Ceramic Capacitors MLCC - SMD/SMT 0805 10uF 10volts X5R 10%2.00$0.10$0.10$0.07
KemetC0805C103K5RACTUMouser80-C0805C103K5RMultilayer Ceramic Capacitors MLCC - SMD/SMT 50volts 10000pF X7R 10%3.00$0.10$0.02$0.01
KemetC0805C473K5RACTUMouser80-C0805C473K5RMultilayer Ceramic Capacitors MLCC - SMD/SMT 50volts 47000pF X7R 10%1.00$0.10$0.03$0.02
KemetC0805C682K5RACTUMouser80-C0805C682K5RMultilayer Ceramic Capacitors MLCC - SMD/SMT 50volts 6800pF X7R 10%1.00$0.10$0.04$0.03
VishayVJ0805A470GXACW1BCMouser77-VJ0805A470GXACBCMultilayer Ceramic Capacitors MLCC - SMD/SMT 0805 47pF 50volts C0G 2%2.00$0.10$0.10$0.03
MurataGRM2165C1H471JA01JMouser81-GRM215C1H471JA01JMultilayer Ceramic Capacitors MLCC - SMD/SMT 0805 470pF 50volts C0G 5%1.00$0.19$0.08$0.05
MurataGRM2165C1H331JA01DMouser81-GRM40C331J50DMultilayer Ceramic Capacitors MLCC - SMD/SMT 0805 330pF 50volts C0G 5%2.00$0.18$0.07$0.04
VishayCRCW08052K20JNEAMouser71-CRCW08052K20JNEAThick Film Resistors - SMD 1/8watt 2.2Kohms 5%1.00$0.10$0.04$0.02
VishayCRCW08051M00JNEAMouser71-CRCW0805J-1M-E3Thick Film Resistors - SMD 1/8watt 1Mohms 5% 200ppm4.00$0.10$0.04$0.02
VishayCRCW0805470RJNEAMouser71-CRCW0805J-470-E3Thick Film Resistors - SMD 1/8watt 470ohms 5% 200ppm2.00$0.10$0.04$0.02
VishayCRCW0805330RJNEAMouser71-CRCW0805J-330-E3Thick Film Resistors - SMD 1/8watt 330ohms 5% 200ppm7.00$0.10$0.04$0.02
Molex15-91-2060Mouser538-15-91-2060Headers & Wire Housings HDR DUAL SMT 6P1.00$0.43$0.32$0.28
Molex22-15-2066Mouser538-22-15-2066Headers & Wire Housings 6P RT ANGL PCB RECEP1.00$0.73$0.55$0.48
Molex22-15-2026Mouser538-22-15-2026Headers & Wire Housings 2.54MM BOARD CONN RA 2 CKT Tin1.00$0.26$0.18$0.15
Schurter3404.2416.11Mouser693-3404.2416.11Surface Mount Fuses UMZ 250 FUSE WITH HOLDER 1A T1.00$1.41$1.41$1.17
EPCOS / TDKB72650M301K72Mouser871-B72650M301K72Varistors 300V 400A 45pF Varistor1.00$1.00$0.76$0.42
Texas InstrumentsRC4558PWMouser595-RC4558PWOperational Amplifiers - Op Amps Dual General-Purpose Op Amp2.00$0.39$0.27$0.12
Lite-OnLTL2R3KGD-EMMouser859-LTL2R3KGD-EMStandard LEDs - Through Hole Thru-Hole Lamp 5mm Grn 571nm 30Deg1.00$0.08$0.08$0.06
Lite-OnLTL2R3KYD-EMMouser859-LTL2R3KYD-EMStandard LEDs - Through Hole Thru-Hole Lamp 5mm Ylw 592nm 30deg1.00$0.08$0.08$0.06
BournsPTL45-10R1-203B2Mouser652-PTL45-10R1-203B2Slide Potentiometers 20Kohms Travel=45mm Center Detent3.00$2.30$1.81$1.60
ApemMHPS2273NMouser642-MHPS2273NPushbutton Switches Momentary key DP1.00$0.83$0.83$0.71
ApemMH12Mouser642-MH12Switch Bezels / Switch Caps TALL SQ BLACK CAP1.00$0.19$0.19$0.18
KyconKCDX-5S-NMouser806-KCDX-5S-NCircular DIN Connectors 5P R/A PCB NON SHLD 10mm CIRC DIN RECPT1.00$1.11$1.11$0.77
Switchcraft35RASMT4BHNTRXMouser502-35RASMT4BHNTRXPhone Connectors SMT 3.5MM PHONE JACK1.00$0.69$0.68$0.65
Kobiconn174-R819B-EXMouser174-R819B-EXTest Plugs & Test Jacks L 1.88" 10A BLACK2.00$1.20$0.99$0.90
Cinch Connectivity Solutions108-0903-001Mouser530-108-0903-1Test Plugs & Test Jacks BANANA JACK BLACK BU-31602-02.00$0.52$0.47$0.41
Heyco1137Mouser836-1137Cable Mounting & Accessories SR 5P3-4 BLACK1.00$0.13$0.13$0.09
3MSJ-5003 (BLACK)Mouser517-SJ-5003BKMounting Hardware SMALL HEMISPHERE BLK 56 PER PAD4.00$0.11$0.06$0.06
Volex17740 10 B1Mouser686-17740AC Power Cords 18AWG PLUG-SVTS 6FT 7IN (2.0m) BLACK1.00$5.93$5.93$5.19
AVXTPSD337M006R0070Mouser581-TPSD337M006R0070Tantalum Capacitors - Solid SMD 6.3V 330uF 20% Tol. 70 ESR2.00$1.18$1.18$0.97
VishayCRCW080510K0JNEAMouser71-CRCW0805J-10K-E3Thick Film Resistors - SMD 1/8watt 10Kohms 5% 200ppm8.00$0.10$0.04$0.02
VishayCRCW0805100KJNEAMouser71-CRCW0805J-100K-E3Thick Film Resistors - SMD 1/8watt 100Kohms 200ppm2.00$0.10$0.04$0.02
VishayCRCW08054M70JNEAMouser71-CRCW08054M70JNEAThick Film Resistors - SMD 1/8watt 4.7Mohms 5%4.00$0.10$0.04$0.02
ToshibaTC7WHU04FUTE12LFMouser757-TC7WHU04FUTE12LFInverters x34 INVERTER(UNBUFF)3.00$0.43$0.33$0.20
KemetC0805C104K5RACTUMouser80-C0805C104K5RMultilayer Ceramic Capacitors MLCC - SMD/SMT 50volts 0.1uF X7R 10%14.00$0.03$0.02$0.01
MurataGRM2165C1H131JA01DMouser81-GRM215C1H131JA01DMultilayer Ceramic Capacitors MLCC - SMD/SMT 0805 130pF 50volts C0G 5%2.00$0.11$0.05$0.03
VishayVJ0805A180GXACW1BCMouser77-VJ0805A180GXACBCMultilayer Ceramic Capacitors MLCC - SMD/SMT 0805 18pF 50volts C0G 2%6.00$0.10$0.04$0.02
RECOMRAC02-05SCMouser919-RAC02-05SCAC/DC Power Modules CONV AC/DC 2W 80-264VIN 05VOUT1.00$12.78$12.60$11.11
AtmelATMEGA328P-AUMouser556-ATMEGA328P-AU8-bit Microcontrollers - MCU 32KB In-system Flash 20MHz 1.8V-5.5V1.00$3.43$3.02$2.27
MurataTZB4P300AA10R00Mouser81-TZB4P300AA10R00Trimmer / Variable Capacitors 4mm 30pF2.00$0.91$0.65$0.57
ABRACONABMM2-16.000MHZ-E2-TMouser815-ABMM2-16-E2TCrystals +/-20PPM 16MHz1.00$1.16$1.02$0.65
ABRACONABMM2-8.000MHZ-E2-TMouser815-ABMM2-8-E2TCrystals 8MHz1.00$0.93$0.82$0.65
ABRACONABMM2-7.3728MHz-E2-TMouser815-ABMM2-7.3-E2-TCrystals 7.3728MHz, 18pF 20ppm1.00$0.93$0.82$0.68
MicrochipMCP4921-E/SNMouser579-MCP4921-E/SNDigital to Analog Converters - DAC Sgl 12-bit SPI int1.00$2.08$1.97$1.49
ON SemiconductorMC74AC74DR2GMouser863-MC74AC74DR2GFlip Flops 2-6V CMOS Dual D-Type Pos. Edge1.00$0.45$0.33$0.21
Texas InstrumentsLM358DMouser595-LM358DOperational Amplifiers - Op Amps Dual Linear1.00$0.44$0.30$0.14
Texas InstrumentsCD4060BM96Mouser595-CD4060BM96Counter ICs CMOS 14-St Ripple- Carry Binary2.00$0.44$0.34$0.18
TDKNL453232T-102J-PFMouser810-NL453232T-102JPFFixed Inductors 1K UH 5%2.00$0.49$0.35$0.23

Case: The case was a standard plastic case, the JB-35R*0000 from Polycase, which I hand-machined with various holes using step-bits and blades/files. The unit in the pictures here was my first unit, with some extra “oops” holes and access to the programming header. For a larger quantity of builds, I would have paid the ~$100 setup fee to have Polycase machine these for me and add fancy graphic overlays. Instead, I created the design in Inkscape as an overlay of the manufacturer’s dimensioned drawing, and printed it out on large white label stock. After attaching it to the case, I used the black areas as a cutting template.

Front Panel Layout

PCB: While I based the design on the Open.Theremin.Uno, I made some PCB BOM changes to optimize the components and layout. I also used this as a moment to try my hand at making a board with 0805 passives; while I have experience designing as small as 0402 passives into PCBAs for work, we have those assembled professionally with pick-and-place, and I have never tried something smaller than 1206 for hand-placed SMT work. It turned out fine, and I could have made the layout much tighter if I had wanted to; in fact, in hindsight it looks like I subconsciously left as much spacing as I would have for 1206. I had the PCBs made by the always-awesome OSH Park, and I had a solder paste stencil made by OSH Stencils. Theremean KiCad Archive for download, if you’re into that kind of thing.

KiCad Schematic
KiCad Rendering – Front
KiCad Rendering – Back

Other Notes:The antennae were made from 5/32″ OD (0.128″ ID) aluminum tubes, hand-shaped and soldered to banana plugs, with some adhesive heatshrink for protection and looks. The mating blue banana jacks were used because I had them on hand already, and I used slider potentiometers with LEDs just to give it some color. I used the original Open.Theremin.Uno Arduino code without any memorable issues; I may have added a few tweaks, I can’t remember.

The distortion effect gave me some trouble; I based it on some guitar effects designs I found online, but after the build I discovered some items that needed to be changed, which are noted on the schematic.

I had some trouble with the original tank capacitor values (probably since they were selected for a different PCB design with its own internal capacitances), so I had to solder in some other values in parallel to give me the capacitance I needed to calibrate the unit correctly. An improvement in the future would be to add a digital capacitor IC (a switched capacitor bank, essentially) to allow the calibration to be automatic, because it was rather finicky.

I am happy with the final product. I kept the first one, gave one to my Mom, and gave one to my friend Sean.

UPDATE: Since the completion of this project, an Open.Theremin.V3 has been released with some newer features; most importantly, the automatic calibration that I wanted to include. But they did it with a tuned diode, instead of a switched capacitor bank (digital capacitor) like I proposed.

Dealing with DC Motor Noise

I have an inexpensive DC motor as part of a project I am doing for work; since it is a proprietary device, I cannot give any more information than is provided here. Suffice to say, it is a portable device with a Li-Ion battery pack and a custom PCB I designed with a MAX1758 Li-Ion charger IC and a baseline Microchip MCU (coded in PIC Assembly – yay!) that controls both an electronic lamp ballast and a small brushed DC motor. To help prevent noise/transients from affecting different parts of the circuit, everything gets its own dedicated power supply with some switching DC regulator ICs built into the PCB; unfortunately, that wasn’t enough!

My first problem was that the MCU would reset the second I tried to turn on the lamp ballast, which is a type of device that I deal with on a regular basis at work for driving many different kinds of mercury lamps – it is known for having an enormous inrush current, up to 5 times the steady-state current draw for the first 100ms of operation. This is due to the nature of the ballast, which requires a 300-700+ VAC “strike” in order to arc the gases inside the lamp; internally, this is achieved with a reactive circuit which resonates until a voltage sufficient enough to arc the gases occurs across the lamp cathodes. This inrush current creates a reactive voltage transient that can affect other parts of the circuit, and a quick and easy way to kill that transient is with a diode so that a transient of sufficient voltage to exceed the diode’s reverse breakdown voltage will be shunted through it and dissipated as heat. I had a few 1N4007 diodes on hand, but that’s actually a poor choice since it has a relatively high Vbreakdown – a better choice is the diode species known as a TVS diode. Of course, as mentioned on that Wikipedia page, there are other devices to choose from and the ability to know what to use where is something that can only come from experience. In this case, the 1N4007 helped enough to solve the problem for now, but a redesign will be required to achieve better long-term performance.

The next problem to come up was that the MCU would randomly reset after an indeterminate period of time of lamp/ballast operation. I took out our new oscilloscope and scoped out the voltage across the terminals of the 1.8VDC motor during operation:

2013-01-29 - DC Motor Noise - Before

Uh-Oh! +31V and -19V transients!?!? Well, that’s the nature of the beast and also the reason your computer fans use brushless DC motors. A quick search online turned up this robot-enthusiast-oriented wiki page that offered up some suggestions; with just the two capacitor method using some spare 0.1uF film caps I had around, the situation was cleaned up and I now faced a much less dire situation:

2013-01-29 - DC Motor Noise - After (2 cap)

Problem solved! The three capacitor method even helped a bit more, but I do not have a screen cap for that. I do have some candid before/after pictures, however!


DIY Bubble Etching Tank

I finally built a simple bubble etching tank; I’ve seen people with them all over the place in the past, but I just haven’t had the desire to put one together until today. In the past, I’ve been etching my PCBs by just filling a pyrex tray with etchant, dropping the masked board in and manually agitating with a foam brush.

This new piece of equipment has these advantages:

  1. Less etchant required; the vertical tank takes up less volume and thus it is more space efficient.
  2. Air agitation; the bubbles oxidize the etchant, which allows it to more effectively etch away copper. It also creates turbulence in the liquid that helps etch very small areas.
  3. Less manual interaction; the acid in the etchant is toxic stuff, and I really need to be more careful than I have been in the past.

The tank is made from some pieces of spare acrylic sheet I had, which are put together with acrylic cement and the outsides of the joints are reinforced with hot glue (just in case). I had an old aquarium air pump around and carefully hot-glued the end of the tube across the bottom of the tank through some holes drilled into the edges; I then carefully poked holes into the tube using some very small-diameter drill bits. Of course, I tested it with water before trying it with the cupric chloride etchant seen in the photos. I found that there were a lot of droplets splashing out of the tank, so I made a small lid with a spare IC storage tube. The whole construction took a total of two hours.

UPDATE: I put together a small, adjustable acrylic rig to top the tank and hold the part being etched in place.

The green top is a piece of junk acrylic sheet that I found and drilled a series of holes into. The sticks are 1/8″ squared acrylic rods pieced into an edge and covered in double-sided tape (for some extra tackiness); the ends that meet the green top piece are sanded down to round pegs that compression-fit into the holes, which allows the spacing to be adjusted for any size board that may fit in the tank. Small holes are drilled in the pegs so that small screws can be set as an added safety measure should the weight of the board cause the peg to slip, but I’ve found that it isn’t really necessary (maybe for larger boards). In fact, the actual problem is that even the thicker (3.175mm) boards I am etching for my microwave antenna array project are able to fall off the holding rods and down to the bottom of the tank if I am not careful.

So far, the whole setup seems to work well for both developing photoresist (why didn’t I think of that initially?!) and etching boards. The only complaint I have right now is the uneven bubble cover; if the board is not moved around occasionally, the parts in the path of the heavier bubble streams etch faster than the less-covered areas. Etch times for cupric chloride etchant seem to be about 15 minutes for 1/2-oz copper and up to 90 minutes for 2-oz copper (ugh).

Do want!

I found a wonderful little tutorial on a better way of applying the dry photoresist film:

Following it, I got much better results; I little wrinkling on both sides, but I was able to (mostly) work around it. I should be able to avoid that next time. The 6pt fonts all showed up well; a few missing letters (not enough pressure when I applied the film). Two of the three sections of 4pt font are vaguely legible, and the 3pt fonts are garbled similarly. None of the 2pt fonts made it, though (it was a stretch that they would, anyway).

Three of the four QFN-16 adapter boards are PERFECT (yay!), and the other once can be salvaged. One of the DFN-8 boards are almost perfect, the other two might have too many problems with the 3[mm] traces, for which the precision is extremely important, so they may not be useable (I only needed one, anyway).

Back of board after developing the photoresist. Green electrical tape is there to protect the parts ruined by the wrinkling of the film when I applyed it. The exposed section is for the back of the QFN-16 adapter boards.

Now for the front of the board. A few places of missing text, but everything looks decent, overall.

The boards after etching and cutting (box cutter, ruler, and hand-breaking; jeweler’s saw is too slow, and dremel is too messy)

The end result; two working boards!

These two use the MASW007107 RF switches, and are test boards for my Senior Design project for school; I will find out how well they work next week! They should work on signals up to 8GHz, but I can’t test that without a Vector Network Analyzer.

Not sure if want…

This is the result of the third attempt to get the photoresistive film applied decently (very difficult) and gets some boards going. At quandrants 2,3, and 4, I have a test board for an RF switch I am using for my Senior Design project; in the first quandrant are 4 adapter boards for an accelerometer IC I got so I could play with it for an idea I had. Either way, these are going to be redone before I etch them.

Results are not great; none of the 7 boards turned out completely perfect. I think I’m just going to remove it, seek out some finer sandpaper, and… I don’t know. The really hard part is getting rid of the air bubbles in the application of the film (the effect of which can be see on the back, where I didn’t bother trying to stop them since I only needed to focus on one side for the boards). Any suggestions?

Front (useful) side of the board. Imperfections make the RF boards useless; the adapter boards could be salvaged, but I don’t wanna.

Back (silly) side of the board. Looks cool, but I can’t etch the boards like this, really. I could mask the whole side, but I’m going to redo it anyway.

Ultraviolet Exposure Light Box with PIC16F54 Timer

Top of the box with a ruler for scale.

I just finished designing and building a (12.5″)x(12.5″)x(6″) ultraviolet light box with a pic16f54 microcontroller programmed as a timer for the exposure. It was made mostly to be a UV light source for exposing photosensitive film used as an etch-resist in the process of making printed circuit boards. It can also be used as a weapon against vampires.

Close-up of the controller board (upside down! Muahahah!).

The red LED indicates power is connected to the microcontroller (controlled by the small switch in the corner or just by unplugging the wall-wart). Pressing the round black button adds 30 seconds two minutes to the timer, which is indicated in binary on with the 8 orange LEDs; it is limited to 255 seconds (4 minutes, 15 seconds) and suffers overrun if you press the button enough times 16 minutes and doesn’t loop back to zero. Power is applied to the ultraviolet LEDS whenever the timer is greater than zero, which can be indicated by (a) the yellow LED indicating the UV lights are on, (b) the green led blinking once per second as the timer counts down, or (c) the bottom of the box emitting a faint blue glow. The assembly code I spent an afternoon writing can be found at the bottom of this post, if you are curious (My first real ASM program! It was actually kinda fun!).

Inside of the light box; still not sure what the cat likes about this place, but he sure likes trying to get in there.

Measurements indicated that the ultraviolet LEDs are using 29.1[mA] each, so the box should be outputting a total luminous intensity of [latex]16 * (1.375 * 80[mcd]) = 1.76[cd][/latex] at wavelengths between 350[nm]-420[nm] (peak @~380[nm]). The MG Chemicals photoresist film that I use has an exposure sensitivity between 315[nm]-400[nm], with a peak response at 355[nm]-380[nm] (good design, huh? ;D).

The UV LED array has a square spacing of 2.5″, meaning the center of four adjacent LEDs is [latex]{2.5[in] * sqrt{2} over 2} = 1.7677[in][/latex] away from any given led. Using the Radiation Diagram from the datasheet, the minimum surface distance from the tip of the LEDs at which the light cone would be at 25% intensity at these centers is then [latex]{{tan (20,^{circ})} over 1.7677[in]} = 4.8569[in][/latex]. I interpret this as the minimum distance an object needs to be from the UV LEDs in order for the light to be relatively uniform across the whole surface. Beyond this distance, it should become even more uniform; fortunately, my two glass plates, a standard 1/16″ copper clad board, photoresist film, and artwork transparencies add up just under 3/8″, so all is well for my application. The largest copper clad board I ever plan to use is 8″x10″, so my 2.5″ spacing works to keep the UV light at a decent intensity on the edges. UPDATE: Unfortunately, this is not the case, as tests have shown that the board needs to be at least another 1/2 inch from the LEDs. This may have something to do with where you measure from, exactly, but there are visibly contrasting regions visible on a white sheet of paper. The solution I have in mind will be to simply extend the bottom of the box.

Just showing off the light emission.

; Timer for UV Light Box Control
; Initially off. Waits for input to set length of ON time, waits for lack of input, then starts. PORTB acts as indicator of number of 2xminutes to set timer.
; PIC16F54 @ 3.579545 MHz
; Drew Jaworski 2012
#include <>
; delay counter vars
dc1 res 1
dc2 res 1
dc3 res 1
ptm res 1 ; 120 second run timer

	movlw b'11110010' ;RA0 is UV control output, RA1 is timer increment button input (active low), RA2 is clock indicator LED output, RA3 is UV on indicator
	tris PORTA

	movlw 0x00 ;RB7-RB0 are time display outputs
	tris PORTB

	movlw 0x00 ;set all outputs OFF initially
	movwf PORTA

	movlw 0x00 ;initial time to display
	movwf PORTB

	movlw 0x78 ; initial 2xminute run timer setting (120)
	movwf ptm

	btfsc PORTA,b'001' ;check button status
	goto wait_start ;skip back if button was not pressed

;delay 0.25 seconds
	movlw	0xC7
	movwf	dc1
	movlw	0xAF
	movwf	dc2
	decfsz	dc1, f
	goto	$+2
	decfsz	dc2, f
	goto	Delay_2
;end delay

	btfsc PORTA,b'001' ;check button status
	goto begin_run_timer;start if button was not pressed
	btfsc PORTB,b'000'
	goto $+3
	bsf PORTB,b'000'
	goto wait_input
	btfsc PORTB,b'001'
	goto $+3
	bsf PORTB,b'001'
	goto wait_input
	btfsc PORTB,b'010'
	goto $+3
	bsf PORTB,b'010'
	goto wait_input
	btfsc PORTB,b'011'
	goto $+3
	bsf PORTB,b'011'
	goto wait_input
	btfsc PORTB,b'100'
	goto $+3
	bsf PORTB,b'100'
	goto wait_input
	btfsc PORTB,b'101'
	goto $+3
	bsf PORTB,b'101'
	goto wait_input
	btfsc PORTB,b'110'
	goto $+3
	bsf PORTB,b'110'
	goto wait_input
	btfsc PORTB,b'111'
	goto wait_input
	bsf PORTB,b'111'
	goto wait_input

	bsf PORTA,b'000'
	bsf PORTA,b'011'

;delay 0.5 seconds
	movlw	0xAF
	movwf	dc1
	movlw	0xFA
	movwf	dc2
	movlw	0x01
	movwf	dc3
	decfsz	dc1, f
	goto	$+2
	decfsz	dc2, f
	goto	$+2
	decfsz	dc3, f
	goto	Delay_0
	goto	$+1
	goto	$+1
;end delay

	bsf PORTA,b'010' ;set led

;delay 0.5 seconds
	movlw	0xAF
	movwf	dc1
	movlw	0xFA
	movwf	dc2
	movlw	0x01
	movwf	dc3
	decfsz	dc1, f
	goto	$+2
	decfsz	dc2, f
	goto	$+2
	decfsz	dc3, f
	goto	Delay_1
	goto	$+1
	goto	$+1
;end delay

	bcf PORTA,b'010' ;clear led

	decfsz ptm,f ; decrement run_timer
	goto run_timer ;continue next cycle if iwt decrement result was not zero
	movlw 0x78
	movwf ptm ;reset run timer if it hit zero
	;also remove a minute from timer
	btfss PORTB,b'111'
	goto $+3
	bcf PORTB,b'111'
	goto run_timer
	btfss PORTB,b'110'
	goto $+3
	bcf PORTB,b'110'
	goto run_timer
	btfss PORTB,b'101'
	goto $+3
	bcf PORTB,b'101'
	goto run_timer
	btfss PORTB,b'100'
	goto $+3
	bcf PORTB,b'100'
	goto run_timer
	btfss PORTB,b'011'
	goto $+3
	bcf PORTB,b'011'
	goto run_timer
	btfss PORTB,b'010'
	goto $+3
	bcf PORTB,b'010'
	goto run_timer
	btfss PORTB,b'001'
	goto $+3
	bcf PORTB,b'001'
	goto run_timer
	btfss PORTB,b'000'
	goto run_timer
	bcf PORTB,b'000'
	goto start ;reset everything if time has run out

Xmas RGB LED PIC Toy Gift Project

I wanted to make something special for people I know to give as Xmas gifts this year, so I went into engineering mode and came up with something fairly simple, but still fun. Admittedly, this isn’t for everyone, but I don’t care; if they can’t at least pretend to appreciate my hard work and creativity, then they just won’t get the cooler stuff I’ll make next year! That didn’t happen with anyone, fortunately; they all at least seemed vaguely interested. My sister didn’t like the blinking, though, so she gave hers to my mom. Everything was purchased through Mouser.

Close-up of one of the devices (1.25″)x(2.125″).

Essentially, it is a small PCB with two CR2032 batteries (soldered in, because battery sockets seem to cost twice as much as the batteries themselves!), a 5[V] regulator, a pic16f616 microcontroller, an RGB LED, two phototransistors, and some passive components. The PIC is programmed in C (compiled with SDCC, and programmed via ICSP with PicProm), and designed to cycle the RGB colorspace at a cycle rate and PWM frequency which varies depending on input from the two phototransistors.It has many uses! Annoy strangers! Cause epileptic seizures! Run down the batteries and ask me to replace them! Put them in your storage/trash and hope I never ask about them again! It doesn’t matter!

Schematic (created with Eagle 5.11 Light).

PCB Layout (created with Eagle 5.11 Light).

One possible use. Music by The Black Dog. Note: The moving lines are just an artifact of the image sensor on my camera playing catch up with the PWM drive of the LEDs; the real devices do not cause scrolling lines to occur in real world use,

On the long, ranting personal experience and electronics construction details side, this was a very fun and time-crunched project to make. I came up with the idea of making something using a surface mount microcontroller and an onboard battery about one week before Xmas; I had the parts list ready (with a rough idea of how to combine it all) on Sunday and made the order with Mouser on Monday afternoon. Kim ended up paying for them, because I am broke until school starts again; she also helped me with some testing and conceptual feedback, so these were partly her gifts to my family as well. I am very fortunate that Mouser is located in Texas, because I not only get to pay taxes (wait, what?), but Ground shipping only takes two days! I took those two days and used them to make sure my programming equipment was up to date and could work; I was able to get some pic16f54 devices programmed, but it turns out the pic16f616 line is a newer breed that wouldn’t work with my programmer (the passive one on the PicProm website ended up working just fine on my breadboard). I used a 0.300″ SOIC->DIP adapter for the chips, which are 0.150″ wide, so it took some work to get them on there with wire extensions. From there, I just tried various things based on the datasheet and some examples of using SDCC available around the web. I was rushing, but I still didn’t have a finalized design until Thursday evening.

SOIC Breakout board used for prototyping during the design process.

That’s when the real fun began! I’ve been using the well-known laser toner transfer method for a while for making PCBs, as well as a Cupric Chloride etchant (HCl and Hydrogen Peroxide as main ingredients), but I need something better for surface mount work (especially since I will need to use what I learn for my Senior Design project soon; I have some (2mm)x(2mm) ICs just waiting around to be used! The photoresistive process has been backed as allowing much better resolution, little to no distortion, and easily reproducible results. Fortunately, Mouser sells a product by MG Chemicals which is a photosensitive film that can be applied to bare copper (which can be found cheap online at Parts Express, btw). I wasted a 12″x11″ piece of the film because the instructions are flawed, however; they claim it turns from “green to blue” when exposed to UV light, but, in fact, it is BLUE ALREADY! It changes to a darker blue when exposed, as I found out after further testing and concluding that just leaving it outside for 10 minutes or so (even on a thoroughly cloudy day) is enough UV exposure to do the job. None of my compact fluorescent bulbs did the job, probably because they have a UV filter on the inside of the glass tube.

I don’t actually care enough to tell MG Chemicals that their instructions for the 416DFR-5 product are faulty and that the film is never green at any point in the process. I hope someone else trying out this dry film product finds this page and discovers this fact before wasting a sheet or worrying that their new roll of film has already been exposed and tosses it out!

I made a big (7.5″)x(8.5″) board of 24 of the devices, and I had originally intended to use a silver solder paste and a toaster oven to reflow solder everything at once, but the boards ended up coming out inconsistent with a few being too blurry (I need to invest in some plates of thick glass) and a most having missing traces (I need to improve my technique for applying the film to the boards (done in the dark with red an yellow LED lighting, btw!). Thus, I ended up hand-soldering all of them, producing a total of 12 completed devices after staying awake for 24 hours straight, and we left for Houston an hour later. I finished the four I used for the above picture/video today, and the other 8 PCBs are far too messed up to salvage. +163XP and (2x) Level UP!

Matrix Games

I built a fairly cool game/interactive device for my little brother as a birthday present, as alluded to in a previous post.

It consists of a DIY Arduino microcontroller, (8) 8×8 LED Matrixes (total of 32×16 LED matrix), (6) push-button switches, (2) 4->16 line encoders and a 16 channel multiplexer to scan the matrix, a custom-built acyrlic case (some scraps I had around), and a week of hard-paced C-style coding to bring it all together. The video says it all, really, but here’s some pictures as well. This is mostly a one-of-a-kind build, as I’ve never seen anyone else make one (online, much less in real life), but it is a fairly straightforward, off-the-shelf design, so I’m not exactly highly proud of my innovation or something silly like that. :P

Please find enclosed, the Source Code.