I picked up a Logitech Extreme 3D Pro joystick from FB Marketplace a couple days ago to control the robot arm. My goal is to create a comprehensive web interface with both button controls and joystick integration.
So far, I've implemented a working web-based control system for the single axis I currently have operational. The system consists of three main components: an Arduino sketch running the stepper motor, a Node.js server handling communication, and an HTML/JavaScript frontend.
The Arduino code manages precise stepper motor control with the AccelStepper library. It includes homing with an endstop sensor, smooth acceleration/deceleration, and positional constraints to prevent mechanical damage. The system tracks position in steps and converts to degrees, with a 300° maximum travel range. Eventually I'll start reprogramming my brain (and code) to think in radians instead of degrees.
My Node.js server bridges communication between the browser and Arduino using WebSockets and Serial connections. It relays commands like 'reset', 'jogcw', and 'jogccw' to the Arduino and broadcasts position updates back to all connected clients.
The browser interface displays the current position in degrees and provides buttons for homing the system and jogging in either direction. I've also added joystick readouts that display all axes and button states from the controller.
While I haven't yet connected the joystick control to the actual motor movement, the groundwork is there. I'll need to resolve some issues with how the joystick values are interpreted before fully integrating it into the control system.
Next steps will be adding speed control based on joystick position and extending the system to handle multiple axes as I complete the mechanical build of the remaining robot arm joints.
Evidently these cheap A4988 stepper drivers come out of the box with Vrefs all over the place, so I learned how to adjust that today. I've increased the Vref to 0.96V according to Vref = Motor Current x 8 x Sensing Resistance. I'm only using 60% of rated current, so I feel safe here and the extra torque is noticeable!
I also experimented some with microstepping today and landed on 1/8 step resolution, which is enough precision and still feels like enough torque. Turns out A4988 drivers are not only loud during operation, but also when they stop on a partial step and hold that position. Because of this annoying high pitched noise, I ordered some TMC2208 stepper drivers to replace them. Shout out to Grok for this suggestion.