Electronics Foundations — Validating Sensor Inputs
A Plausible Code Is Not a Validated Input
In one line
The mere fact that a digital number was output does not verify the input voltage or the cause of a fault.
Why this was needed
A program that reads a voltage always returns the maximum value. If you wrote the code to clip the calculation range for display, the number looks fine even when the input overshoots slightly. But software saturation handling does not protect the physical pin. The normal input range, the absolute maximum rating, and the overvoltage protection conditions must be distinguished when you read the datasheet. This course is a calculation lab that applies no voltage to a real circuit.
How it works
A 12-bit unsigned code has 4096 states, from 0 to 4095. This virtual ADC limits floor(Vin/3.3*4096) to 0 to 4095. This is an explicitly stated educational conversion convention, not the real transfer function of every ADC. Depending on the datasheet, the code boundaries, offset, saturation handling, and calibration formula differ. In particular, do not mix the two-endpoint calibration formula that divides by 4095 with the code width of 3.3/4096 V used here.
Raising the resolution does not make the load error of the front end go away. You must record ideal quantization error, reference voltage error, resistor tolerance, and the error of not waiting long enough as separate items to narrow down the cause. Even if you feed board values into an AI model, the problem of an input that was measured wrong is not solved by the size of the model.
What it looks like in the field
A fault hypothesis must include a prediction. If there is an educational synthetic observation that the output is 2.49 V and the allowed observation interval is ±0.02 V, you calculate and compare the predictions of three models: normal, bottom open, and load short. Even if exactly one candidate matches, it only means "no contradiction among the three candidates". Causes that were not in the initial list, such as a sensor failure, a wiring error, or a mistaken resistor value, have not yet been ruled out.
The next action must be an additional check that can distinguish the hypotheses. On real equipment, checking a resistor requires removing the power, dealing with residual energy, and then isolating the effect of the circuit's parallel paths. This lab does not carry out that procedure but records it as the next item to check. We do not instruct you to use the resistance measurement mode on a powered circuit.
The contract between a value with units and a code
Consider an ADC of the same kind for testing, with 4 bits and a range of 0 to 4 V. The code width is 0.25 V. 0.62 V goes to floor(0.62/4×16)=2. If you store only the number, code 2, you later lose which reference voltage and number of bits it was converted with. In a data pipeline you must keep the raw code, the conversion convention, the reference voltage, and the unit together to be able to reinterpret it.
In the virtual convention, if the input is exactly 4 V, the intermediate value of the calculation is 16 but the display upper limit is 15. Conversely, negatives are clipped to 0. To tell these two apart from values inside the normal range, you need an input-validity flag separate from the code. Whether a real ADC has such a flag differs by product, so do not interpret this textbook's JSON fields as hardware registers.
A resistive load error can be a systematic error with a direction. In such a case, averaging the same value a hundred times does not bring you back to the correct voltage. Repeated measurement helps you look at random variation, but it does not change the model's wrong divider ratio. "Increasing the averaging" and "fixing the wrong connection" solve different problems. When you record, before writing a large sample count, you should first write which error you were trying to reduce.
Four things a report must contain
First is the conditions. State the supply, resistors, load, initial state, time, and ADC convention. Second is the evidence. Keep the formulas and output files, and for values that are not measurements, leave a source label of synthetic or model prediction. Third is the judgment. Explain which tolerance interval you used to include or exclude each candidate. Fourth is what you do not yet know. If you did not put the temperature characteristics of the real parts or the instrument error into this calculation, do not fill the blank with success.
The ±0.02 V of this observation is not the standard deviation of a probability distribution but an agreement interval specified for educational purposes. So you compare whether it is inside [2.47, 2.51] V centered on 2.49 V. There is no statistical basis to call this a "95% confidence interval". In a real measurement report, you must build the uncertainty separately, based on the instrument's accuracy specification, resolution, calibration state, and measurement method.
When you exclude one candidate too, check the calculation conditions. In an ideal short the output is predicted to be 0 V, but with real wiring resistance or protection devices it may not be exactly 0. This lab allows only nominal resistances and ideal faults, so it judges within those conditions. If a real observation disagrees with every candidate, do not force the nearest candidate as the answer; investigate the model or the measurement again.
The JSON grading of the lab checks the calculated values of these ledgers. The fact of having copied an answer file does not prove your whole circuit analysis ability. On your own, change the input supply to another value and recalculate to explain whether the prediction changes linearly and whether it approaches the no-load value when you make the load large. This extra practice is separate from the automatic grading score, and it is better to include in your portfolio the conditions you used and the counterexamples you made yourself.
What you will do in the next lab
You submit the steady state, time response, code, and fault candidates as seven JSON files. Each file is a calculation output that checks the reproducibility of a value. To prove real-board verification skills, you would additionally need instrument settings, raw waveforms, measurement uncertainty, repeated results, and a review of the part datasheets later.