Manual joystick control fro MPCNC

Dear all,

 

during the last few days, I have developed and worked on a solution to easily home, move, and zero the MPCNC (with RAMPS and Marlin, sorry, not working on GRBL) without going through the crappy display menu. I thought, a joystick would be nice! And in my son’s arduino megaset, guess what I found! :smiley:

Arduino Nanos are also on stock so let’s go!

From the way how the ESP3D project is controlling 3D printers I knew it was possible to directly write on the serial port. So I tried this with the Nano and it worked! Just send G28 X Y to the AUX-1 port and the machine homes like as if I had used the menu button (except for it doesn’t say user coomand executed. Yes Ryan, there is a typo in the firmware! LOL! Search for coomand!)

So I soldered the Nano together with the joystick module, some switches and some LED on a breadboard, designed a shabby but functional case for it and gave it a try. I like it!

 

The full documentation including all sources (software, wiring diagram and OpenSCAD file) resides on Thingiverse.

Her you can see the controller in action:

Some pictures:

[attachment file=87431]
[attachment file=87432]
[attachment file=87433]
[attachment file=87434]
[attachment file=87435]

 

If you have any comments, please let me know.

 

Enjoy!

 

Cheers

Armin

 

IMG_20190204_203002.jpg

IMG_20190204_203049.jpg

IMG_20190204_203234.jpg

IMG_20190204_214921.jpg

schaltplan_Steckplatine.jpg

8 Likes

That’s great. Do you want any help with it? Is it working how you want?

I saw a setting in Marlin for enabling more serial ports. That would be nice so the serial port could still the used for other senders like a pi or a laptop.

Do you have trouble with filling up the buffer with commands? There is a command for pausing until the buffer is empty. You’d then have to look for the ‘ok’ message to see that it’s done with the pause before sending another command.

Great idea, well implemented. A little coding, a little printing, a little electonics, and a nice design. Adds up to a very useful addition. I particularly like the single button homing buttons.

1 Like

@Jeffeb3

 

It works perfect as is. And also parallel to the Octoprint. For the board, it’s totally transparent. It can’t distinguish between commands received from the external controller and commands received via USB/serial as both are physically connected to the RS232 on D0/D1 of the Atmega2560.

I always flush the buffer so it’s no issue up to now. I will check on the “ok” message thing but for the time beeing, I am just dumping messages on the bus without actually reading anything. Will try this! THX.

 

Cheers

Armin

 

This is just begging for a custom PCB…

I have updated the software to v0.2 and uploaded it to thingiverse.

Initial version worked but caused connection problems with octoprint (timeouts occured that made it cancel the connection, SD-card uploads didn’t work).

Looks like I solved the issue with v0.2.

 

Enjoy!

 

Armin

 

1 Like

This is crazy, I just finished making a keypad for the exact same reasons you did. A joystick would be even better but I don’t have the know-how to wire in a joystick, lol. I liked your design on thingiverse and will be following along with progress!

1 Like

Hi Armin,

I really like the concept you came up with. I am working on making one. I think it was a clever idea you had to send gcode through the rx/tx pins with stand alone arduino. If I understood correctly from above, it is possible to simultaneously connect usb e.g. repetier host usb connection to ramps and have this device connected at the same time to the ramps board (I’m not sure what would happen if you sent commands simultaneously if it would be garbled or executed sequentially)? I am going to use an extra mega I have instead around of nano and try to add a few other buttons to be able to have additional push button G code commands available to send, will make a different enclosure. For example, I ordered the triac board Ryan has been using to have pwm AC control of router speed, I am not planning to do pid just want to adjust the pwm digitally to set the router speed with button interface for up and down, with a 16X2 lcd display output. I am also interested to add some code for automated X and Y edge finding which I think your device could be extended to do (e.g. take 0.1mm step toward target then read a pin state, repeat until pin state changes when circuit completed by contact between router bit and conductive foil on wood workpiece edge), as I read that the marlin gcode for probing with G38 didn’t work. I learned a German word googling “vorschub” today after I looked over your code, so I learned something else from your project too!

Thank you,

Kevin

 

When you do this the onboard USB to UART chip is going to try to drive the voltage high or low, while the external arduino fights it. They probably have some minimal protection, so you don’t destroy them if you goof up tx and rx, but the data will be garbled, best case.

Totally coming back to this when I’m a little smarter.

1 Like

 

Definitely doing this today.

 

But im looking to do mine a little different.

Ill change mine so it moves in 0.1mm increments only, with a potentiometer adjusting the feedrate.

So i can just hold the joystick down and have it constantly sending a signal every 10ms or so.

Ill adjust the time delay with the feedrate so a faster feedrate means to send the movement command faster. and a slower feedrate sends the command slower.

 

thanks for the starting point. Ive been hoping for something like this for a while.

 

 

 

I just had this exact same idea (tapping into rx/tx for custom programmable pendant remote)! I’m glad you’ve already paved the way. I guess I’ve found my next arduino project.

Am I correct in reading, this is all hardware, no firmware updates to the Ramps board?

Correct, no firmware changes. I’ve used the same method for my own joystick control on a Rambo board. There were posts in this thread that were considering changing some Marlin settings to solve particular problems…for example enabling more serial pins so that the USB connection and the pendant could both be used.

would this be doable on an attiny85?

i just looked at the sketch size and theoretically it should work, it says there is 6k of space left after the bootloader, and the sketch is 6k so maybe a little optimization here and there, the specs on the digispark are:
Power via USB or External Source - 5v or 7-35v (12v or less recommended, automatic selection)
On-board 500ma 5V Regulator
Built-in USB
6 I/O Pins (2 are used for USB only if your program actively communicates over USB, otherwise you can use all 6 even if you are programming via USB)
8k Flash Memory (about 6k after bootloader)
I2C and SPI (vis USI)
PWM on 3 pins (more possible with Software PWM)
ADC on 4 pins

an i2c shift register could handle any extra input…