For my thesis, I have to make a thrust vectoring nozzle that’s controllable with a joystick.
At the same time, an artificial horizon or attitude indicator has to show the corresponding attitude of the plane.
I have sorted out the part how to control the nozzle, but I need your advice about controlling the artificial horizon.
The artificial horizon, works with 2 stepper motors that move the pitch and roll position of the indicator.
The attitude indicator expects commands like this:
Commands from control PC
’ Message layout:
’ Byte 1: Flag byte:&h00
’ Byte 2: Address: 1-255; (Adress 0 excluded)
’ Byte 3: Command: CCCC.1SHL (CCCC=Command 1-15, S= Signbit, H & L are databits)
’ The integer is unsigned 16 bits.
’ Byte 4: Data Low; &h00-&hFF; bit0 always 1 : XXXX.XXX1 → XXXX.XXXL
’ Byte 5: Data Hight:&h00-&hFF: bit1 always 1 : XXXX.XX1X → XXXX.XXHX
’ Byte 6: LPC Check byte or &hFF ’ Commands:
’ 0= noop
’ 1= Initialize
’ 2= Set Instrument Address; Value 0-&hff,second byte:&HAA
’ 3= Set Instrument speed: If positive: Bank; If negative: Pitch
’ 4= Set Bank position (0-4319)
’ 5= Set Pitch position (0-1200)
’ 6= not used
’ 7= Send info about instrument; Reply &h00, Address, Type, Model, Version
’ 8= Switch lights: Low byte= DL00.0000; D=display on/off, L=light on/off
’ 9= Set Instrument Model &Version, Low Byte=Model, High Byte=Version
’ 10= Move bank directly; used for calibration
’ 11= Move pitch directly; used for calibration
’ 12= Set calibration values for pitch and bank centers
’ 13= Clear calibration values for pitch and bank
’ 14= Set/Reset testmode: 0=off, 1=on, turn right, 2=on, turnleft
In my application, I will only need 4 & 5 (pitch and bank)
Note that the number of serial channels available differ depending on the board. Personally I play with the Mega 2560, but I've only needed the i2c port so far (a snap to use), although I'm about to play with reading my foretrex 201 across one of the 232 ports with the use of a little Maxim board.
You should find quite a few sketches to get you going though.