Hello all,
this is exactly what I’ve been looking for!
The Primo was so fun I couldn’t just stop there, so I’m building a sand table.
I’d like it to draw patterns by itself, but it would be nice to have manual “etch-a-sketch” control.
The joystick part is pretty well covered here, but how do you interrupt an ongoing pattern for manual control? And how do you resume or start a new pattern?
What I want is:
Automatic pattern drawing, in sequence or random.
A panel with a gamepad style joystick for manual control.
Buttons for Erase/wipe, next pattern, start/stop, speed and if possible, lighting effects.
Has anyone done anything like that for a sand table?
Btw, I know I’m late to the party, but the sand table should have been named XandY. See what I did there?
@jamiek I really can not wrap my head around this… I only have SPDT switches at hand right now… And connecting it like this sketch doesn’t work. The Reprapdiscount LCD turns off when I flip the switch, and the joystick don’t work when ON… So…
Can anyone see what is wrong here? I do have joystick enabled in marlin!
If I read your diagram correctly, and if this is really how you have it wired, you are connecting 5+ directly to ground when the switch is on. Not a good idea. Assuming the blue line goes to the enable pin, then you probably need to remove the power wire from your switch. While I don’t know for sure, usually pins like the enable pin are pulled high internally to the Arduino, and you pull them to ground to “enable” them.
@dailybombs I agree with Robert’s comment that you should not be connecting power to the SPDT switch. If SPDT is all you have, then leave out the LED. It is a diagnostic aid and not needed for function. I do not have an LED on my joystick implementation and do not miss it. My switch is SPST and clearly marked for On/Off positions, so I easily know if it is active.
If you want the led, then reverse the wiring. Hardwire the positive side of the led to 5+, then connect the negative side of the led to the switch where you’ve attached the enable line. When the switch is engaged, both the enable pin and the led will be grounded.
Good point. That way the LED and resistor in series will be a supplemental pull up on the enable pin. I didn’t think about it much because I saw no need for the LED when using a labeled switch.
I don’t see a need for an LED either, but people often just want things a certain way. BTW, I love how your joystick mount mirrors the feet on the MPCNC.
I think I knew that request was coming. I’ll try to get it posted on Thingiverse within a day or so. I should probably put up an editable CAD file in addition to the STL. Chances of others finding a switch geometry that matches what I pulled out of my random bin of stuff might not be so good, and some will want to add the LED.
Edit: I put the link to this design on Thingiverse in my previous comment.
I like this solution better, and it only requires SPST. Not sure why I didn’t come up with this originally. Somehow I convinced myself that turning on the LED was not possible while simultaneously turning off (0V) the signal to the enable pin without using both switches.
Thanks guys! I probably burned my Arduino connecting some of this wrong hahaha thank god a got another Mega laying around.
I’m running Ramps 1.4 with V1 firmware for MPCNC. I have enabled joystick. It works really well. But now I want to implement the ability to flip the axis on the joystick in code. I have tried to include joystick.cpp and joystick.h and Configuration_adv.h that mentions this setting in code but the compilation doesn’t work. I throws a looot of errors … hehe…
What would be the best procedure for this? I don’t know how to configure latest Marlin for V1 MPCNC (building a LR2).
Joystick.cpp and Joystick.h are already included in the marlin firmware in Marlin/src/feature, so you just need to modify the code in these files. Nothing to include. Note that you could accomplish an axis swap by using a DPDT switch to swap the signal lines from the physical joystick.
Sorry for the dumb question, but I’ve just built a Lowrider v2 with SKR Pro V2 and would love to have a joystick for jogging. I’m afraid after reading this entire post I can’t tell if it’s possible or not with the SKR Pro V2… I love what Jamie has done here and would like to use this solution, but am open to other ideas as well. What’s available with the SKR?
I assumed that for the Z axis red was power, black ground and white signal… When turning the stick the display would go dark and the ramps would reboot.
So now I have white being ground, red being power and black being signal…
D44 for me is EN, which does work without problem…
The rest is wired as in the picture…
The strange thing now is that movement is really slow and that pushing the stick into one direction can lead the MPCNC not only move that axis but all three, sometimes also into a different direction. All is done very slowly… Sometimes there is movement without moving the stick…
Now I absolutely have no idea how to find the mistake. I traced signal to the pins back and forth and they also seem to be wired correctly…
when turning the stick the display would go dark and the ramps would reboot.
This is a strong indication that when you were turning the stick, you shorted power to ground. This can result in a burned out pin and/or a burned out voltage regulator.
So first I suggest you use a multimeter and check the resistance on both sides of each pot both in the deadstick position as well as when when the stick is moved. Also, if you are using it, check the enable button.
Next I’d plug signal line for the axis that shorted into a different analog pin if you have one available…and perhaps pick new analog pins for all three axes. The pins for the joystick are assigned in Configuration_Adv.h.
The strange thing now is that movement is really slow and that pushing the stick into one direction can lead the MPCNC not only move that axis but all three, sometimes also into a different direction. All is done very slowly… Sometimes there is movement without moving the stick…
This sounds like the joystick code is reading different pins than the ones you have the joystick signal lines attached to. If you do an analog read of pins that are not being pulled high or low, they float giving various values around 512 which would give the behavior you are seeing.
I think your best next step is to define JOYSTICK_DEBUG somewhere in Configuration.h or Configuration_adv.h, by adding this line: #define JOYSTICK_DEBUG
Then M119 will display not only the endstop state but also the analog values being read for X, Y, and Z (and enable). This display works even when the joystick is not enabled (via EN), so you can leave it disabled via EN and see what range of values you are getting. If it is inconsistent then perhaps there is a wiring problem somewhere.
And yes the joystick red and black for the Z axis are NOT positive and negative. Red and white on the Z axis are for the positive and negative (or vice versa) and black is for the signal.