Please select Into the mobile phone version | Continue to access the computer ver.
Ronin control with Arduino and D-Bus(S-bus)
12Next >
37081 40 2018-9-22
Uploading and Loding Picture ...(0/1)
o(^-^)o
Sminkly
lvl.1

United Kingdom
Offline

Hi,
I was trying to control a ronin M using the D-bus connector and an arduino. I spent ages searching and though I could find a few videos that showed controlling ronin with futaba receiver, there was nothing concrete about how to do it using an arduino - to allow you to make a custom controller. (with a joystick and arduino could make a control for £30)

After hours of searching arduino forums etc, which although had some S-bus stuff, most of it was a bit too low level. I just wanted basic instructions of how to do it. I eventually worked out a method and I'm posting this here for anyone who want to do something with it.

I'm assuming you know a bit about arduinos so won't go into that(ie how to add a new library etc, do an internet search and you'll find all the answers).

I've tested this on a ronin-M so assuming it works with any other ronin with D-bus(which is really just futaba's S-bus).

To make it work you'll need this library - which was actually written to control the black magic micro cinema camera, but it is a simple way of sending sbus commands.

https://github.com/boldstelvis/BMC_SBUS

The only thing you may need to check is whether you need to use serial or serial1(as described in the github readme). I'm using an adafruit arduino so needed to change to serial1.

To control the ronin M the s-bus channels are

PAN - Channel 1
TILT - Channel 2
ROLL - Channel 4

(there may be other things you can control using the other s-bus channels but I don't know what they are).

The values you need to send are from 0-2047. This is speed data not postional(as far as I can tell). So 0 is fastest in one direction, 2047 fastest in the other. Sending 1023 is stop.

I was using a wii remote using a wiichuck adaptor and the library, but you could use any kind of control, ie potentiometers, rotational encoders etc. The wiichuck was a cheap option as it had a joystick and 2 buttons for £5. I use the trigger button to switch the x-axis of the joystick from pan to roll(if it's held down).

The d-bus connector has 3 pins, looking at the side of the ronin m the 3 pins from top to bottom are

Top - GRND
Middle - 5V
Bottom - Data

You could use the middle 5v to power an arduino(I think, for my tests I had arduino connector to computer via usb for programming/debugging).

The basics to make it work are connect the GRND to the arduino GRND and arduino serial TX(usually pin 1) to the Data pin.

The code I used is this:
// Include the BMC_SBUS library
#include "BMC_SBUS.h"

//Declare BMC_SBUS Object
BMC_SBUS mySBUS;

//Include Wiichuck Library
#include <WiiChuck.h>

//Declare Wiichuck Object
Nunchuck nunchuck;
// Sbus delay value
const int sbusWAIT        = 7;      //frame timing delay in msecs

// Declare sbus control channels
int panChannel = 1;
int tiltChannel = 2;
int rollChannel = 4;

void setup() {

  // Start Wiichuck Object
  nunchuck.begin();
  // Start BMC_SBUS object
  mySBUS.begin();

}
void loop() {
    nunchuck.readData();    // Read inputs from wiichuck

    // Get wiichuck data
    int Yvalue = nunchuck.getJoyY();
    int Xvalue = nunchuck.getJoyX();
    int Zbutton = nunchuck.getButtonZ();

    //Map wiichuck values which go from 0-255 to Sbus values 0-2047
    // For no move send 1023
    int sendValueY = map(Yvalue,0,255,0,2047);
    int sendValueX = map(Xvalue,0,255,0,2047);

    // Set sbus tilt
    mySBUS.Servo(tiltChannel,sendValueY);

    // Check if trigger(button Z) is pressed, if so send the X value to roll channel
    if (Zbutton == 1) {
       mySBUS.Servo(rollChannel,sendValueX);         
    } else {
       mySBUS.Servo(panChannel,sendValueX);
    }
    // Update SBUS object and send data
    mySBUS.Update();
    mySBUS.Send();
    // Delay for SBUS
    delay(sbusWAIT);

}


That's it. You could do a lot more, for instance with more buttons etc have different speeds(by changing the map values).

Hope that helps out anyone else trying to do something similar.

2018-9-22
Use props
katelaidlaw
New

Australia
Offline

Can you point me into the right direction on how I can get the Arduino board connected to the Ronin? Thanks this is very helpful and interesting
2018-9-29
Use props
Sminkly
lvl.1

United Kingdom
Offline

katelaidlaw Posted at 2018-9-29 13:48
Can you point me into the right direction on how I can get the Arduino board connected to the Ronin? Thanks this is very helpful and interesting

Hi,

you just need some wires, either a proper S-Bus type connector or what I used was just female jumper wires connected to the ground pin and the data pin of the D-Bus port of the ronin.(top and bottom pins)

The ground wire connects to the ground of the arduino, the data wire connects to pin 1(or whatever the TX pin is) via some kind of inverter. That's a bit I forgot in my original post, the S-bus data is inverted so need to use something to invert the signal, I used a cheap 74HCT04N chip. This is the basic circuit.

Hope that helps.
2018-10-2
Use props
Volg.in
Second Officer
Flight distance : 8143 ft
United Arab Emirates
Offline

Sminkly Posted at 2018-10-2 08:20
Hi,

you just need some wires, either a proper S-Bus type connector or what I used was just female jumper wires connected to the ground pin and the data pin of the D-Bus port of the ronin.(top and bottom pins)

Is it only for Ronin-M ?  
2018-10-2
Use props
Sminkly
lvl.1

United Kingdom
Offline

Volg.in Posted at 2018-10-2 21:37
Is it only for Ronin-M ?

Hi,

to be honest I don't know. I'd assume that any ronin that has the D-Bus connector should work, as it just uses the same protocol as using an external futaba s-bus receiver. But I've only tried it on a ronin-m.
2018-10-3
Use props
Volg.in
Second Officer
Flight distance : 8143 ft
United Arab Emirates
Offline

If you have time and opportunity, could you shoot a video of Ronin's control process with the WII joystick ? Please !!
2018-10-4
Use props
Sminkly
lvl.1

United Kingdom
Offline

Volg.in Posted at 2018-10-4 00:40
If you have time and opportunity, could you shoot a video of Ronin's control process with the WII joystick ? Please !!

Hi,

here you go. A bit of a mess wiring wise but it's only to test the basic control. The wii remote is a bit loose and floaty another type of controller might be better, plus the ronin isn't properly balanced as I just took of the camera to film this.
2018-10-4
Use props
escore
First Officer
Flight distance : 775568 ft
  • >>>
Finland
Offline

Nicely done!
2018-10-4
Use props
Volg.in
Second Officer
Flight distance : 8143 ft
United Arab Emirates
Offline

Sminkly Posted at 2018-10-4 03:52
Hi,

here you go. A bit of a mess wiring wise but it's only to test the basic control. The wii remote is a bit loose and floaty another type of controller might be better, plus the ronin isn't properly balanced as I just took of the camera to film this.

Wow !!! Great work !! Thanks a lot !
2018-10-6
Use props
cycophyp
lvl.1
Flight distance : 22943 ft
Austria
Offline

Thank you for that post! It was really helpful and exactly what I was looking for for my project
2018-10-12
Use props
Alex Verlaty
lvl.1

Belarus
Offline

Hello.
I 'm developing device for Ronin remote control. I have tested it on the Ronin 1 and now have problem with connection to the Ronin 2 gimbal.
The main problem is that I don't have Ronin 2. About connection asks the operator who is in another city.  He said there are 4 pins connector in Ronin 2 dbus. And I don't know pins assignment (GND, V, Rx, and Tx).
Also I have questions about gimbal control. If I understand right, gimbal position is controled by axles speed.  I transmit the speed value along the axes of the gimbal.
Does anyone know how to transmit the angle of rotation of the axis of gimbal. Control by position is more comfortable for me.
In other gimbals, I control exactly the value of the position of the gimbal.



2018-10-18
Use props
Alex Verlaty
lvl.1

Belarus
Offline

Hello.
I 'm developing device for Ronin remote control. I have tested it on the Ronin 1 and now have problem with connection to the Ronin 2 gimbal.
The main problem is that I don't have Ronin 2. About connection asks the operator who is in another city.  He said there are 4 pins connector in Ronin 2 dbus. And I don't know pins assignment (GND, V, Rx, and Tx).
Also I have questions about gimbal control. If I understand right, gimbal position is controled by axles speed.  I transmit the speed value along the axes of the gimbal.
Does anyone know how to transmit the angle of rotation of the axis of gimbal. Control by position is more comfortable for me.
In other gimbals, I control exactly the value of the position of the gimbal.



2018-10-18
Use props
Sminkly
lvl.1

United Kingdom
Offline

Hi,

to be honest I'm not sure how to work out which pins are which, but if you search for a 4 pin futaba S-bus connector might be able to work out the pins(at a guess, and this is a guess, top -grnd, 2nd 5v, 3rd RX and 4th TX). Could possibly use a multi meter to at least work out the ground and 5v pins.

As for getting motor position maybe with the TX pin you can get some info out of the gimbal regarding position, but my basic knowledge of s-bus(and it is very basic) it sends speed information to the motors, so you would send the motor a speed til it gets to a position read back from the TX pin. Maybe use an arduino PID to make it smooth.

This is all conjecture I don't really know what I'm talking about, I just worked things out by trial and error.
2018-10-19
Use props
djiuser_9PvNDyNBxCgz
New
Italy
Offline

Alex Verlaty Posted at 10-18 23:14
Hello.
I 'm developing device for Ronin remote control. I have tested it on the Ronin 1 and now have problem with connection to the Ronin 2 gimbal.
The main problem is that I don't have Ronin 2. About connection asks the operator who is in another city.  He said there are 4 pins connector in Ronin 2 dbus. And I don't know pins assignment (GND, V, Rx, and Tx).

I think it has the same connector as the Ronin-s. This video might help you

I really like the controller you are making, I might be interested in buying one!
2018-12-9
Use props
Alex Verlaty
lvl.1

Belarus
Offline

Hello.
I made ronin control using my device.
I have one question for control protocol
S.Bus can transmit data of 16 proportional and 2 digital chanels.
But in DJI GimbalAssistant app using only 8 chanels.
CH0 – PAN
CH1 -TILT
CH2 – Left stick Up-down
CH3 – ROLL
CH5 – Function
CH6 – Mode
Does anyone know description for functional all chanel?
2018-12-11
Use props
Alex Verlaty
lvl.1

Belarus
Offline

I am interested in position control and not speed.
I want to set the position (0-360) of axis, but not the speed of movement along the axes
2018-12-11
Use props
WernerD
Captain
Flight distance : 350837 ft
  • >>>
Austria
Offline

Not possible with the Ronin firmware and via RC receiver. Would need an absolute position setting.
Would be better to use bluetooth or similar but that protocol is not opened by DJI either.

https://github.com/wernerdaehn/CC3D-CableCam-Controller
2018-12-11
Use props
Alex Verlaty
lvl.1

Belarus
Offline

Movi gimbal can be controlled by both speed and position and quaternions.
I don't understand why Ronin does not allow to control the position.
2018-12-11
Use props
dazonic.
lvl.4
Flight distance : 8018271 ft
  • >>>
Australia
Offline

Thanks for this. I can confirm the BMC_SBUS Arduino library works with the Ronin-S.
2019-4-15
Use props
Jashin
lvl.1
Flight distance : 27185 ft
Czechia
Offline

I dont understand why this solution is so complicated. I simply connected Frsky XM+ and it started working. I have tried connect it into SBUS-Out of Pixhawk Cube and it started work too.
2019-7-19
Use props
NimiFire
lvl.1

United States
Offline

This is extremely helpful, thanks for sharing that. Can you share also how fast can you move the unit on its axis, essentially the speed of PAN,TILT,ROLL? Were you able to get close to the speeds on the spec? Thank again for sharing, Nimi.
2020-1-15
Use props
CouacProd
Flight distance : 1516568 ft
  • >>>
France
Offline

Jashin Posted at 2019-7-19 22:56
I dont understand why this solution is so complicated. I simply connected Frsky XM+ and it started working. I have tried connect it into SBUS-Out of Pixhawk Cube and it started work too.

Hi Jashin,
Did you manage to control the Ronin's follow focus motor using Frsky XM+ ? If yes, can you please explain me how to do it ?
BTW, what controller do you use ?
Thanks
2020-5-20
Use props
CouacProd
Flight distance : 1516568 ft
  • >>>
France
Offline

dazonic. Posted at 2019-4-15 21:35
Thanks for this. I can confirm the BMC_SBUS Arduino library works with the Ronin-S.

Hi,
Did any of you guys managed to control Ronin's follow focus motor using arduino ?
Thanks !
2020-5-20
Use props
djiuser_zVXBpBwLID1l
New

United Kingdom
Offline

Alex Verlaty Posted at 2018-10-18 23:14
Hello.
I 'm developing device for Ronin remote control. I have tested it on the Ronin 1 and now have problem with connection to the Ronin 2 gimbal.
The main problem is that I don't have Ronin 2. About connection asks the operator who is in another city.  He said there are 4 pins connector in Ronin 2 dbus. And I don't know pins assignment (GND, V, Rx, and Tx).

Hi,

Would you happen to know the name of this connector please. It’s to connect Ronin M controller(receiver) to the Robin M. I thought it’s a JST but don’t know which one. Regards
2020-5-29
Use props
richkeys
United Kingdom
Offline

Hey,

Can anyone tell me how I'd change this code to use with a 2 axis joystick instead of a nunchuck? New to Arduino so any help would be appreciated.

This was my attempt (please don't laugh!)

Thanks,
Rich

// Include the BMC_SBUS library
#include "BMC_SBUS.h"

//Declare BMC_SBUS Object
BMC_SBUS mySBUS;

  // Sbus delay value
  const int sbusWAIT        = 70; // frame timing delay in msecs

  // Declare sbus control channels
  int panChannel = 1;
  int tiltChannel = 2;
  int rollChannel = 4;

void setup() {
  
  // Start BMC_SBUS object
  mySBUS.begin();

}
void loop() {

    // Read Joystick data
    int x = analogRead(A0);
    int y = analogRead(A1);
    int sendValueX = map(x,0,1023,0,2047);
    int sendValueY = map(y,0,1023,0,2047);

    // Set sbus pan and tilt
    mySBUS.Servo(panChannel,sendValueX);
    mySBUS.Servo(tiltChannel,sendValueY);
   
    // Update SBUS object and send data
    mySBUS.Update();
    mySBUS.Send();
    // Delay for SBUS
    delay(sbusWAIT);

}
2020-8-14
Use props
djiuser_9s98Ma2odxp5
lvl.1

United Kingdom
Offline

Alex Verlaty Posted at 2018-12-11 00:50
Hello.
I made ronin control using my device.
I have one question for control protocol

Hi, did you ever find any more info on the 'Function' & 'Mode' commands?
I have an Arduino outputing SBUS commands to a Ronin-S , Pan Tilt & Roll are working fine but I can't make it 'Home' .... any ideas?

Kevin
2020-8-16
Use props
Виталий Нахшунов

Israel
Offline

For the code, please contact my email nvn5000@hotmail.com.
$35


Ronin S_схема.png




Wired diagram_bb.png

2020-8-21
Use props
KevinArea88
lvl.1

United Kingdom
Offline

Виталий Нахшунов Posted at 8-21 21:21
For the code, please contact my email nvn5000@hotmail.com.
$35

Thank you for the offer, but I can easily write the Arduino code, just need to know what values to send to which channels to make it re-centre.
2020-8-27
Use props
Wodie
lvl.1
Mexico
Offline

Hi, any luck with Recenter, Rec Start/Stop buttons and would like to share?
Thank you,
2020-12-17
Use props
Виталий Нахшунов

Israel
Offline

A wireless version of this remote control is available. Only $ 55. Contact me to get the code ..
2020-12-31
Use props
Paul
lvl.1

United Kingdom
Offline

richkeys Posted at 2020-8-14 07:48
Hey,

Can anyone tell me how I'd change this code to use with a 2 axis joystick instead of a nunchuck? New to Arduino so any help would be appreciated.

Hi,
Looking into this exact thing with joystick... did you ever get it working? I’m new to Arduino like you were... any code you can share?

Cheers,
Paul
2021-2-7
Use props
djiuser_vAP23OGljNXj
New

Italy
Offline

Alex Verlaty Posted at 2018-10-18 23:14
Hello.
I 'm developing device for Ronin remote control. I have tested it on the Ronin 1 and now have problem with connection to the Ronin 2 gimbal.
The main problem is that I don't have Ronin 2. About connection asks the operator who is in another city.  He said there are 4 pins connector in Ronin 2 dbus. And I don't know pins assignment (GND, V, Rx, and Tx).

hi, I saw your post from a long time ago, and I wanted to know if you developed the COMPASS controller for Ronin.  I'd be interested.  Thanks so much.
2021-2-8
Use props
djiuser_vAP23OGljNXj
New

Italy
Offline

Виталий Нахшунов Posted at 2020-8-21 21:21
For the code, please contact my email nvn5000@hotmail.com.
$35

hi i saw this post from a long time ago, have you developed a wireless controller for ronin?
2021-2-8
Use props
Nvn Plus
lvl.1

Israel
Offline

djiuser_vAP23OGljNXj Posted at 2-8 05:42
hi i saw this post from a long time ago, have you developed a wireless controller for ronin?

Yes, if you are interested, write to the mail indicated above.
2021-2-15
Use props
Nvn Plus
lvl.1

Israel
Offline

2021-2-15
Use props
Nvn Plus
lvl.1

Israel
Offline

2021-2-23
Use props
Nvn Plus
lvl.1

Israel
Offline

Members of this group have access to diagrams for connecting components to wired remote control on Facebook. Join and stay up to date with all new products.
https://www.facebook.com/groups/1367181840301296
2021-3-1
Use props
Paul
lvl.1

United Kingdom
Offline

Sminkly Posted at 2018-10-2 08:20
Hi,

you just need some wires, either a proper S-Bus type connector or what I used was just female jumper wires connected to the ground pin and the data pin of the D-Bus port of the ronin.(top and bottom pins)

Hi, I tried to do this, I bought a few off those hex inverters. Couldn’t get it working. Do those chips just work out the box?

Paul
2021-3-22
Use props
joshr120
New
New Zealand
Offline

I know this is a pretty old forum but i thought id try anyway.
I have got pan tilt, roll and photo control all working successfully but having some issues trying to use the recenter and user profile channels. Has anyone got this working? From what I have got so far the recenter channel is SBUS channel 7 and the user profile channel is SBUS channel 6, However when i try to control channel 7 it seems to mess up the channel 6 input.
Any help appreciated,
Cheers, Josh.
2021-4-15
Use props
padrien
lvl.1

France
Offline

joshr120 Posted at 4-15 04:00
I know this is a pretty old forum but i thought id try anyway.
I have got pan tilt, roll and photo control all working successfully but having some issues trying to use the recenter and user profile channels. Has anyone got this working? From what I have got so far the recenter channel is SBUS channel 7 and the user profile channel is SBUS channel 6, However when i try to control channel 7 it seems to mess up the channel 6 input.
Any help appreciated,

Hi, I stumbled upon the same problem today, the channel 7 of my ronin s seems to mess up with the channel 6. Did you solved the problem ? (Using FlySky FS-I6S and FS-iA10B receiver connected to the Sbus)
Thanks a lot !
Adrien
2021-8-16
Use props
12Next >
Advanced
You need to log in before you can reply Login | Register now

Credit Rules