LibraHD Commands
Connection Types
- USB Serial - Direct Commands, 115200 baud, 8n1
- Ethernet Direct - Direct Commands, Port 9760, TCP
- Ethernet WebPages - Port 80, Browser based UI. Can be used at the same time as the Ethernet Direct connection. Not meant for automation as the communication often changes automatically on firmware updates.
Direct Commands
Basic Syntax <ttnnccccccpx>
- tt - The two letter target. AL for Altitude Axis, AZ for Azimuth Axis and H1 for general control (Inclinometer and Networking configuration)
- nn - Two digit user supplied Transaction ID that is echoed back. This can be used to match responses to requests. It is often incremented per command
- cccccc - The command to execute. Often 6 characters but can be more or less.
- px - optional payload from 0 to 32 characters. Omitted if there is no payload as part of a command
Lines in responses are separated by \n (0x10).
For responses that contain multiline data it is best to assume that more lines can be added with firmware updates. Thus it recommend to parse on the key value rather then the line number.
Examples
- <AZ12GETCFG> Tells the Azimuth Axis to report the Config using the transaction id of 12
- <AL45MOVABS1000> Tells the Altitude Axis to move to a position of 1000 with a transaction id of 45
Markdown note the \ character is not part of the command. It is used to escape the brackets.
Commands
<AL23GETSTA> Gets the status of the AL or AZ axis. 0 false, 1 true
Sample Response
!23
CurrentTemp = No Probe
CurrentStep = 108585
TargetStep = 108585
IsMoving = 0
IsHoming = 0
IsHomed = 1
TempProbe = 0
RemoteIO = 0
HomeSwitch = 0
END
<AL23GETCFG> Gets the configuration of the AL or AZ axis
Sample Response
!23
Nickname = Altitude
MaxSteps = 72360
DeviceType = G
BLCompOn = 0
BLCompSteps = 40
HomeOnStart = 1
END
<AL23SETHOS1> Sets the Home on Start option to on (1) or off (0) for the Altitude or Azimuth Axis
Sample Response
!23
END
<AL23DOHOME> Homes the Altitude or Azimuth Axis
Sample Response
!23
END
<AL23DOHALT> Halts motion on the Altitude or Azimuth Axis
Sample Response
!23
END
<AZ23MOVABS1023> Moves the Altitude or Azimuth to a specified step (uint_64t). In this case 1023 steps. Allowed range 0 to MaxSteps, which is available from the Alt and AZ GETCFG Command.
Sample Response
!23
END
<AZ23CENTER> Moves the Altitude or Azimuth to the center (mid point, not center step) position.
Sample Response
!23
END
<H123GETCFG> Gets the general shared (or Hub) configuration.
Sample Response
!23
Firmware = 0.0.1
LEDBrightness = 75
HandCtrl = 0
WiredIP = 192.168.1.165
END
<H123SETINCx> Sets the aux port to inc mode (1) or hand control mode (0). Reboots the board to apply new settings
Sample Response
!23
;; or END depending on timing of reboot
#### \<H123GETINC> Gets the latest Inclinometer data. Currently updates ~3 times per second.
Sample Response
```text
!23
X_Raw = 33595
Y_Raw = 32997
T_Raw = 154
END
<H123REBOOT> Reboots the controller.
Sample Response (note, what you get is variable depending on when the unit reboots)
!23
<H123GETHIP> Gets the current Hub IP Settings
Sample Response
!23
IP = 10.8.6.50
Mask = 255.255.255.0
Gateway = 10.8.6.1
PNS = 169.254.1.1
SNS = 0.0.0.0
Def. IP = 10.8.6.50
Def. Mask = 255.255.255.0
DHCP = 0
NetBIOS = GEMINI
MAC = 00:04:A3:67:CF:73
END
<H123SETSIPx.x.x.x> Sets the pending static IP (requires setting and saving all four before application) <H123SETSIP192.168.1.6>
Sample Response
!23
SET
END
<H123SETHSMx.x.x.x> Sets the pending static mask (requires setting and saving all four before application)
Sample Response
!23
SET
END
<H123SETHSGx.x.x.x> Sets the pending static gateway (requires setting and saving all four before application)
Sample Response
!23
SET
END
<H123SETHSDx> Sets the DHCP service to on(1) or off(0)(requires setting and saving all four before application)
Sample Response
!23
SET
END
<H123SAVEIP> Saves the pending IP Settings. Note that all four commands: IP, MASK, Gateway and DHCP state must be set before saving (may require reboot for application)
Sample Response
!23
SET
END
<H123SIPRST> Resets IP Settings and reboots the controller.
Sample Response (note, what you get is variable depending on when the unit reboots)
!23
Error Codes
If the device encounters an error it will report an Error Code and a string description of the error condition.
For example, trying to move out of the allowed range would report a “The received command contained invalid parameters”
Sample Response (may or may not have transaction ID depending on what was sent incorrectly)
!
ERROR ID = 4
ERROR TEXT = The command received was for an invalid target device
END
Sample code
This is a sample Python program demonstrating using the command syntax over the network. If the socket is replaced with a COM Port at 115200 BAUD the same code works over serial as the same commands are used.
import socket
#Set the IP Address of your unit here
TCP_IP = '192.168.1.165'
#Standard port for onboard command system
TCP_PORT = 9760
BUFFER_SIZE = 1024
#Command to get status, you can change and use the 23 to match commands to responses
MESSAGE = b"<AL23GETSTA>"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
data = s.recv(BUFFER_SIZE)
#You can keep the socket open and send more commands but for this demo the port is closed and the data is printed
s.close()
print( "received data:", data)