2
\$\begingroup\$

in a project I want to convert 0-10 DCV to 0-3.3 DCV and feed it to STM32 microcontroller ADC input pin. also I want some protection on ADC pin. I draw this schematic which I found here in Digi Key. please let me know if it will operate normally and if it has no problems!

  • 6.8K and 3.3K resistors are voltage dividers to convert 0-10V to 0-3.3V
  • SS14 works as a clamping diode and it's there to protect from less than zero volt spikes
  • 1K resistors serves as a current limiting resistor for microcontroller pin.
  • 3.9V zener diode makes us sure that the maximum voltage on the pin will stand in its range (max 4V)
  • 100nF capacitors works as the bypass capacitor and also shape and low pass filter with the 1K resistor

enter image description here

\$\endgroup\$
6
  • \$\begingroup\$ why not just use a DC-DC converter is there any reason you are set on this approach? \$\endgroup\$
    – Juan
    Sep 5, 2022 at 4:33
  • 1
    \$\begingroup\$ @Juan I want to map the whole range of 0-10V (input) to 0-3.3V(output) in order to feed to microcontroller ADC pin \$\endgroup\$ Sep 5, 2022 at 4:49
  • 1
    \$\begingroup\$ @Juan, you're recommending using a DC-DC converter to scale 0..10 V signal down to 0..3.3 V for an ADC input, instead of two resistors. Could you explain your reasoning there? \$\endgroup\$
    – TonyM
    Sep 5, 2022 at 7:52
  • \$\begingroup\$ I am not really recommending anything, if I did I would have answered, just a comment asking a question, there are other options, optocouplers, etc. There are enough answers here to provide proper advice \$\endgroup\$
    – Juan
    Sep 5, 2022 at 7:55
  • 4
    \$\begingroup\$ @Juan I'm not aware of any DC–DC converters that produce an output voltage proportional to the input voltage. Furthermore, a DC–DC converter is generally much larger and much more expensive than a pair of resistors. \$\endgroup\$ Sep 5, 2022 at 14:40

2 Answers 2

9
\$\begingroup\$

The link that you provided shows protection for a digital input. The ADC's input resistance is much lower. The electrical operating specifications for the ADC usually provide a formula to calculate the maximum allowed source resistance. They often show preferred protection schemes that are appropriate for un-buffered inputs.

The 1k resistor is not required because the voltage divider provides the same function. The zener is not required as the Schottky internal diode in the micro will be sufficient. I suggest the following circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

Make C1 small enough to track input changes. This circuit will usually require a slower sample rate and a longer sample time both that are programmable.

I prefer a buffer as shown below. It is not the only way and others may have alternate suggestions. This method isolates the ADC from the inputs and provides a very low source resistance thus removing all timing and loading restrictions on the ADC.

schematic

simulate this circuit

\$\endgroup\$
3
  • \$\begingroup\$ thank you @RussellH for your time! would you please explain the role of the D1,D2 clamping diodes? and also do you have any part number suggestion for the opAmp? cause I think it should be a rail to rail OpAmp with at least 3.3V of power supply, right? \$\endgroup\$ Sep 5, 2022 at 5:25
  • 1
    \$\begingroup\$ I have no preference for the op amp. Choose based on the speed that you require. It should have a low input offset voltage and low noise and low bias current. Th bias current flows through R2,. VDD should be the same as the micro controller, well decoupled. Over voltage on Vin will be dropped across R1. The resulting current is diverted to VDD through D2. D1 does the same for negative voltages. Schottky diodes are fast with a low voltage drop, but they can be leaky. Choose carefully. The 1N4148 or IN914 high speed switching diodes would be sufficient. \$\endgroup\$
    – RussellH
    Sep 5, 2022 at 5:49
  • \$\begingroup\$ thank your for your time and explanation <3 \$\endgroup\$ Sep 5, 2022 at 7:17
3
\$\begingroup\$

The Digikey article appears to be talking about digital inputs. Your application is analog.

SS14 is a Schottky diode which is leaky, particularly at high temperatures. 10mA at rated voltage maximum at 100°C and 200uA at 25°C. A leakage of 0.5mA will cause an error of more than 1V. Probably it won't be that much at room temperature and 3.3V reverse voltage, but it will likely be measurable.

More seriously, a 0.5W 3.9V Zener diode will also conduct significantly at 3.3V. Here is data for the 500mW MELF diode series including 3.9V MLL5228A. Vz for the MLL5228A is specified at 20mA, so it appears to be the 4th curve from the left. At 3V it will typically conduct around 1.5mA. Some zeners are specified at much lower Vz and they will conduct less (at both 3.3V and at 3.9V).

enter image description here

So that circuit will affect the accuracy considerably and the effect will vary considerably with temperature.

Designing clamps that work without adding excessive error to precision analog signals is not altogether straightforward, and the first step is to determine your required accuracy and what maximum level of input voltage you are trying to protect against. You will also need to know what maximum input impedance the STM32 MCU can tolerate without undue ill effects. And how much current you are willing to allow the STM32 input protection networks to conduct.

Eg: Re comment, here is the general idea. It's also possible to use the emitter of a PNP BJT to clamp the voltage, provided there's a bit of current draw guaranteed from the 3.3V supply. Base to 3.3V, collector to ground.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
5
  • \$\begingroup\$ thank you Spehro for your time! it seems it's not a good idea to use zener diodes on analog inputs at all! and about the Schottky diode I come to BAT54C which has only 2uA leakage at 25°C and wont affect the accuracy as much as the SS14. I would like to have a protection of 8V.. cause my system main supply is 24V and I wonder if the user connect 24VDC signal to the ADC input and supply around 8Volts directly to the microcontroller pin, by mistake, do you have any suggestions ? I also prefer some protections against voltage spikes \$\endgroup\$ Sep 5, 2022 at 5:17
  • 1
    \$\begingroup\$ I suggest BAV99 (dual non-Schottky diode) with clamping to a zener biased to +3.6V or so and GND. Assuming the STM32 is okay with the resulting input currents (datasheet) and you don't require operation of the product with input out of range. \$\endgroup\$ Sep 5, 2022 at 5:20
  • \$\begingroup\$ sorry @Spehro duo to mu lack of English skills , I did not get the schematic you suggest correctly \$\endgroup\$ Sep 5, 2022 at 5:48
  • 1
    \$\begingroup\$ See edit for the general idea. I'm not going to completely design it for you here, but that should be enough to get an idea. \$\endgroup\$ Sep 5, 2022 at 6:37
  • 1
    \$\begingroup\$ thank you for your time dear Spehro <3 \$\endgroup\$ Sep 5, 2022 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.