Showing posts from September, 2015

Moving code from ESP8266 to ESP32

A while ago I made a mashup of Dan Royer's code CNC 2 Axis Demo with my own code for trapezoidal motion stepper and servo control for ESP8266.

I assumed porting the code to the ESP32 would be trivial, and that was true for the most part: changes like library name being Wifi.h instead of Wifi8266.h were not a problem. UDP now does not like multicharacter writes but you can use print instead. So far so good.

However, when it came to the interrupt code I was stuck with the stepper interrupt causing an exception sometimes. And to make things weirder, the servo interrupt worked flawlessly (both of them had the IRAM_ATTR directive if you ask me).

Going little by little, I could narrow down the culprit to a floating point operation during the interrupt, that would cause problems sometimes but not always. Browsing around I found this post. Where the solution was simple: do not use floats within the interrupt routines but doubles. The reason was the float calculation would be performed by…

How to do a CNC milling farm.

One of my current projects requires to run two, maybe more in the near future, DIY CNC machines. Machine controller is USB-based and a PC could be used to send g-code to machine controller.
However, we have tried a different approach that proved successful: using a cheap tablet instead of a PC.

It all started by testing the excellent program GCodePrintr by Mathias Dietz. This software is designed so people can use a 3D printer directly from a tablet. You can stream a g-code file for printing to the printer plus you can do all the usual manual functions of moving the axis around. Besides, a graphical simulation of the print is represented on the display. And in the few tests I did, printing speed did not seemed to be compromised because the lower tablet performance (compared to a PC).

However, uploading a file from Dropbox or using some FTP app for sending g-code files to the tablet was not very convenient as required user time spent at the tablet. But one feature of GCodePrintr came …

Basic 2D CNC milling workflow

I needed for a project some metal holder plates for nema 23 motors. As I have in the lab a Chinese 6040Z CNC router I thought it will be an easy thing to do. Oh boy, how wrong I was.

They project was a simple plate (very easy to sketch using OnShape).
Once it was sketched a 3D part could be created by simply extruding it, which may come in handy if some drawing assembly needs to be done for documentation purposes. However, for 2D projects a 3D model of the part is not really needed for the process of creating 2D machining code. There are different solutions out there that are free, but one that I like because it is very simple to use and it is on-line is but for that you will need an SVG file instead of the DXF that OnShape can easily produce. 
I usually use Inkscape software for converting to and from SVG and DXF. I did so in this case and it worked as expected.
So, once I have got the SVG file I can feed I need not to forget to change the default dpi value …