New 2.5D Pen/Laser ESP32 Controller

I have done several pen and laser machines lately, so I decided to create a custom PCB for Grbl_ESP32 for these types of machines. This is a small (70mm x 60mm) PCB with all the features a pen plotter or laser cutter/engraver would need.

These typically use stepper motors for the X and Y axes. On pen plotters, the Z axis is controlled by a servo or solenoid. On lasers you need an accurate PWM for laser power control.

Here are the features of the PCB assembly

  • (2) Stepper Motor Driver Sockets for standard stepper driver modules.
  • (1) Hobby Servo Connector.
  • (1) High Current (10A max) Output Control. This can be used for a solenoid, fans, etc.
  • (2) limit/Home Switch Connectors.
  • Laser Power PWM connector
  • Removable Micro SD card. Upload files via Wifi to reliably run off-line.
  • 5V 3A Step Down Power Supply
  • Standard DC Barrel Connector for power input. (9-28 VDC)
  • Power Output Connection for laser module.

Grbl_ESP32 Advanced Features

  • 32-Bit dual core processor
  • Fast 120kHz step rates
  • WiFi
    • Access point or station modes
    • Complete web user interface
    • Telnet
  • Bluetooth Serial
    • Compatible with phone apps
    • Compatible with most serial port gcode senders
  • 16 bit laser power control.
  • Core XY kinematics supported for T style machines.
  • RTOS (real time operating system) allows the use of custom tasks.
    • Precise servo control accurately mapped to Z motion, plus interactive calibration.
    • Precise control of solenoids via adjustable pull and hold strengths using PWM. This allows a strong pull, yet a cool hold temperature.
  • Instant On/Off – Unlike a Raspberry Pi, there is no long boot time or formal shutdown required. It is typically ready to go in a few seconds.

How to control it

There are several ways to connect to the controller, but to run jobs, you basically either stream the gcode or run it from a file on the SD card. The SD card is a great feature because it is free from connectivity interruptions and you don’t need to stay connected to your machine while it is running the job. You can quickly upload files via WiFi or remove it and plug it into your computer.

Serial port

This controller is compatible with virtually all of the serial port gcode senders for Grbl. The default baud rate is 115200.

Bluetooth Serial

This is a great way to use your phone to control a machine. When you connect via bluetooth, your phone or computer will create a virtual serial port. This means you can then use existing serial port based gcode senders.

Wifi – WebUI

The controller has a web server. The controller can create its own WiFi access point or connect to an existing WiFi network. You connect to the controller with a web browser and it serves a full featured machine controller to browser.

Controlling the Pen Up/Down Servo

The servo is controlled using a separate RTOS task on the controller. Grbl thinks it is running a normal stepper motor on the Z axis. Each time the servo task runs, it looks at the current position of the Z. It then computes and sets a position for the servo. You map the servo’s range to a Z range.  For example the range could be set for 0-5mm. Any values of Z above or below this range would would be limited by the range, so any Z value above 5mm in this example would not move the servo past where it was at 5mm.

You can calibrate the end points of the servo to fine tune it. We use the Z axis resolution and max travel settings to do this. $102=100 (100%) would be no change to the first end point. %102=90 or $120=110 would be 10% changes in either direction. $132 works the same way for the other end point. Make sure you do not adjust the servo so it hits the physical end point of its travel. You will feel the servo continuously vibrating as it pushes against the end point. This is very hard on a servo and will overheat and damage it.

The servo updates its position 20 times per second. Therefore it will do a good job of respecting the acceleration and speed settings in the gcode.

The feature also uses the $1 (Step idle delay) setting. It the steppers motors disable, so will the servo and can be moved manually.

Additional parts you need

The controller uses plug in modules for the the ESP32 controller and the stepper motor drivers.

ESP32 Controller

The ESP32 controller needs to be a ESP32 Dev Module. It should have 2 rows of 19 pins. The rows should be spaced 0.9 inch (22.86mm) apart. Be careful: Some similar controllers have a wider pitch.

Stepper Motor Drivers

The drivers are the standard StepStick (Pololu) style footprint. The (3) microstepping selection pins (MS1, MS2, MS3) are all connected to logic high. This typically results in the highest resolution (1/16 or 1/32). The Grbl_ESP32 step rates are high enough  to make that not an issue. I typically use TI DRV 8825 or Allego A4988 modules, but others can be used as long as the pins are compatible. The PCB silkscreen has the corner pins labeled. Use them to insure you correctly install your driver modules.

Source Files (coming soon)

A completely assembled PCB is available on Tindie. The profits from Tindie help me to continue to develop the hardware and firmware for projects like this. If you want to roll your own, the source files are linked below.

 

Suggestion / Changes?

If you have any suggestions or need a custom design please contact me.

If you want to be notified of future blog posts, please subscribe.

 

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks

5 Responses to “New 2.5D Pen/Laser ESP32 Controller”


  1. Ted M

    Can I run one of those 5W Chinese laser diodes with this?

  2. Michael Graham

    Bart this is Badass! Bookmarking this page for future reference. 🙂

  3. bdring

    @Ted M. I have some experience with those types of lasers and it should work fine if it has TTL power control. Mine did.

  4. Alex

    I’m planning to make a plotter (somewhat like axidraw),
    would this board be a good choice?

  5. bdring

    Yes, that is exactly what it was designed for. The advantage this has over most other option is built in wiFi, Bluetooth and SD card.

*