SCARAB AVATAR multiwii code.

Post Reply
tryss
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

SCARAB AVATAR multiwii code.

Post by tryss »

Hi all,

Someone could tell me the modification to be done for that configuration ?
How to add a motor to the BI configuration ?
or
How to add two servo to the TRI configuration ?

My board is a méga (AIO PRO V1). thanks by advance.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: SCARAB AVATAR multiwii code.

Post by PatrikE »

In def.h increase motors to 3.

Code: Select all

#elif defined(BI)
  #define NUMBER_MOTOR     2
  #define PRI_SERVO_FROM   5 // use servo from 5 to 6
  #define PRI_SERVO_TO     6


In otput.ino
Add motor[2] = PIDMIX(0, 1, 0); //Extra

Code: Select all

  #ifdef BI
    motor[0] = PIDMIX(+1, 0, 0); //LEFT
    motor[1] = PIDMIX(-1, 0, 0); //RIGHT       
    servo[4]  = constrain(1500 + (YAW_DIRECTION * axisPID[YAW]) + axisPID[PITCH], 1020, 2000); //LEFT
    servo[5]  = constrain(1500 + (YAW_DIRECTION * axisPID[YAW]) - axisPID[PITCH], 1020, 2000); //RIGHT
  #endif

tryss
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Post by tryss »

PatrikE i ´ve finally understand That scarab avatar is using the TRI configuration.
So i define SERVO_6_PINMODE pinMode(7,OUTPUT); // to command m'y second servo
And i add for the high PORTE |= 1<<5; and PORTE &= ~(1<<5); for low

Problem output 7 doesn t work with the servo ???? Why ????,

tryss
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Post by tryss »

Its work Now ! I understand Now That digital pin 7 of the board is PH4 :)
Everything is based on arduino board !!!!! Digital pin 2 is PE4 !!!!!! Yeah im pround !!!!

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: SCARAB AVATAR multiwii code.

Post by PatrikE »

It seems like it's a TRIcopter with 2 yaw servos on the front arms.
Easiest would be to just use a Y-servocable.

Mega and 328 based boards use different pins for servos.
Image

tryss
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Post by tryss »

Yes its easy but you need to found a Y cable :)

you can write it like that too :

#define SERVO_6_PINMODE pinMode(2,OUTPUT);pinMode(7,OUTPUT);
#define SERVO_6_PIN_HIGH PORTE |= 1<<4;PORTH |= 1<<4;
#define SERVO_6_PIN_LOW PORTE &= ~(1<<4);PORTH &= ~(1<<4);

but you need to know the corresponding between Digital pin and Atmega 2560 PORT

digital PIN 1 is PE1
digital PIN 2 is PE4
digital PIN 3 is PE5
digital PIN 4 is PG5
digital PIN 5 is PE3
digital PIN 6 is PH3

and so and.... it's the PinMap2560 that i've found on arduino web page.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: SCARAB AVATAR multiwii code.

Post by PatrikE »

Or do like other people do...

Code: Select all

#elif defined(TRI)
  #define NUMBER_MOTOR     3
  #define PRI_SERVO_FROM   6 // use only servo 6
  #define PRI_SERVO_TO     6

Change to the servos you want to use.

Then the code in the project Fix all the rest...


/Patrik

tryss
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Post by tryss »

Yes right ! But you Still need to change SERVO_7_PINMODE who is affected to pin 5 (already reserved for front right motor).
Even SERVO_8_PINMODE who is pin 3 (rear motor already affected).

tryss
Posts: 91
Joined: Mon Oct 24, 2011 11:01 am

Re: SCARAB AVATAR multiwii code.

Post by tryss »

the video of the first flight : i still need to tune the PID but it's fly well.

http://www.facebook.com/photo.php?v=102 ... 8537054837

koliver
Posts: 1
Joined: Sat Jun 10, 2017 10:20 am

Re: SCARAB AVATAR multiwii code.

Post by koliver »

Mega and 328 based boards use different pins for servos.
Image[/quote]

My question is that:the specified PIN can be configured as the motor and Servo at the same time ?

Thanks.

Post Reply