Hello,

I want to program a drone so it can move a pre-programmed path.

Anyhow, the height / distance from the ground needs to be accurate

( I want to attach a robotic arm but it needs valid data in height for its tasks ).

I have the DJI Phantom 2 system because I like its long flight time.

Is there a way to program it for a specific route for to fly at a a specific height?

I want to give a certain height and want the Phantom 2 to adjust its

height accordingly to the new distance sensor, lets say an ultrasonic sensor.

Basically, i want to turn it into a robot.

How can I achieve this? I know the inbuilt naza is limited in its features.

Suggestions:

1. replace the naza with the ardupilot

2. find a way to communicate between with the inbult flight controller naza

and my arduino

3. take the remote control and interface it to the arduino, so that the arduino

controls the remote control of the Phantom 2 and gets the data from the Ultrasonic sensors onboard the Phantom 2 via a radio link?

4. is it possible to communicate with the arduino and the Phantom 2 over the canbus,

so the arduino lets the phantom 2 know where to fly?

Thank you for your suggestions!

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • H Max,

    I'm working on option 1 myself, but I've not flown my Phantom 2 yet with the APM as I'm waiting for a cable for the external compass. However I've got to the point where I can arm the motors and the all the radio controls seem to work, and the stabilization seems to work, i.e if I run the motors (no blades attached yet) and then move the Phantom, I can hear the motor speeds being adjusted accordingly.

    Option 2.

    I know someone has been working on decoding the CAN bus data that flows around the Phantom, but I'm not sure how far they've got. Take a look at http://www.rcgroups.com/forums/showthread.php?t=1774685&page=1687 and subsequent postings (the problem with the RCGroups forum is that all posts for the Phantom seem to be in the same thread aaarggggh).

    You may be better off PM'ing the guys who are doing the CAN bus stuff.

    But from what I recall, the Arduino may not be fast enough to decode the CAN bus signals, and they were using a teensy instead (which is supposed to be Arduino compatible via an IDE plugin).

    However if you want to control the Naza, I think you'd probably need to intercept the CAN bus data from the GPS and modify the height data, i.e replace the GPS height with the height from your transducers.

    As the Naza is closed source with no documentation, its hard to know whether modifying the GPS data would be enough, as the Naza may over ride the GPS data with data from its barometer and its gyros etc.

    So even if you went to the trouble of decoding the secret / private GPS Can bus protocol that the Phantom uses, there would be no guarantee that it would give you the desired result.

    BTW. You could possibly take the GPS module apart, as my Phantom 2 DJI GPS module seems to consist of a UBlox NEO7 connected to a DJI daughter board.

    If the DJI daughter board is receiving data from the UBlox in RS232 (UART), SPI or I2C, you could probably cut the tracks on the PCB and insert an Arduino between the GPS and the DJI board.

    This would be harder physically to do, as it would involve literally cutting things with a sharp knife, but would probably be easier to program into the Arduino, as the Data format from the UBlox will be published.

    3. Definitely do-able. (probably the easiest to try)

    I have an Arduino Nano Pro between the Receiver and the APM, so you could do the same thing between the receiver and the Naza.

    There is published code to read the Futaba SBUS data, and writing it out again (to the Naza) should be pretty simple.

    However. This route also has problems, because the Naza will be running a control algorithm which will interpret the control inputs and read the other available data and then compute what speeds to run the motors.

    You'd need to develop an algorithm that determines what changes to the input controls your system needs to make, in order to get the Naza to move the phantom etc

    4. I can't see any difference in this requirement and your requirement number 2.

    Please elaborate ;-)

    • Thanks for the quick reply. With Option 2 I would worry less about hardware but getting the software / protocols right.

      Yes, number 3 seems most simple, anyhow somewhat odd that we have to go this way.

      But i meant to describe it this way ( lets call it option 5 now)

      I would built one arduino mini with telemetric sender for the sensor data onboard the P2 and a second arduino into the remote with a seperate receiver to recieve the ultrasonic sensor data and then the software on the arduino can manipulate / regulate the remote control of the P2 in accordance to the ultrasonic distance received. Of course there will be a delay.

      Will be looking for a light weight sender / receiver device, 100 m is enough for me.

      Saw the post in the rcgroups as well, i think its better not to go that route now

      and will wait for your ardupilot solution (option 1) as with that I could get rid of the seperate radio sender / receiver and the receiving arduino.

      I would have gone for a arducopter from 3d robotics but i am not happy with their flight times / payloads.

      do you know any arducopter with 30 minutes and 300 grams payload?

      In the long run I will build my own system or wait with what becomes available, too.

      • Hi Max,

        I'll let you know when I've managed to fly my modified P2.

        Re: Flight times and payloads.

        I'd have thought it was just a question of overall weight vs battery capacity. The P2 has a Big battery which is why it has reasonable flight times, but I doubt I get much more than 15 mins.

        • Hello Max,

          on option 3:

          this seems to be what I want to do, anyhow the post is from 2012, hopefully it wont be too much different: 

          http://forum.arduino.cc/index.php/topic,113398.0.html

          • Hi max if you have a Phantom 2, here is another relevant posting on the arduino site

            http://forum.arduino.cc/index.php/topic,99708.0.html

            Ie you don't need to use the Servo output class, as the P2 uses SBUS.

            You'd need to write some code that outputs SBUS, as I don't know if anyone has written one already.

            Or for even faster response times, you'd probably need to write some soft of clever circular buffer system which you modify the contents off, on the fly.

            I think you'll also need to find some PID control system code to place between your height value from the ultrasonics and the RC control modifying code.
This reply was deleted.

Activity