Servo

RobotArm

This page documents the LX-16A servo robot arm: 

Components:

Pins for wiring:

OBS: Magnet needs to have a DIODE - It need to be the right way in relation to pluys and minus!!

Possible commands

The commands are sent via serial 115200 baud as JSON on a single line, and "\ n" is used as the end of the command:


{"cmd":"getRelayValue"} // gets state of relay

{"cmd":"begin"} // starts a transaction

{"cmd":"end"} // starts a transaction

{"cmd":"init"}  // init check

{"cmd":"hello"} // hello world check

{"cmd":"setRelay","value":true} // sets relay

{"cmd":"setServoPos","value":460,"time":500, "id":1} // sets servo with time

{"cmd":"setServoPos","value":460,"speed":5, "id":1} // sets servo with speed


{"cmd":"setServoPos","trans":true, "value":460, "time":500, "id":1} /trans mode

{"cmd":"getColor"}

{"cmd":"getServoPos","id":1}


Time is in ms and speed is in degrees pr second.

To create a transactional move

Often it is relevant to make sure that a whole transaction has happened before an new move is initiated:

{"cmd":"begin"}

{"cmd":"setServoPos","value":460, "speed":500, "id":1}

{"cmd":"setServoPos","value":460, "speed":500, "id":2}

{"cmd":"setServoPos","value":460, "speed":500, "id":3}

{"cmd":"end"}

 If you only want to move one motor you can also do:

{"cmd":"setServoPos","trans":true, "value":460, "time":500, "id":1}

Debugging can be done by sending commands through the serial monitor - they need to be in one-line json format with a newline for end of command.

Installation


This is how the folder should look.
This is how the  project should look. Notice the tabs with the different parts.

P5JS - Interface

A custom interface has been made to interact with the robot

https://editor.p5js.org/hobye/sketches/llPPJE7CX 

Code, 2D and 3D models can be found here