I have a communication board, and I am designing an analog interface to it. The point is, to be able to measure 4-20mA and 0-10V analog signals. I know this is not a professional solution, but I just want to provide some data to my board. MY board is supplied with 24VDC wich is also the supply of the 0-10V buffer amplifier. The other opamp for 4-20mA is supplied with a regulated 5V. The opamp outputs are connected to my microcontrollers ADC wich is capable of accepting 3.3V. My question is, do you think that the circuit on the picture would work properly?
In contrast to Asmyldof's answer I would be inclined to make a dual-mode input as is common on industrial PLCs, etc. Typically these add a 500 Ω shunt resistor across the 0 - 10 V input to convert 20 mA to 10 V.
Figure 1. A 0 - 10 V / 4 - 20 mA input for 3.3 V ADC.
- R2, 3 and 4 provide an easy to make 3:1 divider. Their impedance is very high relative to the shunt resistor so the loading should not introduce a significant error.
- There is no reverse protection diode on the input as this will cause a voltage drop in the signal to the ADC.
- D1 and D2 provide over-voltage and reverse-voltage protection to the ADC without voltage drop and without the worry of Zener leakage as the voltage approaches 3.3 V. The current shunted to the PSU through these diodes will be limited by R2 and R3 to a low value.
- The op-amp can be eliminated.
With this arrangement you have a standard dual-purpose input.
For your current loop:
Since the standard is intended to work with relatively large wire and connection losses, in your situation the resistor you chose may well work, but if you mean to use this with more... internet-open-source-type device, you may want to reduce the resistor. With some of those devices, and possibly even some professional ones, you can probably not be sure they can cleanly generate the full current range with voltage drops up to 3V.
You can reduce the resistor to 15 Ohm and have the op-amp amplify the signal by a factor of 10 to get the same effect. You may also want to add a resistor to the op-amp's output and a clamping diode, in case a connection mistake introduces more signal than what you expect, as well as protections for reverse connections:
You can also add a capacitor of 10nF or so on the output of the Op-Amp here for filtering. And if you want to be 100% sure the op-amp is also safe, add a zener diode there too, if you have a 3.3V or 5.6V type they won't leak all too much at the 0.3V for maximum current in the loop, but still offer full protection to a 24V powered op-amp. Of course, with 5V coming in from a mis-connection the resistor will likely clamp or burn-up.
The diode will cost you 0.7V here, you can also use a Schottky diode with a very low forward voltage, like the BAT54 types, they will leak a bit more in reverse, but even 1mA will only generate 15mV in reverse across the op-amp, which should be damage free.
For your voltage sensor:
I would not put the zener diode directly on the input. On a too high input you will load the device generating the voltage a lot, possibly damaging it and if you apply 12V or 24V supply, your zener will probably just blow up.
If you put a 3.3V or 3.6V zener on the junction of the resistive divider your device will be protected, but any current coming in will be clamped. In that case you want to be sure the zener doesn't leak too much at 3V (or whatever your maximum signal is). If the leakage is too high, you can also protect with a diode from that junction back to the 3.3V supply voltage.
The capacitor likely should also not be directly on the input. If the device creating the signal has an immediate op-amp output, capacitive loading may create oscillations or other problems. If you move the capacitor to past the divider as well, the loading effect will reduce significantly and it will actually become an R-C filter, which is much more effective.
If you don't know anything about the device creating the signal, it may be better to buffer the input and then divide resistively, since you have 24V available. Of course, still taking some protective measures:
The zener starts to clamp at 11V, allowing some over-voltage on the input, and when the input goes higher the resistor limits the current to protect the zener and the device creating the signal.