Joystick managed by Marlin

For x and y that is normal. The values 5600 and 10800 (out of a max range of 16384) correspond to 1.7 volts and 3.3 volts from a 5v supply. In other words the pot doesn’t give full range output.

For z twist you should be getting more range than that and it should be roughly centered on 2.5 volts. In fact the z range on mine is a bit bigger than the x and y range.

For reference:

One more thing just in case: if youre at that stage, make sure you get the polarity right, where higher voltage is plus X/Y/Z and lower voltage is minus X/Y/Z. There is currently no facility to flip the polarity in the firmware so you have to get it right before you solder everything up and discover it’s backwards.

Thanks Jamie! I wonder if I got a bad joystick. I did everything with spade connectors so flipping wires around (or replacing the joystick :/) shouldn’t be a problem.

I’ll carry on and see how well it works.

On the Z direction check all 3 wires with an ohm meter. I think the color coding is weird. I just looked at mine and I think I have white connected to + and red connected to - and black connected to signal. But not completely sure, because it’s a bit of a rats nest.

That was it! I just assumed red and black were power and ground.
For future reference the wires up as you mentioned gives counter-clockwise twist increasing voltage (up). I get 1.5 to 3.5v now.

Yes I have clockwise (looking from the top) moving Z down, like screwing a bolt down into a nut, and counter-clockwise goes up, like loosening that same bolt. So it’s easy for me to remember. I can’t guarantee that the colors are standard, but you can switch it to go whichever direction you prefer.

Edit: misread original post.

1 Like

Not being able to switch the polarity seemed like a weakness so I added this feature and submitted a PR: https://github.com/MarlinFirmware/Marlin/pull/16466

So you don’t have to be super careful when wiring it up. It’s so easy to get backwards.

Today is Marlin day for me I guess.

2 Likes

Thanks! I got everything plugged in and after some dead zone tweaking it’s working really nice and smooth.

Here’s the pins I used on the (not mini) rambo board… 3 pins plus ground and +5v off the analog extension pins, and enable on the PWM extension pin closest to the analog extension pins. I wound up cutting a network cable making a long and short cable… wired the short one to the board and the long one to the stick. Mounted a Female to female RJ45 keystone jack on my carriage and now I can just plug it in whenever I need it.

#define JOY_X_PIN 3 // 3- Analog Ext 4
#define JOY_Y_PIN 4 // 4- Analog Ext 6
#define JOY_Z_PIN 5 // 5- Analog Ext 8
#define JOY_EN_PIN 4 // PWM ext pin 6

Edit:
Heres a link to a printable joystick enclosure and rambo enclosure.
Also has photos of the Rambo wiring.


5 Likes

Just curious … what are the maximum feed and acceleration rates based on? It moves way faster than when I jog with the lcd and even if I turn maximum feedrate and acceleration way down it doesn’t seem to have an effect. Sometimes if I push the joystick all the way to the extents the motor just stalls. I can probably get around with it by fudging the min and max x and Y values?

There is a bug (as far as i’m concerned) that they introduced when preparing it for Ultipanel or something, I’m not quite sure. They changed it so the joystick max speed is limited to a lower value, the MANUAL_FEEDRATE (if you have an LCD enabled), whereas I had it so the joystick could use the full max feedrate.

I submitted a PR to fix this, which they merged, but it was after Ryan’s 414 version. It is included in Ryan’s 415 version, or you can apply the fix yourself to the firmware according to the commit (it’s just a one line change).

Eventually it will fix itself when the change propagates but there is a window where the joystick is slow and you have to apply the fix to get the full feedrate.

1 Like

Ok. I actually forked off the release version of marlin from Dec 5 so maybe I am out of date. It’s interesting it doesn’t take the lower of the maximum feedrate or the manual feedrate if they went that route. I’m fine with updating the manual feedrate though now I know where to look thanks!

Actually my fork already has this PR and I am seeing the opposite problem.
(Joystick is moving faster than both the rate on the LCD and the maximum feedrate).

My problem might be I forgot to clear the EEPROM… I’ll try that tonight

Edit:
So managed to mostly solve my issue… the problem wasn’t feedrates at all… I think if you have the limits of the stick config set so that the pot drifts or spikes over those limits then the carriage stops moving… to the point where I had the stick full forward and the carriage moved then stopped for awhile and I had time to run M119 with debug on and verify that the readings still showed the stick full forward. All X Y and Z behaved this way.

I changed my config so the upper limits were 1000 lower and it seemed to almost completely solve the issue with still a little stuttering here and then (if the pots spike over the limits?)

I would also like to know if anyone has got this working with SKR 1.3, and what pins would be able to be used. I am using Dan’s(blomsd) settings for skr 1.3 and uart and I would like to add this joystick. He used a bugfix version from October so it is included, I just need to know what pins to use.

Hello im new in marlin can you zip the marlin file and put it to dawnload and uploadi in arduino for all taht joysick

Hi, I’m looking to integrate one of these joysticks into a pendant that also includes the RepRap display and hopefully a couple discrete buttons. Sort of an all in one deal. The joystick I got off ebay, has a switch in the top. I was wondering if the firmware changes have defined use of this too? Would be nice to use it to trigger Z homing or something.

Along the same lines, are there any other means (e.g. button presses) that are predefined in the firmware for triggering actions or g-code. As a means of replacing some of the custom commands in the menus. I know some have been able to use an arduino to feed gcode into the serial extension. Hoping for more direct support. I am running on a Rambo 1.4 with dual end stop firmware.

This analog joystick is its own module, both physically and in the firmware, so it is going to be independent from the other operations through the LCD or if there were some keypad. Nothing prevents the wires from running in the same bundle and being physically in a single pendant, but it will still be independent. This joystick does not have an Arduino to mediate the commands, so there is nowhere to put the extra ‘interpreter’ so to speak to translate a button press into some command.

I can see how a keypad for custom commands would be handy. The scrolling and clicking on the LCD is a little clumsy. I think a keypad would make a great addition but like I said it would be a separate thing. I think Armin’s approach would be a great starting point for a keypad, and it should work nicely in conjunction with this joystick.

Okay friends, don’t shoot me…but…WHAT!!!

I build my MPCNC middle of last year and LOVE IT!!! Thank you Ryan so much for what you created. I am running a Rambo with dual endstops, and every time I fire that machine up I am as excited as a kid in a candy store. I have effectively ZERO knowledge on firmware and electronics. As such nearly every single word of this post is a foreign language to me. I have been wanting to add a controller, PS4 or xbox or joystick, to my machine since day 1. In the last few weeks I have been reading every forum and watching every youtube video I can to learn how to do it…but alas………I’m lost.

I have read this post, all 70+ entries, countless times but I am just so lost. Its clear that those of you on this post know your stuff…and its amazing. Unfortunately I just cant follow it. I am 100% confident that Ryan put in countless hours to take what is an incredibly complex evolution and make the instructions so simple that anyone can build the MPCNC and run it…and man oh man was he successful! Its freaking awesome.

But here is my issue. I know there are a lot of people who use the MPCNC, based off of my time on the FB group, that want to connect an external joystick but we just cant figure it out. Like most novices, we run the basic setup with Marlin. I love it. Its just like my 3D printer. And like me, most of us don’t want to change out the hardware or stray from Marlin. Best I can tell this thread tells us how to setup Marlin and a Rambo to add a joystick. The real issue…………I just cant follow:

So here is the really…REALLY long story, sorry, dumbed down for us non computer code/non electronic savvy people.

“Can someone put into laymen’s terms how to actually do this”? Step by step instructions with pictures and/or video’s would be great.

Maybe sometime in the near future Ryan could make it a standard part of the build.

Thanks, and sorry for the novice questions.

5 Likes

Yes. I hear you. I can get the whole discussion about getting the code merged into Marlin. And that some firmware tweaking may be necessary so you would have to be comfortable with downloading the firmware, making the changes and uploading to your board. I understand that not all boards can support this easily. I understand that there is a specific joystick that Jamie recommends. I understand that some wires have to go somewhere else. And there is a diagram that is supposed to indicate how that happens. I am not familiar in circuit design symbols. It’s the fault of my education. Should be standard.

Putting it all together is where I get bogged down. Just some pictures of the setup. I know it should be pretty simple.

I have been rather lazy of late, and doing a ton of different things, and I keep wanting to get back and try this.

@jamiek I just wanted ask, is this ready for general use? or is it still in design mode?

from the comments there doesnt seem to be a guide to follow, which would be nice. but I am curious how much of it is hacking and hoping vs just do it, and cleanup?

And special thanks to Ryan as well, I am glad you did this, I have been playing in CnC for years, but some of it has been cost prohibitive to play with. my last CNC I build and played with had me about 5k into it. and I could justify tying that kind of coin up.

500$ is barely noticeable.

@jamiek I am glad there are so many smarter people than I.

1 Like