Ongoing

Mesoscope: Automated Cell Imaging with On-Device AI

Research & Development·2026·Ongoing·3 min read

Built a self-contained microscope that images live cell cultures and runs cell-analysis inference on-device, with no external compute.

Overview

Mesoscope (working title for the CELLAIR project) is a low-cost, automated microscope built around a Raspberry Pi 5, a Hailo-8 NPU, and the open-source OpenFlexure platform. It images suspended cell cultures over time and runs segmentation and tracking models directly at the instrument, so analysis happens on-device rather than on separate lab infrastructure.

Problem

Observing changes in cell behaviour—such as movement patterns during calcification—requires repeated, consistent imaging over long periods. Commercial automated imaging systems are expensive, and manual imaging is slow and hard to reproduce, leaving no reliable way to capture subtle changes across many samples.

Constraints

  • Runs entirely on a Raspberry Pi 5 with no external compute infrastructure
  • Off-the-shelf and 3D-printed hardware to keep the build low-cost and reproducible
  • OpenFlexure v3 had to be ported to a Pi 5 running Raspberry Pi OS Trixie and Python 3.13
  • The larger IMX477 sensor required custom optics to be usable with scraped objectives

Approach

Provisioned the whole system with Ansible so a fresh Pi can be brought to a working state repeatably: camera and NPU drivers, OpenFlexure server, and the Pi 5 compatibility patches. Ported OpenFlexure v3 (FastAPI) to the Pi 5, integrated the HQ Camera via picamera2, and designed a custom 3D-printed optics module so a 125-150 mm tube lens fills the IMX477 sensor with sourced objectives. Cell segmentation and tracking models run on the Hailo-8 NPU over PCIe for real-time analysis at the microscope.

Key Decisions

Run inference on a Hailo-8 NPU at the instrument rather than off-loading to a server

Reasoning:

Keeps the system self-contained and portable, and enables real-time cell analysis without external compute.

Alternatives considered:
  • Stream frames to a GPU workstation for inference
  • Batch-process captured images offline

Build on OpenFlexure rather than a commercial automated microscope

Reasoning:

Open hardware and software made the system low-cost, reproducible, and fully customisable for the imaging workflow.

Provision the entire stack with Ansible

Reasoning:

Made the build reproducible from a freshly flashed SD card and captured the Pi 5 compatibility fixes as code.

Tech Stack

  • Raspberry Pi 5
  • Hailo-8 NPU (AI HAT+, 26 TOPS)
  • Pi HQ Camera (IMX477)
  • OpenFlexure (v3, FastAPI)
  • picamera2
  • Ansible
  • Python 3.13
  • YOLOv8 / ByteTrack
  • OpenSCAD

Result & Impact

Produced a working, reproducible imaging platform that streams live cell cultures and runs on-device inference, verified stable across reboots. It provides a low-cost basis for studying cell movement and calcification across many samples without dedicated lab infrastructure.

Learnings

  • Porting an open-source platform to newer hardware is mostly about untangling driver and ISP compatibility, not the application itself
  • On-device inference makes an instrument genuinely portable, but requires careful driver and kernel-module automation to stay reliable
  • Capturing hardware bring-up as Ansible code turns a fragile one-off setup into something reproducible