Grbl_ESP32 Development Board Version 3.1

This is a quick blog post to document version 3.1. This is for sale at Tindie, but you can make your own via these files.

What is new

  • Integrated SD card socket: This no longer uses a plug in module.
  • Integrated 5V 3A DC power supply.: The previous plug in module used the same parts, but was adjustable. The adjustment was very sensitive and prone to drifting a little.

Source Files

BOM

This list does not include generic resistors and caps or header connectors.

DesignatorDescriptionSource
C1,C6,C11CAP ALUM 47UF 20% 35VNichicon UWX1V470MCL1GB
D1Schottky DiodeVishay SS24 DO-214
J11DC Barrel ConnectorCUI Inc PJ-102A
J20Micro SD SocketKorean Hroparts TF-01A
L1 Inductors 4.7uH ±20% 5.5AnMHCI06030-4R7M-R8
U5Step Down ConverterMPS MP1584EN
U1ControllerESP32 Dev Module

 

Get it at Tindie


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

 

Hackaday Workshop and #Badgelife Experience

Last weekend at the 2018 Hackaday Superconference I gave a workshop called “Small Scale CNC/Robotics Workshop (Build a CNC Badge)”. It was a ton of work and a bit stressful, but I think it worked out about as good as I could have hoped. It was a lot of fun. Here is a quick post on how it went and what I learned.

The Idea

I have gone to a few conferences over the years including one previous trip to SuperCon. I have always wanted to challenge myself and do a talk or workshop. I wanted to inspire some people to consider getting started in DIY CNC. I proposed a 40 minute talk about how easy it is to get started if you work at a small scale. After that you get to build your first machine that is a DrawBot Badge. Badges are currently at “Peak Fidget Spinner” status, so that seemed like a fun idea. The bonus is that the badge is actually a fully functional CNC controller that can control a vast array of machines.

Workshop Approval Process

Superconference is announced early in the summer. Shortly after that, they put out the call for people to propose talks and workshops. I proposed my workshop with a suggested count of 20 people.  I thought 20 would be a reasonable amount for my first time.

My workshop was approved the last week in September. Shortly after that, they announce that people can sign up for them. My conference sold out right away. They asked if I could add a few. I said I could probably add 5 more.  They want a 10 attendee to 1 staff ratio. I asked my friend Jason Huggins (@hugs) to help and a Superconference volunteer also helped.

I now have only 5 weeks to order, assemble PCBs, kit everything, ship it and prepare the talk. This would prove to be a true #badgelife extreme experience.

State of the project before approval

I had a functional version of the badge with functional firmware. This controller could only run the badge and I wanted a full featured CNC controller. Having functional firmware was definitely a head start.

I didn’t want to invest significant time or order parts in case the workshop was not approved. I knew the timeline would only give me one chance at getting the PCB right. The PCB would include several features that I have never tried before. I decided to do another project that would include most of those new features. That was a good move, because I did make a few mistakes. One required a jumper wire soldered to a QFN pin, the other was easier, but ugly and vulnerable to breakage. Also, to upload firmware you had to manually trigger the bootloader because DSR is not the same as DTR (oops).

I made sure the new badge schematic was free of those issues, completed the layout of the PCB and waited for the workshop approval.

Production

As soon as I heard about the approval, I ordered the PCBs and parts. I ordered 30 sets of PCBs and PCB parts plus about 25 sets of mechanical parts. That seemed like a reasonable buffer if I had problems. Adding the extra 5 people after ordering put some pressure on that small buffer.

3D Printing

I immediately fired up my two 3D printers. I have a Lulzbot TAZ6 and a MatterHackers Pulse XE. Both are quite reliable and parts accumulated quickly. There are 7 parts per badge. That equals 210 parts.  I think it only took about 2-3 rolls of filament. This was the easiest part of production and finished early.

To make the arms mount really well, I hot pressed the servo spline into them. I took apart a servo and mount a splined output shaft in an aluminum block with an old 3D printer nozzle heater. I did not actively control the temp. It it seemed to be at a good stable temp at about 8W. I used a small arbor press to make sure they press on straight.

Some parts have bearings pressed in. It is not difficult, but if you screw it up, you might break a 3D printed part. I decided to do them in advance. It only took about an hour to do them all.

PCBs

I did not want to get the PCBs professionally assembled before I had a chance to test one. I built one at home using a toaster oven. It worked perfectly. This meant the design was good and all I had to do was build the rest. Chris Gammel, suggested I use the Neoden pick and place at mHub. mHub is a Product Innovation Center in Chicago. I joined at the $200/mo level. It turned out, it was probably easier and less risky just to do it by hand. I did use their manual paste mask fixture and professional reflow oven. I had some trouble with excessive pasting, but got better over time. This meant there were solder bridges on a lot of boards that needed to be fixed. In the end, 27 of the 30 worked. 3 had mystery problems (probably the tiny QFN USB chip). I think I spent about 24-28 hours building them.

Programming and testing

The process was load the firmware, apply power, connect via web browser, load some additional files and setup unique SSIDs and passwords. That took about 10 minutes each. The final board was done about 72 hours ahead of the conference. I only had time to randomly test the rest of the circuits on the PCBs.

Shipping

Ideally you ship everything with plenty of time to spare. I was able to pre-ship everything but the PCBs. The PCBs and a few other things had to fly with me.

The Workshop

The workshop went pretty well. It started with a presentation which lasted about 40 minutes and then we started building.

The biggest problem we had was the 4 x AA battery packs were under powered and cause brownout resets on the controllers. The servos would start to move, the voltage would drop and the controller would reset. I had tested the battery packs at home. 4 x AAA did not work, but 4 x AA did. I think the cheapo AA Amazon batteries were not as good. Fortunately, I brought several high current AC-DC power supplies and a lot of people had big USB chargers. That saved the day.

There were a few missing tools, screws, lost or broken parts, but I had enough spares. There were a ton of questions during the build, but slowly the questions started to switch to people showing off drawings.

What I learned

  • Hackaday Superconference People are Awesome! It helps when the group is patient and probably smarter than I am. They all had great assembly and computer skills and powered through.
  • Batteries: The battery issue was the biggest problem. I had tested different batteries at home and assumed the ones I ordered from Amazon would be fine. I think I was a little nervous about it so I brought about (5) 12V 5A power supplies. That nervousness should have been something I followed up on.
  • Hardware Confusion: I got a lot of questions about what hardware goes where. I should have had a decoder sheet (like IKEA does) or photo that cleared that up.
  • Extra Parts: I had plenty of extra parts, but they were unorganized. It had to dig around each time someone needed something. A nice parts organizer would have been much better where people could self-serve missing parts.
  • Backward connectors: I was stuck with the servo connectors, which are not keyed. A lot of people plugged them in backwards. Fortunately that does not break anything. The wires are color coded. I had close up photos, but adding the wire colors as text to the silkscreen would have helped.
  • Train my helpers: I should have done a dry run with my helpers. They would have been better prepared to help.
  • Order Extra PCBs: I was very close to not having enough working PCBs. The boards and parts are not that expensive. Have at least 15% extra.
  • Manage the Stress: I was a little stressed during the PCB assembly process. Some boards looked pretty rough coming out of the oven and needed cleanup. Don’t let precious time slip away. Don’t give up.
  • Ask for more time? I think if I do something like this again that requires lead times and assembly, I will put a realistic lead time in the proposal. I would want the approval a little sooner. If I had one more week that might have allowed for professional assembly. An extra hour for the time slot would have allowed for fast people to finish and leave early and the slower ones to have more time and 1:1 help.

The Docs

What’s Next?

I have no more official PCBs, but I may sell the simpler original version on Tindie. Follow me on Twitter (@buildlog) for any announcements.

I am actively thinking about doing something next year. I would like to go for output quality on this one.  I also want to work on a better end to end experience with a web or phone app. If you have any interest, suggestions or want to help, let me know.


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

DrawBot Badge – Workshop

Woot!

I and Jason Huggins (@hugs), of Tapster Robotics, will be giving a conference at the 2018 Hackaday SuperConference. The conference will be “Getting Started in Small Scale CNC and Robotics (Build a CNC Badge)”. By the end of the workshop you will have built, programmed and learned to use the DrawBot Badge.

The badge is way more than that though. The badge PCB is a very capable general purpose CNC/Robotics controller. We considered every small scale CNC machine we could think of and made sure this badge could control it. Here is what it can control.

  • (3) Stepper Motors
  • (3) Hobby Servos
  • (3) Homing/Limit switches
  • (1) Variable Speed Spindle PWM signal
  • (1) Laser Module (Power control and Safety interlock)
  • (4) Control switch inputs
  • (1) Probe switch control
  • (1) Coolant Control
  • (1) High current (3 Amp) output for relays or solenoids (includes flyback diode)
  • (1) i2C interface (for displays or Sh**ty Add-Ons)
  • (1) SD Card socket to store and run files

You can’t use every feature at once, like the Laser PWM and Spindle PWM are the same signal, but they are broken out logically to multiple, machine specific, connectors.

It is all powered by an ESP32 running Grbl_ESP32, which provides serial, Bluetooth and WebUI interfaces.

The first half of the conference will cover tips and tricks for getting started with making and controlling small machines. We will also learn and use some basic gcode to control some motors and other items. It is a just a basic intro to get you started and discover some resources. During the second half we will build the DrawBot badge.

If you are interested, sign up for the conference and be sure to get into the workshop when that is posted. The workshop will be limited to about 20 people, but I will bring extra badges for sale and will be happy to help build and hack them all weekend. I will also bring extra motors, servos, switches, etc for hacking up simple machines.

Open Source

Within the next couple weeks, all of the documentation will be released. Badge kits will also be for sale on Tindie after the conference.

 

 

DrawBot Badge – Preview

I showed off an early version of my DrawBot Badge at the Hardware Happy Hour last night. Some tweeted pictures generated a lot of questions, so I thought I would write a quick post about it.

I have been following the #badgelife thing for a few years and felt that the mechanical and CNC world needed to be represented. The goal was to create something small, safe, fun and something anyone could learn to use. A drawing machine seemed the perfect fit.

Drawing Surface

I decided to use 3″ square Post-It notes. The main feature is that they are self stick, so I don’t need any clamps or tape. It is also cool that you can stick them to things when the drawing is done. They are cheap and easy to find. I like the kind that have the majority of the back (full stick) covered in adhesive. This means you can use a small stack of them and peel them off as they are done.

 

Drawing Mechanism

I tried to make the drawing mechanism as tiny as possible. The size is about 30mm x 70mm. It uses (3) of the smallest readily available class of hobby servos call micro servos. You can buy these from AliExpress for as low $1-$2 in low quantities.  The choice of the arm configurations was primarily based on tightly packing the the motors, but I also wanted something new and interesting.

The pen lift is simply a cam on one of the motors. The entire mechanism rotates on two 3mm bearings. In my experience with drawing machines, gravity is the best way to engage the pen to the work. The mechanism needed to work hanging from a lanyard or sitting on a table.

Electronics

There is only one electronic item right now. It is an ESP32 dev module. There are also (3) connectors for the servos and (1) for voltage monitoring. The entire back of the badge is a PCB. I made the board full size to enclose the back and the pen lift cam need to push on something. I have big plans for the rest of the area though. The ESP32 provides the Bluetooth and Wifi needed for the remote control.

Firmware

It is running my ESP32 port of Grbl with a little hacking for the servos. The ESP32 uses an RTOS, so I just created a low priority, repeating task (20Hz). The task checks the position of a virtual CNC machine, does some kinematic math and updates the servos. The software supports streaming drawing data (gcode) via serial port, bluetooth, SD card or wifi. I am using the bluetooth option to send via my phone. I will publish the firmware soon.

Crazy Math (Kinematics)

The math is actually not too hard. You know the desired pen location, the axes of the servos and the lengths of the linkages. There are two ways to do the math. The first way is using the law of cosines and the Pythagorean theorem.

The second method uses intersecting circles. Each linkage can sweep a circle from a axis point and radius. Any two linkage’s circles will intersect at two points. It is easy to pick one of the points as more desirable. While it is less deterministic, due to the two points thing, it appears to run about 40% faster on the ESP32.

The Z is very simple. Any Z value less than 0 is pen down and everything else is pen up.

Drawing Quality

The quality is basically “Adorably Wiggly”. I am using the cheapest analog servos. That means I might get about 200 x 200 resolution at best at the servo hubs. If you mapped that grid to the paper it would be a warped grid with dense and sparse areas of the grid due to the non-linear nature of the mechanism. Digital servos with very low deadbands (~1us) it would probably do a lot better, but I am not sure that is worth it. It would only be a little less wiggly. They cost about 4x what analog servos do (still pretty cheap).

There is a calibration feature. Each servo is a little different and it is difficult to precisely mount the arms at the right angle. The calibration adjusts the zero angle and pwm/degree of rotation.

Next Steps

This project is part of a talk proposal for Hackaday SuperCon 2018. If that gets accepted, the badge will become a full featured CNC controller capable of running a router, laser cutters, high res plotter, etc, as well as the Drawbot badge. Only the DrawBot will be populated. The rest will be modular like this board.

I may also make a simple version that is only the draw bot. The BOM cost is currently about $10-$12 (without 3D printed parts)

Regardless of what happens all source files will be publish sometime in October.

 

Follow me on Twitter (@buildlog) or subscribe to this blog if you want to follow the project.

 


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

 

 

 

 

 

 

 

Grbl_ESP32 Development Board Instructions

Overview

These are the basic instructions for setting up and using the Grbl_ESP32 CNC board. This is an open source CNC controller. It is for sale on Tindie. The source files are located here.

Program the ESP32

It is always best to program a CPU for the first time not mounted to a board. You don’t know if the current firmware will cause harm in the new application. A simple blink program could damage an I/O pin if that pin is tied to ground or a voltage when mounted.

Setup the Arduino IDE

  1. Get the latest Arduino IDE from arduino.cc. (important…the latest)
  2. Install the Arduino Core for ESP32 by following instructions here.
  3. Using the board manager and other tools menus select the board you have (see below for what options to set.)
  4. Download the Grbl_ESP32 firmware from the GitHub repo. The master branch is generally more stable, but other branches will have the latest features.
  5. Connect the ESP32 board to your computer via USB
  6. Select the com port associated with the ESP32 module you have
  7. Compile and upload the code.

Configure Grbl_ESP32

Now that you know you have everything setup properly to program the ESP32, it is time to configure Grbl. There are only (2) files that typically need to be edited. The defaults should work in many cases, but it is good to know what options you have.

  • cpu_map.h – This is the file that tells the firmware how the I/O pins should be used. The defaults will work with this board without changes.
  • config.h –  This has dozens of things you can change. The defaults will work, but other features may interest you. There are lots of comments in the file to help you understand them.

If you made any changes, compile and upload the code again.

Install the modules into the controller board

  • ESP32
    • Disconnect the USB and install the ESP32. Be sure the USB is aligned with the edge of the board and the pins are perfectly aligned with the holes.
  • Motor Drivers (DRV8825 Recommended)
    • Make sure they are installed correctly. (2) of the pins are labeled, match them up with the same labels on the drivers
    • Set your micro stepping level according to the driver specifications. (DRV8825) using the jumpers provided. The jumpers are labeled (1,2,3  to correspond with the labels on the drivers. See image below)
    • Temporarily connect power (12VDC to 24VDC) to the board and set the current for the drivers. See the driver specifications on how to do that. They work well up to 1A without active cooling. They are set much higher by default and will generally have problems, so you should adjust them
  • SD Card
    • Install the SD module. Align the pin labels with the module and controller board. Note: The controller board has vcc labeled as 3.3V. It is actually 5V.

[image – Microstep jumpers]

Connect your motors, switches, etc.

If you need connectors, I recommend this set. It is low cost and will cover many projects. You can crimp the pins with needle nose pliers, but a crimping tool makes faster and better crimps.

  • Motors
    • The motor coils are connected to adjacent pins. A typical (but not always) motor wire color order would be red – blue – black – green.
  • Limit/Home Switches
    • Wire these as normally open and close to ground. Each switch has its own ground connection on the board to make things easier.
  • Control Switches
    • They wire the same as the limit switches, except the door should be a normally closed to ground. The door pins are connected with a jumper by default for people that don’t use the door feature.
  • Spindle
    • The Spindle PWM controls your spindle speed. If you want to run an on/off rather than variable speed spindle, just change the max RPM to 1. This means any RPM value with be full on. This is done via the $30=1 command. Note: Never connect these pins directly to a spindle or relay (non solid state). It is a very low current 3.3V TTL signal that must be connected to a speed control device or TTL relay driver.
    • Spindle Enable & Direction – This is not supported at this time, The I/O pin is used for the SD on the default firmware.
  • Flood Coolant – This is a 3.3V TTL signal to control a relay via the M8 command
  • Mist Coolant – This is not supported in the default configuration. The I/O pin is used for the SD card on the default firmware.

Power up, test and tune.

  • Get a gcode sender – Here is a good list of senders
  • Many of the settings can be adjusted with $ settings. You can see what the codes mean here.  Send $$ to see the current values. Send $xxx=xxx to change one.
  • Motor Direction – Try jogging the motors. If they go the wrong way your can either spin the connectors 180° or adjust the $3 value in the $$ menu. You should always remove the power if you disconnect motors. The drivers can be damaged if connected while power is on.
  • Tuning motor speed – By adjusting motor acceleration you can see how fast your motors can go with your setup. I like to see how fast the can go unloaded and then use about 75% of those values.
  • Homing (optional, but highly recommended)- Enable homing with $22=1. Switches can be put at either end of travel. Try homing. If any axis does not move towards the switch, you can switch the homing direction with $23

Places to get help

F.A.Q

  • Coming soon.

 

 

Grbl_ESP32 CNC Development Board

This is development board for using CNC on Grbl ESP32. It supports all of the current and planned features of Grbl_ESP32. It is a great way to get started with the firmware.  It is currently for sale in my Tindie shop.

ESP32 brings the following benefits Grbl

  • Small and very low cost
  • Powerful dual core processor running at 240MHz per core
  • 4MB of flash RAM
  • Floating point coprocessor
  • On board Wifi
  • On Board Bluetooth

Features

  • A very modular design – If any of the major circuits get damaged, you can plug in a new one.
  • A socket for a ESP32 Dev board also known as NodeMCU 32S. Most 19 pin per side dev boards should work, just check the pins or ask me.
  • (3) Sockets for stepper motor drivers. These fit many types of drivers. The TI DRV8825 type is my favorite driver for this type of application. Micro-step selection jumpers are included.
  • Home/Limit switch connections for XY and Z axes. These also have R/C filters to eliminate high frequency noise from false triggering the switches.
  • Z Probe connections with R/C filter
  • Control switch input connections for Feed Hold, Cycle Start, Reset and Door. These have filters as well as pullup resistors, because they are on inputs that do not have internal pullups.
  • Spindle output for PWM (Speed). Spindle Enable and Direction are also connected, but not in firmware yet.
  • A socket for a micro SD card module. Note: The SD card feature is in testing and not in the master branch firmware yet. Also it shares pins with other non-popular features that would have to be turned off (Mist Coolant, Spindle Direction and Spindle Enable)
  • DC-DC power supply. There is a strong 3A DC-DC power supply to run the ESP32 if it is not connected to USB. It is adjustable, 0.8V to 20V, but would typically be set to 5V. It also has connections, for off board use.

Required Modules

What it Comes With

  • Fully soldered based board.
  • DC-DC P/S installed and adjusted
  • Basic Testing and Inspection (Voltages  and components)

Open Source

The design is open source with Creative Commons 4.0 Attribution – Share Alike . Here are the source files.

Errata

  • The SD Card pin 5 (vcc) was accidentally hooked up to 3.3V. It should be connected to 5V. The boards have a simple cut and jump. Keep this in mind if you use the gerber files.

Where to get one

You can build your own from the source files or you can buy one from my Tindie store. Buying one from me helps support this project.


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

 

Grbl_ESP32 update: SD Card Support

Here is a look at something I have been working on. I have added some SD card features to Grbl_ESP32.

Why SD Cards?

Grbl works great with senders and really shouldn’t need SD card support. That is true for your typical desktop CNC router. laser, etc., but there are a lot of machines that are not “typical”. I like to make machines I can fit in my backpack or in the palm of my hand. I certainly don’t want to use a traditional PC – Machine setup. I want control via phone or completely autonomous. This means SD card, Bluetooth and Wifi options are critical.

Does a machine even need connectivity at all? Running a file from an SD card and uploading new firmware via SD card is going to be critical for some new projects I have plans for.

What is the best way to do this?

After debating a few methods of implementing this, I decided to do it in a more Grbl’y way, than a Marlin’y way so that it is less likely to break the existing Grbl gcode senders. This means I’ll try to report status and push notifications in a way that won’t break anything. I’ll also follow the strict NIST gcode rules of Grbl. NIST does not have SD gcodes, so they will be more like Grbls $H (homing) than Marlins equivalent gcodes.

With that said, if anyone has some suggestions for changes, I am still in a stage where I can consider them.

Protocol

The commands all start with $F (for file).

  • $FM – Mounts the SD card. You do this once whenever you want to use the SD card or after you re-insert.
  • $F – Reports all the files matching (.NC, .TXT or .GCODE). It printrs one line per file like [FILE:/myfile.nc SIZE:7609]
  • $F=/myfile.nc – This runs the file.

Job progress is automatically appended to the end of the “?” command response. like <…….|SD:55.78> where 55.78 is the percent complete.

Sender Compatibility

  • All of senders I have tested (UGS, LaserGrbl, Grbl Controller) are OK with these changes.
  • They continue to request and get status and update the DROs.
  • If they have a verbose option, you can see the job progress.
  • Some (Grbl controller) filter out (don’t display) the [FILE:….] responses even on verbose mode.
  • All can be disconnected during a job without affecting it.
  • Most send a Grbl Reset when reconnected which kills the job. This would be easy to ignore during SD card jobs (not implemented).

Next Steps

  • I will release a branch with these features
  • I want to look at adding a card detect feature to auto mount the card
  • Look at methods of firmware upgrade via SD card.
  • Can a file be uploaded to the SD card (USB, Bluetooth, Wifi)?

Video


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

 

Grbl_ESP32 with Bluetooth Serial Support

Bluetooth Serial has now been added to the master branch of Grbl_ESP32. Bluetooth Serial means the Bluetooth connection looks like a serial port when you pair with the device. This is ideal because it allows all existing gcode senders that support serial ports to use Bluetooth.

This was added using the Bluetooth Serial library that is part of the espressif/arduino-esp32 development environment. This library is relatively new and has a few issues, but I was able to work around them.

  • Sending Characters: The reporting done by Grbl sends characters a character at a time. This means dozens of calls to the library are needed for each response. This caused characters to be dropped. The solution is to send a full string in a single call using .print(), rather than sending individual characters using .write().  Grbl was written using the character at a time method to highly optimize the reporting. The raw speed of the ESP32 does not require that optimization and the resulting code is much more readable.
  • No Password: The library does not support the use of a password for the pairing. This is a big drawback, and needs to be considered before you enable Bluetooth. Apparently this was due to an upstream component that has now been fixed. Hopefully it means the library will be updated soon.

Why and when to use it.

The cost, size and wireless features of the ESP32 are the primary reason I ported Grbl to the ESP32. I make a lot of tiny CNC machines. A laptop is likely to be many times the size of the CNC machine. I wanted to control the machines via a phone or small tablet. I have found the connection to be very reliable, even for jobs lasting more than an hour. The phone can even be in the “off” state in your pocket and it will still stream reliably. The battery drain is accelerated, but not significantly (like listening to audio via Bluetooth) You do need to stay within range of the machine, although Grbl Controller (Android) appears to be able to resume a job.

Using Bluetooth.

It is optional. You enable the feature at compile time. That allows you to save some code space (not really an issue now). Once the feature is enabled, you can still turn it on or off via a serial port command. All Bluetooth traffic is echo’d to the serial port. This allows you to monitor the communications. You can also use the Serial port at any time, but it is not a good idea to do that while running a job. Here are the steps to set it up.

  • Make sure #define ENABLE_BLUETOOTH is not commented out in config.h.
  • Use a serial port terminal to set the Bluetooth name using $I=NAME, where NAME is the Bluetooth name you want. I don’t know all the naming rules, so keep it short and simple. There is no capability to use a password yet. Grbl converts all input to capital letters, so lowercase will cannot be used.
  • Reboot the ESP32 to turn on Bluetooth with that name. Grbl will send Starting Bluetooth:ESP32BT as the first item when booting to let you know Bluetooth is on. ESP32BT is the Bluetooth name I used in this case. Grbl will now respond on either Bluetooth or Serial data. All Bluetooth sends are echo’d on the Serial port if you want to watch the data.
  • You can now pair a phone or PC with Grbl_ESP32.
  • Caution: Do not pair while running a job. The ESP32 will likely interrupt and/or watchdog issues while the stepper timer is running and the pairing process is running.

Next Steps

  • Other modes: A phone also makes an awesome display and control panel. Maybe the PC is the primary sender and the phone acts as a pendant.
  • SD card. SD card is next on the roadmap. This pairs well with bluetooth, because the phone could select and start an SD card job.

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



 

 

 

Grbl for ESP32 Beta Release

Grbl for ESP32 Firmware Beta

After a lot of work and testing, I have posted the firmware to GitHub. I have a good write-up on the process I went through to get to this point on this blog post. There are some basic getting started instructions on the GitHub page. Realistically, this probably should not be your first Grbl or ESP32 project, but go ahead if you like.

If you want to keep up to date on the project, subscribe to this blog (see end of blog), subscribe to my YouTube channel or follow me on Twitter (most frequent updates). Comments, thumbs up, retweets and replies are very much appreciated and keep me going.

If you see any issues, please comment here or at GitHub. GitHub is preferred for firmware issue tracking.

BTW: If you are interesting the test controller I made, here is a schematic.

Next Steps

I have a busy couple of weeks coming up with some friends coming from France to visit. I won’t be able to work on the project much. The first thing I want to add when I get a chance is BlueTooth support. If you know of any similar projects streaming text from a phone or PC to ESP32 over Bluetooth, please let me know.

Video


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

Grbl CNC Firmware on ESP32

Woot!

I have been working on this for months. I am happy to announce that it is finally working right. The ESP32 will be a great option for CNC. Here are some things I am excited about.

  • Fast – Two 32 bit Cores at 240MHz Each, FPU, 80MHz Timers
  • Memory – Tons of Flash and RAM
  • Low Cost – $3-$10 depending how you buy it.
  • Small Size – Not much bigger than an Arduino Nano
  • I/O – It has about the same number of pins as an Arduino UNO, which is the target for Grbl
  • BlueTooth and WiFi – This is great and actually the primary reason for my port.

Porting

The bulk of the code was very easy to port over, but getting very low jitter, step pulse timing took a long time to achieve. This is not my first port of Grbl. My first port was to the PSoC5. That was much easier, but this was my first major project on the ESP32.

A goal was to use the Arduino IDE to develop the code. I thought it would make the project a lot more accessible to novice programmers that just need to make a few tweaks. I also tried to make the code easy to maintain with Grbl. This means there a few throwbacks/workarounds to AVR port numbering. etc.

FreeRTOS

The ESP32 uses an RTOS (Real Time Operating System). While “real time” sounds perfect for CNC, it is not good for step pulse timing. An RTOS allows multiple tasks to run “at the same time” and it manages the priorities and interaction of those tasks. The RTOS switches tasks at a “tick rate”. The tick rate is typically about 1000Hz. This means each task gets at least 1ms of time and the others wait. You can designate a high priority task to prevent these interruptions, but some tasks have watchdogs that must be reset so you need to give them some time.  You can set the tick rate higher, but I need a more than 50,000 hz step rate. That is not practical for the RTOS. I can turn off the RTOS and/or the watchdogs, but a major appeal of the ESP32 is the WiFi and BlueTooth. These need the RTOS.

Interrupts

The normal Grbl way generate step pulse timing is to use interrupts. As long as you follow the rules for interrupts, they will interrupt the RTOS without any delays in very deterministic manner. The rules are about how much time you can spend in the interrupt and what things you can do in the interrupt. The interrupt duration was not an issue because the code in the interrupt only takes a few micro seconds. What you can do in the interrupt took a while to figure out. The ESP32 does a “panic” reboot when it does not like something. That happened a lot during development. Most of my problems were related to how I used the peripherals. Things like the RMT feature simply can’t be used.

My Dev Board

I designed a little Dev Board to help me with this project. The features include…

  • 3 Stepper Drivers
  • 3 Limit Switches
  • 1 Touch Probe connector
  • Mist / Flood Coolant outputs
  • Start / Hold / Reset / Door switch connector.
  • Spindle / Servo / Laser – Connector
  • SD Card – This is just a breakout to a header that can be wired into the CPU if I ever decide to do that.

Next Steps

Testing – I need to do a lot of testing. I tested most of the features along the way, but need to double check all the config options.

Clean up – I have a lot of commented out debug code that needs to be removed

Publish on GitHub – Done. GitHub Repo

BlueTooth – That is the first new feature I want to add.

Hobby Servo Features – I use them a lot in my small machines and 328P Grbl doesn’t handle them well because the lack of 16 bit timer availability. I want high resolution jitter free servos as an option for any axis.

Simple Kinematics – GCode can be converted on the fly to alternate coordinate systems. This would not consider joint dynamics.

Video


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