When I am designing around a sensor, I rarely treat the electrical specification in the datasheet as the whole story.
A datasheet might tell me:
Supply: 12 V
Output: 0–5 V
Accuracy: ±1 %
Bandwidth: 20 Hz
On paper, that looks easy.
Scale the voltage if necessary, connect it to the ADC, add a little filtering and move on.
But the PCB is only one part of the final measurement system.
Eventually there will be a real sensor, a real cable, a connector, another power supply, grounding between different pieces of equipment, switching loads nearby and probably an installation that looks nothing like my nice clean bench setup.
That is why, when I design an analogue sensor input, I prefer to leave myself some room to react to the real hardware.
Not because I expect the sensor to be bad.
Because I do not fully trust all the assumptions around it yet.
For me, the analogue input starts at the connector
I tend to think of the complete path as something like:
Sensor
|
Cable
|
Connector
|
Protection
|
Scaling / Bias
|
Filtering
|
Buffer / Gain
|
ADC
The connector is an important boundary.
On one side I have my PCB, where I control the power rails, copper geometry, components and grounding.
On the other side is the outside world.
From my EMC background, that boundary always makes me slightly suspicious.
Anything arriving through a cable can potentially bring with it:
ESD
conducted RF
common-mode noise
ground offsets
fast transients
overvoltage
incorrect wiring
power sequencing I did not expect
So I normally ask myself a question quite early:
What is the worst reasonable thing that could arrive at this connector?
Not the absolute worst imaginable event, because then every input would end up looking like the front end of a power station.
But something realistic for the environment where the product is going to be used.
Protection is part of the measurement circuit
It is tempting to draw a protection block and mentally separate it from the analogue design.
I try not to do that.
A protection component still has electrical characteristics.
Take a TVS diode.
It may give me excellent protection against a transient, but it can also have:
capacitance
leakage current
clamping-voltage variation
temperature dependence
For a low-impedance 0–10 V industrial signal, a relatively large capacitance may be completely irrelevant.
For a high-impedance or faster signal, it might not be.
The same is true for series resistors.
Suppose I add:
Sensor ---- 10 kΩ ---- ADC front end
because I want to limit current during an overvoltage event.
That may be a perfectly sensible protection measure.
But I have also just added 10 kΩ to the source impedance seen by everything downstream.
That affects:
RC filtering
ADC acquisition time
leakage-current error
noise susceptibility
So protection is not something I bolt onto the front of the circuit and then forget about.
It becomes part of the analogue path.
Leakage can become surprisingly important
This is especially true if I am working with large resistor values.
Imagine an input network with an effective source resistance of:
100 kΩ
Now suppose the combined leakage from a protection device, ADC input and PCB is:
100 nA
The voltage error is simply:
Verror = Ileak × Rsource
So:
Verror = 100 nA × 100 kΩ = 10 mV
That is already significant for many sensor measurements.
At 1 µA leakage, it would become:
100 mV
This is why I am always cautious when I see a very high-impedance analogue node combined with protection components selected purely from their surge rating.
The protection may work perfectly and the measurement may quietly become inaccurate.
I like leaving filtering adjustable
Filtering is one area where I deliberately like to leave some options.
Suppose I am measuring a pressure sensor whose useful response is only a few hertz.
There is very little benefit in allowing hundreds of kilohertz of unwanted electrical noise into the ADC.
A simple input filter might be:
R
Signal ------/\/\------+------ ADC
|
C
|
GND
The nominal cutoff frequency is:
fc = 1 / (2 × π × R × C)
If I choose:
R = 1 kΩ
and:
C = 100 nF
then:
fc ≈ 1.59 kHz
That may still be far above the useful sensor bandwidth, but it removes a lot of high-frequency rubbish before it reaches the ADC.
The problem is that before I connect the real sensor and cable, I may not know exactly what rubbish I am dealing with.
So I often prefer to give myself options such as:
R = 0 Ω / 100 Ω / 1 kΩ / 10 kΩ
C = DNP / 1 nF / 10 nF / 100 nF
The first PCB can be populated with a sensible starting point.
Then I can look at the real signal and decide.
I have become much more comfortable with this approach over the years.
There are things I can calculate accurately before the board exists.
There are other things that are much easier to understand once the sensor, cable and environment actually exist.
I do not see any benefit in pretending otherwise.
DNP components are still part of the design
This is why I like DNP footprints.
A capacitor that is not fitted can still be a very useful component.
For example:
R1
Sensor ----------/\/\------+------ ADC
|
C1
|
GND
The first build may use:
R1 = 0 Ω
C1 = DNP
That is effectively a direct connection.
Later I may decide:
R1 = 1 kΩ
C1 = 10 nF
or:
R1 = 100 Ω
C1 = 100 nF
depending on what I actually measure.
The important part is that I do not need another PCB revision just to test it.
This is very similar to the way I think about links elsewhere in a design.
A few carefully chosen optional components can give me a lot of flexibility without turning the schematic into a configuration nightmare.
Scaling networks deserve more attention than they normally get
A very common requirement is adapting a sensor range to the ADC input range.
For example, suppose I have:
Sensor output: 0–10 V
and:
ADC input: 0–3.3 V
A simple divider works:
VIN
|
R1
|
+------ ADC
|
R2
|
GND
The relationship is:
VADC = VIN × R2 / (R1 + R2)
If I choose:
R1 = 22 kΩ
and:
R2 = 10 kΩ
then:
VADC = 0.3125 × VIN
So a 10 V sensor input becomes:
3.125 V
That leaves useful headroom below a 3.3 V ADC rail.
But the resistor values are not only about the ratio.
If I make them very large, I reduce current consumption.
But I also increase:
source impedance
leakage sensitivity
thermal noise
ADC settling requirements
susceptibility to interference
If I make them very small, I improve drive strength but increase sensor loading and power consumption.
There is no universally correct value.
The ratio matters more than the absolute resistor values
For measurement accuracy, what I often care about most is the divider ratio.
Suppose both resistors are 1%.
That does not mean the divider ratio is automatically accurate to 1%.
One resistor can move high while the other moves low.
If:
R1 = 22.22 kΩ
and:
R2 = 9.90 kΩ
then the real division ratio is different from nominal.
For a precision input, this may dominate the ADC error by a huge margin.
This is one reason I sometimes prefer matched resistor networks.
What matters is not necessarily whether both resistors are exactly correct individually.
What matters is whether their ratio remains stable, especially with temperature.
Temperature is easy to forget on the bench
On the bench, everything may be sitting around 20–23°C.
The final unit may not be.
If a resistor has a temperature coefficient of:
50 ppm/°C
and the temperature changes by 50°C, the resistance can change by approximately:
2500 ppm = 0.25%
Again, if both divider resistors move together, the ratio may barely change.
If they move differently, the measurement gain changes.
This is where matched components become valuable.
A front end that looks excellent during a room-temperature test can behave quite differently once installed in an enclosure, near power electronics, or outdoors.
The sensor ground is not always my ground
This is another thing I pay a lot of attention to.
A voltage-output sensor may say:
Output: 0–5 V
But that voltage is normally:
0–5 V relative to the sensor’s ground.
If the sensor ground and my PCB ground are separated by a few hundred millivolts, I do not necessarily receive the voltage I think I am receiving.
Imagine:
Sensor output relative to sensor GND = 2.500 V
Sensor GND relative to PCB GND = +0.300 V
My PCB may effectively see:
2.800 V
That is not an ADC error.
That is a system grounding problem.
Long cables, shared supply returns, motors, pumps and other loads can all create voltage drops.
From EMC work, I have become very conscious that a ground symbol on the schematic is not a magical zero-volt point everywhere in the physical system.
Current has to flow through real conductors.
Real conductors have impedance.
Sometimes differential measurement is the better answer
If I expect meaningful ground differences, a single-ended input may simply be the wrong architecture.
A differential input can sometimes be much more robust.
Instead of measuring:
Sensor signal relative to PCB ground
I measure:
Sensor signal relative to sensor return
and let the analogue front end reject the common-mode voltage between the remote sensor and my PCB.
But then I have to check the common-mode input range carefully.
For example:
V+ = 2.60 V
V- = 2.50 V
The differential signal is only:
100 mV
but the common-mode voltage is:
2.55 V
The amplifier has to accept both.
I have seen enough analogue circuits where somebody has checked the differential range and forgotten the common-mode range to always look at both.
“Rail-to-rail” does not answer every question
This is another phrase I treat carefully.
An op-amp datasheet may say:
Rail-to-rail input and output
That is useful.
But I still want to look at the detailed graphs.
How close to the rail can the input really operate?
Does performance change near the rail?
What load is used for the output-swing specification?
How does offset behave through the common-mode transition region?
Can the output drive my ADC input network?
The headline tells me where to start.
The curves usually tell me what I actually need to know.
Sometimes I buffer, sometimes I deliberately do not
An op-amp buffer can be very useful:
Sensor -> filter -> op-amp -> ADC
It can provide:
low output impedance
gain
level shifting
active filtering
isolation from the sensor
But it also brings its own errors:
offset voltage
bias current
offset drift
noise
finite gain
common-mode limitations
output swing limitations
So I do not automatically add an op-amp because “analogue inputs need buffering”.
I try to work out what problem the amplifier is solving.
If the sensor already has a strong low-impedance 0–5 V output and the ADC can accept it happily through a passive network, an op-amp may add complexity without giving me anything useful.
If I have a high-impedance source driving a switched-capacitor ADC, the buffer may be exactly what I need.
ADC acquisition time is part of the input design too
This is closely related to another topic I have written about separately.
A SAR ADC normally has an internal sampling capacitor.
When the ADC samples, that capacitor has to charge from the external circuit.
If the source impedance is too high, the capacitor may not settle before the acquisition window ends.
That means a divider such as:
330 kΩ
100 kΩ
might produce exactly the correct voltage when measured with a multimeter but still give a wrong ADC result.
The multimeter sees a steady voltage.
The ADC is periodically taking charge from the node.
Those are different electrical conditions.
So when I choose scaling and filtering resistors, I also check what source impedance the ADC actually allows.
Cable capacitance can change the circuit as well
Long cables are not electrically invisible.
A cable adds:
capacitance
inductance
resistance
coupling to nearby conductors
Suppose the sensor has a 20 m cable and the cable capacitance is roughly:
100 pF/m
That is approximately:
2 nF
of cable capacitance.
Now imagine the sensor output has a relatively high source resistance.
I have created another RC pole before the signal even reaches my PCB.
If the sensor is slow, this may be irrelevant.
If I am expecting fast transient response, it may not be.
And if an op-amp output is directly driving a long capacitive cable, stability may become a concern as well.
Again, the sensor interface is a system, not just the circuit immediately around the ADC pin.
I always think about what happens when the cable is disconnected
The nominal operating condition is only one condition.
What happens if the sensor cable is open circuit?
If the ADC input has no defined bias, it may float.
A floating analogue input can produce almost any value depending on:
leakage
nearby signals
previous ADC channels
environmental noise
That can be dangerous from a diagnostic point of view.
The firmware might interpret a random mid-scale value as a perfectly valid sensor reading.
Sometimes I deliberately add a weak pull-up or pull-down so that an open circuit produces a known invalid state.
For example:
Sensor disconnected -> ADC tends towards 0 V
Then firmware can identify:
below plausible measurement range = sensor fault
That is much more useful than letting the input wander.
Short circuits deserve the same thought
If the sensor output is shorted to ground, what happens?
If it is shorted to its supply?
If the wrong voltage is applied?
If two connectors that physically fit are accidentally interchanged?
I am not trying to make every PCB indestructible.
But I do want predictable failure modes.
Ideally, a wiring mistake results in:
a current limited by a resistor
a protection device clamping
a diagnostic fault
rather than:
a destroyed MCU ADC input
or even worse:
a partly damaged input that still appears to work but measures incorrectly
Those are much harder faults to find.
Power sequencing can create some very strange behaviour
Another condition I like checking is:
What happens if the sensor is powered and my PCB is not?
Suppose:
Sensor output = 5 V
MCU supply = 0 V
The sensor may drive current through the microcontroller’s internal ADC protection diode into the 3.3 V rail.
Now I can accidentally power part of the PCB backwards through an input pin.
That can produce very strange startup behaviour.
I normally check the device’s permitted injection current and think about whether external analogue signals can exist before the local supply.
A simple series resistor can sometimes make that condition safe.
But, as before, that resistor then affects acquisition time and filtering.
Everything is connected.
Test points are cheap. Debugging without them is not.
For important analogue channels, I like having test points at useful places.
For example:
Connector -> TP1 -> Protection -> TP2 -> Filter -> TP3 -> ADC
That lets me ask:
What does the raw sensor signal look like?
What happened after protection?
What happened after filtering?
What voltage is actually present at the ADC?
Without those measurement points, several blocks can become one black box.
With them, I can follow the signal through the PCB.
From experience, I almost never regret having an accessible analogue test point.
I have definitely regretted not having one.
I particularly like being able to inject a known signal
If the measurement matters, I like having a way to separate the sensor from the electronics.
For a nominal 0–5 V channel, I might inject:
0.00 V
1.25 V
2.50 V
3.75 V
5.00 V
Then I can test:
Input protection
|
Scaling
|
Filter
|
Amplifier
|
ADC
|
Firmware conversion
|
Engineering units
without involving the actual sensor at all.
This is very useful.
If the final displayed value is wrong, I can quickly ask:
Is the sensor wrong?
Is the analogue circuit wrong?
Is the ADC conversion wrong?
Is the firmware scaling wrong?
That separation can save a lot of time.
Calibration can be designed in rather than added later
The same injection point can help with calibration.
If I know the analogue front end will require calibration, I want to think about how that calibration will actually be performed while I am designing the board.
Can I apply known voltages easily?
Can production access the required test points?
Can firmware store calibration coefficients?
Do I need one-point or two-point calibration?
A two-point calibration can correct a lot of static gain and offset error:
Corrected value = m × raw reading + b
where:
m corrects gain
b corrects offset
That can compensate for resistor ratios, reference tolerance and amplifier gain.
It will not correct everything, particularly temperature drift and non-linearity, but it can improve the system enormously.
The PCB layout is still part of the sensor input
Once I have selected all the right components, I still have to put them on the board properly.
For analogue inputs I care about things such as:
keeping high-impedance nodes short
keeping switching nodes away from sensitive signals
controlling return-current paths
placing filter capacitors where they actually help
keeping reference and sensor returns clean
avoiding digital currents flowing through analogue ground paths
The schematic might show:
Sensor GND ---- GND
ADC GND ------- GND
MCU GND ------- GND
Switching regulator GND ---- GND
All the same net.
But physically, I do not necessarily want several amps of switching current sharing the same copper path used by a millivolt-level sensor return.
The electrons do not care that all four symbols have the same name.
They care about impedance.
That is something my EMC experience has made me think about constantly.
Sometimes I even leave alternative gain options
If I am not completely certain about the real sensor range, I may design an amplifier stage with several population options.
For example:
Gain option A = ×1
Gain option B = ×2
Gain option C = ×5
I do not necessarily need jumpers.
Sometimes it is enough to provide alternative resistor footprints and define the gain through the BOM.
The first prototypes can then tell me whether I am using the ADC range efficiently.
There is little point in using a 16-bit ADC if the real sensor only occupies 10% of its input range.
On the other hand, I do not want to amplify so aggressively that normal sensor tolerances cause clipping.
Again, leaving a small amount of controlled flexibility makes development easier.
I try not to design only for the nominal value
This is probably the main habit behind all of this.
If a sensor is specified as 0–5 V, I do not necessarily design a front end that fails at 5.001 V.
I want some headroom.
If the ADC full scale is 3.3 V, I may scale the maximum expected sensor value to:
3.0 V
or:
3.1 V
rather than 3.299 V.
Yes, I lose a little ADC range.
But I gain tolerance for:
sensor output tolerance
resistor error
supply variation
transients
In most real instruments, that is a trade I am happy to make.
Using every last ADC count is not particularly useful if the input clips occasionally.
Designing for uncertainty does not mean guessing
There is an important distinction here.
I am not suggesting adding random capacitors, links and resistors everywhere because something might go wrong.
That quickly creates a messy and difficult-to-control design.
The way I try to approach it is:
What do I genuinely not know yet?
For example:
exact noise spectrum
real cable length
actual sensor source impedance
final required bandwidth
ground difference in installation
Then:
What low-cost option would let me adapt if that assumption turns out to be wrong?
Maybe that is:
one DNP capacitor
one series resistor footprint
one link
one test point
one alternative gain resistor
That is enough.
The real sensor usually teaches you something
This is perhaps the biggest reason I like this approach.
There is always a moment when the real sensor gets connected to the real electronics.
That is when all the assumptions meet reality.
The signal might be cleaner than expected.
Great.
Leave the optional filter components unpopulated.
It might have more noise than expected.
Fine.
Now I already have somewhere to add filtering.
The cable may introduce an unexpected ground offset.
Now I have evidence that the input architecture needs to change.
The sensor output may have a startup transient that was not obvious from the datasheet.
Now I can see it and decide whether the protection needs adjusting.
I prefer letting measurements drive those decisions.
The question I normally ask myself
When I am designing an analogue input, I do not only ask:
Will this circuit measure the nominal sensor output?
I also ask:
What happens when the real sensor is slightly different from the one in my head?
What if:
the impedance is higher?
the cable is longer?
the signal is noisier?
the grounds are not identical?
the sensor is disconnected?
the output exceeds its nominal range?
the sensor is powered first?
I need a different bandwidth later?
I do not need the PCB to solve every possible situation.
I just want enough flexibility to investigate the sensible ones.
Because the first time a new sensor is connected, I would much rather change one resistor or fit one capacitor than explain why the whole PCB needs another revision.
For me, that is what designing an analogue input for a sensor I do not fully trust yet really means.
It is not about distrusting the sensor manufacturer.
It is about respecting the fact that the real measurement system is always bigger than the sensor datasheet.

