Show Posts
Pages: [1] 2 3 ... 64
1  Topics / Home Automation and Networked Objects / Re: Heat Pump for Pool on: July 21, 2014, 11:05:07 am
I use a few of the ready made relay cards; relays work great in lots of applications.  It's the high current applications that I have been replacing the contactors with SSRs.  They're noisy and the arcing on the contacts causes them to fail too often in my climate.  So, water heater, A/C units, outdoor motors, that kind of thing.  I reserve relays for small items.
2  Topics / Home Automation and Networked Objects / Re: Heat Pump for Pool on: July 21, 2014, 02:15:41 am
The way some of these defrost is to run the fan across the coils until the coil temperature sensor goes to whatever the ambient temperature is. This means you have to pay attention to what the actual temperature is and shut the whole thing down if it's too cold to do any good.  The tiny number of them I've seen don't allow operation under 40F, so you might use that as a starting point.   The only strategy I've seen on compressor operation is to run it at least 10 minutes, and let it set idle for 10 minutes after running.  The idea is to keep those short cycles at a minimum to reduce the wear of start-stop cycling.

They're actually pretty simple devices so you should be able to get it working to your satisfaction.  One thing I do recommend is to make your new controller as self sufficient as you can.  Sure, it's great to incorporate it into the house controls, and you should do that, but allow it to operate on its own if necessary.  My experience has been less than stellar using centralized control with ethernet and devices that depend on a datum from somewhere else often don't get it.  I try to make every new device capable of working to some degree without the need for a solid connection.

While you're at it, take a look at replacing the contactors for the motor and fan with solid state relays.  The biggest problem with these devices is those darn big relays that wear out and get contact burns.  I'm replacing all of mine over time; basically when they fail, they get replaced with an SSR.  Haven't had an SSR fail or get dirty contacts.
3  Topics / Home Automation and Networked Objects / Re: Zigbee communication synchronization on: July 12, 2014, 10:58:43 pm
Yep, to guarantee that the data gets there intact, you'll have to use API mode.  The second data byte will get there eventually, but not when you want it to; transparent (AT) mode is buffered and only sent periodically or after a timeout.
4  Topics / Home Automation and Networked Objects / Re: HTML/Arduino coding for single ON/OFF button on: July 12, 2014, 10:53:37 pm
You defined them inside the routine setup(), but used them outside that routine.  Variables defined inside a routine only exists inside it.  If you want to use them in other places, move the definition outside all routines.

Take a look at 'c++ scope of variables'.  It's useful, but can drive you a bit nuts sometimes.
5  Topics / Home Automation and Networked Objects / Re: HTML/Arduino coding for single ON/OFF button on: July 11, 2014, 11:12:48 pm
Quote
3) I'm not sure if there are any commands in to "switch out from the IDE terminal emulator"? I'm quite used to messing around with Raspberry Pi's and SSH'ing into these with Putty - I assume you are suggesting the same here but sending the "?14" instruction over Putty? If so, can I not just log into the Arduino at the appropriate IP/port with Putty and then type this instruction into the command line to activate the switch? In that case, I'm not sure if I need to include anything more in the sketch to facilitate this?

I wasn't clear enough.  In the terminal, in the IDE (which is what you use to compile it), you can type something in and send it to the board through the serial port.  This is where you want to put commands to make things happen.

So, put it together, compile it, fix the compile errors, and shove it out to a board and start trying things.  Then a whole lot of what folk have suggested will make more sense to you.

Oh,, and don't even think this is like a raspberry pi, this little guy has a lot of I/O possibilities that you just can't get on the Pi.  The Pi's a nice board, I have several, but the arduino is a really great little controller for lots of jobs around my house.
6  Topics / Home Automation and Networked Objects / Re: HTML/Arduino coding for single ON/OFF button on: July 11, 2014, 03:04:31 pm
Regarding your ideas:

Nicely done, but you will get killed by details when you start compiling and trying this.  First, you don't need to hold the current state of the switch, simply read the I/O pin to find out what it really is whenever you want.  Keeping states of things like this always leads me to screwing up and not updating it somewhere, so just read the pin to see what it's doing.

Enable the ethernet board before ethernet.begin.  Why are you using an SD card?  If you don't need it, just leave it turned off; it'll make the code easier to understand when you're trying to debug it. 

Put in some commands to try the switch out from the IDE terminal emulator.  You have no idea how useful it is to be able to manipulate various controls from the command line when you're trying to make it work.  Put in a lot of print statements to tell you what is going on.  You'll need them when the light stays on despite the web page being decoded properly.  You don't have to get fancy with it, just looking for a 't' for toggle will save you a ton of time debugging.

An interesting way to toggle the pin for a relay is to  use the input from the pin as a guide for setting the pin as in:

digitalWrite( digitalRead(thePin) ^ 1);

This will toggle the pin from one state to another and you can then digitalRead(thePin) anywhere in the code to see what state it's in if you need to.  However with your setup and wanting only to flip the state, you may not need to.

You don't want to get fancy with HTML on an arduino.  Remember, you have to decode the incoming all by yourself with no fancy language or huge libraries to help you.  When you parse the incoming, you want it to be as simple as possible.  Consider something like:

href="http://xxx.xxx.xxx.xxx/14"

Then in the arduino code, just look for the 14.  The ? to show arguments and & between arguments with named pairs is something for python, php, javascript, etc; not for a little arduino.  If you want to get fancy with POST vs GET discussions, you'll run out of memory or patience.  Just stick with a GET, and let the spot where the file goes (14 in the example above) can be whatever you want.  Suppose you sent:

href="http://xxx.xxx.xxx.xxx/toggle14"

Then parse for "toggle" and grab the two numbers after it for which one.  There's about a jillion ways  to do this, so make it simple at first.  Once you get it running, you can expand it to be as versatile as you have time for.
7  Topics / Home Automation and Networked Objects / Re: HTML/Arduino coding for single ON/OFF button on: July 11, 2014, 02:19:39 pm
Regarding two and three way switching. 

I had a heck of a time finding an example of a UK two way switch setup.  Here is the one I found:

http://www.lightwiring.co.uk/tag/2-way-switch-wiring-diagram/

I'm sure there are others.  If you have a two way in the room, then a SPDT relay will work fine, however, if you have a three way or higher (I've seen them go up to six), then you will need to either: 1) find the spot where the circuit begins or ends and use a SPDT, or 2) use a DPDT somewhere in the middle.  Look at the middle one on this page:

http://www.lightwiring.co.uk/3-way-light-switch-using-a-two-wire-control/

The way they go to more than three way is to simply add switches like the one in the middle wherever they need them.   You see this in hallways sometimes where several bedrooms have exits.  That way each bedroom can turn on the hall lights.

So, it all depends on your wiring.  The way you get a DPDT relay when you can only find SPDT, is to just use two of them side by side.  Clever right?  Notice I didn't say cheap.  Heck, you can even use solid state relays that way if you want silent operation.  Clever arrangement of SSRs can emulate any kind of relay you want, but you'll pay a bunch of money for the experience.

One thing you can do if you want to consider it is to use the flash memory on the arduino to save the state each time it changes, then on boot, before you do anything else, read the state from the flash and set the relay(s) accordingly.  I do this with my thermostats.  I save the various settings in flash, then when the power comes back on after a failure, i read the flash and set temp, mode (cooling, heating), and fan setting based on the last time they were changed.  Sure this will wear the flash memory out over time, so in 2075 or so you might have to think about it a bit.  That way you can get away without using latching relays.  Besides, it'll be fun to do.

8  Topics / Home Automation and Networked Objects / Re: Relay VS RF433 - Would you trust RF 433 to control an automated aquarium? on: July 09, 2014, 06:05:43 pm
Quote
Perhaps I've really answered my question here. Relays are reliable as in you know if it is ON or OFF.
Actually, you don't.  If you close a relay, and the contacts are bad, no power goes through it.  If you close a relay and the power fails, it will probably open up and whatever you're running will stop and not come back on.

Consider closing the relay and then sensing the voltage on the actual thing you're running.  You still won't be able to tell if it is actually running, but you eliminated one more thing that can fail.  Also, remember that the float can get stuck, wires can break, cats can rip things apart, so think of failure possibilities.  Then, run the automation only while you're home for a couple of weeks to get a feel for how reliable it is before you take off on vacation.  I know a guy that has pressure sensors on water flow to be sure the water is actually moving.  He turns on a pump then watches the flow sensor to be sure it started and is moving water.  To be sure the flow sensor didn't fail, he has another one on the pump input.  They both have to be moving  before he trusts it.

You have the opposite problem, but you see what I'm getting at.
9  Topics / Home Automation and Networked Objects / Re: HTML/Arduino coding for single ON/OFF button on: July 09, 2014, 05:55:57 pm
If you have a two or three way switch, it becomes a different problem that I know of two approaches for.

1. Replace all the switches involved with remote switches that control the light and then control one of the remote switches with the arduino.  This is the method that is used in fully automated houses, but it costs more than I usually want to pay.

2. Use wiring and relays that mimic another switch in the circuit.  Here in the US that means a DPDT relay which will turn the light on or off regardless of the state of the manual switches.  To better understand this, take a look at how to wire 2 way and three way switch arrangements, and you'll see what I mean; you're going to add a switch to the arrangement.   For this kind of thing, look into DPDT latching relays.  These are nice because you can send a short pulse to change the relay state and you don't have to worry about what happens when the power fails because the relay (at least some of them) will stay in the last state. 

How to wire 2 and three way light setups is all over the web, so you won't have any problem finding it.
10  Topics / Home Automation and Networked Objects / Re: HTML/Arduino coding for single ON/OFF button on: July 09, 2014, 11:34:47 am
First, in home automation, a button that turns something off is a godsend.  You don't have to go there and see the light is on and turn it off; you just turn it off.  Same with on.  When you can see it, you know what you want to do, but if you can't, ...  This is why things like garage doors are annoying.  You have to know its open to send a signal to it, otherwise you wind up opening the door when you shouldn't.

However I see your point, and todays remote switches will tell you if the light is on so you can display it.  I ran into this problem a few years ago and handle it in various fashions.

If you know the state of the light, just call the opposite routine:

if ( light == on)
  turn it off
else
  turn it on

but I bet you knew that already.  There's also the tertiary statement , the xor, and a special register that can be used to flip the lights.  There's a good article on this here:  http://jeelabs.org/2010/08/27/flippin%E2%80%99-bits/

If you want to change the button in your web page, perhaps you want to change the button color to yellow when it's on and black when it's off, then you name the element and use jquery to cause the browser to change the color:

First, give the button a name you can use to access its attributes.

      <input id=lfp type="button" style="background-color:lightgray" value="Front Porch" onClick="doit('lights','fPorchToggle')">

The 'id=' above gives the button its name.  The background-color gives it a color to begin with, the value holds the text for the button, etc.  Now, in javascript, change the color to yellow or put it back to lightgray:

if (data.lfp=="On"){
         $("#lfp").css("background-color","yellow");
         }
      else{
         $("#lfp").css("background-color","lightgray");
         }

You'll have to get the javascript libraries into the user's browser by putting:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

somewhere up in the code.  Using the attributes of elements is a fast and (relatively) easy way of changing the appearance right on the user's browser.  I use this kind of thing a lot to change the appearance of items on a browser.  The nice thing is that all the code runs on the user's browser and the arduino is left with the chore of loading the text out the ethernet port.

A warning though, HTML pages take a whole lot of text.  You can run even a mega out of memory doing this, so be frugal.
11  Topics / Home Automation and Networked Objects / Re: Ethernet based home automation system on: June 18, 2014, 01:57:45 pm
OK, you need input from other people as well on this, but:

That one will do the job, but in the US, we have split phase 220 which means that each leg has 110V to ground and 220 between them, so  I always use 2 SSRs to control this.  I shut off both legs so that I don't have to worry about one leg to ground grabbing me when I stick a screwdriver in there to tighten something.

Also, I am really careful about shutting off the power if I need to get in there with a screwdriver.  These little devices have a tiny amount of leakage, and although I've never had a problem, I'm chicken and shut the power off before touching anything with anything besides a meter lead.

There's usually some suppression circuitry built into the SSR that causes the leakage, and that can confuse you, so read up on it a bit so you understand.

You can also use a double SSR or even a tripple and leave one leg unused if the price works for you.
12  Topics / Home Automation and Networked Objects / Re: Ethernet based home automation system on: June 17, 2014, 02:13:04 pm
Quote
ost large 220v AC units use "contactors" to do the power switching.
That's totally true, and I'm starting to wonder why.  I used to have a bunch of contactors around the house.  The water heater, well pump, pool control, both AC units, and I've been replacing them with SSRs as they start to have trouble.  The well pump was a real problem since it was outside near the ground in an enclosure and ants would get caught between the contacts as they looked for food.  Then other ants would smell the roasted one and come to investigate which roasted more ants .Bug poison would help, but the rain (rare) would wash it away and back came the ants.

After a short while, the acid from the roasted ants would corrode the contacts and I'd have to clean them to make the pump work.  Then after about three times doing that, I'd have to replace the contactor, which is a high dollar item at the pool pump repair store.  Now, with an SSR in place of the contactor, I haven't even seen a sign of a problem.  Had to use a heat sink on it though since the combination of summer sun and current through the device got it too hot.  I also had trouble with a contactor on the water heater.  It was a 110V device and made noise.  I found out that that is a really common problem with contactors, they eventually start to buzz.  The SSR I put in there solved the problem nicely and didn't need a heat sink since it was indoors. 

I only have a contactor on one of my AC units, so far.  The contactor started to have trouble and needed to be swatted with a wrench every once in a while to knock crud out of it.  I tried to keep the various animals that were pooping on the AC condensor and causing the problem away, but you can't watch it all the time and a cactus wren just never gives up.

I'm a big proponent of SSRs.
13  Topics / Home Automation and Networked Objects / Re: Ethernet based home automation system on: June 16, 2014, 01:21:39 pm
The relay can probably handle it just fine, but I worry about the connections for the wires.  Usually things that carry 30 Amps, which is a LOT of power, have big connnections.  A little heating there will cause arcing, which will cause more heating until the connection burns up.

Take a close look at SSR (solid state relay), these can be controlled directly by the arduino and isolate the control from the SSR pretty effectively.  They last a long time; I've never had a failure.  They have big connectors.  They don't make any noise.

just my thinking though.
14  Topics / Home Automation and Networked Objects / Re: HVAC controller log / Introduction on: June 16, 2014, 11:05:43 am
The smoothing algorithm is showing zero because it's filled with zeros to begin with and you haven't  taken enough sample to change it yet.  My algorithm starts at a negative number and step up to room temperature over a few seconds.  If you want it to show something else while it stabilized, just fill it with that value.  Say, fill it with 70, then it will show 70 and change a bit as it stabilizes.

Me, I like the numbers changing until it reaches room temp; it tells me it's alive.
15  Topics / Home Automation and Networked Objects / Re: HVAC controller log / Introduction on: June 15, 2014, 10:26:58 pm
In your loop only turn the compressor on when a flag is set.  Then when the compressor shuts off set the flag to false and set a timer to fire in 10 minutes.  When the timer callback happens, set the flag to true.  This will force a 10 minute wait between compressor cycles.

Code:
#include <Time.h>
#include <TimeAlarms.h>

boolean compressorAllowed;

To set the timer when you turn off the compressor, it would look something like this:

Alarm.timerOnce(10 * 60, allowCompressor); // let the compressor back on in 10 minutes

The call back would look like this:

void allowCompressor(){
    compressorAllowed = true; This is your flag
}

Then, somwhere in your loop:

If (compressorAllowed){
    ....
Nothing to it, but you'd have to give up that delay call.  If it were me, I'd make my loop() look something like this"

Code:
void loop(){
    alarm.Delay(0);
}

And in setup, I'd set up timers to handle everything:

alarm.timerRepeat(1, goCheckTheTemperatureAndDoStuff);  // This is the every second go check for something to do
alarm.timerRepeat(dowFriday,5,30,30,goBuyFlowersForThatGoodLookingChick); // This is to keep the people you're ignoring happy

But, that's just me.
Pages: [1] 2 3 ... 64