fan control with 1 button

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by Richc, Jul 10, 2008.

  1. Richc

    Richc

    Joined:
    Jul 3, 2008
    Messages:
    16
    Likes Received:
    0
    Location:
    dural
    We are putting in several ceiling fans with c touch B&W logic with 3 channels per fan with capacitor in DB and wish to program the 3 speeds and off with the sequential touching of 1 saturn button. Is this possible? thanx in advance.

    richard
     
    Richc, Jul 10, 2008
    #1
  2. Richc

    Lucky555

    Joined:
    Aug 13, 2007
    Messages:
    229
    Likes Received:
    0
    It can be done very cleanly with C-Bus logic.

    You need to set a key input up with a group address eg "Fan Control". Make the button an on/off type (very important) - bell press can easily be missed.
    Every time the "Fan Control" group is turned on your logic can increment a counter and turn the button back off. You can easily link each counter value to a C-Bus relay channel and an off state.

    I do this to provide easy controlled step dim in the loo.

    Can write some sample code when I get a moment - if you need ?

    Are you intending to do the whole lot eg 1,2,3, off - with one button or do you want one button for speed and another for on/off control ???
     
    Lucky555, Jul 11, 2008
    #2
  3. Richc

    znelbok

    Joined:
    Aug 3, 2004
    Messages:
    1,151
    Likes Received:
    17
    There has been lots of threads over the years on fan integration - I would like to see a small c-bus fan controller - something in the same size as the blind controller (and cost).

    Mick
     
    znelbok, Jul 11, 2008
    #3
  4. Richc

    Richc

    Joined:
    Jul 3, 2008
    Messages:
    16
    Likes Received:
    0
    Location:
    dural
    fan 1 button

    our button allocation is somewhat restricted so we only want
    1 button to turn a fan or fans to hi med or low then off, in that order.
    similar to an old fashion fan with a pull cord.

    most fans should be started in high (actually 240 v) to minimize current draw
    so the ist press of the button should be hi then med then low speed
    followed by off, with 3 channels of the relay.

    putting high as the first press forces the user to start the the fan on high.

    if the prgramming is simple then fan control with cbus will become much
    more attractive a proposition.

    if possible the button should be orange when fan is on and blue when off.

    if a generic logic could be made available it would be greatly appreciated.




    kind regards
    richard
     
    Richc, Jul 11, 2008
    #4
  5. Richc

    froop

    Joined:
    Dec 23, 2007
    Messages:
    124
    Likes Received:
    0
    Location:
    Melbourne, Australia
    Here's how I do it. I'm using a bell press rather on/off as lucky suggests. But he is right, sometimes a quick push is not enough, and I need to hold for 1/4 to 1/2 a second.

    I've created a _CeilingFanSpeed lighting group with 4 levels:
    Off = 0x00
    Low = 0x01
    Medium = 0x02
    High = 0x03

    Then there are three scenes, which set the relay states appropriately.

    This is all the logic that is required:
    Once(GetLightingState("_CeilingFanKeyPress") = ON) then
    begin
    case GetLightingLevel("_CeilingFanSpeed") of
    0 : SetScene("Ceiling Fan - High") ;
    3 : SetScene("Ceiling Fan - Medium");
    2 : SetScene("Ceiling Fan - Low");
    1 : SetScene("Ceiling Fan - Off");
    end;
    end;
     
    froop, Jul 12, 2008
    #5
  6. Richc

    Lucky555

    Joined:
    Aug 13, 2007
    Messages:
    229
    Likes Received:
    0
    You will need C-Bus group addresses as you see in the code below plus GA's eg "Fan 1 Relay Low" - "Fan 1 Relay Med" - "Fan 1 Relay Hi" and "Key 1 LED".

    You should put the above groups into scenes and order them as follows;
    "Scene Fan 1 Hi"
    Fan 1 Relay Lo = OFF
    Fan 1 Relay Med = OFF
    Fan 1 Relay Hi = ON
    Key 1 LED = ON

    "Scene Fan 1 Med"
    Fan 1 Relay Lo = OFF
    Fan 1 Relay Hi = OFF
    Fan 1 Relay Med = ON
    Key 1 LED = ON

    Etc....

    Scene Fan 1 Off = all groups off.

    Then some simple code like this;

    Code:
    {Enter Variable definitions here}
    
    CounterFan1 : integer;
    
    
    {Enter Initialisation code here}
    
    CounterFan1 := 0;
    
    
    
    {FAN 1 MODULE}
    
    once GetLightingState("Fan 1 Button")= ON then
    begin
      CounterFan1 := CounterFan1 + 1;
      SetLightingState("Fan 1 Button", OFF);
      case CounterFan1 of
      0 : ;
      1 : SetScene("Fan 1 Hi");
      2 : SetScene("Fan 1 Med");
      3 : SetScene("Fan 1 Low");
      4 : SetScene("Fan 1 Off");
      end
    end;
    
    if CounterFan1 >= 4 then
    begin
      CounterFan1 := 0;
    end;
    
    Simple, fast, copyable, etc.

    The code above works - don't forget you can simulate it all in PICED.

    That person who wrote PICED must be brilliant !

    PS I am assuming you are taking care of interlock with the relays.
    If not you might want to ramp Fan Relays ON in your scenes (4s with relay on thresholds at say 50%).

    No thanks needed - just throw money... ;)
     
    Last edited by a moderator: Jul 12, 2008
    Lucky555, Jul 12, 2008
    #6
  7. Richc

    Lucky555

    Joined:
    Aug 13, 2007
    Messages:
    229
    Likes Received:
    0
    Froop,

    case GetLightingLevel("_CeilingFanSpeed") of
    0 : SetScene("Ceiling Fan - High") ;
    3 : SetScene("Ceiling Fan - Medium");
    2 : SetScene("Ceiling Fan - Low");
    1 : SetScene("Ceiling Fan - Off");
    end;
    end;

    I am guessing you carefully associate "_CeilingFanSpeed" levels in the relevant scenes ???

    Pretty clever.

    But......... You are making counters feel unwanted :p

    Your solution has less code - you win ;)

    PS. Bell press and logic is really not the way to go.

    But you still win...
     
    Lucky555, Jul 12, 2008
    #7
  8. Richc

    froop

    Joined:
    Dec 23, 2007
    Messages:
    124
    Likes Received:
    0
    Location:
    Melbourne, Australia
    Yes.. almost too clever. It all works and has been since I put it together about 7 months ago. When I pulled it up this morning to post my reply, it took me a while to figure out how it worked again. To the point that I was convinced I had opened up an old version of my PICED project :)


    Why thankyou. And yes, I think I'll change to an on/off trigger like your code.
     
    froop, Jul 12, 2008
    #8
  9. Richc

    froop

    Joined:
    Dec 23, 2007
    Messages:
    124
    Likes Received:
    0
    Location:
    Melbourne, Australia
    You can also cut out a little more code from your solution. This last bit where you reset the counter

    Code:
    if CounterFan1 >= 4 then
    begin
      CounterFan1 := 0;
    end;
    
    Can be replaced with an extra line in your case statement:
    Code:
      5 : CounterFan1 := 0;
    
     
    froop, Jul 12, 2008
    #9
  10. Richc

    Lucky555

    Joined:
    Aug 13, 2007
    Messages:
    229
    Likes Received:
    0
    Yes you are right again.
    Whenever I use a case statement I think - ok - now let's make sure we don't end up with a 'run time error' by having a case selector value outside the case selector list. There is no better way to do this than to take care of it within the case selector list. Just goes to show, I am getting rusty and hacked the example code quickly and outside of a real situation.

    Usually I have taken care of things inside the case selector list but now I find myself blunt around the edges...

    ;)
     
    Last edited by a moderator: Jul 13, 2008
    Lucky555, Jul 13, 2008
    #10
  11. Richc

    Lucky555

    Joined:
    Aug 13, 2007
    Messages:
    229
    Likes Received:
    0
    Froop - one tiny thing though.

    With a counter and case statement inside the logic block it is relatively closed loop.

    There is a slight chance that your group address could end up at a value other than what is covered in your case selector list eg someone connecting a foreign key input device, bodgie MMI message etc.

    I did say tiny... ;)
     
    Lucky555, Jul 14, 2008
    #11
  12. Richc

    froop

    Joined:
    Dec 23, 2007
    Messages:
    124
    Likes Received:
    0
    Location:
    Melbourne, Australia
    Very good point. I might have to add in that if block of yours after my case statement after all :)
     
    froop, Jul 14, 2008
    #12
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.