bk99.de entertain the web since 1997

Using Linux for time-critical tasks

Summary

Using a Raspberry Pi and a stepper motor, Hackaday explains why normal Linux fluctuates and which measures improve soft real-time behaviour. The experiment uses a 28BYJ-48 stepper motor. A ULN2003 drives its windings.

Ideas

  • A stepper motor makes timing deviations immediately visible.
  • Memory pressure can swap out a control process for seconds.
  • mlockall keeps the required memory pages in RAM.
  • An oscilloscope shows jitter more precisely than visible movement.

Insights

  • A fast response on average does not guarantee a maximum response time.
  • Measurable worst-case latency decides whether a controller is suitable.
  • Hard real time often belongs on a separate microcontroller.

Facts

  • Normal Linux is not a hard real-time operating system.

Recommendations

  • Measure latency under CPU, memory and I/O load.
  • Move safety-critical timing control to suitable hardware.

References

Read the original article

Search the Web Archive