Pen Plotter Driver Library β Written in C (Open for You)
π±ποΈ βDraw the world in code and ink.β β‘β (β Σ¦β ο½β Σ¦β qβ )
MoonBerry-Painter is a lightweight and high-performance C-based driver library for controlling pen plotter machines. It is designed with real-time precision, low-latency GPIO control, and modular adaptability β making it suitable for both embedded systems and desktop environments.
Whether youβre building your own drawing robot, testing motion control algorithms, or integrating plotting into your automation workflow β MoonBerry-Painter gives you the tools to paint with hardware precision.
β Successfully implement π± Growing implement πΈ Customizable implement
| Feature | Description | Status |
|---|---|---|
| πͺΆ Pure C Implementation | No runtime overhead, just efficient C code. | β |
| βοΈ Low-Latency GPIO Driver | Optimized for real-time pen plotting control. | β |
| π§ Configurable Axis System | Supports multiple stepper motor axes (X, Y, Z, etc.). | β |
| π¨ Path & Curve Interpreter | Converts paths or vector data into motion commands. | π§ͺ |
| π Teensy / Raspberry Pi Support | Works with both microcontroller and SBC environments. | β |
| π§° Modular I/O Layer | Easily adapt to your own hardware interface. | β |
| π§Ύ Logging & Debug Mode | Built-in serial and runtime logger for debugging. | β |
| πͺ΄ Open & Extendable | Fully open for customization, integration, and learning. | πΈ |
| ποΈ Svg Preview and Svg Render converting | Fully compatibility convert vector format. | π± |
Youβll need:
- C Compiler (GCC / Clang / ABCC / etc.)
- Make or CMake (optional)
- Access to GPIO (for Raspberry Pi / Teensy/Arduino)
- Basic knowledge of C and embedded I/O
- Hobbyst custom or DIY pen plotter hardware printing math with super highly precision curve and shapes
# Clone the repository
git clone https://github.com/archanaberry/MoonBerry-Painter.git
cd MoonBerry-Painter
# Build using GCC
gcc -o moonberry main.c src/*.c -Iinclude -lmIf you use CMake:
mkdir build && cd build
cmake ..
make#include "moonberry.h"
int main(void) {
mb_init();
mb_set_pen(UP);
mb_move_to(0, 0);
mb_set_pen(DOWN);
mb_draw_line(0, 0, 100, 50);
mb_set_pen(UP);
mb_shutdown();
return 0;
}; MoonBerry Painter Script
; Converted from C example
INIT ; set up system (equivalent to mb_init)
PEN UP ; mb_set_pen(UP)
MOVE X0 Y0 ; mb_move_to(0, 0)
PEN DOWN ; mb_set_pen(DOWN)
DRAW X100 Y50 ; mb_draw_line(0, 0, 100, 50)
PEN UP ; mb_set_pen(UP)
SHUTDOWN ; mb_shutdown
END
MoonBerry-Painter
β
βββ core/ β Motion control & GPIO abstraction
βββ backend/ β Hardware drivers (Teensy, Raspberry Pi, etc.)
βββ driver/ β OS Driver Hardware for Linux Windows or Microcontroller OS.
βββ parser/ β Command & vector interpreter
βββ include/ β Public headers
βββ scripts/ β For etc, or python plugin
βββ examples/ β Usage demos & test code
Each module is isolated and can be replaced with your own driver backend or logic layer.
MoonBerry-Painter follows the βOpen Core, Modular Edgeβ principle:
- The core provides stable, clean abstractions for motion control and I/O.
- The edges (drivers, parsers, extensions) are replaceable β you can make it yours.
- Code simplicity and readability are prioritized over over-engineering.
| Platform | GPIO Type | Supported | Notes |
|---|---|---|---|
| Raspberry Pi | BCM / sysfs / memory-mapped | β | Recommended for prototype |
| Teensy | Native I/O | β | Best latency |
| Arduino | via serial link | βοΈ | Experimental |
| Custom Board | Custom driver interface | π§© | Extend with your own driver |
You can configure machine parameters via a simple header file or runtime config:
#define MB_AXIS_X_STEPS_PER_MM 80
#define MB_AXIS_Y_STEPS_PER_MM 80
#define MB_FEEDRATE_DEFAULT 1200
#define MB_PEN_DOWN_DELAY_MS 50; MoonBerry Painter runtime setup
CONFIG AXIS X.STEP_PER_MM 80
CONFIG AXIS Y.STEP_PER_MM 80
CONFIG FEEDRATE 1200
CONFIG PEN.DELAY 50
; Ready to draw
INIT
Or load via configuration file (optional support planned).
Contributions are welcome! Feel free to fork, modify, or extend modules such as:
backend/teensy_gpio.cfor microcontroller supportpath.cfor vector data decoding
ABPL License This project is open-source and free to use in any personal with berry personality or commercial project (With berry permission) β just give credit if possible. π±π
- Author: Archana Berry
- Email: [email protected]
- Project Page: https://github.com/archanaberry/MoonBerry-Painter
πΈ MoonBerry-Painter β where hardware meets art.
