Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Switching 24VDC relays from microcontroller

Status
Not open for further replies.

KnutH

New Member
Hi!

I hope this is the right forum for this question, I am new here!

First a short introduction: I am a computer programmer looking forward to playing with home automation, but don't have too much understanding of the details of the hardware part. But we have a totally new house, where I already have made some basic decisions for the home automation. But now I am a little stuck about how to really put the "Smart" into "Smart home".

Here is what I have:

- (low voltage) wires from all switches, PIR sensors etc to a central in the basement
- all lights, ovens etc. are switched on/off by relays
- The relays are toggling pulse relays requiring a 24VDC pulse, one to switch on, another to switch off. Please do not suggest changing these for another type, that is not an option since they are already paid for and installed! And they work fine when I connect a toggling light switch to give 24VDC directly to the correct relay (which is how the lighting system works so far, as in an ordinary house).
- thermo actuators for the water based floor heating, also requiring 24V to be on, 0V is off.

The only smart part working so far, is the heating control. I use a PC with Windows 7 Pro, reading temperatures from 1wire sensors (through a USB plug) hidden in the smoke detectors in every room (hidden wires in the roof) and a Phidget board with 16 digital outputs to switch the 24V for the actuators. The whole thing runs through Promixis Girder as programming environment.

But this is to unreliable (not the Phidget, but Windoze)! Once in a while, some Windows update demands a reinstall of the 1wire drivers, a hard disk goes corrupt etc. etc.

So I want to use a more reliable brain. I don't really care if it's an Arduino, Raspberry Pi, Microcontroller (not quite true, being from Trondheim I have a little bias towards Atmel microcontrollers) or anything else.

What I can't quite grasp, is what hardware I need to use the signal I get from an Arduino, Raspberry Pi or a microcontroller. It seems they mostly output 5VDC, while I need a 24VDC pulse to switch my relays (and a steady 24VDC signal to keep the thermoactuators open).

Of course, price is also a point here. The easiest for me would be to buy some more Phidgets. But $100 for 16 more digital outputs seems a little overkill, when I need maybe 60-70 outputs. I have the feeling this can be done easier and cheaper.

Concrete suggestions or hints on good tutorials around this are much appreciated!
 
Opto-isolators that can handle 24 volts.
Logic level MOSFETs. N channel are easiest but they switch the ground side of the relay.
De-multiplexer chips will get you 60-70 outputs. It is a good thing that the relays are toggling pulse relays because the De-multiplexer chips like to output 1 of 8 or 1 of 16 etc…
 
ClydeCrashKop: thanks, they all seem like valid suggestions! But opto-isolators seem to be expensive, this one **broken link removed** e.g. seems like it would suit me perfectly, except they cost around $40 each...

MOSFET's I have trouble finding one with the correct specifications.

De-multiplexers: I don't seem to find any with that many outputs?

Any clues on how to search for the correct types?

nsaspook: I also started with Girder with X10, running lighting and heating with the system for some years in the old house until we tore it down and build a new house. But my point here was that Phidgets seem a little pricey, I would need 5-7 of them at $100 each (plus norwegian taxes and toll, probably ending at around $120 a piece).
 
There are several I/O expansion board for the RPi that can give you the I/O you need to program the signals.
**broken link removed**

Some fairly cheap output boards for converting the TTL level signal to 24vdc switched are here (your link looks very nice also)
https://www.futurlec.com/InterfaceBoards.shtml
 
This starts to seem like an option: http://yourduino.com/sunshop2/index.php?l=product_detail&p=156, currently costing me around $2 pr output. If I have that, I'm guessing I could connect any Atmel microcontroller, Arduino or Raspberry directly to this. Or do I still need something in between?
Since you are good at microcontrollers you can use two of 40 pins and write a program for them to talk to each other. This way you may have the 70 outputs you need. Buying multiplexers is always expensive. Small signal transistors that cost a few cents can drive your relays.
 
I won't to throw this https://gravitech.us/busio.html out for you to look at. I'm not saying it's good or bad and it may create more questions than answers. It's basically a board that's controlled by an I2C interface. I2C is inter-IC communocations and really isn't designed to run far.

The I2C chip used isn't as smart as it could be. Some I2c I/O expanders as they are called will support interrupts.

The idea is to low-cost detect/monitor and isolate signals of interest. Standardized I/O modules that have been used in industry have been about $20 or more per point.

Here is an I2C manual: https://www.google.com/url?sa=t&rct...=pPAzCvQ38eJNvi7jaxwjTA&bvm=bv.86956481,d.eXY

It's possible to isolate I2C so only one isolator is used.

There is some weirdness in all uP lines about the logic outputs/inputs. They generally now are 3.3 or 5V. Some 3.3 V inputs are 5V tolerant.

What also might be another route for you is an opto-isolated "High side driver". These are designed to drive solenoids and have fault outputs. See https://www.google.com/url?sa=t&rct...cbKe1zJ4zJNOhnQ&bvm=bv.86956481,d.eXY&cad=rja for an example.

An old relay driver chip is the ULN200x series. See https://www.google.com/url?sa=t&rct...=ny6Ims50pzUf8MWrIZtGyg&bvm=bv.86956481,d.eXY

This takes a TTL signal and turns on a relay by switching ground.

PS: Lighting contactors that use a pulse for on and a pulse for off are actually common because the relays don;t consume power unless they are switching which is a good thing. There were/are some lighting systems that were essentially home run. so, lights were run direct to an enclosure. All dimming, etc was done there using low voltage on/off modules for the switches.
The pulse thing may have been a good choice. without a SET/RESET, you might have trouble keeping tack of the state. Relays that switch motor or lighting loads are usually called "definite purpose contactors".

Changing to LEDs/CFL's has created problems with dimming.

A reminder to place free-wheeling diodes across the relay coils and close to the coils.

I have a habit of throwing out ideas rather than suggest an approach. Something can be learned by the bad ideas too.
 
Before suggesting drivers, decoders, or opto-isolators, I would need to know more about your 24Vdc relays...

How much current does it take to actuate them?
How long does the pulse have to last?
 
Thanks for lots of input! I need some time to go through all of this...

After a quick glance, this seems promising: "Small signal transistors that cost a few cents can drive your relays.". The problem is I wouldn't know how to connect them to a microcontroller without risking frying it! Or how to find the correct signal transistor...

So without any more specific info, I will need to go for one of the premade boards.

As to keeping track of state, the relays only switch one of the cables for a light (except in bathrooms, where both wires must be switched, according to the electrician, so there I have added a piggyback-thing making the 2 pole switching relay into a 3 pole switching relay). So the plan is to use the free pole of each relay as feedback to my controller with 24VDC cables connected.
 
24 volt relays at digikey have typically 16.7mA coils.
These opto-isolators will do 30 volts at 100mA **broken link removed** at 43 cents each or $0.20 each if you buy 100.
 
I would use ULN2003 (7 bits) or ULN2803 (8 bits) to drive the relays. These can handle up to 50 volts at a few hundred mA per bit. Tip: ULN2003 Driver provides some details on how to use these chips. They are basically transistor, base resistor and freewheeling diode x 7 or 8 in one package.

To control these drivers, I'd use MCP23017 I2C port expanders. Each of these has 16 bits that can be configured as inputs or outputs. Up to 8 of these can be used on one 3 wire interface (SDA, SCL and /INT).
 
Thanks again!

Right now, I think the ULNs are the way to go. But I will get used to the soldering iron before I'm finished, that's for sure! I'm no expert yet, but it's about time to start practicing.
 
Are we making it harder than it needs to be? Look at Knuth's data sheet. Doesn't it say that it only takes 3mA to actuate the relay?

Srly.gif
 
The ULN2803 is still the way to go, since the relays require 24 VDC. They're cheap and take care of all the details.
 
According to this data sheet, KnutH's 15522 relays are of the 2 pole TL 16A variety, which seems to have but a single pulse input, which toggles the relay to the opposite state each time it is pulsed.

I cannot find a confirmation that the open-circuit voltage across the normally-open pulse button is actually 24Vdc, or how much current flows in the button while it is closed. What a piss-poor data sheet!

It implies that the pulse button is returned to the Neutral line, which really does beg for opto-isolation between a digital controller board and the relay rack...

What a dumb way to build a relay!
 
Here's some additional information. Looks like the state toggles with each press of a button but there are some more complex options available.

If in fact the state changes with each impulse and there's no feedback to the control system, this isn't a great choice for remote operation.
 
Status
Not open for further replies.

Latest threads

Back
Top