Introduction: Cessna 172

Introduction
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com). It is an airplane modeled after the Cessna 172. All of the body was designed in Solid Works and printed on a 3D printer. No, it doesn't fly. The propeller spins and all of the control surfaces move via a remote control.

Step 1: Materials Needed

Materials for Model
Razor blade
Super glue
Wire cutters
Sand paper
Dremmel with sanding and cutting tools
Small screw driver
Needle nose pliers
Scissors


Electrical Compoments
Arduino Uno
Breadboard
Dc motor- 6V
Diode (1N4004)
Resistor (330 Ohm)
Transistor (NPN-2N2222)
Capacitor- 470uF
4 servos- Tower Pro SG90 9g
IR receiver
IR Remote-( I used an old Sony Stereo Remote)
Resistor– 10k
9V connector
External Battery Pack- 4 AA battery
4 AA batteries
1 9V battery
USB cord
Various wires
Jumper wires
Filament wire-

Step 2: Print 3D Parts

These are all the parts that need to be printed.

1. Print them. This will take about 20 hours.

2. Remove support material.

A. Use needle nose pliers to pull off as much as possible.

B. Next, use a sanding tool on a dremmel to get off the rest.

C. Finally, use fine grain sand paper (300 grit) to smooth the surfaces.

Step 3: Solid Works Parts and Assembly

    Assemble the Body of the Aircraft
  1. Super glue together the fuselage front and back.
  2. Glue the tail and horizontal stabilizers to the back of fuselage.
  3. Glue wheels to the tires. And wheels to the wheel struts.
  4. Attach the other end of wheel strut to fuselage. (These are the rear attachments. The front ones attach the wing struts.)
  5. Attach the front wheel strut to bottom front of fuselage. (There is a hole.)Run the wheel pin through the front wheel strut and the front wheel. (It has indentions on both sides.)
  6. Glue the prop blades to the prop hub. There are flat surfaces where the blades can be glued.
  7. Attach wings to fuselage.
  8. Attach wing struts to wings on one end and fuselage on other.
  9. Put small end of prop hub through hole in front of fuselage. Put dc motor in slot inside of nose. Attach post from motor in hole in end of prop hub.
  10. Run filament wires for control surfaces.
    1. In each wing, run 2 wires from hole in wing for aileron to hole in end of wing.
    2. Run 2 wires through hole for flaps to hole in end of wing.
    3. Run 2 wires from hole in vertical stabilizer through hole in tail.
    4. Run 2 wires from each horizontal stabilizer through hole in tail.
  11. Glue wires to control surfaces. Attach one to the top and one to bottom of each control surface.
    1. Flaps.
    2. Ailerons.
    3. Elevators.
    4. Rudder.
  12. Insert control surfaces into slots provided for them.
  13. Glue 2 servos to inside of fuselage just in front of wing. One on each side.
  14. Glue 2 servos to inside of fuselage near back wall.
  15. Tie strings from bottom of elevators to one side of horn on one servo near back.
    1. Tie strings from top of elevators to other side of horn on servo.
    2. Do the same for the flaps, ailerons, and rudder.

Step 4: Electronic Component Setup

  1. Electronic Components Setup
    Connect the Arduino and the IR receiver to one side of the breadboard and the dc motor and the 4 servos to the other side because the servos and the motor draw to much current for the Arduino to power them. These are going to be connected to an external power source (the 4 AA battery pack). Anything more than one servo needs an external power source. The 4 AA batteries works well because it provides 6V which is sufficient to power the
    components.
    If you want to make or edit the Fritzing diagram of the circuit you will need to download this free software:
    http://fritzing.org/


1. Connect the Arduino to the breadboard.

A. Connect the 5V on the Arduino to the power rail on the right side to the breadboard (the side with a-e)
B. Connect one of the grounds to the + side of the breadboard (again on the right side.)

2. Set up IR receiver
A. Put the IR receiver on the right side of the breadboard with the rounded part facing you. (I used E27,28,29)
B. Connect the right leg to the power side of power rail (use the jumper wires to makes this neater.)
C. Connect the center leg to ground (jumper wire.)
D. Connect the 10k Ohm resistor to the left leg on one end and the power rail onthe other end.
E. Connect the left leg also to pin #4 on the Arduino.
3. Set up dc motor
A. Install the transistor to pins 24,25,26 on the left side of the beardboard with the rounded part facing you. (row f).
B. Install the diode so the side the white strip is in G29. And the other side is in G26 (with the left leg of transistor).
Polarity does matter.
C. Connect the resistor so that it plus into pins G25 and G21. (Polarity does not matter.)
D. Connect the 470uF capacitor to I29 (the longer leg is the positive one.) And the shorter leg (-) to I26.
E. Now connect J29 to the power rail. And J24 to ground.
F. Finally connect J21 to pin #3 on the Arduino
4. Install Servos on the left side of breadboard with dc motor.
A. Connect the brown wire from the servo to G3. I3 connects to ground rail.
B. Connect the red wire to G4. I4 connects to power rail.
C. Connect the yellow wire to G5. I6 connects to pin # 12 on Arduino.
D. Repeat this process for the other 3 servos in a different spot on the breadboard.
5. Connect External Power Source
A. On one end connect the red wire from the power supply to the power rail on the left side of the breadboard.
B. Connect the black wire to the ground rail.
6. Connect a 9V battery to the connect and plug that in to the plug on the Arduino. (to upload the software you will need to plug the USB cord into the Arduino and this will also power it. To make it a self contained unit for the final product the 9V battery makes in possible to have to external cord running out of the black box.)
7. Last connect the ground rail on the left side of the breadboard to the ground on the Arduino. (All parts have to have a common ground. This connects both sides of the breadboard.

Step 5: Sketches

Provided are the sketches necessary to run the electrical components. Download the free software to run the sketches. http://arduino.cc/

How it Works:

Airplane.ino is the main program to run the components. The main code calls two libraries to run the electrical components. The main code defines several variables: IR Receiver, decode_results, Receiver pin, 4 servos and the positions for the servos and the dc motor pin. The servos are attached to Arduino pins 9 through 12. The dcc motor is attached to pin 3 and the IR receiver is attached to pin 4. The My_Servo object from the Servo library is called to control the servos. It takes the inputs from the main code and turns it into movements in the servos. The IR Receiver library is called from the main code also. First, it takes the signal sent from the remote and converts it to a code that can be used by the rest of the program. These can be displayed on the serial monitor. Next, the main code uses the numeric codes from the remote and sends a signal to the servo telling it where to rotate. For each servo, it can rotate clockwise, counter clockwise, or center (which goes back to the initial position.) Finally, the last options from the remote are to turn the power on or off to the motor pin. This makes the post on the motor and therefore the propeller spin. When the servos rotate, they pull on one of the sets of wires attached to them and move the control surface.

To make it work:

1. Save the main code- Airplane code- into a file on your computer.

2. Save the other files in the Library file of the Arduino folder.

3. Upload the Airplane file to your Arduino.

4. Open the serial monitor.

5. Point your remote at the IR Receiver and push a button that you want to use for the first servo.

6. Record the code. Replace the number in my program with this number.

7. Do this for all of the other buttons that you need to use.

8. Save and Upload the code to the Arduino again.

9. Push a button on the remote to control the servos or the dc motor.