I am looking into a 0-5V analog sensor. The problem with this sensor is that it

will typically swing within 15 millivolts of the power supply rails with no output load.

(datasheet p. 4)

This means that the last 15mV of its ideal 0-5V range are unused, so its range is really 0.015-4.985V.

I have two questions about this:

  • Is this common to all analog sensors?
  • If so, why is this the case?
  • \$\begingroup\$ No, it's not common. This sensor likely has a rail-to-rail DAC in its last stage like some other magnetic sensors have (e.g. MLX90340 \$\endgroup\$ – Huisman Feb 25 '19 at 17:10
  • \$\begingroup\$ It swings to within 15 millivolts, so your range is really be much better than you stated: 0.015 to 4.985, considerably better than 0.15 to 4.85, and introducing an error of about +/-1 degree at the zero-crossing point. \$\endgroup\$ – John Birckhead Feb 25 '19 at 17:28
  • 3
    \$\begingroup\$ 15mV = 0.015V, not 0.15V. \$\endgroup\$ – DKNguyen Feb 25 '19 at 17:38
  • \$\begingroup\$ yes, it's common; ever try to weigh a cat on a bathroom scale? \$\endgroup\$ – dandavis Feb 25 '19 at 18:10
  • \$\begingroup\$ Thanks Toor, good thing you're right or that would be a lot of nonlinearity. \$\endgroup\$ – user211492 Feb 25 '19 at 21:23

Correction: range is 0.015V - 4.985V

Close to power supply rails is common for sensors that have been followed with an active linear amplifier before output. Since your sensor outputs a linear voltage, and requires a 5V power supply, it seems that a linear amplifier is likely used.
A sensor that generates its own voltage or current (like a piezo, or a sense coil) and has no amplifier would not likely have this kind of specification.

A linear amplifier includes transistor devices (probably N-channel and P-channel MOSfets) that pull the output voltage down toward ground (zero volts) or up toward the positive supply rail (+5 volts). These devices cannot pull all the way....
An analogy might be raising a weight from a ceiling-mounted pulley with a rope. No matter how hard you pull on the rope, the weight can only rise up to the pulley, and never quite reaches the ceiling. That would be analogous to the +4.985 voltage limit of your sensor not quite reaching the +5V power supply ceiling.

| improve this answer | |

This means that the last 15mV of its ideal 0-5V range are unused, so its range is really 0.15-4.85V.



will typically swing within 15 millivolts of the power supply rails with no output load.

Emphasis mine. So, add a load to the output and you will probably dampen that oscillation.

Note that this isn't what you'd normally see from a rotary encoder. Because that is not an analog sensor at all, actually. It only has an analog output for convenience reasons. Internally, it's more or less a digital counter with a digital-to-analog converter. Probably, that conversion is done with a PWM unit, followed by an analog low-pass RC filter, and that filters "better" when you load it. (Unless you design it with a sharper filter, which they seemingly didn't; the analog model is really just a PWM model + one resistor + one capacitor, most likely.)

Is this common to all analog sensors?

No, yes. I mean. Yes.

You get noise in every system that is warmer than absolute zero. In an analog system, you notice that as fluctuation away from the actual signal value.

If so, why is this the case?

Hm, imagine solid matter as a somewhat structured clutter of atom cores with electron bands, in which the electrons kind of "dissolve" and just contribute to the band as a whole. These bands exist as a statement of "at energy level soandso and impulse soandso, there's a x% probability of electron".

If you now apply a small vibration (that's what temperature is, the energy of mass bouncing around very quickly, but overall staying in the same place, otherwise the thing wouldn't be solid), you kinda disturb the whole distribution of electron probabilities.

That has consequences: because in some energy-impulse position that prior had a 0% chance of electron, you might now have a 90% chance of electron. That means that overall, the "likely" positions of electrons shift.

That's effectively a current. You see noise currents due to thermal noise, and that implies noise voltages.

Thermal noise isn't the only kind of noise: anything that conducts is kind of an antenna – probably a pretty bad one, but for some frequencies, an OK one. So you pick up radio waves, too, for example.

There's way more sources of noise than I could list here – but in the analog world, you can't make a decision on whether they're part of the signal or not.

In the digital world, you restrict yourself to discrete voltages, say 0 V, 1 V, 2 V and 3 V. If your receiving end sees "1.1 V", it can reasonably apply a correction to that. Sure, there's some likelihood that it's not a noisy 1 V (+0.1 V noise), but say a noise 2 V (-0.9 V noise) or a 0 V (+1.1 V noise) originally, but for most noise types, lower values for noise amplitude are more likely than higher, so this question can be answered with a maximum likelihood approach of "take the nearest discrete value".

That's why, whenever feasible (technologically and economically), an EE will choose to place the ADC as close as possible to the analog sensor: Where your 0.1 V noise on the digital line make no difference at all, it would be a 2% error on your analog 0 to 5 V sensor.

| improve this answer | |
  • \$\begingroup\$ "Internally, it's more or less a digital counter with a digital-to-analog converter." While likely, I'd avoid flat declarations. PWM can be done purely analog, using a pulsed ramp generator and a comparator or two. The idea seems pretty perverse, but I'm not sure it can be ruled out. \$\endgroup\$ – WhatRoughBeast Feb 25 '19 at 18:16
  • \$\begingroup\$ @WhatRoughBeast the device's datasheet specifies its PWM mode and how it relates to the 1024 angular counts. \$\endgroup\$ – Marcus Müller Feb 25 '19 at 19:41
  • \$\begingroup\$ @MarcusMüller I enjoyed your detailed response on the physics, thanks. One followup: I thought that making PWM into analog with an RC filter was approximate and ineffective. I didn't think you could get a reliable output at 1kHz because of the delay. Are you saying that with the correct resistor and capacitor you can process a 1kHz 10 bit PWM to the corresponding analog signal? \$\endgroup\$ – user211492 Feb 25 '19 at 21:56
  • \$\begingroup\$ Well, it all depends to what error you're accepting – but sure, a 1 kHz PWM signal has limited bandwidth, and especially, aside from its average, no spectral components below 1 kHz; so a filter that suppresses 1kHz by the amount you need (e.g. 50 dB) would do. The hard thing is not designing that filter (an RC filter has roughly -6 dB per octave in attenuation, so your cutoff frequency just needs to be 2⁻⁸ below 1 kHz – so, at roughly 4 Hz. The problem is not designing that filter, (some kΩ R and 1 µF C), but that you really mustn't load that RC filter. \$\endgroup\$ – Marcus Müller Feb 25 '19 at 22:17

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.