Menu

A Drone You Can Program – Introducing PlutoX

Introduction

Within just a few short years quadcopters have evolved from specialized craft for wealthy hobbyists into common items for people of all ages. From photographers to real estate agents, from farmers to scientists and as toys for children (and those who are young at heart) quadcopters are everywhere. With prices ranging as low as 15 dollars (and up to several thousand) pretty well everyone can afford to try out these cool devices.

For electronics experimenters, aviation hobbyists and those who like to tinker most commercial quadcopters are not suitable for hacking. Their propriety circuit boards and sealed plastic enclosures don’t exactly beg to be modified. Which is a shame as all of the innovations in this field have come from people who aren’t afraid to build and experiment.

The PlutoX is a quadcopter with a difference. It is designed specifically for those who not only want to fly a quadcopter but who also have an urge to experiment, build and design. The product is actually not even billed as a “quadcopter”, instead it is an “Aerial Robotics Kit” that you can configure and program to be whatever you want.

It doesn’t even need to be configured as a quadcopter! Using the PlutoX board and the Cygnus IDE (more on both later) you can turn your PlutoX into a rover, a dirigible or even into a hybrid quadcopter that can also run around on a couple of wheels.

The PlutoX is manufactured by Drona Aviation in Mumbai. The good folks at Drona were kind enough to supply me with an advanced release of the PlutoX and I have been very impressed with the product and I think it has enormous potential.

Writing just one article or producing only one video that completely covers the PlutoX would be impossible, so in this article (and the associate video) I will explain what the PlutoX is and I’ll show you how to get started programming the device. In the near future I’ll work on interfacing custom hardware and writing more sophisticated programs.

So let’s get started!

PlutoX Components

The PlutoX Aerial Robotics Kit that I received was an advanced release that was sent to me by Drona Aviation as part of their crowdfunding campaign. So the equipment that was included in my kit may differ slightly from the final production model.

PlutoX Drone

Naturally the drone is the main component in the PlutoX Aerial Robotics Kit. It is constructed on a 90mm frame that is 3D printed.

According to the designers at Drona Aviation it has been drop-tested from a 6-floor height. While I didn’t attempt to verify this I can attest to the drone being very durable, considering the number of crash landings that I subjected it to!

The PlutoX is also fitted with propeller guards, like the propellers themselves these are not 3D printed. The drone body also has tabs on the bottom which are used to mount accessories like the camera and the geared DC motors (the latter can be used to build a “hybrid drone”).

The main component of the PlutoX is the circuit board, which Drona Aviation calls a “PrimusX” board. It has the following features:

All of the components on the board can be accessed programmatically using API’s. I’ll discuss programming the PlutoX in a few moments.

The PrimusX board also has a connector for the LiPo battery, a micro USB connector for charging the battery, a camera connector and a power/charging switch.

The most intriguing feature of the PrimusX board is the 20-pin GPIO connector. This connector allows you to attach additional components to the drone, expanding its capabilities beyond what is included on the PrimusX board.

The GPIO has the following features, note that several of the pins perform multiple functions:

8 Analog Inputs.

11 Timer Channels.

2 UARTS for serial communications.

2 DAC (Digital to Analog Convertor) channels.

I2C Bus connection.

SPI Bus Connection.

The GPIO also supplies power for external components, 3.3 volts at up to 500 mA.

The 20-pin connector used by the GPIO mates with the connector on the bottom of the BasicX Expansion Cards.

BasicX Expansion Cards

The BasicX Expansion Cards are small prototyping boards that allow experimenters to attach additional electronic components to the PrimusX board GPIO.

The PlutoX specifications say that it can handle a payload of 15 grams, which is a little more than half an ounce. While it doesn’t seem like much it is more than enough for a few sensors or indicators.

As I mentioned earlier I received two BasicX Expansion Cards with my PlutoX – a blank one and one with two Time of Flight sensors. The latter board has the two sensors mounted 180 degrees apart, facing sideways when mounted on the drone. The sensors actually have small lasers and receivers to accurately measure distance from about 20 cm to 1.2 meters. They can be used to position the drone, Drona Aviation supplies instructions for an experiment that uses the PlutoX as a fancy “ping pong ball”, I’ll have to give that a try!

I’d have to say that the BasicX expansion boards are what intrigue me the most about the PlutoX. To be able to add my own hardware is a capability that I have been looking for in a quadcopter.

PlutoX Video Camera

The video camera included with my PlutoX kit consists of a small camera module mounted on a circuit board with a microSD card slot and a connector for a cable to attach it to the PrimusX main board.

The camera uses a 1 MP sensor and is capable of 720p video.

The camera module is mounted on its own 3d printed frame, with notches to attach it to the bottom of the PlutoX.

Drona Aviation advertises the camera module as an “image processing camera” as the intention is to use the camera for things like object recognition, color tracking and navigation as opposed to FPV (first person video) or simply taking pictures.

I’ll be evaluating the camera in more depth in a future article and video.

Geared DC Motors

The two geared DC motors included in the kit are intended for another PlutoX experiment. They are mounted on brackets that can attach to the bottom of the PlutoX using the same brackets that the camera is attached to. You can’t have the camera and geared DC motors attached at the same time, it’s one or the other.

The motors come with a set of small wheels. The purpose of the motors is to create a “hybrid” drone, one that can act as both a drone and rover! I’ve always wanted to build a flying robot and this comes pretty close to fulfilling that ambition.

Getting Started with PlutoX

Now that you’ve seen what’s’ included in the PlutoX kit it’s time to put it to use. The first thing to do is to get it mated with its controller.

The PlutoX does not use a dedicated controller device, instead it makes use of a controller app that is available for both Android and IOS.

PlutoX Controller App

I used the PlutoX app for Android so I can’t comment on the IOS version. The app for Android can be downloaded from the Google Play Store. As of the time of writing the app is still in beta so the final app may appear slightly different.

Once the app is installed you’ll need to connect to the PlutoX via WiFi. My PlutoX came with a pre configured WiFi name and password and I used that with my Android tablet to successfully connect to the device.

When you first open the app you’re asked to provide your name and to check off a box to indicate you are a developer. You’ll need to do that to enable Developer Mode, the mode that the controller needs to be in to run the custom programs that you create yourself.

Upon opening the app you are greeted with a splash screen, followed by the main app screen.

Clicking the Connect button establishes a connection to the PlutoX. This is confirmed by a “Pluto Connected” voice.

Once you are connected you can arm the drone using (what else?) the Arm switch.

The app has several features. The most obvious ones are the two “joysticks” that are used to control the flight of the PlutoX. These operate in the same fashion as other quadcopter joysticks.

There are also a number of additional features that you can activate using the Menu button (the app needs to be disarmed to use the menu).

The Drone Settings menu item has a few interesting features.

There are two calibration buttons that you can use to calibrate the accelerometer and magnetometer. Press them and you’ll be given instructions for positioning the PlutoX while the calibration routines run.

Below the calibration buttons are a couple of controls to trim the pitch and roll.

The next item is a motor test. You can activate the PlutoX motors individually or all at once. The drone will remain on the ground while you test the motors.

Scrolling down on the Drone Settings page you’ll find a button labeled Sensor Graphs. This opens up a screen with four graphs that display the outputs from four of the PlutoX internal sensors.

Accelerometer

Gyroscope

Magnetometer

Barometer

As I was testing indoors the Magnetometer and Barometer only showed minor changes when the drone was moved. However I was able to get great readings from both the accelerometer and gyroscope.

Finally you can change the WiFi settings and set the PID (Proportional, Integral and Derivative) ranges.

After playing with the PlutoX for a while you’ll naturally want to start programming it. Let’s look at how you do that now.

Programming the PlutoX

The real fun with PlutoX is to program it to do things that it wasn’t originally designed to do. The PlutoX is programmed using a development environment called the Cygnus IDE. the programming itself is done in C++.

PlutoX Programs are built (compiled) using the IDE and then flashed to the PlutoX using a WiFi connection. You then use the PlutoX controller app to enter Developer Mode to run your program.

There are several API’s available to work with all of the PlutoX onboard hardware.

PlutoX Programming Structure

All PlutoX programs begin by including the PlutoPilot API library, in addition to any additional API libraries your program may need.

The structure of a PlutoX program is in many ways similar to that of the Arduino. There are functions that are called when the PlutoX is turned on, when you start Developer Mode (using the controller app), when you are in Developer mode and when you exit Developer mode.

Let’s look at these functions in a bit more detail now.

plutoInit()

This is the PlutoX startup function. It is called when the PlutoX is turned on. Typically you would add any code you need to initialize your custom hardware here.

onPilotStart()

This is the Developer Mode startup function. It is called when you use the PlutoX controller app to enter Developer Mode. You’ll place the variables you need to initialize for your program here as well as any setup routines.

In many ways onPlutoStart() is similar to the Arduino setup() function.

plutoPilot()

This is the main function in developer mode and most, if not all, of your application code will reside here. Code in the plutoPilot() function will run in a loop until Developer Mode is terminated.

Arduino programmers will find this to be very similar to the Arduino loop() function.

onPlutoFinish()

This is the Developer Mode finish function. It is called when Developer Mode is exited. You would generally put “clean up” code here to restore the PlutoX to its original configuration after running your program.

Developing with Cygnus IDE

The Cygnus IDE (Integrated Development Environment) is the application that you will use to write, compile and deploy PlutoX programs.

You can install the Cygnus IDE on Windows, Linux or on a Mac. The installation procedure is different for the three operating systems.

Microsoft Windows Installation

This is the easiest installation of the three operating systems. Just unzip the Cygnus IDE for Windows file and move it into a folder that you have full permissions to read and write to. No additional software or configuration is required.

Linux Installation

Apple Mac OS X Installation

To install the Cygnus IDE for Mac you’ll first need to install Xcode, which you can grab from the App Store for free. You’ll also need to install the Java 8 JDK if you don’t already have it.

Cygnus IDE Desktop

Regardless of which operating system you are using the Cygnus IDE desktop has a similar interface.

Like many development environments the Cygnus IDE is divided into panes or windows. Each individual pane can be minimized, maximized or hidden from view, allowing you to tailor your development environment to your own personal preferences.

On the left side is the Project Explorer. This is where the files for your project are displayed.

On the right side is the Project Outline. All of the libraries and functions you include in your code will be displayed here. If you need to jump directly to a specific function you can click on it in the Outline and the editor will move directly to the beginning of the function.

On the bottom of the Cygnus IDE you’ll find a tabbed display. It has four tabs, as follows:

Properties – This displays the properties of the item highlighted in the Project Explorer.

Console – This displays messages produced during the Build process.

Problems – This displays error messages.

Pluto Monitor – A text monitor that displays results from the PlutoX while the code is running. This is similar to the serial monitor in the Arduino IDE. You can write to the monitor in your code.

Pluto Graphs – There are three graphs; Red, Green and Blue. As with the Pluto Monitor you can write data to these graphs in your code.

In the center of the IDE is the code editor itself. This is where you will enter your PlutoX code.

The top menu bar has a number of selections. A few key ones are as follows:

File – As with most applications you can create and manage files here. When creating a new project you’ll want to use the sub-menu to choose New PlutoX Project.

Build – Once you have finished writing the program you’ll need to build or compile it. The Build icon on the toolbar is used for this purpose. When you click it a dialog box will appear that displays the build progress and that will alert you to any errors that prevent the build from completing.

Flash – The Flash icon is what you’ll use to send your program to the PlutoX via a WiFi connection. There are two types of Flash – Normal and Full. A Normal flash will send the program to the PlutoX and retain all of the PlutoX existing calibrations. A Full flash will wipe the PlutoX calibrations and reset it to its factory-original condition.

Connect – You’ll use the Connect button to connect to the PlutoX while your program is running in Developer Mode. You need to do that if you are writing to the monitor or graphs in the Cygnus IDE.

Now that you have a feel for the IDE let’s run a simple program to see it in action.

PlutoX Experiments

When you start developing in a new programming environment it is customary to first write a “Hello World” type of program. These programs, while simple, accomplish a great deal.

They show you the syntax and structure of the coding environment or language.

They get you familiar with the editor and other development tools.

You go through the process of compiling and deploying your code.

Once you’ve successfully deployed and run your “Hello World” program you can move on to more exciting things.

For Arduino programmers the “Hello World” program (or sketch) would be the “Blink” sketch.

In the case of the PlutoX Drona Aviation has provided a “Hello World” sketch of sorts, one they call DebugAPIs . It’s a simple program that will get you familiar with deploying code to the PlutoX.

DebugAPIs does the following:

It takes control of the status LEDs on the PlutoX.

It reads the altimeter and determines if the drone is moving up or down.

It turns the status indicator Green if the drone is moving up.

It turns the status indicator Red if the drone is moving downwards.

It writes to the Cygnus IDE Pluto Monitor and prints the velocity as either a positive (drone moving up) number or as a negative (drone moving down) number.

It writes to the Cygnus IDE Pluto Graphs and plots the altitude on the Red graph.

Here is the code for DebugAPIs:

DebugAPIs

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

/* Name: DebugAPIs

Author: DronaAviation */

// Do not remove the include below

#include "PlutoPilot.h"

#include "Led.h"

#include "Control.h"

#include "Althold.h"

#include "Print.h"

//The setup function is called once at Pluto's hardware startup

voidplutoInit()

{

// Add your hardware initialization code here

}

//The function is called once before plutoPilot when you activate Developer Mode

voidonPilotStart()

{

// do your one time stuffs here

Control.disableFlightStatus(true);

}

// The loop function is called in an endless loop

voidplutoPilot()

{

//Add your repeated code here

if(Althold.getVelocityZ()>0){

ledOp(L_LEFT,ON);

ledOp(L_RIGHT,OFF);

}

else{

ledOp(L_LEFT,OFF);

ledOp(L_RIGHT,ON);

}

Print.monitor("Velocity Z:",Althold.getVelocityZ());

Print.monitor("\n");

Print.redGraph(Althold.getEstimatedAltitude());

}

//The function is called once after plutoPilot when you deactivate Developer Mode

voidonPilotFinish()

{

// do your cleanup stuffs here

Control.disableFlightStatus(false);

}

Let’s go over the code to see how it works.

We begin by including the PlutoPilot API library, as noted earlier this library is an essential component of every PlutoX program.

Next we include a number of other API libraries that we will need.

Led.h – As you might imaging this library works with the LEDs on the PlutoX.

Control.h – This library works with the onboard PlutoX controls.

Althold.h – This library works with altimeter functions.

Print.h – This library has functions to write to the Cygnus IDE monitors.

There is no extra hardware to initialize so the plutoInit() function is not used.

In onPlutoStart() we disable the onboard flight status functions. We will be replacing them with our own code. Remember this function is called as soon as the PlutoX is put into Developer Mode.

The plutoPilot() function is the main loop. Here is where we get the Z velocity (up or down velocity) and use it in our code. If the velocity is positive the PlutoX is moving up and we light our status LEDs accordingly (the indicator is set Green). Otherwise the PlutoX is moving down and we illuminate the Red indicator.

Finally we use the Print function to send data back to the Cygnus IDE, the velocity for the monitor and the estimated altitude for the graph.

As plutoPilot is a loop we then do it all over again. This will continue until the PlutoX is taken out of Developer Mode or is powered off.

In the onPilotFinish() function we enable the flight status functions so that the PlutoX is back to normal after we exit Developer mode.

Building and Deploying the Code

After you enter the code into the Cygnus IDE you’ll need to build it so that it is ready to deploy to the PlutoX. Just click the Build icon on the toolbar and the code will start to compile. A dialog box will be displayed to indicate your progress. Assuming that there are no errors in the code you’ll get a message that the code is built successfully.

In order to deploy your code over to the PlutoX you’ll need to connect to the drone via WiFi. Turn on the PlutoX and use the computer running the Cygnus IDE to connect to the PlutoX WiFi.

Once you are connected to the PlutoX click the arrow beside the Flash icon on the toolbar. You will be presented with the choice of a Full Flash or Normal Flash.

While either selection will work it is recommended that you use the Full Flash option first,as that sets the PlutoX back to its factory configuration so you are sure to be working with a “clean slate”. Afterwards, if you make changes to your code, you can use the Normal Flash option.

While the code is flashing observe the status indicators on the hPlutoX, they are extinguished during the flash operation (at least mine were).

After the code is deployed it’s time to test it out!

Running the Code on PlutoX

You’ll need to connect to the PlutoX using your controller app, so do that now.

Once you have established a connection to the drone us eteh button in the lower left corner of the app to place the PlutoX into Developer MOde. The button will glow green after you press it.

The code should now be running on your PlutoX. Pick up the drone (or fly it) and observe the status indicator on the circuit board. You should see it glowing green as the drone is moving up, red while it is moving down.

Your code is working!

Now go back to the Cygnus IDE. Assuming that you are still connected to the PlutoX WiFi click the Link icon on the toolbar, this allows the IDE to act as a monitor for the PlutoX.

Once that is done click on the Pluto Monitor tab in the bottom pane of the Cygnus IDE. You should see the actual Z-axis values printing out. Note that as the drone moves upwards the values are positive while when it is going down they turn negative.

Finally click on the Pluto Monitor tab and observe the Red graph. You should see the drones altitude plotted on the graph. Again move it up and down and observe how it is tracked on the graph.

You have just written and deployed your very first PlutoX program!

Conclusion

I think that the PlutoX Aerial Robotics Kit has a lot of potential for experimenters and hobbyists. It would also make an excellent educational platform for schools and for parents who want to purchase a drone for their children that is more than just a toy.

Obviously this article and video have just scratched the surface of what you can accomplish with the PlutoX. In future articles and videos I’ll show you how to do some more advanced programming, how to use the BasicX Expansion Cards and how to integrate the camera and the geared DC motors. So stay tuned.

Until then I’d urge you to get yourself a PlutoX, I really enjoyed working with mine and I’m sure you will too!