Tag Archives: desk lamp

Converting a Magnifying Desk Lampโ€™s Donut Fluorescent to LED Strip โ€“ Part II

Well, I completed the project last night. Here is what I did…

First, I measured the current draw of the LED strip from the PSU. It was 1.45A max. I found a 12V 2A wall wart laying around (trusting it would actually provide 2A), and it fit perfectly in the space at the bottom of the lamp (where the ballast transformer was). I removed the plastic case of the adapter, soldered the power input and output cables (also stabilized them with black hot glue), and used the bottom half of its case for insulation.


The surgery on the 12V 2A wall wart adapter went well.


I used the bottom half of the wall wart adapter for insulation.

After screwing the cover plate of the bottom part back into its place, it was time to make another LED driver card. I had made one of these for a sculptor friend, who is going to use it for one of his lamps. So the firmware and the PCB was ready, all I needed to do was to print the PCB on a piece of PNP paper, laminate it on a 50 mm x 100 mm copper clad, etch it, and solder the components on. The whole process of making this card took me about an hour and a half.


As I stated on a previous post, the laminator does a great job with these PNPs.


2 nice PCBs at once. 50 mm x 50 mm each.


Program the PIC 16F88, and all is set.

My friend, who wanted this LED driver built for him, needed to control the brightness of the LEDs with an optical quadrature encoder in his project (well, he actually said: “no turn limits, very little friction, high resolution”). So the PIC counts the pulses, checks the direction, and feeds it to the PWM DC registers. No look-up tables, no gray code, simple and functional. Works with both mechanical and optical encoders. The only difference is, the mechanical encoders’ A and B pins can’t be reversed, optical ones don’t care. They only need the extra power pin on the board. The mechanical encoder I use in this project is 24 P/R, the optical one I used for his project is 400 P/R. Here’s the schematic, and the PCB shot. Schematic and PCB files are in Proteus Isis & Ares format, but there’s also a PCB print in PSD format. The PIC was programmed in Hitech PIC C. The code is rather simple and efficient. All can be downloaded from here.


The circuit is simple. 12V DC is fed to the LEDs through an N-MOSFET, which is PWM driven by the PIC. The plastic box is an efficient, 5V, switching DC/DC converter, which requires no external components. You could use a 7805 with the necessary capacitors if you chose. The N-MOSFET IRF530 can drive 100V at 14A, continuously. A bit of an overkill, but good for future uses. The firmware limits the DC (duty cycle) of the PWM to 98%, since the N-MOSFET heats up badly (there is a technical explanation for this, but I don’t know what it is) at 100%. The LED on the card is on whenever the min (0%) or the max (98%) value is reached. The PWM frequency is 980Hz, and the DC is adjusted by loading the number of encoder pulses from 0 to 250 (250 is 98% and 255 is 100%) to CCPR1L. Since it would take the mechanical encoder 250 / 24 = 10.42 turns to sweep the whole range, I multiplied the counter with 10, to be able to cover the whole range with 25 pulses (one pulse more than a whole turn). This was no problem with the 400 P/R optical encoder, since 62.5% of a turn (250 / 400) was covering the whole range. It took me a while to be able to fit the card in the space at the head of the lamp. I had to remove a terminal block which was actually unnecessary. I also added two 100 nF capacitors from the A and B pins, which are on the side of the mechanical encoder, to the center GND pin of the encoder for debouncing.


I had to push the card under the lamp to open up room for the rotary encoder.


The two 100 nF capacitors for debouncing.

As I was thinking about drilling a hole in the head of the lamp for the quadrature encoder, I realized could actually use the hole for the starter of the old fluorescent lamp. But there was a problem. The hole was too deep for the length of the knob on the encoder. So I turned aย  25 mm long aluminum cylinder with 20 mm diameter (good for the 22 mm hole), and drilled a 6 mm hole 12 mm deep (encoder shaft length) at its center. I also cut a grove around the end, and sanded the edges for a better finish. Later on I drilled and tapped a hole on the side for a M4 setscrew. I was actually proud of this last part. It looks really good IMO.


Mechanical encoder with the new knob on. The smaller original knob is on the right.


The encoder was stabilized using black hot glue (gunk).


More detail on the knob.


Click click!

After stabilizing the card in its place, and making the necessary connections with the cables, I screwed the plastic cover back in its place, and finished this project / hack. Here are some extra shots of the lamp and other details.


The blue LED is on when min and max DC values are reached.


From another angle.


All covers closed, ready to go ๐Ÿ™‚

I also made a rather affordable MIDI Thru box for my music setup in the meantime. I will be writing about it in my next post.


I decided to put the status LED outside for better visibility. Since I didn’t turn off the lamp (what a noob!) as I was unscrewing the cables, I shorted the PSU, and fried it. I mounted the LED in a hole by the knob anyway. The fuse was blown, so I went and got another 0.5A glass fuse. But when I came back, I realized I had fried the IC as well. So I went and got another PSU, 12V 5A (3A was the same size) this time. The case looked bigger than what the space at the bottom of the lamp could handle. Yet, when I opened it, I realized I could saw off an ample part of the PCB, since the traces were straight, thick, and long towards the right. And I didn’t need the 220V socket. So I did that, soldered and gunked the cables back in their places and closed case cover.


The PSU, after about 20mm from the right part of the PCB was cut off.


A perfect fit ๐Ÿ™‚ I put a piece of cardboard at the bottom for insulation.


Status LED on when DC = 0%


Status LED on when DC = 98%

Ok, now I can use my lamp…

Converting a Magnifying Desk Lamp’s Donut Fluorescent to LED Strip – Part I

I’ve had a magnifying desk lamp for years, of which starter plug, and donut fluorescent lamp had died last year. I wanted to replace the lamp with a LED block made for this purpose, but I could not find one anywhere here. So, I decided to make my own. I had a 3m 12V white LED strip (50 x 3 LED strips, merged together) in stock from another project, which I could use for this hack. The lamp had an ID of 150 mm and an OD of 207 mm. All I needed was a circular cardboard piece of the same size, so I could stick the LEDs on it.

Then I had an idea! Why not wrap the LED strip around the old fluorescent lamp? I made some calculations, and realized the LED strip was the perfect size. The diameter of the fluorescent lamp was about 180 mm at the center of the cylinder (28.5 mm thick) forming the donut. So the circumference was about 565 mm. Each 3 LED section of the strip (10 mm wide) perfectly covered one turn around the cylinder. So I needed roughly 565 / 10 = 56 of these 3 LED sections. I had 50 all together, whichย  was enough ๐Ÿ™‚

I started with disassembling the desk lamp, removing the fluorescent lamp and the ballast transformer at the base. I decided to keep the already mounted cables and the switch.


After unscrewing a couple of screws, the bare-bones of the lamp was ready for the hack.

The plastic part of the fluorescent lamp and the piece holding the starter were crumbling to pieces, probably due to heavy UV exposure from the lamp over time. I replaced the plastic part of the fluorescent lamp with duct tape, and started winding the LED strip around the donut.


It took me a while to nicely wrap the adhesive backed LED strip around the donut lamp.


Quarter way through.


And here’s a nice donut LED lamp with spiraling LEDs all over.

I stabilized the final winding with duct tape as well ๐Ÿ™‚ Next, I inserted the leads of the LED strip to the terminal block in the lamp’s head, and and placed the lamp in its grove. Finally I placed the huge magnifier in its place, and screwed the transparent lid back in its place.


Looking good ๐Ÿ™‚


Here’s the final assembly. Still needs a LED driver, and a part to stabilize the PSU.

I used a 12V 5A switching power supply for this lamp. I still don’t know the current draw (should be about 1500 mA), and I’ll measure it tonight. Eventually, I may get a smaller PSU, so I can fit it better where the ballast transformer was. I also made a simple PWM driver with an N-MOSFET, for driving high powere LEDs. I’ll also use it with this lamp for adjustable lighting. All will be explained in the next part.

Here are some shots of the lamp while it’s on. Although it’s hard to tell from the pictures, I’m rather pleased with the amount of light the LED strip puts out.


See you in the next part ๐Ÿ™‚