Author Topic: Relay driver  (Read 8419 times)

0 Members and 1 Guest are viewing this topic.

Offline Greg RobinsonTopic starter

  • Regular Contributor
  • *
  • Posts: 90
  • Country: au
Relay driver
« on: November 18, 2013, 09:13:08 am »
Hi everyone.

I'm working on a project that will incorporate a 7 or 8 bit relay array to make a discrete "digital pot".
(7 DPDT relays would make a 7 bit pot)
I know there are commercial digital pots available, but the max voltages (highest rated I've seen was around 50V) rule them out for my application.

Where I need help is in figuring out how to drive this array in a sensible manner. I could of course use 7 or 8 digital outs from a microcontoller, but if I want to have 2, 3 or more of these arrays, I will quickly run out of pins.

Ideally, I would use some sort of "analog to binary" chip, something that would accept an analog signal from the main micro, and have 7 or 8 digital outs for driving an array. If there is such a device, I don't know what it's called, and haven't been able to find it.

I guess otherwise I would need to use a small micro for each array, but that would be non-ideal, requiring multiple micros to be programmed.

Anyway, if anyone has any suggestions, I would greatly appreciate your help!
 

Offline Greg RobinsonTopic starter

  • Regular Contributor
  • *
  • Posts: 90
  • Country: au
Re: Relay driver
« Reply #1 on: November 18, 2013, 09:55:31 am »
So I'm starting to think that the easiest way to go would be a small micro for each array, and I2C from the main micro.

Anyone got any better ideas?
 

Offline Dago

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: fi
    • Electronics blog about whatever I happen to build!
Re: Relay driver
« Reply #2 on: November 18, 2013, 10:21:51 am »
I'd use an I2C port expander such as MCP23017 http://ww1.microchip.com/downloads/en/devicedoc/21952b.pdf
Come and check my projects at http://www.dgkelectronics.com ! I also tweet as https://twitter.com/DGKelectronics
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2135
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Relay driver
« Reply #3 on: November 18, 2013, 10:27:27 am »
Ideally, I would use some sort of "analog to binary" chip, something that would accept an analog signal from the main micro, and have 7 or 8 digital outs for driving an array. If there is such a device, I don't know what it's called, and haven't been able to find it.

a.k.a. analog to digital converter - something like an ADC0804 driving a ULN2803A.

All though you might want some hysteresis in the design.

Personally I'd use a small PIC (18F1220 being in my parts bin) driving the relays with a 4094B and ULN2803A combination.

https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline KJDS

  • Super Contributor
  • ***
  • Posts: 2442
  • Country: gb
    • my website holding page
Re: Relay driver
« Reply #4 on: November 18, 2013, 10:33:41 am »
Demultiplex the outputs, you only need three processor pins to drive eight relays, only four to drive sixteen. With eight processor pins you can drive 256.

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: Relay driver
« Reply #5 on: November 18, 2013, 01:52:10 pm »
Naah, just use the trusty 74HC595 serial/parallel latch and drive it with your favorite small MCU from the SPI output. The 595 could even drive small relays but maybe you will want to put an ULN2803 or similar between. If you need more relays just chain more 595s until you have enough bits. Simple and efficient.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Relay driver
« Reply #6 on: November 18, 2013, 03:07:05 pm »
Naah, just use the trusty 74HC595 serial/parallel latch and drive it with your favorite small MCU from the SPI output. The 595 could even drive small relays but maybe you will want to put an ULN2803 or similar between. If you need more relays just chain more 595s until you have enough bits. Simple and efficient.

For something slow like driving relays a chain of shift registers will drive as many as you like with 3 processor pins.

TI do the TPIC6C596 (NPIC6C596 from from NXP) which is an 8 bit register with 33v 100mA open drain outputs. I am surprised such parts are not more popular and easy to source.
 

Offline Jon Chandler

  • Frequent Contributor
  • **
  • Posts: 539
    • Throw Away PIC
Re: Relay driver
« Reply #7 on: November 18, 2013, 03:25:06 pm »
An I2C port expander like the MCP23017 gets my vote.  16 output pins that can supply 25 mA each (but watch for max current limitations of the device).  Eight of these can be used on a pair of port pins and port pins can be controlled individually without shifting out a string of data for all the bits.

Use a ULN2003 or ULN2803 if more current drive is needed.
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: Relay driver
« Reply #8 on: November 18, 2013, 06:14:05 pm »
Don't wish to argue but let me ask why I2C? It is far more complex than SPI and doesn't bring anything extra to this application. The relays won't have much to say so you don't need any kind of configurability. SPI is dead easy to do in most MCUs and the probability of problems is minimal.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline kxenos

  • Frequent Contributor
  • **
  • Posts: 284
  • Country: gr
Re: Relay driver
« Reply #9 on: November 18, 2013, 07:27:12 pm »
Don't wish to argue but let me ask why I2C? It is far more complex than SPI and doesn't bring anything extra to this application. The relays won't have much to say so you don't need any kind of configurability. SPI is dead easy to do in most MCUs and the probability of problems is minimal.
You're right but I think I2C will be more appropriate for this application because a) there is no high speed output that would justify SPI and b) there are many I2C port expanders. Although I would agree that in this application shift registers would be adequate.
 

Offline Rudolfo

  • Contributor
  • Posts: 30
Re: Relay driver
« Reply #10 on: November 18, 2013, 10:45:42 pm »
An industrial 16 bit I/O port on SPI can be done with the iC-JX to drive relays up to 36V (http://www.ichaus.biz/wp1_mcu_interface ). A complete board is described here: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=9556&sid=a98d84943f7db20dd53348135d463765
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Relay driver
« Reply #11 on: November 19, 2013, 12:05:30 am »
An industrial 16 bit I/O port on SPI can be done with the iC-JX to drive relays up to 36V (http://www.ichaus.biz/wp1_mcu_interface ). A complete board is described here: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=9556&sid=a98d84943f7db20dd53348135d463765 .

Nice chip, and I thought the NPIC6C596 was hard to source - lol.
 

Offline Greg RobinsonTopic starter

  • Regular Contributor
  • *
  • Posts: 90
  • Country: au
Re: Relay driver
« Reply #12 on: November 19, 2013, 12:53:28 am »
Thanks for the suggestions everyone.
If you hadn't guessed I'm no good with digital, I'm an analog guy.
You've all given me enough information to get started, I'll probably be back once I get more details sorted for some feedback.
Thanks again!
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28503
  • Country: nl
    • NCT Developments
Re: Relay driver
« Reply #13 on: November 19, 2013, 02:19:24 pm »
Naah, just use the trusty 74HC595 serial/parallel latch and drive it with your favorite small MCU from the SPI output. The 595 could even drive small relays but maybe you will want to put an ULN2803 or similar between. If you need more relays just chain more 595s until you have enough bits. Simple and efficient.
For something slow like driving relays a chain of shift registers will drive as many as you like with 3 processor pins.

TI do the TPIC6C596 (NPIC6C596 from from NXP) which is an 8 bit register with 33v 100mA open drain outputs. I am surprised such parts are not more popular and easy to source.
I second the TPIC6x595 choice. ST also makes them.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline strangelovemd12

  • Regular Contributor
  • *
  • Posts: 102
  • Country: 00
Re: Relay driver
« Reply #14 on: November 19, 2013, 03:33:59 pm »
Your application sounds similar to a project I'm currently working on and I came to the same solution as some of the above posts.  I am using an 8 bit latch to hold an "operation code" where the first 4 bits act as a crude digi pot by switching around some resistors.   This is probably the method I'll end up going with, but I'm still working on the best means of supporting multiple satellites boards.

Is there any way to solidify your expansion estimates?  2-3+ is fairly vague and in the range where +/-1 may force significant design changes.
Please hit my ignorance with a big stick.
 

Offline Greg RobinsonTopic starter

  • Regular Contributor
  • *
  • Posts: 90
  • Country: au
Re: Relay driver
« Reply #15 on: November 21, 2013, 07:22:56 am »
Your application sounds similar to a project I'm currently working on and I came to the same solution as some of the above posts.  I am using an 8 bit latch to hold an "operation code" where the first 4 bits act as a crude digi pot by switching around some resistors.   This is probably the method I'll end up going with, but I'm still working on the best means of supporting multiple satellites boards.

Is there any way to solidify your expansion estimates?  2-3+ is fairly vague and in the range where +/-1 may force significant design changes.

Cool, interesting to hear of someone else doing a similar thing.

In terms of expansion, I'm hoping that my eventual solution will be highly so, effectively "limitless" within practical considerations, each module being a self-contained expansion.
Obviously, that's not very real-world, and in reality I will probably be looking at around 20 modules.
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2315
  • Country: ca
Re: Relay driver
« Reply #16 on: November 21, 2013, 03:45:02 pm »
Try something like UCN-5841A. It is literally designed for what you need to do.
This is a serial input relay driver circuit: serial input, parallel output shift register with high current outputs and built in protection diodes. It has a serial data output that can be used to daisy-chain multiple chips. So if you need 32 relays, connect 4 such chips together, and shift 32 bits through them, then hit the strobe line to load the data and you're done. Just 3 I/O (data, clock, and strobe) on your micro for as many outputs as you need.
 

Offline calexanian

  • Super Contributor
  • ***
  • Posts: 1886
  • Country: us
    • Alex-Tronix
Re: Relay driver
« Reply #17 on: November 21, 2013, 08:50:36 pm »
5841A's are now discontinued  :-\ we use 74HCT574's to grab the output data and latch it right off the buss in out products, then feed 2803's with that. Works pretty well and is robust and cheap.
Charles Alexanian
Alex-Tronix Control Systems
 

Offline Greg RobinsonTopic starter

  • Regular Contributor
  • *
  • Posts: 90
  • Country: au
Re: Relay driver
« Reply #18 on: December 27, 2013, 02:58:43 am »
Thanks for the help so far everyone. With the suggestions I've received, I've decided to use shift registers to control the digital pots.

Now my next challenge is to figure out how to interface the rotary encoders that will set the value of the pots. I've decided on 12 rotary encoders, and would also like to use two digit 7 segment displays to show the set value for each pot (I'm going to have values of 0-99 available, skipping a couple of bits for 7 bit linear, and an approximate logarithmic lookup table from 8 bit values).

Any suggestions how best to achieve this? Remember, I'm hoping to stick to the Arduino environment. My unfamiliarity with digital hardware is really holding me back.

Thanks again!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf