I'm designing an input interface for a microcontroller (uC). Want to detect signals (only want to know if there is voltage or not) of different typology, so you can have in the same input to the board:
- 0-12 VDC
- 0-24 VDC
- 0-230 VAC (Vpp)
Between the uC and the input (as it can be AC), i would like to use an optocoupler. On the other side of the optocoupler there will be the auxiliary circuits to adapt the signal to TTL to the uC.
The following schematic is the design of the interface between the input signal and the optocoupler led. The 230V AC on the Schematic represents the signal (in this case is 230VAC, but it must work with 12VDC too). There will be 12 input interfaces to detect voltage and operate 12 digital inputs on the uC side.
The common of the 12 different signals will be grouped by 4 signals (each 4 signals will share the ground. So, for example, you will be able to connect 230VAC signals in a group of 4 inputs, 4 signals of 48VDC on another group, etc.
The design I have developed needs op-amp, so I need to supply it with another power supply to keep it independent from the power supply on the uC side. That means too much components (op-amp, isolated power supplies for each group...).
The diode on the bottom line avoids the reverse current of the AC source to going into the output drain of the op-amp.
The values and exact parts to use are not defined completely, it's more a conceptual design than a final design.
The uC will be programmed to identify pulsing signal of the AC signals (because in the design below, it will only pass half of the sine waveform), and take it as Voltage AC detected.
(the red point is the led of the optocoupler).
So here my question:
Is there any way to do this interface to the optocoupler, using only passive components? (taking into account the different voltage sources... from 5VDC to 230VAC).
If my design makes no sense, please, forget it, what I really want is to know if there is any possible combination of passive components that will allow to detect voltage on such wide possible values.
After days reading and checking information, taking into account all answers here. I declined to do an universal AC/DC detector due to complexity (and consecuently, cost of the components). What I will do is to implement an standard input to covers DC, and depending on the final user necesities (AC or DC), I will add to the input a capacitor for limiting current.
Thanks to Transistor and everybody for helping me.