1. PURPOSE / DESCRIPTION
1.1 Control the motors on quadcopter via DRONA and WiRa (BrainBox) communication
2. TEST SET-UP
2.1 DRONA firmware: https://github.com/Vairdo/DRONA_firmware, version: 96d90b1
2.1.1 Make sure the power source is from battery. Only battery can provide power to the motors
2.2 WiRa applications: https://github.com/Vairdo/BrainBox_Applications, version: 4f10e03
2.3 More details for setting BrainBox, please refer to: http://wiki.vairdo.com/wiki/etp-526-set-up-brainbox/
3.1 DRONA setup
3.1.1 The motors on quadcopter are usually controlled according to the value of pitch, roll, yaw, and throttle. To test the motor control independently, please comment the function FC_Try_Process_Controls() in main loop. Otherwise FC_Try_Process_Controls() will keep updating the motor pwm value by reading pitch, roll, yaw, and throttle.
3.1.2 Set a breakpoint in MC_Set_Motor_PWM()
3.2 WiRa setup
3.2.1 Uncomment the code (new Thread … ) in \drone\src\main\java\com\vairdo\dev\drone\MainService.java
18.104.22.168 It will automatically send a request to DRONA via SPI
22.214.171.124 The parameters in setMotors are mapped from 0~6000. (0~6000 maps to 0%~100% duty cycle)
126.96.36.199.1 The pwm value depends on which type of motors is used. You should check the data sheet of dsPIC33EP512MC806, and determine a proper range for your motor.
188.8.131.52.1.1 Brushless: 1875~3750
184.108.40.206.1.2 Brushed: 0~6000 (shown as the picture below)
3.2.2 Comment launchmain() in \drone\src\main\java\com\vairdo\dev\drone\MainService.java
3.3 Before connecting to motors, it would be better to use debug mode to check if the pwm values are valid.
3.3.1 Connect DRONA with MPLAB ICD3 (More details on setup ETPs)
3.3.2 Check if the pre-set breakpoint is ready
3.3.3 Run DRONA with debug mode, and power on WiRa (the power up time may vary; in general, it takes about 40 seconds to start the drone APP on WiRa)
3.3.4 After drone APP sends the request, the DRONA should be paused on the breakpoint
3.3.5 Check if the values are correctly written in duty cycle register (SDCx; x is from 1 to 4)
3.3.6 In drone APP, the parameters are 0.05, 0.1, 0.15, and 0.2 300, 600, 900, and 1200 in DRONA firmware
3.4 Connect motors to DRONA
3.4.1 To connect brushed motors with two-pin connectors
3.4.2 To connect brushless motors, with three-pin connectors
3.4.3 For quadcopter, the four motors are for FrontLeft, FrontRight, RearLeft, and RearRight
3.5 Remember to apply power with battery. Only battery can give power to motors.
3.6 Download the DRONA firmware and free run it. Then turn on WiRa (the power up time may vary; in general, it takes about 40 seconds to start the drone APP on WiRa)
3.7 The 4 motors will run at the setting from drone APP.