Custom Gimbal/Manipulator controlled over Serial port

Hi everyone,

I have a custom Gimbal (or manipulator if you want) based on NEMA Stepper Motors and TB6600 Stepper Motor Drivers.
Can someone advise me on the best way to integrate it with ArduPilot: Rover?

I know that ArduPilot (like other autopilot systems) is designed to control various motors via PWM/PPM or SBUS, which are fast and accurate. However, it seems a bit odd to me to convert PWM to stepper PUL/DIR signals using another controller (e.g., Arduino) for my gimbal.

I’m using speedybeef4-v3 as my autopilot board which seems does not support GPIO and lua scripting so I really want to utilise avaliable comms like uart/i2c/spi.

There is a very helpful article for creating Custom Sensor Drivers - but this is for sensors (reading device), and I need a driver for controlling a device like a gimbal.

I found support for the SimpleBGC gimbal controller, which can communicate with ArduPilot using MAVLink or a custom serial protocol: common-simplebgc-gimbal

This looks like what I need, but I can’t find any articles showing where/how I can implement a custom serial protocol in a way that doesn’t require changing the ArduPilot core code.

Or maybe it’s better to go from other way and implement MAVLink protocol (v1) on my manipulator side?

I feel like I’m almost there with my research, but before I start coding, I would appreciate some advice or oppinion from the experts or community.
Looking forward to your feedback!

I think you should implement Gimbal Protocol (v2) | MAVLink Guide on the gimbal side.

Thanks for quick reply, yes make sence to me.

But what I’m also thinking is if there is a good/proper way of adding support for my own simple serial protocol, so it will become an option for SERIALx_PROTOCOL parameter? and maybe also MNTx_TYPE?

Why reinvent the wheel?
You will need to add code in both situations, so why not doing it correctly?

Yap, thanks @amilcarlucas

Just a quick update on this topic for the ones who might be interested: I’ve successfully converted the PWM signal to PUL/DIR stepper driver signals using an Arduino Nano (using ext interrupt pins for accurate PWM reading). It works well with manual controls and is serving my needs for now.

Next, I’m considering implementing the MAVLink gimbal protocol on Arduino but that is not the highest priority on my plans.