kaybee.org  
  Home  
  KickstartWeb  
  AutoScrapbook  
  ImageBackup  
  PerlTW  
  Whole-House Audio  
  Fan Control  
  ProjectAdmin  
  mp3Rip  
  Logwatch  
  Linux  
  Books  
  Donations  

Misterhouse Hampton Bay RF Fan Control

UPDATE: I just pulled the whole setup apart as I was going to wire up a second transmitter in the attic. I decided to move the transmitter away from the Weeder cards in the process. Now it works 10 times better, including reaching a fan that it could never control at all before. I only moved it about 18" away from the Weeder cards, and it made this huge difference. I would have moved them further but that is the length of all of the wires I had on there. If I was to start from scratch, I would change the following:

  • I would have placed the remote back in its original case once I had soldered the wires on. I would have made each wire 3-4ft long and had them coming out of the battery compartment. If you only need to toggle one DIP switch from the computer, and you are not using Reverse, you could use a length of CAT5 cable since it has 8 wires (+9V, Gnd, Light, Fan Off, Low, Med, High, DIP switch).
  • I would have then kept all of the custom circuitry close to the Weeder boards and keep all of that several feet away from the remote control transmitter.

You can download "stable" version 1.3.1 here (I call it "stable" because I think I'm the only one who uses it so it is hard to quantify the quality of this release).

This code has the beginnings of dim control, but the RF is not reliable enough in my house to allow it to work very well, so don't expect any progress in this area. But it deos have a option to go through and make sure all of your fan lights are set to come on at maximum brightness.

Secondly, my pictures for this project are visible here.

Now, here is the README file from the tarball and is the extent of the currently available online documentation. If you download the tar file from above you will also get some schematics which should help you create the circuits as described here:


You have downloaded a set of instructions and some Perl code that allows you to
control RF Hampton Bay ceiling fans from your computer.  First, some
disclaimers:

   1) I am not an electrician nor an expert at Electrical Engineering.  One of the
   things you must do to support this is run a wire from each fan to your computer.
   This might be in violation of building code and/or be dangerous.  You might
   burn down your house.  Mine has not burned down yet, but only time can tell!

   2) To reiterate, if you blow up your computer or burn down your house, it is
   not my fault.  I make no claims that anything here is safe, but I hope it
   is.  If you have any suggestions to make this safer, please email
   kirk@kaybee.org.

   3) I'm sure everything can be done better.  Please send suggestions to 
   kirk@kaybee.org.

   4) This is NOT EASY.  You must be DEDICATED to accomplish this.  It will
   require building circuits and crawling around in your attic plus some
   money.

So, why do all of this?  Well, what you get is:
   1) Control up to 16 Hampton Bay ceiling fans via RF.  This includes light
   on/off, dimming, all three fan speeds, and even forward/reverse.
   2) The existing RF remotes still can be used to control the fans.

So, why not just use an X10 wall-switch?  Well, all it can do is turn all of
the power on and off.  So, you could turn the whole fan off (to turn off the
light) and then turn it back on (so that the remote still works).  But you also
turned off the fan.  And there is no way to turn anything on this way.  Plus,
the remote control allows 3 different fan speeds without any humming, which is
better than all but the most expensive X10 wall switches could do.

SUMMARY/OVERVIEW
----------------

So, to start, here is what you will need.  Again, this could probably be done
very differentely.  For example, I know it would be possible to just generate
the RF sginals directly.  But I'm not very good at EE... especially not RF.  So
I went the digital approach.  So, I purchased an extra Hampton Bay RF remote
control from Home Depot.  It came with a fan control unit that I might use for
something else in the future.  It was about $30.  I then purchased a Digital
I/O module from Weeder Technologies (http://www.weedtech.com/).  That was $59.
I then used some transistors and resistors to allow the I/O board to control
the DIP switches (to select between different fans) and to "press" the buttons
on the remote.  I find that the remote can reach all of the fans in my
particular house.  Your mileage may vary.  You should test the new remote
from its destined location before you disassemble it to make sure it can reach
all of the fans;)

So, that doesn't sound too hard, right?  Well, there is one problem.  It is the
Light On/Off/Dim button.  I hate toggle buttons.  The computer has no way to
know whether the light is on or off.  So, it doesn't know what will happen when
the button is pressed.  Sure, it could try to keep track of the state, but then
you couldn't use manual remotes as it would screw the state up.

This is where the new wire comes in.  If one wire is run from each fan's light
to the equipment room, the voltage applied to each light can be monitored.
This allows the computer to know if the light is on or off and also to do
controlled dimming.  But this also means that you'll need to buy a Analog Input
board from Weeder (http://www.weedtech.com) for $69.

CURRENT PROBLEMS/SHORTCOMINGS
-----------------------------

I have a few problems with my setup currently.  I'd be happy to hear from
you if you have any ideas or theories about these problems.

1) My fan remote is centrally located to 4 different fans, which means it is
not in the same room as any of the fans.  I have problems with the fans
not getting my signals sometimes.  I have two fans, for example, that are about
10 feet apart and I temporarily set both fans to the same channel.  The closer
one responds pretty well to the lights on/off signal, but the further one 
responds better to the Fan High signal.  Who knows why?

2) Dimming is problematic because the light sometimes flickers, presumably due
to poor RF signal strength.  It works better some times than others.  But, if I
take the fan's real remote and place it literally 6-inches away from the remote
the computer uses it seems to work just fine.  I don't know what I could have
done to make the remote work worse than others, but I seem to have done it ;)

PARTS/COST
----------

You must have a home automation computer.  I use Misterhouse
(http://www.misterhouse.net) on Linux, but you could probably adapt the code to
work in other environments.

You must have a serial port for the Weeder cards to connect to.  I had to buy
an 8-port serial expansion card from www.byterunner.com.  It is an 8-port PCI
card with an 8-port octopus cable and it worked great in my Linux system.  I
bought the PCI-800H-9 for $147.

You must have a soldering iron and know how to use it.  A pretty good one is
recommended so that you don't ruin your remote control when you solder wires
onto it.  A multi-meter is probably required for testing purposes.  

                                       APPROX.
PART                                   COST     MY SOURCE
------------------------------------------------------------------------------
Spool of 14-gauge solid-core wire      $15      Home Depot
Extra Hampton Bay RF Remote            $30      Home Depot (came with receiver too)
Weeder Technologies Digital I/O Board  $59      www.weedtech.com
Weeder Technologies Analog Input Board $69      www.weedtech.com
Enclosure (sprinkler enclosure)        $25      Home Depot
9V *REGULATED* power supply            $15      Radio Shack
Diodes, resistors, capacitors,         $10-$20  Radio Shack/Electrical Supply
   transistors, wire
Solder Bread-board                     $5-$10   Radio Shack?/Electrical Supply

TOTAL: Less than $245

NOTE: The enclosure I bought is way overkill, but it gives me room for
other projects.

The electrical parts summary are calculated based on the number of fans (N)
and the number of DIP switches (D) as described in the next section and the
number of remote control buttons you want to control (B) up to a max of all
6:

NPN transistors (B=200): D+B
1.5 MOhm resistors: B (you may want to use smaller... see comments below)
10 MOhm resistors: D (you may want to use smaller... see comments below)
180kOhm resistors: N
15kOhm resistors: N
Diodes (breakdown voltage of at least 150V and max current of at least 1mA): N
Capacitors (around 4.7uF, 5V or higher): N

DIP SWITCHES
------------

You can save yourself a little bit of work by making sure that your fans use
efficient DIP switch allocations.  Each bit on the DIP switch that you need the
computer to be able to change is one more circuit you will have to build.  So:

1 fan:     no DIP switches need to be controlled
2 fans:    1 DIP switch needs to be controlled
3-4 fans:  2 DIP switches need to be controlled
5-8 fans:  3 DIP switches need to be controlled
9-16 fans: All 4 DIP switches need to be controlled

In my case, I have 4 fans.  So, I made sure that all four fans had two of the
DIP switches set EXACTLY the same.  The other two DIP switches have a total of
4 different combinations and hence each fan used one combination.

RUNNING ONE WIRE TO EACH FAN
----------------------------

Since this wire carries 120VAC directly from the fans, I doubt this is
completely to code.  I figure that I'll undo the wire splice before I move.

Do this step first because if you can't do this then the rest is kind of moot.
Also, change your DIP switches, if necessary, as you are up messing with these
fans as described above.

This was by far the most difficult part since I have 4 fans.  I bought 1000' of
14-gauge solid-core wire from Home Depot ($15).  I then ran a wire from each
fan's location into my equipment room (where the computer and the remote will
be located).  I fed the wire into the electrical box from inside of the attic.
Unless you live in Phoenix, AZ and are doing this in the dead of summer I don't
want to hear any complaining.

I ran out of the attic and hopped in the pool.  I then took the collar off
where each fan meets the ceiling.  Three of these fans were here when I bought
the house, so I found out I had three different types of fans:

   1) One fan had a separate light kit that could be removed.  The remote control
   receiver (with the DIP switches on it) was inside of the light kit which was
   *under* the fan motor.  Difficulty: MEDIUM.
   
   It had a condiut down the center of the fan motor that had plenty of room
   and a few wires already run through it.  On this fan I was able to feed the
   wire from the attic down this conduit and out the bottom of the fan motor.
   My loving wife held the fan up while I did this.  It probably would have
   been easier just to take the whole thing down like the next type.
   
   I then used a crimp-style wire splice (Radio Shack and Home Depot has them)
   to hook this into the "to light" wire that goes to the lightbulbs.   I then
   put everything back into place and was done.

   2) The next two fans had tighter conduits through the fan motor.  The RF
   receiver seemed to be integrated inside of the fan motor component that 
   I didn't want to take apart.  Difficulty: HARD.

   I took these completely off of the ceiling.  I then used another piece of
   14-gauge SOLID CORE (i.e. stiff) wire and eventually shoved it through
   the condiuit from the top towards the lights.  Unfortunately, it can only
   get about 1/4" through the bottom before it hits a piece of metal.  I then
   had to use pliers to pull it the rest of the way out.  Don't get me wrong.
   This one was very difficult.  It probably took me about 30 minutes each
   to get the wire through.  I thought it wasn't going to happen for a while.
   It just takes lots of attempts until it finally gets through.

   I then used the same crimp-syle wire splice to tap into the HOT wire going
   to one of the light bulbs.  I then put the fans back and used a wire-nut
   to connect the wire in the attic to the new wire that I ran through the fan.

   3) The last fan, thankfully, was a piece of cake.  The RF receiver was
   actually in the collar area against the ceiling.  And a wire nut connected
   the "to light" wire to the fan.  I just added my new wire to this existing
   junction.  Difficulty: EASY.  NOTE: When testing to make sure I understood
   it correctly, I found out that the "to light" will stay fixed at 120VAC
   regardless of what you do with the remote unless it is actually connected
   to a load (the light).  It confused me quite a bit at first.

NOTES:
   1) BE SURE you tap into the HOT wire to the lightbulbs and not the Neutral
   wire!  They may be the same color.  If in doubt, test it with a multimeter
   before you do anything!
   2) Don't forget to cover the other end of the wire (in your equipment closet)
   with electrical tape before you turn the light on.  Remember, this is 120VAC
   with up to 15A.  It can really cause damage.  I used a multimeter to test
   in my equipment closet that all of the taps were working.

REMOTE CONTROL
--------------

Okay, now, you need to solder new wires onto the remote control you bought.
Take it apart and get the circuit board out.  Turn it over and you will see
where some soldering has already been done.  Each button connects ground to
some other area.  Each of these areas has some existing solder point that I
just added a wire to.  You shuold be able to follow ground from the black wire
all the way around the board.  In general, you should see an area shared by
more than one button so that is obviously ground (unless, of course, it is the
Light button which spans three buttons).  It wasn't easy, but I didn't ruin
anything either.  

If you don't want to control forward/reverse then you can skip that wire. 
I don't know if I'm going to use it yet myself.  Probably not, as it is another
toggle that I can't determine the present state of.

You also need to connect a wire to the remote control's ground and +9V.  I just
added my own wire to the same point the wires from the battery connector were
soldered.  I electrical-taped the battery connector because we don't need it.
And finally you need to connect one wire to each DIP switch that you decided
needs to vary between fan and fan (see above).  I went ahead and soldered all 4
DIP switches so that I can add more fans in the future.

Please see pictures at: http://www.linux.kaybee.org:81/tabs/fancontrol/

VOLTAGE MONITORING CIRCUIT
--------------------------

I first built this on a breadboard and tested it using that spare RF receiver
that came with my new remote.  I then moved it to a soldering breadboard and
soldered it together.  You need one circuit for each fan.  See the file
'voltage.circuit' for a description of this circuit.  Don't forget to solder
on a wire that goes to the Weeder board and another wire that you will attach
to the wire coming from the attic.  The ASCII art should show you how it
all goes together.

Please see pictures at: http://www.linux.kaybee.org:8080/tabs/fancontrol/

DIGITAL CONTROL CIRCUIT - BUTTONS
---------------------------------

I first built this on a breadboard and tested manually.  Once I knew it worked,
I moved it to a soldering breadboard and soldered it together.  You need one
circuit for each button you want to control:
   LIGHT ON/OFF/DIM
   Fan Off
   Fan Low
   Fan Med
   Fan High
   Fan Forward/Reverse

I built one circuit for each of these 6 buttons myself.  See control.circuit
for the circuit details, and be sure to use the resistor value for buttons.
Don't forget to solder the wire from the remote onto the breadboard and to add
a wire to go to the Weeder board.

NOTE: I never got the forward/reverse working because I didn't care much about
it.  I had to decrease the resistor for the "Fan Off" button from 1.5MOhm to
1MOhm for it to work.  I have no idea why.  This is why I hate EE!  Somebody
might be able to confirm or deny this, but I think the equations I used
provided the resistor value on the edge of acceptable.  It seems that lower
tends to also work but higher does not.  You may want to test it out and
consider using around 25% smaller values than I did.

Please see pictures at: http://www.linux.kaybee.org:8080/tabs/fancontrol/

DIGITAL CONTROL CIRCUIT - DIP SWITCHES
--------------------------------------

I first built this on a breadboard and tested manually.  Once I knew it worked,
I moved it to a soldering breadboard and soldered it together.  You need one
circuit for DIP switch you want to control (as you should have determined
above).  See control.circuit for the circuit details, and be sure to use the
resistor value for DIP switches.  Don't forget to solder the wire from the
remote onto the breadboard and to add a wire to go to the Weeder board.

Please see pictures at: http://www.linux.kaybee.org:8080/tabs/fancontrol/

CONNECTING IT ALL TOGETHER
--------------------------

I soldered wires directly between the fan remote and the self-made circuit
board.  I placed both of these into a small enclosure because of the high
voltage on part of the self-made circuit board.  I then placed this into my
larger enclosure which contained my Weeder cards.  Obviously the Weeder cards
are chained together and hooked up to a serial port.  

I then used wire nuts to connect the wire from each fan to the wires I soldered
onto my circuit board.   I tinned the rest of the ends of wire to screw into
the appropriate Weeder terminals.

I plugged in a 9V REGULATED power supply.  I thought I was going to use one of
the cheap "Wall-Warts" I had laying around.  But as I started testing them I
found the 9V ones to have voltages of up to 15V.  I didn't want to risk this on
the remote control I put so much work into (it may have been able to take it, I
don't know... the weeder boards could have taken it).  I found this page about
those cheap Wall-Wart power supplies: http://www.qsl.net/ke3fl/htm/WALLWART.HTM.

So, I ended up going to Radio Shack and buying a regulated power supply with
an adjustable output voltage for about $15.  I was able to fit some of that
14-gauge solid-core wire into the ends of this generic power supply and then
use wire nuts to connect them as follows:
   +9V: * Both Weeder board power inputs (I didn't want to bother with running 
          the power along the serial line).  
        * The +9V wire you soldered onto the remote control
   Gnd: * Both Weeder board power inputs
        * The Ground wire you soldered onto the remote control
        * A wire going to the ground on my homemade breadbord
        * The GND terminal of the Weeder Digital I/O card (not sure if that 
          is necessary)
        * The COMMON terminal of the Weeder Analog I/O Card

WARNING: This method of hooking things up makes the this guy at Weeder nervous.
Ideally, I should have run two wires from each fan, one hooked to HOT and one
hooked to NEUTRAL (i.e. both sides of the lightbulb).  And then these two wires
could go into an isolation transformer that also steps down the voltage.  I
could then use two input pins to do a differential voltage reading.  But there
is no way in hell I'm going to run a second wire.  So, this method seems to
work and it has been working for a few weeks now.  I make no promises.

THE SOFTWARE
------------

Once you have all of the hardware hooked up, you need to modify
fan_control_daemon.pl and then run it with the --calibrate option.  This will
go through and try to determine the button "hold" time and an acceptable number
of retries for each fan.  It does this by turning the lights on and off and
monitoring the results.  I am not good with RF, and these numbers seem to be
very unpredictable.  I had some numbers working, for example, but then I moved
the Weeder boards closer to the RF remote and closed the plastic cover and
everything changed.  In any case, you can telnet to this daemon and run the
following commands:
   fan XXX light on
   fan XXX light off
   fan XXX motor off
   fan XXX motor low
   fan XXX motor med
   fan XXX motor high

You should also receive a message if the fan light is changed manually (i.e.
through a normal RF remote).  Once this all works, you need to place Fan_Control.pm
in your Misterhouse code directory and optionally apply the supplied patch to
Misterhouse.  You'll have to add these lines to your mh.ini:

   fancontrol_module=Fan_Control
   fancontrol_host=localhost
   fancontrol_port=3412

If you decide to apply the patch, then you can add these types of entries to
your *.mht file(s):

   FANLIGHT,   fr,     fr_fan_light,           Inside_Lights|All_Lights|FamilyRoom(9;7)
   FANLIGHT,   mb,     mb_fan_light,           Inside_Lights|All_Lights|MasterBed(7;8)
   FANLIGHT,   dr,     dr_fan_light,           Inside_Lights|All_Lights|LivingRoom(5;5)
   FANLIGHT,   patio,  patio_fan_light,        Inside_Lights|All_Lights|BackPorch(10;4)
   FANMOTOR,   fr,     fr_fan_motor,           Fans
   FANMOTOR,   mb,     mb_fan_motor,           Fans
   FANMOTOR,   dr,     dr_fan_motor,           Fans
   FANMOTOR,   patio,  patio_fan_motor,        Fans

The FANLIGHT currently has states 'on' and 'off'.  The FANMOTOR has states
'off', 'low', 'med', and 'high'.

TODO
----

First of all, I want to add support for the dimming of the fan lights soon.  I am
only hesitant because of the reliability problems I have with the RF signals.

On that note, I think I'm going to wire up a second remote and place it in my attic
in a better location for some of my fans.  I will then run a CAT5 cable to it and
connect it to the unused digital I/O pins on the Weeder card.  I would obviously
have to expand fan_control_daemon.pl to support more than one remote card.


Control circuitry

This is an NPN transistor (B=200):

                          (wire from remote)
                             [collector]
                                 |
                                 |
                                 /
                           |   _/
                           |__/
Weeder digital ---- Rb ----|
output                     |---_
[base]                     |                                                                      |
                                 |
                              [Emitter]
                                 Gnd

For buttons:      Rb = 1.5 MOhms 
For DIP switches: Rb = 10 MOhms

NOTE: I never got the forward/reverse working because I didn't care much about
it.  I had to decrease the resistor for the "Fan Off" button from 1.5MOhm to
1MOhm for it to work.  I have no idea why.  This is why I hate EE!  Somebody
might be able to confirm or deny this, but I think the equations I used
provided the resistor value on the edge of acceptable.  It seems that lower
tends to also work but higher does not.  You may want to test it out and
consider using around 25% smaller values than I did.



Voltage monitoring circuitry


Fan Light ------- R1 ------- D1 ------------- TO WEEDER ANALOG INPUT    
                                   |    |    
                                   |    +   
                                  R2   C1  
                                   |    - 
                                   |    |
Ground ---------------------------------/ 

R1 = 180kOhm
R2 = 15kOhm
D1 = D1N4004 (This one handles up to 1A although up to 1mA is fine)
             (This one breaks down at 600V, break-down voltage must be around 150V or higher)
C1 = 4.7uF (must be able to handle at least 5V)

Summary: 

This is a half-wave rectifier with a voltage divider and a capacitor to even
out the AC into quasi-DC. 


This page last modified Wed Jan 3 20:47:52 2007 Copyright 2014 Kirk Bauer