Show Posts
Pages: [1] 2 3 ... 7
1  Topics / Home Automation and Networked Objects / Re: Using Arduino with C Bus on: July 04, 2011, 01:24:04 am
Thanks for that. When i get a few minutes later I'll give them a reading...
2  Topics / Home Automation and Networked Objects / Re: Using Arduino with C Bus on: July 03, 2011, 09:17:55 pm
Thanks for your input.
Even finding out what the PHY layer is would be a start. I'm guessing RS422 over Cat-5 cabeling but don't know. I'm your documentation does it mention how many bits it uses or what the packet is made up from?
3  Topics / Home Automation and Networked Objects / Re: isolating the Arduino output via optical on: July 03, 2011, 07:12:14 pm
do you just want to turn a motor on or off ? Or do you want to do some sort of speed control ?  You project is a little confusing. Yes that opto isolator will be OK for use in a circuit that simply switches a motor on or off. No it wont be any good to use with a PWM signal then a relay to speed control a motor as speed control, mainly due to the relay.
4  Topics / Home Automation and Networked Objects / Re: Iphone control program over network: someone interested? on: July 03, 2011, 07:04:12 pm
Doesn't something like,

<html>
 <body>
 
IP address = <%=Request.ServerVariables("REMOTE_ADDR")%>
 
</body>
 </html>
Get the address of the pc browsing the web page ? You'd have to post that to some server side script that would sort out it it's allowed or not. I haven't done much web stuff with Arduino so not sure how you'd go about server side stuff. If it is only protection from the WAN you are interested in could you not put the protection on your router and only let certain IP's get mapped to the right LAN address?
5  Topics / Home Automation and Networked Objects / Re: Using Arduino with C Bus on: July 03, 2011, 06:38:29 pm
Ah..not exactely a very interesting topic this one then ??
6  Topics / Home Automation and Networked Objects / Re: Measuring phase angle and power on: July 03, 2011, 06:37:40 pm
It's not generally a good plan to rely on how long a function takes to run for the basis of doing something at a particular time. The most obvious problem would be if you transported the code to a faster or slower compatible processor or one with slightly different architecture. Even if you don't change the system speed a complex function that gets inputs and gives outputs will involve various hardware handshakes etc and thus will be different every time they run. In your case I don't think the differences are going to matter so if you’re happy then job well done. However if you want to protect against variations and make the code multi platform then you would need the do while loop to add on however many milliseconds are needed to hit the 2000 mark. Of course this would still require the slowest processor to be able to do the calcs and samples in a fraction of the 2000 milliseconds. Delay() has its place but should be treated with caution.
7  Topics / Home Automation and Networked Objects / Re: Measuring phase angle and power on: July 03, 2011, 06:24:56 pm
I like snow but then the girl thing maybe more tempting. smiley
8  Topics / Home Automation and Networked Objects / Re: Measuring phase angle and power on: July 02, 2011, 05:10:23 pm
Just a quick interjection that might (maybe) help you avoid a problem.  I tried solid state relays for a high current project, a water heater controller.  It was a 240V thing that was optoisolated.  Worked great, got hot.  It had to have a heat sink and airflow to keep cool enough to touch and couldn't be mounted in a box outside where I live (desert) because the ambient temperature and afternoon sun would destroy it.  I switched to an old fashioned contactor controlled by a little bitty relay off a 5V digital pin.  This was because an A/C contactor was easily available and ran off 24VAC.  It runs nice and cool and has been cycling now for over two years.  At first the noise was offensive, now its comforting because I know it's working.

Now, I know it may have been the particular device I got stuck with and your mileage may vary, but keep this in mind when choosing the device.  In my case, old school worked best.
Yep some of them can get warm but heat sinks on the bay are fairly cheap, better still use the hot water tank as the heat sink and don't waste any preciosu watts. We don't have the same problem over here dray with things overheading if left outside, we do lose things due to being floated off in the rain or wind though smiley
9  Topics / Home Automation and Networked Objects / Re: Measuring phase angle and power on: July 02, 2011, 05:06:26 pm
The first question is, do you need it to run at an accurate time frame? And if so what kind of tolerance do you need?
One thing to remember about the delay() function is it is a little unproductive in that all it does is stop the processor so nothing gets done or calculated for the period you’ve set, well nothing gets done except for interrupts. So in essence you can’t set a cycle time by using a delay function as every time you add a println or take one out your timings will change and unless all the functions you use in a program always take exactly the same amount of time to do their thing then the timings will change every loop of the code. So back to the original question, how accurate do you need it? If the answer is very accurate and quick then you may have to do a lot more analysis on what your function do and how they do it. For example that clumsy anti chatter stuff would be ditched. If the answer is pretty accurate and fairly fast then we have a bit of wriggle room.
I’ll go with the latter for now, if everything is happening fast enough for your liking when you minus off the 2 second delay you put in then we don’t need to analyse the code too deeply but we will need to get an idea of how long it takes to perform a single loop as obviously you can’t have a refresh quicker than the bare loop time. You could put a println(millis()) statement at the start of the program and do 10000 loops then do another println(millis()) at the end and calculate the average time for one loop add a bit of time (say 50%) to get a bit of comfort and then take this as you max speed. You could then set up an interrupt to fire off the required output routine on a timed basis knowing all the other calculations have had time to do their thing. However there is an even easier answer if you don’t mind a little bit of variation and that is to take a snapshot of the time (millis()) then keep looping until the
now time = the start time + 2000
and then fire off the output routine the actual time the output routine takes will still be a variable but should be fairly constant. So after all my waffling try this.

Add a couple of unsigned integer variables called StartTime and NowTime
Take out the delay() code on line 95
And instead add the following code.
do
{
    // Whizz around here until the 2 seconds have been used up
   NowTime = millis();
  If (NowTime < StartTime) {
    break;
  }
} while (NowTime < (StartTime+2000));
StartTime = millis();

This should act as a buffer to get the timings right as long as all the functions and print statement etc take less than 2 seconds to operate then it should fire off the outputs every two seconds. The output functions also take a finite time thus the start time is reset just before the outputs get called then the time it takes for them is also included in the overall timings.
Two slight problems with the quick fix and that is the first loop maybe out slightly as the millis function starts when the program starts to run and this will be ever so slightly different to the value of StartTime (which is zero) when it first gets compared. The second problem is every 50 days or so the millis() function will over flow which give us two scenarios
1, It happens just after the StartTime gets assigned and thus the NowTime will be a lot smaller than the StartTime
2, It happens after the NowTime gets set and thus the StartTime will be a lot smaller.
Scenario 2 doesn’t really matter as it just means a short loop for that one but scenario 1 would result in a verrrry long delay and thus I’ve put a check for it in the While loop.
See how you get one with it I’m writing it in word in my tea break so as per normal it’s not tested and thus maybe tosh..
10  Topics / Home Automation and Networked Objects / Re: Measuring phase angle and power on: July 02, 2011, 11:17:04 am
I was thinking of something like these on flee-bay 250844628309  or   270774264382 the first one is too small in current capacity but shows how neat they can be and again I don't think you need opto isolation but that would have to be checked with each version of the SSR.
As for the power controller I gasp at the thought of spending large amounts of beer tokens something simple (read cheap) like www.nxp.com/documents/application_note/APPCHP6.pdf. You don't have to be too fussy how you control an immersion heater, it is after all only a piece of wire, so something cheap and dirty like the above would work no problems. You could even adapt a dimmer or something.
Using a binary approach and having a few heaters each double the capacity of the last then:-
10 heater = resolution down to < 1 w
7 heater (7 bit) = 142w
4 heater (4 bit) = 66 w
but using the Arduino with a firing circuit would probably work out a lot easier and cheaper.
11  Topics / Home Automation and Networked Objects / Re: Using Arduino with C Bus on: July 01, 2011, 06:53:51 pm
I think it is this one.

http://en.wikipedia.org/wiki/C-Bus_(protocol)
The controllers are XL100s http://www.softyon.com/
It's a honeywell system. Other than that I've basically got very little info on the system already in place and was hopeing to maybe tag an arduino in to capture all the commands being sent back and forth and work out the command set then use the arduino to replicate the controllers in the system.
12  Topics / Home Automation and Networked Objects / Using Arduino with C Bus on: July 01, 2011, 06:34:08 pm
I'm doing a project on a H&V system running on C BUS and would like to replace a few of the nodes that are getting old and rather flaky with an Arduino board. Has anyone got any experience of how I'd interface the Arduino with the C Bus ? Thanks in anticipation.
13  Topics / Home Automation and Networked Objects / Re: Measuring phase angle and power on: July 01, 2011, 06:26:34 pm
Are you using an SSR (solid state relay) and forget me if I'm wrong but i think you can get them with an opto built in and they are generally more reliable. Once you get this up and running your next step is to do a power controller so that you don't waste any. At the moment you only turn the immersion on once 1 kW differential has been reached but wouldn't it be better to capture all excess energy down to save 50w ?
14  Topics / Home Automation and Networked Objects / Re: Measuring phase angle and power on: June 30, 2011, 09:34:23 pm
High Bill,
  I’m no expert either but I think the old style meters you mention did indeed have two coils in them set at 90 degrees apart, one being primarily set up to give a field depending on current and the other on voltage which then gave you a quite clever way of discerning the phase angle between them by the direction and speed of the rotating disc. If you are in perfect phase (phase angle = 0) as in your suggestion the old meter would stop turning. In practice it is quite tricky trying to maintain unity power factor in a house as you’d have to continually adjust the capacitor bank in relation to the inductance of whatever you switch on or off but would result in a low electricity bill smiley. This isn’t (I don’t think) the same thing as watt less current where you try and aim for 90 degrees and thus purely inductive. As the watts = VI cos phi and cos of 90 = 0 then watts is zero independent of what V and I are.  << going off on a tangent.

Ahh those old typos they always get me.... smiley
15  Topics / Home Automation and Networked Objects / Re: Measuring phase angle and power on: June 28, 2011, 07:51:07 am
Hello, sorry I've been a while to get back to you it's been a bit busy here. I tried to write this in my break so I haven't tested it on an Arduino and even if I had I'm not an expert but it should work or at least give you a good head start on making it work. I haven't re printed all the code in the link you sent me I've just added some bits in red.. so basically copy the code from the link you provided then add the bits in red from below.
The hysteresis should be provided by the anti chatter counter in that if the value is around 1000 w difference between ch1 and ch2 the output wont change until it has been that way for more than 2000 programe cycles. I  hope you find it helpful smiley

int wavelengths = 50;                             //number of wavelengths to sample
int AntiChatter = 0; // used to ensure the output doesn’t chatter
int inPinV = 1;                                   //Analog input pin number that voltage signal is connected to
int inPinI_1 = 0;                                 //Analog input pin number that current signal is connected to. Channel 1
int inPinI_2 = 2;                                 //Analog input pin number that current signal is connected to. Channel 2
int RelayOn = 4; // pin four is the one to connect the opto isolator to but you can pick any pin other than  0,1 or 2

void setup()
{
   Serial.begin(9600);
   pinMode(RelayOn,Output); // this sets the pin named RelayOn to an output
}
unsigned long wtime;


void loop()
{
  //-------------------------------------------------------------------------------------------
  // 1) Calculate energy monitor values
  //-------------------------------------------------------------------------------------------
  ch1.emon_calc(inPinI_1,ICAL_1);                                       //Energy Monitor calc function for channel 1, pass Arduino analog in pin nummber and calibration coefficient
  ch2.emon_calc(inPinI_2,ICAL_2);                                       //Energy Monitor calc function, for channel 2, pass Arduino analog in pin nummber and calibration coefficient
 
  //delay(2000);
  Serial.print("Channel 1 Real Power: "); Serial.println(ch1.realPower);
  Serial.println("");
  Serial.print("Channel 2 Real Power: "); Serial.println(ch2.realPower);

  If (ch1.realPower > (ch2.realPower +1000)) {
    // count the number of program cycles that ch1 is higher than ch2 by at least 1000
    AntiChatter ++ ;
    If (AntiChatter == 2000) {
      // the state ch1 > (ch2 +1000 ) has been true for 2000 cycles
      digitalWrite(RelayOn,HIGH); //turn the output on
      //minus one off the Antichatter variable to clamp it at a max of 2000    
      AntiChatter -- ;
       }
     }
  else{
  // if ch1 isn’t > (ch2 +1000) then start counting down and when the AntiChatter counter reaches zero turn the output off
    If (AntiChatter == 0) {
      // the state ch1 <= (ch2 +1000 ) has been true for 2000 cycles
      digitalWrite(RelayOn,LOW); //turn the output off
      //add one off the Antichatter variable to clamp it at a min of 0
      AntiChatter ++ ;
     }
  }
 
  ch1.wh = ch1.wh + ch1.whInc;                                          //Accumulate wh for channel 1 until ethernet send
  ch2.wh = ch2.wh + ch2.whInc;                                          //Accumulate wh for channel 2 until ethernet send 
}
Pages: [1] 2 3 ... 7