Maker Pro
Maker Pro

PC control of 240V loads?

D

Dave Hinz

Jan 1, 1970
0
One of the heat systems in my house is electric powered hydronic heat.
I'm using a water heater, which is sufficient for my needs. Time-of-use
electricity makes it cheaper than propane, nights and weekends.

I'd like to do something a bit more sophisticated than my current
control system, which is a day/hour timer switch. Can anyone suggest
something which ideally would be:

1. Computer controlled (PC is OK, others are OK too)
2. Capable of driving a 30A 240VAC relay
3. Capable of taking temperature readings from several inputs
to determine if the relay needs to be on or off
4. Reasonable cost

Basically, a smart controller that knows about time and return water
temperature, and turns on the heat when it's got access to cheap
electricity and when the floor is cool enough to need it.

Suggestions of vendors, or specific products, or even homebrew solutions
are most welcome.

Dave Hinz
 
S

Sylvan Butler

Jan 1, 1970
0
1. Computer controlled (PC is OK, others are OK too)
2. Capable of driving a 30A 240VAC relay
3. Capable of taking temperature readings from several inputs
to determine if the relay needs to be on or off
4. Reasonable cost

Basically, a smart controller that knows about time and return water
temperature, and turns on the heat when it's got access to cheap
electricity and when the floor is cool enough to need it.

Boy, that is a tough combination. programmable thermostat is the
closest "cheap" solution that comes to mind. But for full-blown
homebrew computer control...

For temperature, use Dallas/Maxim DS1820 temperature sensors. They are
direct to digital, and can be hooked up with a bunch of them on a simple
twisted-pair bus (ground plus combined power and signal and optional
seperate power). aag.com.mx (iirc) and peter h anderson sell ways to
get them hooked up to your computer. (Dallas did a "weather station"
promotion a few years ago, that is what I have, and now AAG sells the
current version.)

Then connect some solid-state relays (SSRs) to the parallel port. You
need ones which take a fairly low trigger current (15ma is a stretch,
try to find lower) at 5volts, ideally a range such as 3v-12v. I watch
the surplus places such as allelectronics.com, bgmicro.com, etc and have
found some good deals. I'm using some two-pole, 240vac @ 40amp relays
that were about $15/ea. I put two relays in a dual-gang metal box with
two duplex outlets (split) on top. I mount an rj45 on the box for the
control input, and have a few feet of 12ga pigtal with a plug for input
power. The line from the computer plugs into the rj45 and then I have
four individually switched outlets.

(SSRs need a heatsink, and the closer to operate to their max current
ratings, the more heatsink they need. Mine are rated at 40amps, and I
have four of them per 20amp circuit, they are mounted to a metal
electrical box and never seem to get warm.)

See computerchristmas.com and the many other similar sites for how to
connect to the computer. It isn't hard. The standard parallel port has
8 data bits and 4 control bits for output (5 bits of input), and you
just wire those outputs to the control inputs on the relays. For added
safety, use a resistor in series to limit the current (330ohm to 470ohm
should be very safe, but might not allow enough trigger current). I
took two network cables, cut them in half, and wired them into a plug
for the parallel port so that I have three four-bit output plugs, and
one input plug.

Distance between the computer and the relays might be a factor. My
relays only need 3v on the trigger to switch, and I have run them thru
about 30ft of cat-5 (8 meter cable plugged into the relay box, rj45
coupler, 1 meter cable into parallel port) without problem.

Now find or write the software. (That's a whole 'nother topic!)

I estimate cost as:
$10-$20 for dallas 1-wire bus interface
$2-$5 per DS18s20
$15-$20 per two-pole relay
plus incidentals (cables, connectors, boxes, etc)
plus computer (w/ rs232 or usb for 1-wire, and parallel for relays)
plus software

You could eliminate the 1-wire bus interface, and just connect the
DS18s20's to the parallel port inputs. But then software has to do all
the bit-banging directly, it's a pain and I don't know if any software
out there supports that.

sdb
 
B

Bruce in Alaska

Jan 1, 1970
0
Dave Hinz said:
One of the heat systems in my house is electric powered hydronic heat.
I'm using a water heater, which is sufficient for my needs. Time-of-use
electricity makes it cheaper than propane, nights and weekends.

I'd like to do something a bit more sophisticated than my current
control system, which is a day/hour timer switch. Can anyone suggest
something which ideally would be:

1. Computer controlled (PC is OK, others are OK too)
2. Capable of driving a 30A 240VAC relay
3. Capable of taking temperature readings from several inputs
to determine if the relay needs to be on or off
4. Reasonable cost

Basically, a smart controller that knows about time and return water
temperature, and turns on the heat when it's got access to cheap
electricity and when the floor is cool enough to need it.

Suggestions of vendors, or specific products, or even homebrew solutions
are most welcome.

Dave Hinz

Well relays are really "Old School" these days, you might think of using
SolidState Relays with Logic level inputs. I see some in Jameco that
will do 40Amps at 240Vac for around $20US. These can be driven from
Cmos drivers at logic levels. You also might look at the Opto22 stuff
that can be setup as a Network Device, on TCP/IP or ModBuss, or as a
Parallel Port device from a PC. I have used Dallas Semiconductor
Temp Sensers that come in TO92 cases and are Logoc Level devices for
doing liquid Temp monitoring. You would need an A/D of 8 bits or more
but they are dirt cheap.


Bruce in alaska
 
T

Thomson Tim

Jan 1, 1970
0
Whatever for? The PC alone will waist more energy than a well insulated
tank!
I mean come on we do our banking and such with a computer now
................but why would someone want to wake up and find out that the
water is frooze because the PC frooze?
 
A

Anthony Matonak

Jan 1, 1970
0
Yes, this is probably a job for a PIC.

Anthony

Thomson said:
Whatever for? The PC alone will waist more energy than a well insulated
tank!
I mean come on we do our banking and such with a computer now
...............but why would someone want to wake up and find out that the
water is frooze because the PC frooze?
....
 
M

Morten

Jan 1, 1970
0
Thomson Tim said:
Whatever for? The PC alone will waist more energy than a well insulated
tank!
I mean come on we do our banking and such with a computer now
...............but why would someone want to wake up and find out that the
water is frooze because the PC frooze?

You wouldn't, you'll just have to design the controller so that it won't
need any guidance from the pc, then the pc is 'demoted' to logging station,
so if / when it freezes the worst thing that happens is that you might loose
a couple of datasets.

I'd say use a PicAxe, its a small series of basic programmed very easy to
use and quite well priced. They're made by a British company especially for
teaching new students how to program / controll stuff, they have an embedded
basic interpreter that stores a program uploaded to the PicAxe via a serial
cable (no complicated eeprom burner involved here) and starts running thge
code as soon as you power it up.

They come in different variants from a very small 8 pin device with 5 i/o
pins to 40 pins devices with 32 i/o pins.

Do you want to slow down a dc motor, use PWM (part of the basic language
used in the picaxes), serial communication, servo control and much more.
Same goes for Dallas ds1821 devices...


Have a look at http://www.picaxe.co.uk

disclaimer: I have absolutely nothing to do with RevED (who makes these
devices) I'm just a very happy costumer...


Interfacing to the real world is quite easy, there's load of examples in the
documentation available on the above site, but I've used both solid state
relays via a driver mosfet and some 2ma powered relays I've found on ebay
once, they just require 2ma to react, there's a small transistorised driver
built into the relay that drives the relay coil. If you use relays remember
to add a power diode in reverse on the coil to kill the back emf. that the
coil generates when the magnetic field colapses in the coil when the power
is taken off the coil, otherwise the coil will create a very high voltage
spike that WILL fry any Pic / PicAxe attached...


Standard PIC's are great, but if you haven't done anything on a pic before
and starts out fresh, they can be a bit daunting and the additional hardware
can be quite expensive. The next quiestion is which language, Basic is by
far the easiest to learn, C/C++ is the most powerfull but requires a
compiler that knows about the hardware ie. the particular pic your'e
fiddling with, and then there is Assembler, you can do pretty much anything
in Assembler if your head doesn't explode trying to figure out what's going
on and why it isn't working.


For small controllers like this I'd go with Basic and use a PicAxe, it will
give you the quickest start and is quite powerfull if you are a little
vigilant about how you program the thing.


You can have your first program up and running within 15min. from you break
the shrinkwrap, it's that easy...



Regards

Morten




 
D

Dave Hinz

Jan 1, 1970
0
Boy, that is a tough combination. programmable thermostat is the
closest "cheap" solution that comes to mind. But for full-blown
homebrew computer control...

Right. Seems like there'd be some industrial system for that.
For temperature, use Dallas/Maxim DS1820 temperature sensors. They are
direct to digital, and can be hooked up with a bunch of them on a simple
twisted-pair bus (ground plus combined power and signal and optional
seperate power). aag.com.mx (iirc) and peter h anderson sell ways to
get them hooked up to your computer. (Dallas did a "weather station"
promotion a few years ago, that is what I have, and now AAG sells the
current version.)

Got it. Once we're in, I can graph with MRTG and handle the logic there.
Then connect some solid-state relays (SSRs) to the parallel port. You
need ones which take a fairly low trigger current (15ma is a stretch,
try to find lower) at 5volts, ideally a range such as 3v-12v. I watch
the surplus places such as allelectronics.com, bgmicro.com, etc and have
found some good deals.

Back in the early 1980s, I designed and built a christmas tree light
controller. Had 4 strands going around the front window, another 4 up and
around the peak of the house, and they did the "chase" effect. Ran it all
off of a TRS-80 Color Computer. Took it out the expansion port, gave it
a hardware address, and just flipped bits for each of the 8 strings of
lights. We had more than a few people stop by and ask how the lights worked.
This was 1982 or 1983... from the TTL-level voltage, I ran it through
a CMOS 4066 maybe? (4 per chip analog switch), which then drove a triac,
which drove the lights. I suppose I could do that & drive a relay from
the triac. Once we're back into the world of 74xx series chips I'm back in
my comfort zone.
I'm using some two-pole, 240vac @ 40amp relays
that were about $15/ea. I put two relays in a dual-gang metal box with
two duplex outlets (split) on top. I mount an rj45 on the box for the
control input, and have a few feet of 12ga pigtal with a plug for input
power. The line from the computer plugs into the rj45 and then I have
four individually switched outlets.

Any problem mixing low and high voltage wiring in the same box?
See computerchristmas.com and the many other similar sites for how to
connect to the computer. It isn't hard. The standard parallel port has
8 data bits and 4 control bits for output (5 bits of input), and you
just wire those outputs to the control inputs on the relays.

And I can probably do it with Linux or *BSD, which are my preferred solution.
Might even be able to use a laptop for it, I think I have a PII lying around
with built-in || port.
Distance between the computer and the relays might be a factor. My
relays only need 3v on the trigger to switch, and I have run them thru
about 30ft of cat-5 (8 meter cable plugged into the relay box, rj45
coupler, 1 meter cable into parallel port) without problem.

If I use the laptop, I can just bracket it right to the wall right by the
valves and such. No muss, no fuss.
Now find or write the software. (That's a whole 'nother topic!)

Thanks, good suggestions. By the way, you inspired me to clean up and
well-light my shop, and it's immensely better. Forget how we got on
the topic, but whatever - 12 4-tube light fixtures later, and it's great.

Dave Hinz
 
D

Dave Hinz

Jan 1, 1970
0
Whatever for? The PC alone will waist more energy than a well insulated
tank!

If I'm heating, it's winter. If it's winter, and the PC "wastes energy",
it becomes heat. Which is what I'm after. I have time-of-use electric
billing, so off-peak electricity is substantially cheaper than propane.
If I'm gonna heat, I want to heat the right places without playing balancing
games with the valves, thus my questions.
I mean come on we do our banking and such with a computer now
...............but why would someone want to wake up and find out that the
water is frooze because the PC frooze?

Apparently Sylvan understand what I'm doing more than you do. Thanks for
your thoughts, though. Not sure how you think a basement floor is going
to freeze, ever. It's also not my primary source of heat. THanks,
though.
 
D

Dave Hinz

Jan 1, 1970
0
Yes, this is probably a job for a PIC.

I googled "PIC" but get too many hits to narrow it down. Can you tell
me what you mean here?

Dave
 
S

Sylvan Butler

Jan 1, 1970
0
Got it. Once we're in, I can graph with MRTG and handle the logic there.

Yup. Project called One-Wire Weather (OWW), I think Simon has it on
sourceforge now, might be an interesting reference or starting point. I
think he sticks uses rrdtool to store and graph the data.
Any problem mixing low and high voltage wiring in the same box?

Problem for me? No... And my understanding of the NEC (my only
reference is a version or two out of date though) says that they are
allowed to mix if the only reason is for control/sensing of the load and
they only come together in the box where they actually need to be
together. In other words, if you were going to switch a 120vac light
with a low-voltage signal, the signal conductors and power conductors
would have to be run seperatly, even if that required two conduit runs,
until reaching the box where the load is controlled.

Oh, and most SSRs are opto-isolated between control input and load
terminals.
And I can probably do it with Linux or *BSD, which are my preferred solution.

I use linux.
Might even be able to use a laptop for it, I think I have a PII lying around

Laptops usually work fine, but many times laptops only have 3v logic on
the parallel port. So if your SSR is fussy, or the distance is long,
you might need some buffering to get back to TTL levels (perhaps a 74hct
series with schmitt-trigger inputs).
If I use the laptop, I can just bracket it right to the wall right by the
valves and such. No muss, no fuss.

Probably be great.
well-light my shop, and it's immensely better. Forget how we got on
the topic, but whatever - 12 4-tube light fixtures later, and it's great.

Sounds nice, congratulations!

sdb
 
S

Sylvan Butler

Jan 1, 1970
0
I googled "PIC" but get too many hits to narrow it down. Can you tell
me what you mean here?

Most likely Microchip PIC. They have a very diverse selection of
microcontrollers. Competitors include Atmel AVR, and a host of others
based on or compatible with Intel 8051 and various motorola processors.

http://piclist.com/

The microcontroller (uC) could handle all the baby sitting chores of
turning things on and off, perhaps buffer up and store data, so when the
PC was connected it could get the data for the past, and change the
behavior (program) for the future if needed.

Nice thing about the approach I mentioned, is that PIC's (and other
uC's) can easily interface with the Dallas 18s20 to read temperature
(some also have analog inputs so you could use way cheap temperature
sensors instead) and whatever logic you connect to the parallel port
output for control can be connected to the uC outputs instead.

So you don't lose much by getting your I/O hardware working with a PC.
It can easily move to a microcontroller if you so decide.

And if you keep your software modular, you can simply rip out the bottom
layer and replace it with a higher-level communication (eg via rs-232 or
USB) protocol that gets data from and sends commands to the uC.

And it is so much easier to do all that initial development, testing and
debugging with a real computer instead of a development board...

sdb
 
D

Dave Hinz

Jan 1, 1970
0
Yup. Project called One-Wire Weather (OWW), I think Simon has it on
sourceforge now, might be an interesting reference or starting point. I
think he sticks uses rrdtool to store and graph the data.

Excellent. Now we're _really_ in my area of comfort.
Problem for me? No... And my understanding of the NEC (my only
reference is a version or two out of date though) says that they are
allowed to mix if the only reason is for control/sensing of the load and
they only come together in the box where they actually need to be
together. In other words, if you were going to switch a 120vac light
with a low-voltage signal, the signal conductors and power conductors
would have to be run seperatly, even if that required two conduit runs,
until reaching the box where the load is controlled.

Gotcha. No other way to do that, is there. I think where I got messed
up on that was with putting a TV cable into the same box as the AC. (guys?
If it's not to code, please don't sell faceplates that give me that option,
ok?)
Oh, and most SSRs are opto-isolated between control input and load
terminals.

Right. I played with them back in the early 1980's, but not since. I had
a BBS running on a TRS-80 Color Computer, with code that a friend and I wrote
in BASIC. Due to the primative modem software, if someone could cause an
error to occur (or a disk error, or whatever), they'd get dumped to the
command line. This would have been bad, so I ran the modem power through
an SSR, which was powered through the reed relay on the computer's
main board. That reed relay would shut off at any error that basic
encountered. It was _intended_ to be the tape recorder's motor control
relay (so the tape would stop playing when you got a read error), but it
worked nicely to power the modem. When I started up the BBS, a command of
motor on
would turn on the relay, powering the SSR, turning on the modem. Any error
would shut it down and let me figure out what happened on the system to
make it error. Fun times. Kind of a brute-force firewall I guess.
Laptops usually work fine, but many times laptops only have 3v logic on
the parallel port. So if your SSR is fussy, or the distance is long,
you might need some buffering to get back to TTL levels (perhaps a 74hct
series with schmitt-trigger inputs).

I'm comfortable in the 74ls world, so 74hct should be an easy transition.
Got a bunch of 74ls stuff that I'd been meaning to ebay, but maybe I can
use some of it. (who am I kidding...what I have, is what I won't need).
Sounds nice, congratulations!

Thanks again

Dave
 
Top