DeeEmm

Pragmatism in code

Home

Waxing lyrical about life the universe and everything tech related since lunchtime 2006.
4 minutes reading time (877 words)

Marlin CNC Pendant

IMG_8886-1

I built an MPCNC a while back and am finally getting around to finishing it off. My machine is a combined use CNC and 3D printer so I have elected to use Marlin software. The main use for my machine is 3D printing using a direct granule extruder that I am developing for use with recycled plastics, this requires a larger format and heavier machine than a regular 3D printer due to the size of the extruder. I also have plenty of aluminium CNC work for it, so it's very much a dual use machine. 

One aspect that I wanted to add was a jog-wheel control, so that I could control it in the same manner as other CNCs I have used, but being controlled by 3D printer software it does not lend itself well to traditional CNC controls. After looking around for such a solution I did not really see something that worked exactly as I wanted. There are a few solutions using G-Code parsers to send G-Code to the controller, but the issue with using these with a jogwheel is that a small flick of the wheel produces many G-code move commands, which are buffered in the machines memory. This means that the machine will continue to move long after the jog wheel has stopped, resulting in a large overshoot and difficult control characteristics.

My initial solution was to modify the Marlin code to accept direct input from the jogwheel, but then I came across Jamies joystick solution over at the MPCNC forums and decided that I could leverage this as the protocol for my jog-wheel control.

Essentially what I have created is an external controller that mimics the joystick and is connected to the same inputs used by the joystick. This connects to Marlin in the standard manner defined by Jamies code, which has now been added to the latest Marlin 2.0 release. This means that there are no code hacks to maintain and no code to change, just the standard connections and standard setup you would have to go through if you were hooking up a regular joystick.

Here's how it works: The regular joystick control comprises of three potentiometers for X,Y and Z respectively. Using three voltage controlled resistors (VCRs) we can easily make the Arduino mimic the potentiometers within the joystick.

The controller uses an Arduino nano, a regular CNC style encoder jogwheel and simple selector switches to select the axis and speed. (X, Y, Z & X1, X10, X100). A regular MPG jogwheel pendant like those found on ebay will also work. Three MCP4151 10kohm VCR chips are used to interface with the main controller and mimic the X,Y and Z axis joystick inputs. The arduino controls the VCRs using the SPI serial comms protocol. This uses a two wire serial bus that connects all three chips to the Arduinos MOSI / CLK ports. The relevant chip is selected using a simple Chip Select (CS) signal connected to outputs on the Arduino. The arduino enables the relevant VCR, decodes which speed is selected and then sets the virtual potentiometers to a value that corresponds with the speed selected, for as long as the encoder is rotated.

When the jogwheel is inactive, the VCRs are set to mid position to mimic the joystick center. If X1 is selected and the jog-wheel rotated, it will move the potentiometers virtual wiper to a position that corresponds with a small joystick movement. As the speed selector is changed, this resistance changes which mimics a larger joystick movement. Of course the movement will only be one axis at a time and only at the selected speed, although smaller movements tend to create short pulses which result in slower movement.

There is also an adaptive output speed function, which will scale the output such that the output speed (potentiometer position) is proportional to the speed that the jog-wheel is rotated. The faster you rotate the encoder, the faster the CNC will move. Like the regular speed selects, this can be enabled by pulling the assigned input low. The adaptive speed function overrides all other speeds selected.

The project is currently working and tested with Marlin 2.0. You can view a video of the adaptive speed function working below...

To download the project or to contribute, please visit the projects Github page at https://github.com/DeeEmm/Marlin-CNC-Pendant

...

GitHub - DeeEmm/Marlin-CNC-Pendant: A jogwheel based pendant controller to interface to Marlin / Arduino controlled 3D printers & CNCs

A jogwheel based pendant controller to interface to Marlin / Arduino controlled 3D printers & CNCs - DeeEmm/Marlin-CNC-Pendant
...

Joystick managed by Marlin - Hardware Development - V1 Engineering Forum

As a bit of a diversion from my second build, I’ve put together a joystick that allows jogging with analog control of the feed rate. https://youtu.be/b2xEmkZEF6Y I decided to take a different approach from the approach…
...

Jogwheel / MPG pendant control - Hardware Development - V1 Engineering Forum

Hi All. I built an MPCNC a while back and finally getting around to finishing it off. My machine is a combined use CNC and 3D printer so I have elected to use Marlin software. The main use for my machine is 3D printing …
DIY Cheato Reactor

Related Posts

 

Comments

No comments made yet. Be the first to submit a comment
Already Registered? Login Here
Guest
Tuesday, 14 July 2020
If you'd like to register, please fill in the username, password and name fields.

Captcha Image