Explain sensors, analog-to-digital conversion and sampling, and record and analyse real data from a phone or a simulated microcontroller.
Why it matters
Every physics result starts as a voltage in an instrument. Data acquisition (DAQ) is the chain that turns a physical quantity (temperature, acceleration, light, charge) into numbers in a file. Physicists design, calibrate and debug these chains constantly, and many analysis problems are really acquisition problems: the wrong sample rate, a missing timestamp, an uncalibrated sensor.
The DAQ chain
- Sensor or transducer: converts the quantity into an electrical signal. Examples: a thermistor (resistance changes with temperature), a photodiode (current from light), a MEMS accelerometer (capacitance changes with acceleration), a photomultiplier (charge pulses from single photons).
- Signal conditioning: amplifiers, filters and dividers that bring the signal into the converter's range and remove noise. An anti-aliasing low-pass filter removes frequencies the converter can't sample correctly.
- Analog-to-digital converter (ADC): samples the voltage at fixed times and rounds it to an integer.
- Timing and storage: a clock stamps every sample; software writes the data with its metadata.
Resolution
An n-bit ADC splits its input range into 2^n steps.
step size = V_range / 2^n
10-bit, 0-5 V: 5 / 1024 = 4.9 mV per count
12-bit, 0-3.3 V: 3.3 / 4096 = 0.81 mV per count
16-bit, +/-10 V: 20 / 65536 = 0.31 mV per count
A reading of 512 counts on a 10-bit, 5 V ADC is 512 * 5 / 1024 = 2.50 V. Resolution is not accuracy: an ADC with tiny steps can still be offset or noisy, which is why you calibrate against a known reference.
Sampling rate and aliasing
The Nyquist criterion says you must sample faster than twice the highest frequency in the signal. A 60 Hz signal sampled at 100 samples per second does not just look rough, it masquerades as a 40 Hz signal (100 - 60). Once aliased, no software can undo it, so you filter before the ADC and choose a sample rate well above twice the frequencies you care about (five to ten times is common).
Noise and averaging
Random noise shrinks when you average: the standard error of N independent readings is sigma / sqrt(N). Averaging does nothing for systematic errors, such as a sensor that reads 0.2 °C high; only calibration fixes those.
Phones and microcontrollers as DAQ
- Smartphone sensors are real MEMS instruments. The free phyphox app, from RWTH Aachen University (https://phyphox.org), records the accelerometer, gyroscope, magnetometer, light sensor and microphone and exports CSV files.
- Microcontrollers such as Arduino boards read sensors through built-in ADCs (
analogReadreturns 0 to 1023 on a 10-bit, 5 V Uno) and send data over USB serial. The free Wokwi browser simulator (https://wokwi.com) runs Arduino code with virtual sensors and potentiometers, so you can practise without hardware.
A minimal Arduino logger looks like this:
void setup() { Serial.begin(115200); }
void loop() {
int counts = analogRead(A0); // 0..1023
float volts = counts * 5.0 / 1023.0;
Serial.print(millis()); Serial.print(",");
Serial.println(volts, 3);
delay(10); // about 100 samples per second
}
Good data habits
- Record timestamps with every sample, not just a sample count.
- Save metadata: sensor model, settings, sample rate, units, date, who and where.
- Keep raw data untouched; write processed data to new files.
- Use plain, documented formats (CSV for small data, HDF5 for large arrays).
Real labs
Lab DAQ hardware, high-voltage detector supplies, lasers and cryogenics need institutional training and supervision. At home, stick to phones, simulators and battery-powered kits.
Common mistakes
- Sampling too slowly and analysing an aliased signal.
- Trusting raw counts without converting units and calibrating.
- Losing timing by assuming a perfectly steady sample rate; phones in particular vary.
- Averaging away a real signal with too long a window.
Recap
- Sensor, conditioning, ADC, timing and storage make up the chain.
- Step size = range / 2^n; resolution is not accuracy.
- Sample faster than twice the highest frequency, and filter first.
- Save timestamps, metadata and raw data.
Try it
Open the Do tab to record accelerometer data with phyphox (or a simulated sensor in Wokwi) and analyse its noise and sample rate.