Author Topic: Monitor lots of optocouplers  (Read 2646 times)

0 Members and 1 Guest are viewing this topic.

Offline HoleTopic starter

  • Contributor
  • Posts: 32
  • Country: de
Monitor lots of optocouplers
« on: April 29, 2017, 02:57:51 pm »
Hi!

I need to monitor a lot of optocouplers... the prior designer decided to use about 120 individual optocouplers to monitor about 120 lines coming from some frontend. Design is o.k. that way for the time, but now it shall get a new backend. The couplers are simple 4n35 style types with a 2k pull up each.

Initial idea is to throw some i2c port expanders at it (CY8C9560A, mcp23017 or so), but perhaps there is some sort of trick to come around with less parts than one per coupler.

Any suggestions welcome!

Thanks!
 

Online wraper

  • Supporter
  • ****
  • Posts: 16847
  • Country: lv
Re: Monitor lots of optocouplers
« Reply #1 on: April 29, 2017, 04:12:33 pm »
You could put optocoupler outputs in series or parallel to make AND/OR logic gate if you have a few inputs and you look for some sort of condition which is met when at least one or all of the optocouplers in a group are activated. Or you could make an optocoupler output switch matrix the same way as it is with keyboards.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26891
  • Country: nl
    • NCT Developments
Re: Monitor lots of optocouplers
« Reply #2 on: April 29, 2017, 04:20:50 pm »
Use a bunch of parallel to serial shift registers (74HC165 for example) connected to an SPI interface.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Monitor lots of optocouplers
« Reply #3 on: April 29, 2017, 04:36:04 pm »
Initial idea is to throw some i2c port expanders at it (CY8C9560A, mcp23017 or so), but perhaps there is some sort of trick to come around with less parts than one per coupler.
I don't get it, the CY8C9560A has 60 I/O's. You'd only need 2 chips.
 

Offline bobaruni

  • Regular Contributor
  • *
  • Posts: 156
  • Country: au
Re: Monitor lots of optocouplers
« Reply #4 on: April 29, 2017, 05:02:24 pm »
You could use a 12x10 or 15x8 matrix and scan the optos sequentially, a bit like a keyboard.
So you could do it with using only 22 I/O lines.
« Last Edit: April 29, 2017, 05:04:23 pm by bobaruni »
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Monitor lots of optocouplers
« Reply #5 on: April 29, 2017, 10:33:28 pm »
If it is acceptable to read the optocoupler outputs at different times, then arrange the optocoupler outputs into a matrix just like a keyboard.  This will minimize the number of I/O signals required.

A parallel to serial input using something like a chain of 74HC165s allows reading all of the optocoupler states simultaneously.

I would consider using small and cheap microcontrollers to directly grab groups of outputs using either of the above methods to simplify printed circuit board routing.  4 output pins driving 8 input pins through a matrix would be 32 inputs and can be done with a low pin out microcontroller.
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Monitor lots of optocouplers
« Reply #6 on: April 29, 2017, 11:07:27 pm »
Use an FPGA, certainly get the I/O required. Design would be pretty
simple to get all the coupler status into a set of bytes or words.

Throw in a low end arm core to control, format, and output status.

Another way possibly is to do a 12 x 12 matrix using a UC and scan
them like a keyboard matrix. Lots of tech details to consider, not even
sure if it would work because of Vcesat issues, you would have to look
into this carefully, do a DC worst case analysis.

Regards, Dana.
« Last Edit: April 29, 2017, 11:30:30 pm by danadak »
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Monitor lots of optocouplers
« Reply #7 on: April 30, 2017, 11:22:45 am »
I would have each eight optocouplers feed a 4051 (8 way analog multiplexer, 15 of them 3 digital control lines so far).
Then take these 15 mixed lines and feed them into 2 further 4051s (6 digital control lines so far).
On the two outputs of those 4051s I'd put two pull-up resistors and feed these into your microcontroller.

Solution eliminates 118 pull-up resistors and only uses 8 microcontroller pins (6 outputs, 2 inputs). Although you do have to scan through 60 at a time - so might be slow for your application (you could easily scan at 60KHz for a 1ms resolution).
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7725
  • Country: ca
Re: Monitor lots of optocouplers
« Reply #8 on: April 30, 2017, 12:08:31 pm »
I would have each eight optocouplers feed a 4051 (8 way analog multiplexer, 15 of them 3 digital control lines so far).
Then take these 15 mixed lines and feed them into 2 further 4051s (6 digital control lines so far).
On the two outputs of those 4051s I'd put two pull-up resistors and feed these into your microcontroller.

Solution eliminates 118 pull-up resistors and only uses 8 microcontroller pins (6 outputs, 2 inputs). Although you do have to scan through 60 at a time - so might be slow for your application (you could easily scan at 60KHz for a 1ms resolution).
With your solution, a cap in parallel across each opto's output would allow slower scanning and you would still catch small spikes as they become fat.  However, on initial startup, all the opto's will shortly read triggered until enough scans go through to charge up all those caps on each opto.  This is actually useful if you only want to scan 10 times a second or slower, but, may have shorter pulses, or, AC inputs feeding the LEDs.
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Monitor lots of optocouplers
« Reply #9 on: April 30, 2017, 04:31:18 pm »
I would have each eight optocouplers feed a 4051 (8 way analog multiplexer, 15 of them 3 digital control lines so far).
Then take these 15 mixed lines and feed them into 2 further 4051s (6 digital control lines so far).
On the two outputs of those 4051s I'd put two pull-up resistors and feed these into your microcontroller.

Solution eliminates 118 pull-up resistors and only uses 8 microcontroller pins (6 outputs, 2 inputs). Although you do have to scan through 60 at a time - so might be slow for your application (you could easily scan at 60KHz for a 1ms resolution).
With your solution, a cap in parallel across each opto's output would allow slower scanning and you would still catch small spikes as they become fat.  However, on initial startup, all the opto's will shortly read triggered until enough scans go through to charge up all those caps on each opto.  This is actually useful if you only want to scan 10 times a second or slower, but, may have shorter pulses, or, AC inputs feeding the LEDs.

Indeed you could - would certianly work if you wanted to collect short pulses.  But wouldn't bother for AC (50/60Hz), it would be trivial to scan fast enough to detect mains.
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline HoleTopic starter

  • Contributor
  • Posts: 32
  • Country: de
Re: Monitor lots of optocouplers
« Reply #10 on: May 01, 2017, 09:52:18 am »
Thanks for all the feedback.

I think the matrix is the way to go, there is no high speed I have to read it. Depending on the physical layout I perhaps end with some µc's spawning 8x8 matrixes and communicating via i2c to a host-µ.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf