Show Posts
Pages: [1] 2 3 ... 64
1  Topics / Home Automation and Networked Objects / Re: Smart Thermostat Project: Looking for 24 VAC to ~9 VDC Power Supply on: July 30, 2014, 09:33:55 pm
I did this exact thing.  I used the 24VAC that comes from my AC unit and rectified it to give me around 37VDC which I filtered and then sent to a 5V regulator to power the thermostat.  I'll never do that again, it was silly.

What I would do now is get a variable buck power supply off ebay that can take at least 40VAC input and regulate it down to what I need, then put a 100uf cap and a couple of small value caps on the output to filter the trash that these little supplies always have and use that.

I have had incredible luck with the one I built a few years ago, but it was expensive and it runs hotter than I like.  I describe the project on my blog if you want to see how I did it.  But, like I said, I'd do it differently if I was doing it now.
2  Topics / Home Automation and Networked Objects / Re: Gps module returning erroneous and same data on: July 30, 2014, 07:07:41 pm
 That looks like you have the wrong baud rate.  I suggest that you put together a small program that just reads from the GPS pin and prints what it gets.  The sentences should make sense, and yours don't.

Just cut the code down to do a read a character from the GPS and then print it.  You should see the sentences come out with the data in it.  When you do this, attach the GPS to the sofware serial port, and use the regular serial port with the arduino IDE, don't try to use the serial port in a split mode where you have one pin hooked to the gps and expect the other one to talk to the IDE.

So, move the GPS tx pin to the software serial input pin, and try to just read from the GPS  and output it through the regular serial port.  Remember to set the baud rate of the software serial port.  You don't have that in the first code you posted, but do in the second.  Something like this:
void setup()
  ss.begin(4800); // your GPS should be hooked here
  Serial.begin(4800); // this is only to talk to the IDE serial monitor
                                          // you can use any baud rate you want here.

void loop(){
      int c =;

and see what you get.  For some problems, you have to go all the way back to the very beginning.
3  Topics / Home Automation and Networked Objects / Re: Gps module returning erroneous and same data on: July 30, 2014, 04:45:28 pm
There's several things wrong with what you're trying to do, and listing them would probably cause you a lot of confusion.  So, I'm going to suggest you get the example from the author's site and use it as a starting point.

There's several reasons for this, but there are two notable that you should pay close attention to.  First, he uses SoftwareSerial so that the console port is available for you to use for debugging and testing.  Second, he doesn't have any delay() calls in there that will make you miss characters since the cpu is in a hard loop and ignoring everything else.  You can't do that kind of thing with something that is sending characters all the time.

The example is at:

Now, before you tell me that you used that example and that's where you got the code from, take a closer look at what he's doing and reproduce it.  Get the darn delay() out and use SoftwareSerial.

There are other examples where people used the same library out there as well.
4  Topics / Home Automation and Networked Objects / Re: Heat Pump for Pool on: July 23, 2014, 10:00:17 am
My peak draw on startup of two A/C units is fairly high and SSRs stand up to it just fine, but it would be good if you find a better source than me on this.  I recommend that you find one of the hardware engineering forums and ask about this exact thing.  Some of those folk have designed the devices and can give you definitive answers.

Then, of course, come back here and post your results .  smiley

5  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.
6  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.
7  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.
8  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.
9  Topics / Home Automation and Networked Objects / Re: HTML/Arduino coding for single ON/OFF button on: July 11, 2014, 11:12:48 pm
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.
10  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:


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:


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.
11  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:

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:

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.

12  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
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.
13  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.
14  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
  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:

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"){

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

<script src=""></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.
15  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.
Pages: [1] 2 3 ... 64