Set up Mega 2560 with RC control with modifed phamtom X

Hi everyone,

I posted the same question here as well:
forums.trossenrobotics.com/showt … -Phantom-X

Here is what I am currently planning to achieve:

  1. Download and modify Phantom X mark 3 to take standard servos ---- the original smart servos are too expensive for my budget.

  2. Configure Phoenix code to run on Arduino Mega 2560 with RC as input control (I have a 10 channel futaba RC radio).

I have a arduino mega 2560 currently on order and modifying / 3D printing the phantom X mark 3 to suit standard servos is easy (I am a mechanical designer and work with solidworks on a daily basis).

I do however have a few questions / difficulties configuring the Phoenix code to do the above and would like a few questions answered, after spending considerable time on github in KurtE’s Arduino_Phoenix_Parts, reading throught the codes. (github.com/KurtE/Arduino_Pho…master/Phoenix)

a: is it possible to use the mega 2560 to run the phoenix code without a dedicated servo controller? That is what “Phoenix_Driver_ServoEx” is for am I right? Would the mega 2560 struggle to take control input from user, compute leg movements and drive servos at the same time?

b: if I my assumption is correct in question a, is there anywhere I can go to find the pin connection diagram (which pin to which servo)?

c: is there anywhere I can find more info on the pin connections between the RC receiver and the mega 2560? I believe it is possible since that is what “Phoenix_Input_RC” is for, am I correct?

d: All the examples I can see on github is for certain hardware combinations (servo controller “X” + input controller “Y” for Phantom X for example), I have a shallow understanding of how this is all configured in the Hex_Cfg.h file----is it possible to have some step by step guidance on how to go about configuring the Phoenix code to do a combination of “mega 2560 as servo controller + RC input control”?

Any suggestions, pointers will be gratefully received----I am new to this hobby and I look forward to learn from you guys and one day contribute to the community with my skills.

Thanks for your time in advance.

Kind regards,

powerover

Hi all,

After some more digging around I found this thread here:
forums.trossenrobotics.com/sh…n-should-I-use!

In there KurtE attached a example zip file containing a setup that uses RC as input.

Within the Hex_Cfg.h file I found the follow code:

// Define the Pins that are used by the RC Receiver const byte caRCPins] PROGMEM = {6, 7, 8, 9, 10, 11}; #define RCPIN_COUNT (sizeof(caRCPins)/sizeof(caRCPins[0]))
This is presumably the define for pins on the arduino mega 2560 am I correct?
looking at this picture here:
electroschematics.com/wp-…560-Pinout.jpg
pin 6-11 are the physical pins located towards the top side of the board am I correct? (all PWM capable pins).

in _phoenix_Input_RC.h, I found the follow code:

// Include the Pin Change code. Can also tell it not to define some Interrupt vectors...
#define NO_PINCHANGE_0 // No Pin changes on 0-7 - Typically Analog pins A0-A5.
// #define NO_PINCHANGE_1 // No Pin changes on 9-15 - On non-mega: D8-13
// #define NO_PINCHANGE_2 // No Pin Changes on 16-23 - non-mega: D0-7
//#include "PCInt.h"

what do they do? with so many pins on the mega 2560 I would assume that you don’t need to “change pins”? I have trouble understanding this portion of the code if someone can jump in and maybe shine some light on this.

The second part of my initial question / problem remains tho:

Is it possible to use the mega 2560 as the servo driver without a dedicated servo controller? If this is not possible them I have misunderstood the code / description, please feel free to let me know so I don’t waste anymore time on it.

I am assuming that I will need to put #include “_Phoenix_Driver_ServoEx.h” in the main config header file? What else do I have to change / config?

I keep clinging on the hope to not use a dedicated servo controller because of my budget limit, and I found this bit of code with comment in the _Phoenix_Driver_SSC32.h, it gave me hope that what I wanted is indeed possible:

//Project Lynxmotion Phoenix
//
// Servo Driver - This version is setup to use the SSC-32 to control
// the servos.
//================================================== ==================


//Servo Pin numbers - May be SSC-32 or actual pins on main controller, depending on configuration.
#ifdef QUADMODE
const byte cCoxaPin] PROGMEM = {
cRRCoxaPin, cRFCoxaPin, cLRCoxaPin, cLFCoxaPin};
const byte cFemurPin] PROGMEM = {
cRRFemurPin, cRFFemurPin, cLRFemurPin, cLFFemurPin};
const byte cTibiaPin] PROGMEM = {
cRRTibiaPin, cRFTibiaPin, cLRTibiaPin, cLFTibiaPin};
#ifdef c4DOF
const byte cTarsPin] PROGMEM = {
cRRTarsPin, cRFTarsPin, cLRTarsPin, cLFTarsPin};
#endif
#else
const byte cCoxaPin] PROGMEM = {
cRRCoxaPin, cRMCoxaPin, cRFCoxaPin, cLRCoxaPin, cLMCoxaPin, cLFCoxaPin};
const byte cFemurPin] PROGMEM = {
cRRFemurPin, cRMFemurPin, cRFFemurPin, cLRFemurPin, cLMFemurPin, cLFFemurPin};
const byte cTibiaPin] PROGMEM = {
cRRTibiaPin, cRMTibiaPin, cRFTibiaPin, cLRTibiaPin, cLMTibiaPin, cLFTibiaPin};
#ifdef c4DOF
const byte cTarsPin] PROGMEM = {
cRRTarsPin, cRMTarsPin, cRFTarsPin, cLRTarsPin, cLMTarsPin, cLFTarsPin};
#endif
#endif

I assume the above code links to the following part of code in Hex_Cfg.h?

// If we are using a SSC-32 then:
// If were are running on an Arduino Mega we will use one of the hardware serial port, default to Serial1 above.
// If on Non mega, if the IO pins are set to 0, we will overload the hardware Serial port 
// Else we will user SoftwareSerial to talk to the SSC-32
#define cSSC_OUT 0 //Output pin for (SSC32 RX) on BotBoard (Yellow)
#define cSSC_IN 0 //Input pin for (SSC32 TX) on BotBoard (Blue)


//================================================== ==================
//[SSC PIN NUMBERS]
#define cRRCoxaPin 0 //Rear Right leg Hip Horizontal
#define cRRFemurPin 1 //Rear Right leg Hip Vertical
#define cRRTibiaPin 2 //Rear Right leg Knee
#define cRRTarsPin 3 // Tar


#define cRMCoxaPin 4 //Middle Right leg Hip Horizontal
#define cRMFemurPin 5 //Middle Right leg Hip Vertical
#define cRMTibiaPin 6 //Middle Right leg Knee
#define cRMTarsPin 7 // Tar


#define cRFCoxaPin 8 //Front Right leg Hip Horizontal
#define cRFFemurPin 9 //Front Right leg Hip Vertical
#define cRFTibiaPin 10 //Front Right leg Knee
#define cRFTarsPin 11 // Tar


#define cLRCoxaPin 16 //Rear Left leg Hip Horizontal
#define cLRFemurPin 17 //Rear Left leg Hip Vertical
#define cLRTibiaPin 18 //Rear Left leg Knee
#define cLRTarsPin 19 // Tar


#define cLMCoxaPin 20 //Middle Left leg Hip Horizontal
#define cLMFemurPin 21 //Middle Left leg Hip Vertical
#define cLMTibiaPin 22 //Middle Left leg Knee
#define cLMTarsPin 23 // Tar


#define cLFCoxaPin 24 //Front Left leg Hip Horizontal
#define cLFFemurPin 25 //Front Left leg Hip Vertical
#define cLFTibiaPin 26 //Front Left leg Knee
#define cLFTarsPin 27 // Tar

Does it mean if I #include “_Phoenix_Driver_ServoEx.h” the the above “SSC pin numbers” then correspond to actual physical pin numbers on the mega 2560?

Can I please have some guidance / pointers?

Thanks for your help in advance.

Kind regards

powerover

The PhantomX uses smart servos, so the code won’t apply to RC servos.
Can you tell us more about your setup?