Experimental Arduino RC Plane Build Log

Would you use the hardware and/or software designed as part of this project for your own RC planes?

  • Yes

    Votes: 10 100.0%
  • No

    Votes: 0 0.0%

  • Total voters
    10

Power_Broker

Active member
Hey guys,

I'm using this thread as a sort of build log for my next Arduino airplane. I've been working with UAV avionics as a hobbyist, intern, and university researcher for about 2 years now. This will be the first plane, though, that I will lay out exactly how all the systems come together and are designed in detail.

What I will be covering:
- Models for 3D printed plane and ground station pieces
- Custom software files for both ground and air microcontrollers
- Circuit schematics and PCB layouts
- Equipment required/used
- Pictures/videos/general updates

Note that everything - software, electronics, and frame will all be custom/scratch built.

Please ask questions and provide feedback! Thanks!
 

Power_Broker

Active member
Update #1.)

A couple of weeks ago I started designing PCBs for both my ground station and the flight avionics to make electrical connections more reliable and keep the wiring under control. My last plane had a ton of extra wiring which sucked up space in the airframe in addition to making it harder to visually verify everything was plugged in and plugged in correctly.

I first started designing the flight controller PCB. This PCB is a two layer board (I don't feel like paying an arm and a leg for a 4 layer board 🙃) and consists of the following:
- 1 Teensy 3.5 Microcontroller
- 1 XBee Pro S1 (60mW)
- 1 NEO-6M GPS
- 1 L7805CV 5V Linear Voltage Regulator (for FPV camera)
- 1 BNO055 IMU
- 2 I2C Pullup Resistors
- 1 Pitot Tube Pressure Sensor Input RC low pass filter
- 1 Power Switch

The board also has connections for external battery supply, LidarLite V3 altimeter, FPV camera/radio, ESC, BEC, pitot tube, and a PCA9685 (16 channel, 12 bit servo driver). It also has 4 mounting holes that fit M8 screws. I also plan on 3D printing an enclosure for the flight controller PCB.


I ordered 10 of these PCBs through SEEED Studio and they should come in sometime next week (I hope they work, lol).

I've attached a zip to this post with the schematic, layout, and gerber files - everything needed if you want to fab your own.

schematic.PNG


layout.PNG
 

Attachments

  • Integrated Flight Controller.zip
    153.4 KB · Views: 0

Power_Broker

Active member
Update #2.)

Been sprucing up the 3D model of the plane. I basically took the model of my last plane, elongated it, and added some new features (such as extra wiring holes and more rigid supports for the rear landing gear mount.

Note: The main wings and stabilizers are going to be made of either Ready Foam Board or hot wired foam (haven't made up my mind yet). Also, the main wings will be mounted to the cover pieces via zip ties and hot glue. I'll cover how everything goes together later when I do it myself. That way I can explain it with pictures of my own setup. Lastly, I'm using Maya to model the plane and ground station. I never liked Fusion 360 that much and I've been lucky enough to have a roommate here in college who was an art major and taught me modeling with Maya.


Check out the attachments if you want to print your own!


I will be printing my own pieces starting in about two weeks. I'll give another update soon after!


Model_1.PNG

Model_2.PNG
 

Attachments

  • Flight_Test_Plane_Parts.zip
    422.4 KB · Views: 0

Power_Broker

Active member
Update #3.)

The PCBs came in today! Won't have a chance to test them for another week, but here's what they look like:

IMG_2529.JPG
IMG_2530.JPG
 

Power_Broker

Active member
Update #4.)

This next plane will be my first to have an on board pitot tube and pressure sensor for airspeed data. This will provide useful flight control feedback when implementing autopilots (especially autolanding features).

Earlier this semester, I was able to gain access to a research wind tunnel and test my pitot tube and pressure sensor (MPXV7002DP) at various air speeds. This particular pressure sensor outputs an analog signal that is proportional to the pressure caused by the air flow.

I used a Teensy 3.5 to sample (16 bits of precision at 100Hz - if I remember correctly) the analog voltage of the sensor at different air speeds and send that data to a lab PC running a MATLAB script for data logging. A second MATLAB script was used to analyze all of the data logged and spit out a 'curve of best fit'. This basically gives me a mathematical model to map voltage readings to airspeed.



The resulting curve was:

ADC = 6.5251*S^2 + 9.6444*S + 34090

Where

ADC = Analog to Digital Conversion of the sensor's signal in binary = sensor output voltage * (2^16 - 1)/3.3 <-- This conversion assumes using an ADC with 16 bits of precision and a 3.3V reference.

and

S = Air speed in meters/sec
(units matter!)



BUT, during a flight we need to derive air speed from ADC output. Therefore, we need to rearrange the equation as:

S = (2 / 65,251) * (-24,111 + sqrt(-5560435134679 + 163127500 * ADC))

Where S = Air speed in meters/sec and ADC = Analog to Digital Conversion of the sensor's signal in binary



This mathematical model will be incorporated into the flight controller software later on. Attached is a zip with all of the files and data used to calibrate this sensor.
 

Attachments

  • Pitot_Tube_Calibration.zip
    1 MB · Views: 0

Power_Broker

Active member
Update #5.)

Finally able to start working again on the plane after graduation ceremonies this weekend; finally have a shiny new BS in electrical engineering!!

I've been busy printing the plane's body pieces (starting with the nose and motor mount). All of the pieces except for the motor mount are glued together with CA glue and Zip Kicker spray. The motor mount is fastened with M3 screws and hex nuts. This is so that I can swap out new motors and their respective mounts easily without completely dismantling the frame. Having an easily replaceable motor mount is good for maintenance since the motor mount is the most likely piece to break in the event of a crash.

Here is a pic of the motor mount, nose, and two body sections:
IMG_2581.JPG
Notice how the plane also has a nose wheel (steerable). Also, the landing gear is tricycle styled. You can also see in the above pic a big hole in the side of the fuselage. This is for the "on/off" switch I will be installing later in the build.

Here are some close up pics of the nose landing gear, nose, and motor mount so far:
IMG_2573.JPG
IMG_2574.JPG
IMG_2576.JPG



I have also been putting in a lot of work developing a 3D printed case for the Integrated Controller Board. It comes in 3 pieces:

- A bottom piece with M3 mounting holes for the PCB
- A wall piece that includes flange tabs with M3 hex nut inserts for fastening the cover piece
- A cover piece with M3 mounting holes and a center hole for wiring to run through

The bottom and wall pieces are glued together with CA glue and Zip Kicker. The cover and wall pieces are fastened using M3 screws and hex nuts.

The files for printing this box is attached.

Here are some pics:
IMG_2579.JPG
IMG_2580.JPG


Lastly, I've been making leaps and bounds with the actual PCB and soldering everything together (but not quite finished).

The first thing to keep in mind is that printing the board layout from Eagle will help a lot when plugging things into the board (especially since I made a mistake and the DuPont connector footprints are NOT labeled on the silkscreen - oops).
IMG_2551.JPG
It is also a good idea to have both the schematic and the board layout on a computer for more detailed reference:
IMG_2560.JPG



Also, note that the XBee does not use normally spaced female connectors:
IMG_2550.JPG

I also use several of these JST-XH 3S connectors on the PCB itself:
IMG_2549.JPG
I generally prefer these to DuPont connectors since these actually "lock" in place and can only mate one way - no way to accidentally plug them in wrong.



Here are some close up pics of the smaller pieces I'm using for the PCB:

Full sized female connectors (cut to size):
IMG_2548.JPG

Passive components (caps and resistors):
IMG_2552.JPG

5V Linear Regulator (bent at 90 degrees):
IMG_2553.JPG

Teensy "on/off" switch:
IMG_2554.JPG

Male DuPont connector:
IMG_2555.JPG



Here's how I solder the JST-XH 3S connectors:
IMG_2565.JPG
Note how you always want to solder connectors while mated. This is especially important when the connectors are plastic - if the solder heat deforms one of the pieces, you want to deform the other one in a like fashion so that they still mate even when slightly deformed.



Here's how I soldered the XBee:
IMG_2556.JPG



Here is the finished board (minus the DuPont male connectors):
IMG_2558.JPG



Lastly, I've been testing the PCB one piece at a time. This board has a decent amount of stuff going on, so trying to test everything at once is not only dangerous, but overwhelming - especially when trying to debug.

First, I tested the Teensy by itself on a breadboard and NOT on the PCB. I uploaded a sketch to the Teensy that flashed the LED on pin 13. It worked!

Next, I tested the same Teensy sketch, but on the PCB with power from the BEC. It worked!
IMG_2577.JPG

Next, I tested the ability for the XBee to communicate not only with another XBee, but also with the Teensy. It worked!
IMG_2578.JPG
For this XBee test, I used a second XBee that was connected to my laptop via an "explorer dongle" and controlled through Digi's software: XCTU. As I sent data (ASCII characters) to the Teensy via the XBee network, the Teensy was able to report the same data correctly in the Arduino serial monitor.

The code for both these tests are attached.


I plan on testing the rest of the PCB functionality over the next week.
 

Attachments

  • Controller_Box.zip
    67.3 KB · Views: 0
  • IMG_2557.JPG
    IMG_2557.JPG
    1.6 MB · Views: 0
  • IMG_2559.JPG
    IMG_2559.JPG
    1.1 MB · Views: 0
  • IMG_2561.JPG
    IMG_2561.JPG
    1.3 MB · Views: 0
  • PCB_Testing_Code_1.zip
    510 bytes · Views: 0

Power_Broker

Active member
Update #6.)

Just finished testing the Integrated Flight Controller Board and the other electronics. The main problem I encountered was the I2C communication - I couldn't get it to work initially. Since the servo driver, IMU, and LiDAR sensor all talk via I2C, it is imperative that it works properly. If not, the plane won't get off the ground and, if already in the air, will fall out of the sky. While debugging, I knew I was using I2C port 2 while almost all Arduino libraries assume you are using I2C port 0 (computer engineers always start counting at 0, lol). I figured that inserting "Wire.setSDA(4);" and "Wire.setSCL(3);" somewhere in my sketch would do the trick, but it didn't. After some digging, I found this. I used the fix suggested by Palliser and it worked!! Unfortunately, that meant I had to go into each of the libraries for the sensors that use I2C and add "extern TwoWire Wire2;" under the library includes and change all "Wire.xxx" calls to "Wire2.xxx" in the respective .cpp files.

Testing the LiDAR Lite V3 altimeter:
IMG_2583.JPG

Testing the servo driver:
IMG_2584.JPG

Testing the IMU (Inertial Measurement Unit):
IMG_2585.JPG

Testing the GPS:
IMG_2586.JPG

All testing code is attached - Remember to change the I2C sensor libraries as described above!!


I also needed to add hot glue to both the GPS and IMU. The IMU needed hot glue where the connectors mate so that the IMU's relative angles to the plane's frame of reference does not change in flight:
IMG_2588.JPG
The GPS external antenna needed glue so that it doesn't disconnect mid flight:
IMG_2589.JPG



Here it is all put together (minus FPV power):
IMG_2590.JPG
IMG_2591.JPG
 

Attachments

  • IMG_2587.JPG
    IMG_2587.JPG
    1.5 MB · Views: 0

Power_Broker

Active member
Update #7.)

My new motor and prop came in today! I knew this plane is going to be my heaviest yet, so I upgraded to a motor/prop combo that will pull a 5.5 pound plane (I'm estimating that this plane will weigh in around 5 pounds once finished).
IMG_2597.JPG

Since I changed up the motor, I had to make a new motor mount and replace the old mount (and old motor) with the new one:
IMG_2600.JPG
IMG_2599.JPG
The .obj for the new mount is attached.



Another update is that I glued the nose wheel steering servo mount inside the plane. The mount is 3D printed and CA glued to the inside of the plane directly behind the nose wheel. It has 4 mounting screws for the servo mounting tabs and fits quite nicely. Usually, the servo mounting tabs are placed on the outside of the mount's tabs, but to save space in the avionics bay, I decided to mount the servo with the tabs in reversed order (it's really neither here nor there but I thought I'd mention it):
IMG_2594.JPG



I also finished wiring the solid state relay. This relay is controlled by the 12V signal on the Integrated Flight Controller Board (one of the green screw terminals) and, in turn, controls the power connection from the battery to the ESC. This way, if I use the external power switch to turn off the control electronics, the solid state relay automatically disengages power to the ESC. This is a safety precaution - if anything goes wrong on the ground (i.e. a crash), I can quickly and safely remove power to the motor without putting my hands near the prop.

Here's a pic of the relay. Notice the small (22 AWG) red and black twisted wire is the 12V control signal and the two big (12 AWG) wires make up the power connection between the battery and ESC. I later soldered on XT-60 connectors to the 12 AWG wires (along with a common 12 AWG ground wire).
IMG_2595.JPG



In terms of mounting all the other electronics, the battery, box for the PCB, and the servo driver are all velcroed:
IMG_2598.JPG
The solid state relay and GPS antenna are both hot glued.



Here are some pics of the plane in its current state:
IMG_2603.JPG
IMG_2601.JPG
IMG_2602.JPG
 

Attachments

  • Updated_motor_mount.zip
    41.3 KB · Views: 0

Power_Broker

Active member
Update #8.)

Finished printing the main body, LiDAR altimeter mount, and added the rear landing gear. Be careful when CA gluing the LiDAR mount to the plane - make it as level as possible, or your readings will be off.
IMG_2608.JPG
IMG_2609.JPG



Also finished a PCB layout for the new Ground Station. The gerber files for the board are attached.
GS_Schematic.PNG
GS_Board.PNG
The ground station uses many of the same components as the Integrated Flight Controller Board, so when buying components - you might want to buy two sets of some things (i.e. 2 XBees, 2 Teensys, etc.).



I also did a combined test of all the sensors and electronics (except for the GPS and ESC). The code is attached. If you run this test, remember to use the Arduino serial monitor for debugging and use Digi's XCTU software application for debugging the XBee connection. Here are some pics from the testing. Note that I'm testing the pitot tube without mounting it. You can test that the tube and avionics are working together properly by blowing lightly into the forward port and seeing if the pressure value is increasing in the serial monitor.
IMG_2612.JPG
IMG_2611.JPG



Here are some new overall pics of the plane so far:
IMG_2604.JPG

IMG_2605.JPG
 

Attachments

  • IMG_2610.JPG
    IMG_2610.JPG
    885.8 KB · Views: 0
  • IMG_2606.JPG
    IMG_2606.JPG
    1.1 MB · Views: 0
  • GS_Gerber_Files.zip
    324.4 KB · Views: 0
  • Combined_Test.zip
    1 KB · Views: 0

Power_Broker

Active member
Update #9.)

It's been a while since my last update, but things have been a little slower than usual for the plane.

I have, though, started to build a hot wire cutter to make the wings. If you have any suggestions as to what foam to use or what to treat the wings (for stiffening purposes), I would greatly appreciate it!!!

My hot wire cutting setup is comprised of three 2x4s bolted together with nichrome wire as the heating element. For a power supply, I'm using a soldering iron rheostat (including an internal isolation transformer) and an extension cord. The extension cord is stripped at one end and two alligator clips with high current ratings are attached (one on each of the two wires of the extension cord). The extension cord is plugged into the soldering iron rheostat and each of the two alligator clips are clamped to the ends of the nichrome wire (at the bolts). Here are some pictures for better reference. Note: it isn't quite finished, yet.

Nichrome Wire:
IMG_2620.JPG

Extension Cord:
IMG_2619.JPG

Extension Cord Stripped:
IMG_2622.JPG
This end goes in the alligator clip.

Cord With Alligator Clip Installed:
IMG_2617.JPG


Soldering Iron Rheostat:
IMG_2621.JPG

Example 2x4 Layout (the wings in the pic are my old plane's wings; I plan on making the new plane's wings with the same dimensions):
IMG_2623.JPG



I also found my old 3D printed chocks (source: link):
IMG_2627.JPG

I put two lines of hot glue on the bottom of the chocks to give them more grip:
IMG_2628.JPG



I also used some wooden dowels from Michael's to make the empennage (minus the stabilizers):
IMG_2650.JPG




As a pseudo-random note; I'm going to have a micro USB cord permanently fixed to the plane and plugged into the Teensy. That way I can easily update the software or debug without having to take the plane apart.
IMG_2630.JPG

When doing this, make sure either the rest of the plane is off, or the external power switch on the plane's PCB is in the off position. That way you are not powering the Teensy with both USB and battery power (could damage the Teensy). If you don't want to deal with worrying about turning the external power on and off, you can cut the USB power trace on the backside of the Teensy. Doing this will require you to turn on the plane every time you want to access the Teensy with your computer over USB since the USB port isn't able to power the device by itself anymore. More info here. I plan on using a Teensy with a cut USB power trace.



Lastly, I tried calibrating the ESC and promptly burned two Teensy's. At first I thought something was wrong with the solid state relay, but after burning the second Teensy, I realized I had the ESC plugged in backwards! I'll be getting my 2nd replacement later today - I hope I don't burn this one out, lol.
 
Last edited: