Joystick managed by Marlin

I’m really happy about all the enthusiasm. It’s ‘complete’ as far as the design and the firmware goes but the documentation is lacking and I only have experience with the RAMPS-like boards, not Rambo.

Let me see if I can pull together a more self-contained document that’s a bit easier to read than this thread.

At a minimum you will need to know how to enable a couple lines in the configuration and re-flash your board. The switch and joystick can be wired directly to the board if you skip the LED indicator light, so it shouldn’t need much skill beyond making good electrical connections. I’ll see if I can get a guide together this weekend.

6 Likes

Here’s a photo of the rambo (not rambo mini) connections I used.
On the left, Brown=ground, red = +5V
Working right, Blue purple grey are XYZ, and green is enable.

If you google how to wire up potentiometers you will see how the joysticks are supposed to be hooked up… power and ground on the outside pins, and signal on the middle.

featured_preview_IMG-3187

3 Likes

Are the configuration values for the joystick in EEPROM? It might make it possible to add in the default firmware (but pins are precious). But for that to be worthwhile, you wouldn’t want to have to reflash it to change the min/max/deadzone. You’d also need to choose a Gcode/Mcode…

1 Like

@jamiek

So I am willing to be your documentation guinea pig.

I have a Ramps 1.4 and I am using a Pi4 for Octoprint.

I believe I have all the parts needed to build the controller.

On top the above, I also purchased this item

https://www.amazon.ca/Freenove-Processing-Oscilloscope-Voltmeter-Components/dp/B06X3V84PV/ref=sr_1_1” in preperation of doing the mod.

and I also have this one :

WHICH was also a potential use.

Trying to bridge the knowledge gap here.

I’m trying to figuring this out, but it’s quite the treasure hunt. I have an Archim board. In the conversation above, folks are referring to pins that have specific names on certain boards.

So this comment assumes that everyone knows what board we are talking about, but nowhere in the first post does it name the board. I assume it is the RAMPS?.

So then how to we trace things out to get to the other boards?

I know the microcontroller has in/out pins. They have numbers. I know that these pins get mapped to pins on the control board and can be used for various purposes. Some are clearly set up for the motors, the fans, the extruders, thermistors, etc.

Some pins are still free for various jobs. Some pins can be remapped for other purposes. I’m going to keeping poking away at these boards and get a better understanding of all the pins and connectors.

And awaiting Jamie’s clearer documentation. Thanks in advance!

Jamie uses RAMPS.

You can choose the pins you want. They need to be capable of analog in (for the 3 axis inputs). Many of the rambo pins have assignments already, like the xmin endstop. But there are spare ones on the aux connectors.

1 Like

I have an Archim2. This is the perfect project to help me understand these boards better and how to control them to control other things.

So I could define the pins in the J20 header with the undefined GPIO pins referred to here in /Marlin/src/pins/pins_ARCHIM2.h? Just guessing. I am currently using one of the fan pins for a cooling fan on the control board. It seems I can use the other fan for the PMW part of the joystick.

Otherwise I am trying to figure out where the firmware is configured for this.

// Unused Digital GPIO J20 Pins
#define GPIO_PB1_J20_5 94 // D94 PB1 (Header J20 5)
#define GPIO_PB0_J20_6 95 // D95 PB0 (Header J20 6)
#define GPIO_PB3_J20_7 103 // D103 PB3 (Header J20 7)
#define GPIO_PB2_J20_8 93 // D93 PB2 (Header J20 8)
#define GPIO_PB6_J20_9 99 // D99 PB6 (Header J20 9)
#define GPIO_PB5_J20_10 101 // D101 PB5 (Header J20 10)
#define GPIO_PB8_J20_11 100 // D100 PB8 (Header J20 11)
#define GPIO_PB4_J20_12 102 // D102 PB4 (Header J20 12)
#define GPIO_PB9_J20_13 108 // D108 PB9 (Header J20 13)
#define GPIO_PB7_J20_14 98 // D98 PB7 (Header J20 14)
#define GPIO_PB15_J20_15 66 // D66 PB15 (Header J20 15)
#define GPIO_PB16_J20_16 67 // D67 PB16 (Header J20 16)
#define GPIO_PB14_J20_17 53 // D53 PB14 (Header J20 17)
#define GPIO_PA18_J20_21 71 // D71 PA17 (Header J20 21)
#define GPIO_PA17_J20_22 70 // D70 PA17 (Header J20 22)

Hello, great article and great work. Thanks. I only have a problem with the Z axis. After using the M119 command, the values ​​jumps. Actually on each axis they jumps but the most on the Z axis is also another potentiometer

2 4.7kR potentiometers X and Y axis
1 potentiometer 1.5-3.6k in the Z axis

Because of this I cannot adjust the value

#define JOY_Z_LIMITS {90, 150-30, 150 + 30, 290}

Do you know what to do?

1 Like

This is my take on a handheld controller for my MPCNC.


I have used the lastest firmware, but wanted to be able to software invert the polarity of the axis, so I have included the code from jamies pull request.
Files for the housing can be found here: https://www.thingiverse.com/thing:4144229

9 Likes

Od Makarewicza do Orzechowskiego mówię wam: cześć i witam!

1 Like

Another Rambo success! I finished adding this to my machine today, many thanks to Jamie, Greg (for Rambo specific details) and of course Ryan :slight_smile:!

Process was relatively smooth minus me glossing the fact that you need a double throw switch to enable the… enable led to work :wink: I did run into some weirdness in that my analog pin3 didn’t seem to work right. My Y axis reading came out ranged 14-25-40 while the other axes were pretty close to Jamie’s published offsets. I switched Y to analog 6 after confirming wiring and resistance of the pot and it worked. Printed quick enclosure and off to the races!

I found a 2x5 header block in my parts bin along with a cat5 surface mount jack. Made an adapter cable that dangles out of the bottom of Ryan’s enclosure and ran a cable from the joystick to the plug. Painter’s tape holding it to the main stepper bundle will be replaced with a ziptie at some point.

20200217_122418

4 Likes

Forgot to mention, flashing firmware with PlatformIO was delightful!

1 Like

I like platformio.

I had a project that was using both an arduino and a raspberry pi. I put platformio on the pi and could remote flash the arduino.

Hello, great article!

How would I go about doing the same thing via the AUX2 port on the Ramps board, but with with 4 direction buttons instead. I need continuous jogging and the other solutions I’ve seen only jogs in increments.

I’m a total noob, so please be gentle :stuck_out_tongue:

Depending on how you use the joystick, it will jog the axis either in increments or continuously.

So how would I go about it using 4 direction buttons instead of a joystick to get the same effect?

So you want to just move X and Y?

You’d need a circuit that would make about 2.5V with not buttons pressed and then higher with one button pressed and lower with the other button pressed.

GND -- R1 -- R2 -- out -- R3 -- R1 -- 5V

           |-B1-|       |-B2-|

If you used 4 resistors of the same size (about 1k-10k) in series. You can wire buttons across the second and third resistors. The output is in the middle. With no buttons pressed, the voltage will be 2.5V. With B1 pressed, out will be 1.65V. With just B2 pressed, it will be 3.35V.

Repeat that for X and Y. You need completely separate buttons though. A D pad with a common pin for all 4 switches wouldn’t work this way.

1 Like

Many many thanks, I’ll give that a bash.

I did think the starting point would be 2.5V as if the wiper was in the the middle of the potentiometer, but didn’t know how to go about getting the other two extents. But you cleared that right up.

Planning on using 4 tact switches so this would work perfectly.

Hi. I almost have this working, however I’ve not quite got the fine tuning down yet. I have a bunch of questions. I’m running a Rambo like @tailslide , with dual end-stops. At moment I am only working with x and y. My z seems to have a broken wire.

I am able to get the values from m119 but when I change the firmware values it doesn’t quite respond as expected. For instance, the dead band at ± 100 was very sensitive… I’ve tried increasing this a bunch but it doesn’t seems to be adjusting as much as I’d like so as to avoid those small off axis moves when positioning. How wide can this be?

Also should it stop and start or be completely smooth? If I push the stick full tilt too quickly it goes then halts. If I push slowly, it will mostly go ok. But still halts once in a while in travel. I’ve had to increase the over all range values (max and min) from what was recommended by @jamiek as well so that I could move the stick more freely, i.e. so it is not limited close to center. My range of values from M119 appear to be 0 (min travel) to 16378? (max travel). I expected to be able to go full on stick and have it run at its max speed but it seems to just stop. Normal?

Precision. Not really a joystick problem but it kind of stinks the lcd only reports X & Y at 1mm increments. If I drive to a location. Reset zeros (G92 X0 Y0). And machine something. If I later need to rehome for any reason (after disabling steppers for something) , there is zero chance I could return to exact same location. Best I could do is within .5mm. Better to use the menus.

Finally, I have found that it does not seem to respect the end stops (machine limits?). I can crash the gantry pretty easily using joystick. Should that be the case or is something amiss? I’m runnning dual end stop firmware. It seems this version of Marlin (downloaded in the last few days from V1 for this feature) does not handle endstops the same as my older version (downloaded last summer). In past version, when I home with G28 X Y, the coordinates X Y coordinates would set to zero. Does not seem to do that anymore. Could be why I can crash. Is this the new normal?

Sorry for long post. Any input is appreciated. Thanks.

Seeing pretty much exactly the same thing. I am a developer by trade and tried applying some smoothing algorithms to deal with the start-stop issue which didn’t help… I think the problem might be something other than bad analog readings. Also saw the same thing with the endstops not being respected. Fortunately it seems to be a minor annoyance that doesn’t prevent me from finding it very useful. All in all I’ve still found it the most time saving upgrade I’ve done.

Also regarding finding the same spot I have mine hooked up to raspberry pi cnc.js so it’s easier to read off or set the coordinates although in practice I never seem to need to but might try it some day on a very long job.

1 Like