RustyPlotter
A 2-axis pen plotter with a solenoid-actuated Z-axis
Author: Enache Elian-Daniel
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-ibbnog
Description
The RustyPlotter is a 2-axis CNC pen plotter using the STM32 NUCLEO-U545RE-Q as its microcontroller. It uses the Embassy asynchronous firmware stack in Rust to concurrently read the .gcode files from the SD-card, drive the motors for X/Y motion and actuate the solenoid for the pen to move and write. Because it uses a display with an integrated SD-card, it can run entirely without any other computer, as it takes its power from an external power supply.
Motivation
My initial inspiration definitely came from my passion for 3D printers. While I initially wanted to do a full 3D printer build, I ended up taking notes from Creality Ender 5-style machines for the skeleton and motion system of this plotter. There is also a great aspect of upcycling parts, as some of the hardware comes from a disassembled Tronxy X5SA-Pro I had lying around. Because the software needs to be written entirely in Rust (unlike standard C++ 3D printer firmware like Marlin), this project presents a great opportunity to explore asynchronous embedded programming. Furthermore, I wanted to execute the plotter idea differently compared to most DIY solutions by using a solenoid to push and pull the pen, rather than the usual servomotor handling its position.
Architecture
The main components of the plotter work together to complete the build:
- STM32 NUCLEO-U545RE-Q: The brain of the machine, running the Embassy executor
- NEMA17 Stepper Motors (with A4988 Drivers): Provide X and Y-axis planar motion via GPIO step/direction signals
- JF-0530B Solenoid (with a Dual MOSFET Module): Moves the pen up and down, actuated via PWM
- Mechanical Endstops: Get the origin (home) 0,0 position for X and Y-axis via GPIO input
- MKS MINI 12864 V2.0 Display (with an SD-card): Manages the entire user interface and reads the .gcode files for plotting over SPI
Log
Weeks 1 - 5
Thought of the initial project idea. Drafted the initial project proposal and documentation. The original concept was a 3-axis plotter inspired by 3D printer cube frames, using an aluminum bed driven by two Z-axis stepper motors on leadscrews.
Week 6
Received feedback on the initial project proposal from the lab assistant. As per suggestion, I fundamentally changed the Z-axis mechanical design to instead use a fixed bed with a solenoid mounted on the X-axis carriage to handle the pen movement, reducing mechanical complexity.
Weeks 7-8
I started more research on the components, especially what solenoid to use and what its requirements are. I figured out the necessary driver components (JF-0530B solenoid, Dual MOSFET module as suggested, flyback diode and decoupling capacitors). Also started purchasing the necessary hardware components and began testing the stepper motors in Rust.
Week 9
I mapped out the hardware architecture diagram and wrote the system documentation for the first documentation milestone.
Weeks 10-11
I planned, cut and assembled the aluminum frames for the new skeleton of the frame. I connected all the main components together and tested them, all working. Changed the display as the old one gave me trouble (lack of proper documentation). Bought another set of useful motion parts. Finished the KiCAD schematic of the circuit.
The frame of the plotter
The render of the frame
The connected components
Cutting the aluminum profiles
Tapping threads into newly made holes
Hardware
The plotter is built upon a rigid skeleton of 2020/2040 aluminum extrusions. Planar motion across the X and Y-axis is achieved using GT2 belts, pulleys, and V-slot wheels driven by two NEMA17 stepper motors. The electrical components are all connected through an 830-point breadboard with breadboard wires and jumpers. The NEMA17 steppers are driven by 2 A4988 stepper drivers, interfacing with the STM32 NUCLEO-U545RE-Q via GPIO. For protection of said drivers, 100uF 35V decoupling capacitors are added to help against voltage spikes. For the pen actuation, a JF-0530B 12V push-pull solenoid is used. It is controlled by a 15A 400W Dual Mosfet module, interfacing with the microcontroller via PWM. To prevent reverse voltage spikes from the solenoid getting to the MOSFET module, a 1N4007 flyback diode is used. The mechanical endstops, via GPIO, establish a known origin position for the X and Y-axis. In order to not get false triggers, 10kOhm external pull-up resistors and 0.47uF 50V debouncing capacitors are added. The machine is controlled (via SPI) with the help of the MKS MINI 12864 V2.0 Display, which contains a 12864 LCD with a rotary encoder, used for navigating through the menus, showing status and selecting the .gcode files for plotting, which are stored on an SD-card plugged into the SD-card reader, the other component of the Smart Controller. The entire system is powered by a 12V 6A power supply with a DC barrel-jack, with 5V particularly going to the STM32 via a 12-24V to 5V 5A step-down module.
Schematics
Bill of Materials
| Device | Usage | Price |
|---|---|---|
| x1 STM32 NUCLEO-U545RE-Q | The microcontroller | 112.47 RON |
| x1 12V 6A Power Supply | Supplies power to the board and the other components | 49.99 RON |
| x1 12/24V to 5V 5A Step-down Module | Provides the STM32 with 5V | already owned |
| x1 MKS MINI 12864 V2.0 | The display with encoder and SD-card reader | already owned |
| x1 SanDisk microSDHC Ultra 16GB C10/UHS-I | MicroSD-card (with SD-card adapter) | already owned |
| x2 NEMA17 SL42STH40-1684A-23 Stepper Motor | The motors that will move the pen on the X and Y axis | already owned |
| x2 A4988 Stepper Driver | The drivers that control the stepper motors | 15.98 RON |
| x2 100uF 35V Capacitor | Decoupling capacitors for protecting the stepper drivers | 0.60 RON |
| x1 JF-0530B 12V Push-pull Solenoid | Moves the pen up and down | 24.38 RON |
| x1 Dual MOSFET PWM Module, 15A, 400W | Helps control the solenoid | 2.83 RON |
| x1 1N4007 Diode | Flyback diode for the solenoid | 0.49 RON |
| x2 Mechanical Endstop | Used for getting the origin position on the X and Y axis | 13.98 RON |
| x2 0.47uF 50V Capacitor | Debouncing capacitors for the endstop false triggers | 0.50 RON |
| x2 10kOhm resistor | 10kOhm external pull-up resistors for the endstops | 0.20 RON |
| x1 GL-12 830 Point Breadboard | The central prototyping platform | 15.00 RON |
| x1 DC Jack Module | Gives the power to the breadboard | 4.99 RON |
| x1 40 Breadboard (DuPont) M-M 20cm Wires | For connecting the components | 15.00 RON |
| x1 140 Breadboard Jumpers | For connecting the components and short breadboard connections | 14.82 RON |
| x12 2020/2040 Aluminum Extrusions | The skeleton of the build | already owned |
| x1 Aluminum Bed | The surface on which the paper will sit | already owned |
| x6 Bed Screws with Springs | For securing the bed and making sure it's flat | already owned |
| GT2 Belt | X and Y axis motion | already owned |
| GT2 Pulleys | Guides the belt | already owned |
| x9 V-Slot Wheels | X and Y axis motion | 51.52 RON |
| x3 Eccentric Nuts | X and Y axis motion | 18.00 RON |
| Total | Total cost of the components | 340.75 RON |
Software
| Library | Description | Usage |
|---|---|---|
| embassy-stm32 | Embassy Hardware Abstraction Layer (HAL) for ST STM32 series microcontrollers | Async task management |
| embassy-executor | Async/await executor designed for embedded usage | Runs the asynchronous tasks |
| embassy-time | Instant and Duration for embedded no-std systems, with async timer support | Times the motor step pulses and delays |
| embedded-hal | A Hardware Abstraction Layer (HAL) for embedded systems | PWM for solenoid control |
| st7567s | Driver for the ST7567S LCD controller | Display driver library |
| embedded-graphics | Embedded graphics library for small hardware displays | For displaying the system on the screen |
| display-interface-spi | Generic SPI implementation for display interfaces | SPI communication layer for display driver |
| embedded-sdmmc | A basic SD/MMC driver for Embedded Rust | For storing and using the .gcode files |
| micromath | Embedded-friendly math library | For calculating motion |
| gcode | A gcode parser for no-std applications | For parsing the .gcode files |
| defmt | A highly efficient logging framework that targets resource-constrained devices, like microcontrollers | For debugging |