AI Control Software for a Precision Laboratory Instrument

The Challenge

Space Needle's product controls a scientific instrument called a scanning tunnelling microscope (STM for short); a device scientists use to take pictures of individual atoms. It works by hovering an extremely sharp needle, called a tip, about 2 nanometres above the surface being examined. That is roughly one fifty-thousandth the width of a human hair. The tiniest vibration (a passing truck, footsteps in the corridor, even air currents) can make the tip touch the surface and break. In some labs a tip lasts only a few hours and can cost up to €500 to replace, turning high-end microscopy into a fragile, expensive workflow.

Space Needle's idea is to actively cancel those vibrations before they reach the tip, using a small set of fast-spinning flywheels (a concept borrowed from how satellites keep themselves pointed in space). The hard part is not the mechanics; it is the brain. Something has to decide, thousands of times per second, exactly how to move those flywheels to counteract disturbances it cannot see in advance. A traditional, hand-tuned controller is not precise enough on its own; a purely AI-trained controller is not trustworthy enough on its own. Wozify was brought in to build the software that solves both halves of that problem.

The Solution

We delivered a complete Python software stack centred on a modern AI technique called reinforcement learning (the same family of algorithms that taught computers to beat humans at Go and to pilot drones). The architecture deliberately pairs a proven, hand-tuned classical controller with a neural network that learns small corrections on top. The classical part guarantees safe, predictable behaviour; the AI part handles the messy, real-world effects that mathematical models cannot capture. The industry calls this pattern “residual reinforcement learning”, and it is a pragmatic way to get the reliability of traditional engineering and the adaptability of modern AI in the same system.

The delivered software includes four tightly integrated components:

  • A physics-accurate digital twin. We built a simulator (using MuJoCo, a high-end physics engine widely used in robotics and AI research) that models the real device down to realistic hardware limits: how fast the flywheels can spin up, how much force they can deliver, and the kinds of low-frequency vibrations a real laboratory produces. Training inside a simulator is orders of magnitude cheaper and safer than training on a real microscope.
  • An AI controller. A PPO (Proximal Policy Optimization) neural network policy, implemented with PyTorch and Stable-Baselines3, learns corrective adjustments on top of a classical stabiliser. The codebase supports both the residual approach and pure end-to-end learning, selectable via a config flag, so the client can compare them side by side.
  • An engineering-grade training pipeline. 1 kHz physics simulation, a 100 to 200 Hz control loop, deterministic seeding for reproducible experiments, automatic episode termination when safety limits are exceeded, and anti-windup guards that keep the trained policy within what real hardware can actually do.
  • Interactive evaluation tools. A live 3D viewer lets engineers “poke” the simulated device at runtime and watch the AI recover in real time, alongside scripted benchmarks that compare the AI-controlled behaviour against the classical baseline using clean, numerical metrics.

Every design choice in the software was made with the eventual real-world prototype in mind. Actuator limits, sensor noise, and vibration profiles inside the simulator are matched to the hardware Space Needle is building, which directly attacks the biggest failure mode in applied AI for robotics: policies that work beautifully in simulation but fall apart on real hardware (a problem known in the field as the “sim-to-real gap”).

Space Needle simulation: reinforcement-learning AI controller stabilising a virtual microscope tip inside a physics-accurate digital twin

The Result

In roughly two months, Wozify took Space Needle from a blank codebase to a working, trainable AI controller with all the supporting infrastructure a small research team needs to iterate. The deliverables include:

  • A one-command training workflow that produces a robust AI controller on top of a safe classical baseline.
  • Reproducible, numerical benchmarks (root-mean-square and peak tip motion) that quantify how much better the AI-controlled system is than the classical baseline alone.
  • An interactive visualisation that lets non-specialists see the AI recover from deliberate “pokes”, making the system easy to demo to investors and partners.
  • Built-in safety limits and anti-windup protection, so nothing the AI learns in simulation would be physically impossible on real hardware.

In business terms, the software directly supports Space Needle’s value proposition to labs: even halving the rate at which tips are damaged translates into meaningful annual savings per instrument and, more importantly, predictable experimental time for the scientists using them. The project also shows what a small team equipped with modern AI tooling can do in a short timeframe, turning a research-grade idea into demonstrable, investor-ready software without a large engineering headcount.

Project tech stack

Python programming language

Python

PyTorch deep learning framework

PyTorch

MuJoCo physics simulation engine

MuJoCo

Gymnasium reinforcement learning environment

Gymnasium

Stable-Baselines3 by DLR-RM

Stable‑Baselines3

Long-term wins

A reusable AI control stack. The pattern we built (a safe classical controller plus a learned AI correction on top) transfers cleanly to other precision-instrument problems, not just microscopes.
Faster iteration, lower risk. Training inside a simulator means Space Needle can test controller changes in minutes, without risking an expensive piece of lab hardware.
A credible path from simulation to real hardware. Realistic physics, safety limits, and noise are baked into the training loop, shrinking the gap between what works in simulation and what works on the bench.
A clear business case. Longer tool life means fewer consumables, less operator downtime, and more predictable research time, which compounds quickly on high-end instruments.