Monitor lots of optocouplers - Page 1
Forum section: electronics / projects

author: Hole
author_rank: Contributor
timestamp: April 29, 2017, 02:57:51 pm
content: 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!

author: wraper
author_rank: Unknown
timestamp: April 29, 2017, 04:12:33 pm
content: 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.

author: nctnico
author_rank: Super Contributor
timestamp: April 29, 2017, 04:20:50 pm
content: Use a bunch of parallel to serial shift registers (74HC165 for example) connected to an SPI interface.

author: Jeroen3
author_rank: Super Contributor
timestamp: April 29, 2017, 04:36:04 pm
content: Quote from: Hole on April 29, 2017, 02:57:51 pmI don't get it, the CY8C9560A has 60 I/O's. You'd only need 2 chips.

author: bobaruni
author_rank: Regular Contributor
timestamp: April 29, 2017, 05:02:24 pm
content: 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.

author: David Hess
author_rank: Super Contributor
timestamp: April 29, 2017, 10:33:28 pm
content: 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.

author: danadak
author_rank: Super Contributor
timestamp: April 29, 2017, 11:07:27 pm
content: Use an FPGA, certainly get the I/O required. Design would be prettysimple 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 scanthem like a keyboard matrix. Lots of tech details to consider, not evensure if it would work because of Vcesat issues, you would have to lookinto this carefully, do a DC worst case analysis.Regards, Dana.

author: fcb
author_rank: Super Contributor
timestamp: April 30, 2017, 11:22:45 am
content: 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).

author: BrianHG
author_rank: Super Contributor
timestamp: April 30, 2017, 12:08:31 pm
content: Quote from: fcb on April 30, 2017, 11:22:45 amWith 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.

author: fcb
author_rank: Super Contributor
timestamp: April 30, 2017, 04:31:18 pm
content: Quote from: BrianHG on April 30, 2017, 12:08:31 pmIndeed 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.

author: Hole
author_rank: Contributor
timestamp: May 01, 2017, 09:52:18 am
content: 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-µ.