Skip to main content
Version: FILS English

RustyPlotter

A 2-axis pen plotter with a solenoid-actuated Z-axis

info

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
  • RepRapDiscount Full Graphic Smart Controller (with an SD-card): Manages the entire user interface and reads the .gcode files for plotting over SPI

RustyPlotter Architecture

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.

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 RepRapDiscount Full Graphic Smart Controller, 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.

Bill of Materials

DeviceUsagePrice
x1 STM32 NUCLEO-U545RE-QThe microcontroller112.47 RON
x1 12V 6A Power SupplySupplies power to the board and the other components49.99 RON
x1 12/24V to 5V 5A Step-down ModuleProvides the STM32 with 5Valready owned
x1 RepRapDiscount Full Graphic Smart ControllerThe display with encoder and SD-card readeralready owned
x1 SanDisk microSDHC Ultra 16GB C10/UHS-IMicroSD-card (with SD-card adapter)already owned
x2 NEMA17 SL42STH40-1684A-23 Stepper MotorThe motors that will move the pen on the X and Y axisalready owned
x2 A4988 Stepper DriverThe drivers that control the stepper motors15.98 RON
x2 100uF 35V CapacitorDecoupling capacitors for protecting the stepper drivers0.60 RON
x1 JF-0530B 12V Push-pull SolenoidMoves the pen up and down24.38 RON
x1 Dual MOSFET PWM Module, 15A, 400WHelps control the solenoid2.83 RON
x1 1N4007 DiodeFlyback diode for the solenoid0.49 RON
x2 Mechanical EndstopUsed for getting the origin position on the X and Y axis13.98 RON
x2 0.47uF 50V CapacitorDebouncing capacitors for the endstop false triggers0.50 RON
x2 10kOhm resistor10kOhm external pull-up resistors for the endstops0.20 RON
x1 GL-12 830 Point BreadboardThe central prototyping platform15.00 RON
x1 DC Jack ModuleGives the power to the breadboard4.99 RON
x1 40 Breadboard (DuPont) M-M 20cm WiresFor connecting the components15.00 RON
x1 140 Breadboard JumpersFor connecting the components and short breadboard connections14.82 RON
x12 2020/2040 Aluminum ExtrusionsThe skeleton of the buildalready owned
x1 Aluminum BedThe surface on which the paper will sitalready owned
x6 Bed Screws with SpringsFor securing the bed and making sure it's flatalready owned
GT2 BeltX and Y axis motionalready owned
GT2 PulleysGuides the beltalready owned
V-Slot WheelsX and Y axis motionalready owned
TotalTotal cost of the components271.23 RON

Software

LibraryDescriptionUsage
embassy-stm32Embassy Hardware Abstraction Layer (HAL) for ST STM32 series microcontrollersAsync task management
embassy-executorAsync/await executor designed for embedded usageRuns the asynchronous tasks
gcodeA gcode parser for no-std applicationsFor parsing the .gcode files
st7920SPI driver for the ST7920 LCD display controllerDisplay driver library
embedded-graphicsEmbedded graphics library for small hardware displaysFor displaying the system on the screen
embedded-sdmmcA basic SD/MMC driver for Embedded RustFor storing and using the .gcode files
micromathEmbedded-friendly math libraryFor calculating motion
defmtA highly efficient logging framework that targets resource-constrained devices, like microcontrollersFor debugging
  1. Embassy Framework Documentation
  2. RepRapDiscount Full Graphic Smart Controller Wiki
  3. A4988 Stepper Driver Datasheet
  4. JF-0530B Solenoid Datasheet
  5. STM32 NUCLEO-U545RE-Q Specifications