Servo
RobotArm
This page documents the LX-16A servo robot arm:
Components:
RGB Color Sensor: TCS34725
Four servos: LX16A
Hiwonder TTL/USB Debugging Board
Jumper Wires
5v PSU for servos and Arduino
19v psu for magnet
Magnet from 20-30v relay.
Pins for wiring:
#define RELAYPIN 3
#define RXSERVO 9
#define TXSERVO 8
A5 to TCS34725 SDL
A4 to TCS34725 SDA
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}
Installation
Download the latest folder in the Arduino folder
If using the yellow keyStudio board then you need to install the driver
Extract the folder.
Make sure that the folder name is miniRobotIno_X and inside there are all the ino files.
Install the libraries
Arduino_JSON
Adafruit_TCS34725
Double-click the miniRobotIno_X.ino to open the project.
Choose an Arduino Uno board and press compile/upload.
P5JS - Interface
A custom interface has been made to interact with the robot