Controlling Gimbal using Serial API from a PC using Python script
  • Hi everyone,
    I was wondering if you could help me with the following: I want to control my gimbal (CAME-TV Prodigy) using a python script from my Ubuntu Laptop by sending commands from the Serial API. I was able to identify each of the RC_ROW, RC_YAW and RC_PITCH interface pins (which unfortunately weren't labeled) in the gimbal by connecting a Futaba RC receiver in it and moving the motors with the RC transmitter. According to the SBGC manual and website, one could transmit hexadecimal commands from an Arduino using the Serial API by connecting to the RC_ROLL interface on the gimbal. In my case, I want to transmit from my computer directly, for which I use a FTDI Serial TTL-232 cable as the one shown here: https://www.adafruit.com/product/70. This allows me to send the hexadecimal serial commands to the gimbal as TTL. I even checked with an oscilloscope that the CMD_MOTORS_OFF command was being transmitted after running the following python script:

    import serial
    ser = serial.Serial( '/dev/ttyUSB0', baudrate=115200, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS )
    mess_off = "3e6d006d" # this is the CMD_MOTORS_OFF command, including the checksum byte
    ser.write( mess_off.decode('hex') )

    where I transmit only the header of the message since there is no data to be transmitted. Then I connected the Tx pin of the FTDI Serial TTL-232 cable to the RC_ROLL pin as well as the Ground in the gimbal's interface. Then I turn on the gimbal which starts at a certain fixed position, so you can tell the motors are activated. Next I ran the previous python script expecting the motors to turn off, but unfortunately nothing happens, and you can still see the gimbal firmly in that fixed position.

    I've ran out of ideas at this point. Can anyone please point me in the right direction?

    Thanks guys!
  • Hello everyone,

    I have an update. So, I connected a Futaba RC receiver for each roll, pitch and yaw. I was able to move both yaw and pitch with my RC transmitter; unfortunately the roll motion didn't work. Could it be that this input (RC_ROLL) is not working properly or could it be that I burnt it? I'm saying this because when I started trying to send hexadecimal messages using the RC_ROLL input mode in Serial 2nd UART, I did it with a USB-TO-RS232 converter (huge mistake) which works with a different voltage level than a TTL signal. How can I easily check if the RC_ROLL input is broken? Also, how could I fix this?

  • Hello,
    An easy way to understand does your serial port work or not, is tying to connect GUI to it. Once you have configured RC_ROLL to "SBGC Serial API", you should be able to connect from the GUI to it using USB-to-serial adapter (you will have now 2 ports in list).

    If RS232 had +12V logic, it is a big chance it had damaged TTL inputs. +5V logic should not damage it. Though, even if it burned, you can move RC_ROLL pin function to AUX3 - see the option "Hardware" - "Swap RC_SERIAL - UART2" ports.
  • Thanks Alexmos. I tried a thousand ways to send serial commands and to connect to the GUI by using the RC_ROLL input (I did change it to "SBGC Serial API mode"), but had no luck. I contacted support from basecamelectronics and even send some pictures of the gimbal controller board (which supposed to be version 3.1, with firmware 2.60b4 according to the GUI). They told me that they didn't produce that kind of form factor of the board; so at this point I don't even know if the controller board incorporated in the CAME-TV Prodigy gimbal has this functionality enabled through the RC_ROLL input. All in all, since this gimbal came with a bluetooth joystick, I figured I could use its bluetooth module in order to send serial commands wirelessly from my laptop (using C programming and the serial API, and yes, I had to make some small modifications to the API written originally for Arduino applications). It turned out to work pretty well, so I was able to turn the motors on and off as well as to move the Pitch and Yaw by arbitrary angle values. At this point I have two questions:
    1. Every time I want to set the position of the angles to zero I can see that the jaw is constantly changing its reference. That is, zero Yaw is not always the same. I could even confirmed this with the GUI, where everytime I set the zero values in the program and then look at the GUI, the jaw was certainly at zero, but this zero was different than other zeros at a different time.
    2. Also I would like to know if it is possible to get compass data, like the heading of the gimbal with respect to real north, from the IMU module incorporated in the gimbal.

    Thanks Alexmos.
  • Just a comment, I was able to control only the yaw and pitch motion of the gimbal via bluetooth connection. Since I was not able to control the Roll either by RC (pwm) nor by Bluetooth, I think that it is likely that the option to control the Roll for this gimbals has been simply disabled, as well as the possibility to use the RC_ROLL input as a way to establish a serial connection. Remember, is the CAME-TV Prodigy gimbal.