# OuijaCNC: Raspberry Pi 3 and ESP32 power automated magnetic Ouija board

> **Key takeaway:** A Raspberry Pi 3 Model B+ running Raspberry Pi OS Trixie controls a custom core XY CNC machine via Python Flask and G-code, using an ESP32 as the motor driver for a magnetically-actuated planchette.

**Published:** 2026-10-30T09:02:14+00:00 
**Source:** Raspberry Pi News 
**Category:** open-hardware 
**Canonical URL:** https://fosswire.org/news/ouijacnc-raspberry-pi-3-and-esp32-power-automated-magnetic-o.html 

## Summary
A Halloween-themed open hardware project combines a Raspberry Pi 3 Model B+ with a custom-built core XY CNC machine to create an automated Ouija board. The system uses an ESP32 microcontroller to drive stepper motors via G-code commands received over USB serial from a Python Flask web application running on the Pi. The planchette is moved magnetically from beneath the board surface, with ball bearings embedded in its base to reduce friction against a heavy wooden piece.

The software stack includes Raspberry Pi OS Trixie, Raspberry Pi Connect for remote access across changing networks, and a Python Flask web UI that converts typed text into G-code coordinates mapped to letter positions on the board. The ESP32 handles real-time motor control while the Pi manages network connectivity, web serving, and G-code generation. The project demonstrates how commodity single-board computers and microcontrollers can be integrated for precision mechanical control in home-built CNC applications.

## Hardware architecture and control flow
- **Raspberry Pi 3 Model B+:** Serves as the primary controller running Raspberry Pi OS Trixie, handling network connectivity via Raspberry Pi Connect, web UI serving, and G-code generation through a Python Flask application.
- **ESP32 microcontroller:** Acts as the real-time motor driver, receiving G-code instructions over USB serial from the Pi and translating them into stepper motor commands for the core XY mechanism.
- **Core XY CNC mechanism:** Built with 3D-printed parts, fishing line as drive belts, and multiple magnets on both the CNC head and planchette; spring-loaded magnet mounts maintain consistent pressure against the board underside.
- **Friction reduction system:** Free-spinning ball bearings embedded in the planchette base address the challenge of moving a heavy wooden piece with large surface area across the board.
- **Coordinate mapping:** Letter and word positions on the board surface are stored as G-code coordinates in a JSON file read by the Flask application, requiring manual calibration for each board layout.

## Why it matters
This project illustrates the continued utility of older Raspberry Pi hardware in embedded control applications, with the Pi 3 Model B+ finding new purpose after years as a print server. The combination of a Linux SBC for high-level networking and UI with a dedicated microcontroller for real-time motor control reflects a common and accessible pattern for hobbyist CNC and robotics builds. While the Ouija board itself is a novelty, the underlying core XY design was already reused by the builder for a CNC plasma cutter, suggesting the mechanical and software framework has broader applicability for open hardware fabrication tools.