Show me your sp00nz

From Electriki
Jump to: navigation, search

A.K.A. The *555 drawer LED lighting driver.


What is this all about?

There is a lot of LED lights on the market. In all forms: bulbs, LED strips, TV backlights, etc. Generaly everything is being lit by LED nowdays. A lot of solutions, colors, shapes, but the fact is - it's the same LED technology shining bright in every single solution. So while people all around glue their remotely controled RGB LED strips to any single piece of wall/ceiling/cupboard that hasn't been lit yet - i decided to light my cutlery drawer. There are solutions on the market, yes. But the simpler the design is, the cheaper it gets... read on!


General idea

So how this kind of drawer lighting systems work like, is that they just lit when someone opens the drawer. Then the light is being turned off by either closing the drawer or by the driver automaticaly (after a pre-set delay time). This is it. No more, no less (or is it?).


Solution v1.0

Solution v1.0

In fact, the "less" of idea variant is possible... To simplify the design, i dropped the "turned off by closing the drawer" part. This driver only turns on the light for a pre-set period of time. Yes, the typical *555 monostable operation scheme (Figure 1.). Except for one tiny detail, but read on.

Sensor can be pretty much everything i guess: mechanical switch, Domen's stargate switch, inductive sensors, etc. But for a really simple, cheap and compact design i chose reed switch. Idea is to attach a magnetic element to the drawer, so that when it's closed the reed switch's electrodes are short-circuit'ed (switch closed). When someone pulls the drawer out - magnet gets away from the reed switch, thus switch gets open. This kind of operation held me from directly connecting this switch to a puled-up TRIGGER input of the *555. The thing about *555 is that in monostable operation it produces a high-state on OUTPUT for a set period of time. This time is set by a capacitor and resistor connected to the chip (R and C on the datasheet drawing on Figure 1.). However, no matter what values do these elements have, the output pulse will not be any shorter than the TRIGGER line's low pulse's duration. This explains why i needed a fixed-length triggering pulse circuit. The simplest solution is usualy the best one. Serial capacitor and pararell resistor attached to the signal line should do. So i've put this circuit together in pspice, I did some simulations, I have fixed few things, played with values and no matter what i would get there, i couldn't get this capacitor to not-produce returning (discharging) pulse on the TRIGGER line way above VDD value. The *555 doesn't seem to have any protection on the inputs, and the rated absolute max value of input voltage is VDD, so sadly - yes even a diode wouldn't save the day here (well maybe Schotky's diode would in fact be okay, but let's not experiment here, but just make it work as it should). So basicaly this little feature eliminated the schools/universities' concept of Differentiator [1]. Other solution was to isolate the TRIGGER line from the capacitor with a NPN transistor, as shown on the final schematic below (Figure 3.):

The C3 capacitor cuts DC off the T2's base. It only lets through the AC part of the reed switch switching (switchedy switch switch yo!) its state from 0 to 0,5VDD. While this switching is taking place, the C3 is being charged in both directions: voltage on T2's base changes from -0,5VDD to 0,5VDD. Still this is not that important, as I am powering this whole driver with a 9V battery, thus the T2's base is being treated with around -4,5V to 4,5V voltage. Well the P-N base-emitter junction can handle this w/o any major problems so it's irrevelant. What is relevant though, is the fact that this pulses are strobing T2's base only for a short while when switching the reed switch. And this is what we want here, right?

Note: After presenting this to nomead and SM_Barbie, they both laughed at the basic error of setting no bias point for the T2 here. Well as long as the base isn't some sort of antenna here, i believe it's safe to say this transistor's base (after discharging the C3) is connected to ground. However, to remedy the situation and to make it the OE-circuit-101 compatibile, i have soldered another 2 Meg [Ohm] resistor between T2's base and emitter. I first though that there are some noises on the base that this resistor could help to eliminate, but in fact, it didn't change a damn thing to the primary design. Still it is there soldered on the board. CBA to desolder it out, really.

When i was playing with pspice, i've also noticed that there's a very short low pulse showing up on the T2's collector sometimes when the switch gets closed again. This is probably caused by discharging C3 quickly, however I decided not to test if this happens in real world as well, and I have put the filtering capacitor to make this problem go away (C4 on schematic). This covers the input circuitry here, and for output... well you never really know what you're going to put there. VDD for CMOS version of *555 can vary from 2VDC to 18VDC (iirc), so one can have a 12V bulb on the output, a single diode, set of diodes, set of bulbs, whatever your power supply handles here (watch out for the -0,5VDD voltage on the T2's base 'feature' described above though!). Would this be a good reason to put there a power-transistor to drive the output light source? Well I don't know really. As for me, having few unused IRLR2705's in my drawer was just about enough of reasons to put it on this board. It just gives a lot of more performance than one expects from simple LED driver, really. And it's cheap.


Other pics v1.0

Conclusions v1.0

After few weeks of using this, I can tell my thoughts on this version:

+ mom likes it,
+ it just works,
+ simple design,
+ cheap design,
- battery went dry after ~3-4 weeks,
- fixed lights-on time,
- no drawer closing detection.

Only one conclusion: this has to be upgraded.


Solution v2.0

Solution v2.0

Actualy instead of upgrading this controller I decided to build new one. Atmel released those very small packaged (SOT-23) ATTiny's. Those have four GPIOs, external interrupt, timer with PWM and way too much memory for simple application like this one. Small package allows to keep the compact size. Previous design proved that replacing battery with power supply is a must. Using microcontroller also allows to detect when the drawer is being closed... which allows to eliminate the fixed time-out problem. All's tip-top then? Hopefully! Let's have a look at schematic and PCB (~30x20mm, single sided) of complete device in version v2.0:

The commonly found LED stripes work with 12VDC supply, this is why this is the optimal nominal voltage for power supply. Microcontroller runs on wide range of 1.8VDC - 5.5VDC. LM1117 5.0V LDO should be just fine, and it comes in DPAK package which is also a plus. Every other aspect of this design is either carried from version 1.0 or so simple it's not even worth writing about... Well all except the programming.

This Tiny MCUs family uses TPI programming protocol. Programmers are available and whole subject is widely covered in the datasheet. Only thing worth commenting is the fact that with very compact chip's size, one gets limited pincount. This forces to use the same pins to program device (yeah it has ISP!) and drive the application. Basicaly the pins shared betwen app and programming interface should be separated with resistors to prevent from any potential unwanted occurances. I've decided not to install any programming header in here, just to keep the small size of device. For small series (well I need two of those) this is not a problem to solder few wires during to just upload the code and remove them afterwards. Compromise, yes. Now everything's cool? Word.


Conclusions v2.0

B-|


Yours truly,

pit, 2011-02-01 (version 2.0 @ 2011-03-31)