A laboratory data logger built around a microcontroller shows three separate problems

PHYSICS · Multi-part · Fermi University Physics · Electronics, Instrumentation & Communication · Digital electronics, embedded systems and data acquisition · Digital electronics, embedded systems and data acquisition

Electronics for Measurement, Ch The microcontroller as laboratory hardware

Problem

A laboratory data logger built around a microcontroller shows three separate problems, each explained by a different member of the team. ((a)) The photodiode channel is sampled by a software loop intended to run at 5 kHz5\,\mathrm{kHz} (200 μs200\,\mu\mathrm{s} nominal interval). Over 10 00010\,000 samples the measured mean interval is exactly 200.0 μs200.0\,\mu\mathrm{s}, yet the digitised waveform shows small residual scatter about the expected sine. One team member says: "the mean interval is exactly right, so the sampling must be uniform and the scatter must come from somewhere else." Say what is wrong with this claim. ((b)) The same channel is also serviced by a timer interrupt that starts an SD-card write, with a latency of 4 μs4\,\mu\mathrm{s}, a critical section of 60 μs60\,\mu\mathrm{s} while the buffer is written, and one competing interrupt that can delay it by 6 μs6\,\mu\mathrm{s}. The record shows occasional gaps of up to 70 μs70\,\mu\mathrm{s} timed to the SD-card writes, but the designer calculated an "average" response time of 10 μs10\,\mu\mathrm{s} (latency plus a typical, not worst-case, critical section) and concluded this was safe against the 200 μs200\,\mu\mathrm{s} sampling interval. Say what is wrong with this reasoning, give the correct worst-case figure, and say whether it still fits within the 200 μs200\,\mu\mathrm{s} interval. ((c)) A humidity sensor is read over a 3.3 V3.3\,\mathrm{V} I2C bus with a 2.2 kΩ2.2\,\mathrm{k}\Omega pull-up, clocked at 400 kHz400\,\mathrm{kHz} (maximum allowed 30 to 70 per cent rise time 0.30 μs0.30\,\mu\mathrm{s}). With a short cable the bus capacitance is 100 pF100\,\mathrm{pF} and readings are reliable. Extending the cable raises the bus capacitance to 350 pF350\,\mathrm{pF} and the readings become unreliable. A team member says: "the bus rate is set in software, so the cable length cannot be the cause." Say what is wrong with this claim, and support it with the rise time 0.85RC0.85RC for both cable lengths.

Browse the problem library