In this tutorial, I will show you how I build an Arduino based RC Airplane, and also, I will show you how to control it using the custom build Arduino transmitter.
I have previously built many Arduino based Projects,so if you are interested, you can check them out.
So, the airplane is entirely made out of Styrofoam. For making the shapes, I used my Arduino CNC Foam Cutting Machine. Although I’m using a CNC machine for building this Arduino RC airplane, I can still say it’s 100% DIY because the CNC machine is also a DIY build.
Moreover, the control of the airplane is also 100% DIY, based on Arduino and the NRF24L01 module for radio communication.
Using the right joystick of the transmitter, we can control the ailerons and the elevator of the airplane, and using the left joystick, we can control the rudder and the throttle. In addition to that, using the right potentiometer, we can adjust the responsiveness of the controls, or reduce the amount of servo travel, and using the left joystick, we can sub-trim the rudder or adjust the neutral position of the servo arm.
Components Required for Arduino RC AirplaneSo, radio communication is based on the NRF24L01 modules. Although it might look a bit complicated, this DIY Arduino transmitter is actually pretty simple. It has several controllers, joysticks, potentiometers, and some buttons, and it constantly sends their data to the receiver. The receiver accepts this data wirelessly through the NRF24L01 module and it outputs appropriate commands to the servos and the brushless motor for controlling the airplane.
Controlling servos and brushless motors with Arduino is also quite simple, so therefore this entire Arduino RC airplane concept I think is not that hard to be understood. The brushless motor I’m using in this project has a rating of 1000KV and it requires 30A ESC. The ESC drives the motor and also provides power to the Arduino and the servos through its Battery Eliminator Circuit feature which outputs 5V. And the power to the ESC and the brushless motor comes from a 3S Li-Po battery.
I added one more feature to this airplane, and that’s a simple LED that will indicate if the battery is empty. Using a simple voltage divider, we drop the 12V coming from the Li-Po battery to around 5V so we can read them with the Arduino analog input and so know when the battery will drop below 11V. The receiver still has several free channels, so we can add more features to this airplane if we want, like strobe lights, flaps, dropping mechanisms, and so on.
Arduino RC Airplane Electronics – Circuit DiagramSo, as I already said, this RC airplane is entirely based on the Arduino, both the Transmitter and the Receiver are custom builds based on the Arduino Pro Mini board.
I already have detailed tutorials on how to build and how the transmitter and the receiver work, so you can check them out for more details. Here I will explain the circuit diagram and the working principle of this Arduino RC airplane and how everything needs to be connected.
Designing the RC Airplane – 3D ModelI started by designing the airplane using a 3D modeling software, Fusion 360 in this case. I made the design by looking at some commercial RC airplanes and following some basic guidelines or the rule of thumbs for model airplane parameters.
The starting point is the wingspan, and I chose to be 80cm. From there we get the fuselage length, which is generally 75% of the wingspan. As for the airfoil, or the wing cross-section I chose the CLARK Y Airfoil, which a popular choice for RC airplanes.
I downloaded the airfoil shape from airfoiltools.com as.SVG file and then I imported it into Fusion 360. I adjusted the size appropriately so that the wing chord or the length of the wing in stream-wise direction is around 1/5th of the wingspan.
The horizontal and vertical stabilizers are also sized according to those basic guidelines. Here are some of those basic RC model airplane design parameters:
The fuselage of the airplane will be made out of two 10mm sides and a 50mm core which will be hollow to accommodate the electronics.
You can download the 3D model from the links given here. There are two versions of the Airplane. Version 1 is the one shown here in the images, and version two has a bit smaller nose and the motor can be placed more to the front in order to improve airflow.
Generating G-Codes for My DIY CNC Foam Cutter- Now, as my Arduino CNC Foam Cutting Machine work area is limited to 45cm, and the fuselage is 60cm in length, I had to make the fuselage out of two parts.
- So, I cut the fuselage at 34cm from the front point and made a new sketch in which I projected the shape and added a point near it. Next, in the manufacturing tab of Fusion 360, I can generate the G-code for cutting the shapes.
- Here, first I made a new setup where I selected the sketch as a model, selected the point I added earlier as an origin for the setup, and adjusted the X and Y axis appropriately.
- Then I chose the 2D contour operation and selected or generated a new tool, with a diameter of 3mm, because that’s the approximate size of the cuts that the hot wire makes when passing through the Styrofoam. Here we can also set the cutting feed rate which depends on the hot wire itself and the hardness of the Styrofoam. I set it to 150 mm/m.
- Then in the geometry tap, we can select the contour or the shape that needs to be cut. As for the heights I set them all to 1mm as there isn’t any Z-axis movement on my foam cutter machine. Lastly in the Linking tap, I selected the entry position to be the edge located near the origin point.
- With this, the toolpath is generated and we can take a look at it by clicking the Simulation button. The toolpath should be a closed-loop single pass, and if that’s the case, we can finally generate the G-code. For that, we can go to Post Processes, select the GRBL firmware, select the output folder, name the file, and click the post button.
- Then we can save the file, and we can see the G-code in the WordPad editor or something similar.
- So now once we have the G-code file, we can load it into the Universal G-code sender and send the G-code to the CNC machine to make the shape.
- As I said, for the sides I used 1cm thick Styrofoam and for the middle, I used 5cm thick Styrofoam.
- As for the wing, I used 10cm tick Styrofoam which I cut it around 30cm wide because that’s the maximum span my hot wire machine can cut. I placed two wing profiles in a single G-code file and I cut a couple of them.
- In order to get the 80cm wingspan, I will glue 3 pieces of 27cm, and in order to get them straight, I manually cut off the ends of the pieces so that they are perpendicular.
- We can note that the process that I’ve just shown you is probably not the best one or not professional at all, but still, it does the job of getting the G-codes to work with my DIY CNC Foam Cutting Machine. Of course, for more details about this DIY CNC machine you can check my particular tutorial for it, the link is in the description of the video.
You can download the G-code files given below.
Attachments📷G-codes - Airplane shapes.rar
- 📷G-codes - Airplane shapes.rarDownload
So here are all the Styrofoam pieces I cut with a CNC machine. Three pieces for the front, three pieces for the back, and three pieces for the wing. Now I can start assembling them.
I will start with the front part. I’m using a glue gun for gluing the pieces together. The hot glue was melting a little bit the Styrofoam but still, I was able to glue them using this method.
Another good way to glue Styrofoam is with 5-minutes epoxy. Before gluing the other side, I will make the holder for the motor. For that purpose, I’m using a 30mm wide aluminum profile which is pretty lightweight. I cut the profile at around 18cm, marked the holes for mounting the motor, and drilled them using a 3mm drill bit. Then I bent the profile at 90 degrees. I secured the motor to the holder using some M3 bolts.
Using this assembly, I made a hole through the front part of the Styrofoam. Then, using a utility knife, I enlarged to hole to 30mm in diameter, the same as the motor diameter. Next, on the other side of the motor holder, I made 4 holes which will serve for securing the holder in place and also for attaching the landing gear. I marked the location of these holes on the fuselage and using a 4mm drill bit I made holes through the Styrofoam manually. I made another aluminum piece around 7cm long with the same holes, and now I can use it for securing the motor holder.
Using M4 bolts we can easily secure the motor holder in place without damaging the Styrofoam. However, I will do that later, so I removed them and I continued with gluing the other side. Using the same method, I glued the back pieces as well. The next step is the marriage, or connecting the front and the back part of the fuselage. In order to make the connection stronger, I will add simple barbecue sticks in between them.
I would suggest even using some bigger sticks because when the airplane will crash it might easily break here. I added some decent amount of hot glue to the connecting site and squeezed them together. So here it is, the fuselage is ready and I think it looks pretty cool.
Next, using a utility knife I’m cutting two pieces of 10 mm stick Styrofoam which will be the horizontal and the vertical stabilizers. I beveled the edges so they look better and also be a little more aerodynamic. The stabilizers will be directly glued to the backside of the fuselage but before I do that, I will first make their controller surfaces.
For that purpose, I cut around 1/3rd of their length, and that will be their control surface or the elevator for the horizontal stabilizer and the rudder for the vertical stabilizer. In order to be able to hinge the control surfaces on the stabilizers, I needed to bevel their contact surface. Again, I did that using a utility knife, and we actually need quite a sharp one for getting these cuts clean. I continued by making the stabilizers a bit more aerodynamic. For that purpose, I used sandpaper and made their leading edges rounded. I also sanded the trailing edges a little bit.
Now, as the Styrofoam is quite fragile, I’m going to wrap the whole area of the stabilizers and their control surfaces with simple packing tape. This will not only make the parts stronger but also increase the aerodynamic, as the tape is much smoother than the Styrofoam itself.
After wrapping it, I cut the rudder bottom part at 45 degrees, in order to make space for the elevator to be able to move freely.
Now finally, I can make the hinge for it, and I’m doing that using the packing tape again. So, I just connected the two parts together with the tape, and that makes quite a strong hinge.
I repeated this process for the horizontal stabilizer as well. For making the hinge even stronger we can also add tape on the other side. Using the same tape, I wrapped the sides and with that, the two stabilizers are done.
I moved on with gluing the horizontal stabilizer to the fuselage using hot glue. For securing the vertical stabilizer, first I inserted and glued 3 barbecue sticks through the horizontal stabilizer and the fuselage. Then I put some hot glue on them and the contact surface and pushed the stabilizer down firmly.
With this, we are done with the stabilizers and we can move on with making the wing. So, as I already said, the wing will be made out of 3 pieces because of the limited work area of my DIY CNC foam cutting machine. Again, I’m using barbecue sticks for providing additional strengths when gluing the pieces. For attaching them precisely in line, I’m using a straight wooden strip on which I can slide the pieces.
Once done with that, the wing is actually quite fragile as it’s long and tin. Therefore, I will reinforce it by adding a wooden stick to it. I cut the stick to size and marked the wing where I need to make a pocket so I can fit the stick in it. Using the utility knife, I slowly and carefully made the pocket. I added some hot glue to it and secured it in place without disturbing the airfoil shape too much.
Now the wing is much stronger with the wooden stick in place. Although stronger it would still easily break apart if it hits the ground, so therefore I will wrap it all with the packing tape as same as I did with the stabilizers. I started adding the tape from the backside of the trailing edge of the wing, to the front side of the leading edge.
In this way, the incoming air from the front won’t tend to detach the tape. Although this process looks pretty easy, it can be a bit annoying if you don’t have steady hands and enough patient. I think the wing came out just perfect. Now it is much stronger, more aerodynamic and it looks quite good. All right, the next step is making the control surfaces of the wings or the ailerons. I’m going to make them 22cm wide and about 1/4th of the wing chord in length. In order to be able to move freely, I cut off like half a centimeter of it.
And of course, I wrapped all edges exposed with the cutting. Next, I beveled the bottom part of the aileron at 45 degrees, and in the same way as to show earlier, now I can hinge it to the wing. In order to fit on the fuselage and be able to easily attach the wing to the fuselage, I had to make one more recess in the middle of the wing.
Next, it is time to install the servo motors for controlling the ailerons. I’m using the 9g micro servos. I marked the location where they will be placed and using the utility knife, I carefully made an opening in the wing so that the servo can fit it. Meanwhile, I removed the servos mounting brackets so that their shape is simpler. I put some glue on the servo and inserted in the opening.
Using the utility knife, I made a small groove from the servo to the center of the wing so that I can fit the wiring of the servo in it. Finally, I covered everything with a piece of tape. I repeated the same process for the other side as well. I continued with making the control horns. I’m going to make them out of the aluminum profile that I used before for making the motor holder. I draw the shape by hand to approximately match the servo motor horn height and to hang over the hinge point. I cut the shape using a hacksaw.
I will use 2mm steel wire as a control rod so I made an opening in the horn using a 2.5mm drill. I made a small groove in the aileron and glued the horn in place. Then I measured how long the control rod should be and made it out of 2mm steel wire with the help of some pliers. We need to note that when measuring and inserting the control rods, the servo motors need to be in a neutral position.
We can do that by manually placing it in the middle of its motion range, or by connecting it to a servo tester, or do that with an Arduino. I repeated the process for the other side, and with that, the wing is now completely done. Next, I need to install the servos for controlling the rudder and the elevator. I’m using the same 9g micro servos here as well, and the process of installing them is actually pretty much the same as I’ve just explained. First, I marked the location, made the opening using a utility knife, and glue the two motors in place. Here, they are next to each other but with their output shafts on the opposite side.
Again, I made a small groove in the fuselage in order to conduct the wiring of the servo to the electronics compartment. I covered the servos with a piece of tape and made openings for the servo horns. In the same way, shown earlier, I made the control horns and glued them in place using a glue gun. Lastly, I made the appropriate control rod and installed them accordingly.
Ok, next I’m going to install two 8mm wooden rods which will serve for securing the wing to the fuselage. I made the holes manually using a 6mm drill bit. The rods should hang over around 1cm on both sides. I secured them to the fuselage with some hot glue as well and here’s how they actually work.
We use rubber bands for securing the wing to the fuselage. In that way, the wing can be easily removed and in case of crushing the rubber bands will significantly reduce the impact on the wing. At the same time, the assembly is plenty strong.
Next, I’m going to make the landing gear. For that purpose, again, I’m will use the aluminum profile and wheels made out of Styrofoam. I made them using the CNC machine as shown earlier. I made little grooves on the aluminum profile so I can easily bend it. Here’s how the landing gear should actually look like.
For attaching the wheels to the profile, I will use M5 bolts and an aluminum tube with 6mm inner diameter. The tube is secured to the bracket using the M5 bolt and nut, and on the sides, I added M5 washers so the wheel can rotate around the tube freely. With the same method, I made the wheel for the backside of the airplane.
Ok, so now all the components are ready, and before I assemble them let’s take a look at the electronics of this project.
Arduino RC Airplane CodeSo finally, let’s take a look at the Arduino code of this Arduino based RC airplane and wrap this project up. The code is exactly the same as explained in the previous tutorial, for controlling servos and brushless motors using the NRF24L01 transceiver modules.
Here’s the complete code for this Arduino RC airplane project:
/*
Arduino RC Airplane
== Receiver Code =
by Dejan, www.HowToMechatronics.com
Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#include
#include
#include
#include
#define led 9
RF24 radio(3, 2); // nRF24L01 (CE, CSN)
const byte address[6] = "00001";
unsigned long lastReceiveTime = 0;
unsigned long currentTime = 0;
Servo throttle; // create servo object to control the ESC
Servo rudderServo;
Servo elevatorServo;
Servo aileron1Servo;
Servo aileron2Servo;
int throttleValue, rudderValue, elevatorValue, aileron1Value, aileron2Value, travelAdjust;
// Max size of this struct is 32 bytes - NRF24L01 buffer limit
struct Data_Package {
byte j1PotX;
byte j1PotY;
byte j1Button;
byte j2PotX;
byte j2PotY;
byte j2Button;
byte pot1;
byte pot2;
byte tSwitch1;
byte tSwitch2;
byte button1;
byte button2;
byte button3;
byte button4;
};
Data_Package data; //Create a variable with the above structure
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX);
radio.startListening(); // Set the module as receiver
resetData();
throttle.attach(10);
rudderServo.attach(4); // CH1
elevatorServo.attach(5); // CH2
aileron1Servo.attach(6); // CH3
aileron2Servo.attach(7); // CH4
pinMode(led, OUTPUT); // CH6
}
void loop() {
// Check whether we keep receving data, or we have a connection between the two modules
currentTime = millis();
if ( currentTime - lastReceiveTime > 1000 ) { // If current time is more then 1 second since we have recived the last data, that means we have lost connection
resetData(); // If connection is lost, reset the data. It prevents unwanted behavior, for example if a drone jas a throttle up, if we lose connection it can keep flying away if we dont reset the function
}
// Check whether there is data to be received
if (radio.available()) {
radio.read(&data, sizeof(Data_Package)); // Read the whole data and store it into the 'data' structure
lastReceiveTime = millis(); // At this moment we have received the data
}
// Controlling throttle - brushless motor with ESC
throttleValue = constrain(data.j1PotY, 80, 255); // Joysticks stays in middle. So we only need values the upper values from 130 to 255
throttleValue = map(throttleValue, 80, 255, 1000, 2000);
throttle.writeMicroseconds(throttleValue);
// Adjusting the servos responsiveness
travelAdjust = map(data.pot2, 0, 255, 0, 25);
// Elevator control
elevatorValue = map(data.j2PotY, 0, 255, (85 - travelAdjust), (35 + travelAdjust));
elevatorServo.write(elevatorValue);
// Ailerons control
aileron1Value = map(data.j2PotX, 0, 255, (10 + travelAdjust), (80 - travelAdjust));
aileron1Servo.write(aileron1Value);
aileron2Servo.write(aileron1Value);
// Rudder trimming function
if (data.j1PotX > 127) {
rudderValue = data.pot1 + (data.j1PotX - 127);
}
if (data.j1PotX < 127) {
rudderValue = data.pot1 - (127 - data.j1PotX);
}
// Rudder control
rudderValue = map(rudderValue, 0, 255, (10 + travelAdjust), (90 - travelAdjust));
rudderServo.write(rudderValue);
// Monitor the battery voltage
int sensorValue = analogRead(A3);
float voltage = sensorValue * (5.00 / 1023.00) * 3; // Convert the reading values from 5v to suitable 12V I
// If voltage is below 11V turn on the LED
if (voltage < 11) {
digitalWrite(led, HIGH);
}
else {
digitalWrite(led, LOW);
}
}
void resetData() {
// Reset the values when there is no radio connection - Set initial default values
data.j1PotX = 127;
data.j1PotY = 80; // Motors stops // the central point of the joystick is not starting point for the throttle, its at value of 80 instead of 127
data.j2PotX = 127;
data.j2PotY = 127;
data.j1Button = 1;
data.j2Button = 1;
data.pot1 = 1;
data.pot2 = 1;
data.tSwitch1 = 1;
data.tSwitch2 = 1;
data.button1 = 1;
data.button2 = 1;
data.button3 = 1;
data.button4 = 1;
}
Arduino RC Airplane WorkingSo that’s it. I would like to hear your thoughts about this project in the comments section below, especially from you who have experience with building and flying RC airplanes.
I hope you enjoyed this project and learned something new. Feel free to ask any questions in the comments section below and don’t forget to check my Projects Collection.
Comments