Sunday, November 7, 2010

110V Lamp Bulb replacement

With one of the 10 Watt LED lamp kit Roberto sent, I tried to build a bulb replacement.
Here some notes and comments.

First attempt

I started from an old CFL lamp, removing the fluorescent tube and the electronic ballast.
The LED power supply in the kit was round and fit perfectly the old CFL base.

The initial kit included the 10 Watt LED and a small square heat-sink with a fan.

I glued the LED to the heat-sink with a thermal compound and I attached the heat-sink to the CFL base using hot glue.
Unfortunately I don't have pictures of the first bulb replacement attempt.
It worked nicely until one day the fan broke down. Without the fan the temperature of the heat-sink was high enough to melt down the hot glue, detaching the heat-sink and the LED from the bulb base.

Second attempt

I had to rebuild the lamp bulb.
This time I choose to have a passive heat-sink, so I ordered one round and big enough for the 10 Watt LED.

The problem to solve was how to connect the heat-sink to the bulb base.
I decided to try the same method adopted for one of the desk lamp modifications.
Since the bulb base is around 2 inches diameter, I cut a piece of wood with that diameter.
Lee was able to drill and tap a hole in the heat-sink in order to screw it to the round piece of wood.

I did a hole in the bulb base to have the wires out and then I screwed the wood round piece to the bulb with 4 screws.
Here the lamp assembled and a detail of the attachment to the bulb base :

The only problem so far is that the bigger heat-sink prevent to use the lamp in many of my fixtures !!
Otherwise is working perfectly.

Friday, November 5, 2010

Flood alarm with X10

This simple project was done years ago, it can be an excellent example to show how is easy to integrate X10 in our own projects.
I needed a simple low cost flood alarm, capable to monitor some sensors and notify as soon as possible about flood conditions.

The problem

X10 Universal module
After two floods in the basement, one from the washer and one from the HVAC, I decided to monitor these area to avoid further problems. 
I also needed a way to be informed in the rest of the house about a problem in the basement, where the problem happened.
So I decided to use an X10 transmitter, controlling an X10 Universal module (it has the possibility to generate a sound when triggered).
The the transmitter was modified, in order to control the pushbutton with a rele reed.


Since I needed something simple, quick to build and reliable, I used the usual PIC 16F84, plus some external components (at the time I was using PICs rather then the MSP430).
Before to excite too much who is reading this article, I built the X10 interface hacking a ready-made X10 RF transmitter.
So I didn't designed nothing directly with X10.

I always try to optimize the effort and re-use as much as possible what I have around, so instead to design an X10 transmitter, with all the problems that such design imply (interface the power grid, insulation, ecc.) I choose another way also because the flood alarm is supposed to be placed in areas potentially flooded !

So I choose to use a ready-made X10 RF transmitter, drove it by a reed relay, simulating the pushbutton.
In this way I was able to obtain the requested insulation and safety and also the capability to place the alarm everywhere needed.

Here a block schematic :

Here a floor map of the basement where the flood alarm was deployed :



As I said before, the hardware is based on the PIC 16F84 and the code is not critical, so it should be  easy to port it on other PICs or other Micro controller.
As you can see from the schematic, the PIC is handling directly the LCD and the sensor, based on a Cmos port.
There is nothing to add, is almost all standard.


The sensor, based on a CMOS 4049, is very simple.
When no water is touching the two terminal of the sensor, the port is forced by the pull-up.
As soon water connect the two sensor entries, the port change state.
The LED was placed just to debug the system, is not necessary for normal operations.
The capacitor between the sensor terminal allowed to stabilize the signal event, removing noise.
Since the flood condition is (hopefully) a rare one, I didn't bother to use an AC signal to prevent sensor corrosion.
This is a flood alarm, not a level indicator so the sensors are supposed to be dry all the time.
To avoid false alarms the software filters out the reading of the sensor, cutting out any possible "spike"


The software is written all in C and compiled with the PICC Lite. It's very simple.


As you can see, the firmware perform a debounce function for each sensor input, in order to avoid as much as possible, false alarms.
Because the type of events to monitor, 10 seconds to have a positive reading for a flood, are more than acceptable.
That allowed to simplify the sensor electronic design.



For this project I used two types of sensors :
  • Sensor 1 - in a pipe
  • Sensor 2 - on the floor
In order to built the floor sensor, I used a toy container, the ones that is possible to find in some coin machines, at least here in the USA.
I screwed 3 screws on the bottom, connected a wire to one screw and the other wire to the other 2 screws.
Then I added some plastic clay to increase the weight of the sensor (be sure the clay used is not conductive and water resistant) and "glued" the entry wires with other clay.
The pipe sensor, to be placed in the T junction at the output of the HVAC, was built with two brass bars, glued with hot glue, to a pipe cap.


Here some pictures of the circuit and the placing.

The box used to host the circuit is a plastic display box for dolls.
Easy to find and work (Plexiglas) it gives an interesting view of the circuit and is easy to seal.
Note the X10 transmitter at the base of the box and the rele reed that controls it.
They are just attached with some velcro.
The X10 transmitter still uses it's own original batteries, they last years in normal use.

Here the sensor for the pipe.
The pipe it was bringing out the water from the HVAC condenser and sometime there were "clogs" in the end of the pipe.
When this was happening, the water generated by the HVAC overflowed from the condenser in the basement.
Quite a mess.

Just in case the pipe sensor was not able to catch the flood, I prepared another sensor and placed just on the bottom fo the HVAC unit, where I noticed the water going first.

Here a modification for watering the plants.
We had a very dry and hot summer, so I decided to collect the HVAC water to water the plants.
I used a big container (actually a paper waste) and created a very fast "sensor" using two PC slot covers attached to one entry of the flood alarm.
In this way when the bucket was almost full the alarm would tell me so, allowing me to empty the bucket and water the plants.

In order to fill up the bucket, I temporarily diverted the pipe coming out the HVAC.


The flood alarm worked for a couple of years without problems and currently is in some box, since the moving changed the needs.
At least I know to have it if the need arise again :-)

The most critical part, the sensor, was actually extremely reliable even if so simple.
Only one time I had problems, when a sensor wire broken up, because my bad installation (never EVER use uninsulated pins to attach a cable just because you run out of time !).
But other than that the circuit was really stable and reliable, saving me at least from 3 floods.

As usual, if somebody is interested in the source code, just contact me.
I don't have yet set up a public place where to store the code.

Sunday, October 24, 2010

Repairing a Mickey Mouse Lamp

My daughter has a nice Mickey Mouse lamp.
We bought it years ago and it worked nicely for many years, until "somebody" connected it to an X10 Lamp module.
After few times, the lamp stopped to work completely.
In this article I'm documenting the repairing process.

The lamp

Here the lamp.  Mickey is pulling the cord every time the big red button is pressed, while some sentences are spoken, turning the lamp on and off.

The circuit

Inside the base of the lamp, are present four PCBs.
  • Main control module
  • lamp activation module
  • pushbutton support
  • main power support
Here a schematic block of the lamp, obtained looking the circuit :
The LAMP control module feeds the transformer via a main fuse, and it  receives from the Main control module the command to activate the bulb.
Here a picture of the inside :

On the left lower corner, it is located the main control module, just below the transformer.
On the righ side, the LAMP control module.

Main control module

The main control module circuit, is the main PCB of the lamp.
The main controller module performs these functions :

  • it power supply the circuits
  • it controls the bulb  via the LAMP control module
  • it controls a motor for some motion effects
  • it generates sounds/voices when the lamp is activated/deactivated
  • it handles the main on/off pushbutton

LAMP control module

The bulb  control module (called LAMP in the block schematic) feeds the transformer that power the main control module via a fuse, and it receives via photocoupler the comand to turn on/off the bulb.

Here a schematic of the LAMP module :

Open the lamp

It is quite easy to open the lamp.
On the base there are 4 adhesive pads. Under each pad there is a hole containing a screw that connect the base with the main body of the lamp.
After the screws are removed, the bottom of the base is coming out.
The PCBs and the transformer are screwed to the upper part of the base.
The only annoying thing is that all the wires are soldered to the PCBs, no connectors. 
 bottom1.jpg bottom2.jpg
 bottom3.jpg lamp2.jpg

The problem

The lamp was totally dead.
Measurement made on the LAMP  control module didn't show up any problem.

The diagnosis

Since all the functions of the lamp, motion, voice and lamp, were dead, as the first thing I checked out the  power supply.
Hooking a voltmeter to the transformer secondary (blue wires) showed up 0 volts.
Then I disconnected the transformer secondary from the main control boards and did again the tests.
Still 0 V.
So it seemed the transformer was gone.
To be sure of that, I disconnected also the primary of the transformer (cutting out the red wires) and removed it from the base.
The primary resistance of the transformer was infinite, the secondary one 0.6 Ohms.
So the primary of the transformer was broken, thus no power to the entire circuit.
I then hooked up a DC power supply to the main board control, when the secondary  of the transformer was connected.
Around 7V the circuit started to work.  Pushing the ON/OFF button the character spoke and moved as usual.
However connecting the main power (110V) to the lamp, the lamp remained OFF
Possible reasons :

  • a) also the circuit that control the bulb had problems (SCR dead or some diodes broken)

  • b) the LAMP control module needed to be driven with a signal in sync with the AC line
    Since I used a DC power supply to test the main control board, I didn't have any AC signal

  • c) the bulb was broken
The last one was correct.
The bulb was broken.

The  repair

Since all the functionalities of the lamp were present when powered with the DC power supply, in order to repair the lamp, the transformer had to be substituted.
In order to do so, I had to figure out  what transformer to use.
The original transformer was labeled "HUNG KAI 4104".
A search  with google showed only a Chinese company who produce it (Hung Kai Electric Co) and that the model 4104  belonged in the category of transformers below 15W, with max. voltage of 42V.
Clearly the original transformer was  NOT sending out 42V, a main line capacitor on the main control board  was a 16V max electrolitic.
Since the main circuit board was working with 7V DC, my first guess was that the transformer had to be a 6V one.
I found on Jameco a 6.3 V transformer, 1.2 A , with dimensions "close" to the original one. 
Approx 6.3 V AC, once filtered  become around 8V DC

Here the "fix".
The transformer is little bit bigger than the original one, so it is attached upside down, with  some high heat hot glue on the top and a velcro support (not in the picture) on the base to avoid movements (safety must be always the first concern when repairing electric appliances).
It is also possible to see the rewiring (yellow and white wires) connected to the original wires (red and blue).
The small gray wire is the one in parallel to the original pushbutton, connected to a jack.
This is used to command the lamp with an X10 Universal module  (see below).
The unused wires on the transformer, were cut and insulated and glued to prevent short circuits.

The improvement

Since the lamp was open, I decided to add a jack to "bring out" the push button ON/OFF function.
In this way it is now possible to control the lamp with a remote push button or connect the lamp to a X10 Universal Module .

Sunday, October 17, 2010

Hacking an Infoglobe - part 5

In order to better test the interface permanently connected to the Infoglobe and free up the breadboard for other experiments, I finally I decided to build an Infoglobe interface on a small experiment PCB, with the technique of point-to-point connection, i.e.wired.

I considered to prepare a PCB but since is still a prototype, is better to build it "fast and dirty", i.e.  a point-to-point connection on an experimental board.
Also, I didn't want to spend too much for that, so I looked in the junkyard for components and housing.

I found a nice box I bought years ago for who-remember-now project and I started to collect the components.
I decided that a broken piece of experimental board from Radio Shack was enough for the job, so I collected all the components and started to prepare the first Infoglobe Interface for permanent test.

First I prepared the mechanical part, i.e. drilling the housing to connect a DB9 female, an RJ11 outlet and two holes for the pushbuttons.
With the help of some power-tools I was able to do a "just-barely-decent" work.
No, I'm not really good with the mechanical part.

Then I started to figure out how and where to place the micro-controller PCB.
I picked up a new MSP430F2012 PCB and look in the junkyard to see what I could do.

I started with a straight 7+7 DIL (male and female) but the micro was too hight for the box, so I had to use two 90 degrees 7+7 DIL to obtain a decent hight.
Unfortunately that left very few space for the rest of the components !
Well, will be a very populated board !

With the power tools I beautified (well ...) the broken experimental PCB and started to place some components on.
Here the layout of the experimental PCB I'm working on:

A quick note. The current firmware revision of the code, include the reading of the internal temperature of the MSP430F2012 internal sensor, connected to the ADC.This why the two pushbuttons. They select the operating mode.
More details in future articles.

And here some other pictures of the prototype.