Category Archives: code snippets

PWM Based LED Driver

** Updated code for better performance and stability [26 Feb 2015, rev.3]

It has been quite some time since my last post – as often happens, life intervenes and this time just a bit too much hospital time both for myself and one of my kids. Things are good now and normal can resume…

Black-Decker-FSL18FL-Firestorm-18-volt-FlashlightFor years I have had this Black&Decker FireStorm FSL18 flashlight, but hardly ever used it due to its anemic light quality. The fixture is powered with an 18v battery pack and uses a KPR18v0.3A bulb putting out 7 candlepower when running at 18 volts. 1 candlepower = 1 lumen. Compared with the brightness of the 12v power LEDs I have been working with lately, the brightness from this incandescent bulb is not much better than a glassed candle.

The trigger for upgrading this flashlight came one day when the wife complained an LED lightbulb had failed in her workshop. I replaced the bulb, but rather than throw it away, I took it down to my workshop to disassemble and identify what had broken. Continue reading

Advertisements

Simple PROM tester

In order to grow my inventory of parts, I scrounge the interwebs for people selling boxes of miscellaneous parts. I try to find those that look to have come out of a company’s lab or workshop. Sometimes I find some really cool stuff. Recently I picked up a batch of very old bipolar PROMs – memories that can be programmed once but read many times. The ones I found (82s129, 8bitx4, 1K) were used in arcade game consoles and Motorola two-way radios.

I know a few people who really want to have these, but they don’t want to waste their time writing data to used or bad chips. To keep them happy, I built a simple PROM tester, that scans through the entire memory array looking for high bits. (E)PROMs by default are all zeros. When they get programmed, the necessary bits are set to HIGH by exposing the bit to high voltage and burning an integrated nichrome fuse. Once the fuse has been burnt, it stays that way.

Photo on 4-4-14 at 11.11 PMTo check if the PROM has been used, I made a small circuit with a CD4040 binary counter and an Arduino. The binary counter has 12 output pins and when it receives a pulse on the pulse pin, it increments the output by one binary bit. The Arduino then scans the PROM output and checks for any HIGH bits. If one is found, the program halts and lights the PROM-BAD LED. If all bits are LOW, the Arduino sends another pulse to the binary counter and checks all the bits again until it reaches the max number of addresses the chip supports. If everything has been found good, the PROM-GOOD LED is lit and the program halts. Replace the PROM, hit reset and start over.

This same program can be used to test any type of memory for zeros. Static ram could be tested for write as well, with a few modifications.

The code can be found in my code repository.

The PNG schematic is here. Eagle schematic is here.