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

PsyBorg

Wake up! Time to fly!
Isn't it amazing the power of those little + and - signs have over us in this hobby. You would think after all these years the electrons would be happy to go flying and behave themselves and work in harmony. Sorry you let the magic smoke out of your gear but at least you know why and have resolved the issue so you can move forward. Keep up the good work mate this is pretty interesting to a lot of people I am sure.
 

Power_Broker

Active member
Isn't it amazing the power of those little + and - signs have over us in this hobby.

Yup, I've accidentally fried my share of batteries and chips for just that reason. One time I accidentally plugged a 3S LiPo into the wrong side of a buck converter and fried the battery so bad that the insulation on the wires melted and the connector on the buck converter almost de-soldered itself, lol.

Although it's my responsibility as the user/builder to make sure everything is plugged in correctly (I usually double and triple check connections), I still say that "the powers at be" who made DuPont connectors for servos, ESCs, and BECs as the standard connector type for this hobby made a terrible, terrible choice. It's a poorly designed connector that can be so easily mated the wrong way. That's one of the several reasons I try using the JST-XH connectors whenever I can: 1) no way to reverse mate 2) the plug locks with the receptacle 3) much more durable.
 
Last edited:

PsyBorg

Wake up! Time to fly!
Kinda why I solder EVERYTHING. One wire at a time making sure of polarities too many times to count before powering something on. I even am redundant enough to check continuity on individual wires on a common plane like on pdb's even though I know if one pair is shorted they all are.

Here is an example how true that is hehe.

 

Power_Broker

Active member
Update #10.)

Finally got the ESC and motor playing nice together.

During testing I discovered the motor does work with the solid state relay, but only at low power settings. If I crank the throttle to the max, the motor jitters and fails to produce the large amounts of power expected. Because of this, I'm purchasing a mechanical switch (found here). Since I don't have a cutout specifically for this new switch in the fuselage, I'll end up mounting it in the nose opening where the ESC and motor connect. That way I can still quickly disengage power to the motor without taking apart the plane. The only problem is that I'll still need to put my hands close to the prop :confused:.

When testing, I wanted to make sure if I burned any electronics, it would be cheaper then burning a third Teensy, so I used an Arduino Nano instead. Note that when doing static ESC calibration, remove the prop first! Here are some pics of the setup (code is attached):
IMG_2653.JPG

IMG_2654.JPG
 

Attachments

  • Test_8_ESC_withArduinoNano.zip
    450 bytes · Views: 0

Power_Broker

Active member
Update #12.)

I decided to change the hot wire cutting setup to something much safer. Instead of using a soldering iron rheostat, I recently bought a bench DC power supply (0-30V and 0-10A). Here is a link to the one I bought and here is a pic:
61TfenSNMqL._SL1000_.jpg

This setup is ideal because it not only outputs DC voltage, but it also allows me to easily regulate the wire temp via the voltage and current knobs. More to come later.

I also wanted to take this opportunity to talk a little bit about how I'm doing the altimeter. As seen in previous posts, I'm using a LiDAR Lite V3 distance sensor. It's max range is 40 meters (even in broad daylight!) and has an accuracy of about 5cm. In an earlier airplane prototype, I had this LiDAR sensor mounted on a servo gimbal that worked in tandem with the on board IMU. As the plane rolled and pitched, the servo gimbal accounted for these angles, thus keeping the LiDAR sensor looking straight at the ground. This was an easy way to provide extremely accurate altitude data - even in turns, climbs, and dives. For simplicity, the current plane has a fixed LiDAR mount in the back of the plane's fuselage by the tail boom mounts.
IMG_2670.JPG

This means, though, that any roll and pitch of the plane will greatly throw off the altitude readings (basic geometry). Assuming that the plane is flying over completely flat ground, I can easily and accurately estimate the plane's true altitude by taking the LiDAR reading and multiply it by the sine of the roll angle and by the sine of the pitch angle:

True Altitude = Raw LiDAR Measurement * sin(Roll Angle) * sin(Pitch Angle)


The Roll Angle and Pitch Angle are both found directly from the IMU.
 

Power_Broker

Active member
Thanks Grifflyer!


Update #13.)

I finally decided to finish the frame and airfoils (minus the main wing). First, I made the stabilizers out of foam board and attached them to the plane. The horizontal stabilizer's dimensions are 24in wide by 8in long with a 3in long elevator. Here is a pic for reference:

IMG_2673.JPG


After cutting out the general outline, I scored the line that separates the elevator from the stabilizer. Once scored, I cut 45 degrees into the inside corner of the control surface to get the elevator to rotate in both directions. Here is a pic that better explains the process:

IMG_2674.JPG


Next, I laid the elevator and stabilizer combo on the table in such a way that the elevator was on the table surface and the stabilizer hung off the side. Then, after placing something heavy on the elevator, I taped the connection between the control surface and stabilizer (on the side that was scored and cut at 45 degrees) with clear packaging tape. Here is a pic for reference:

IMG_2675.JPG


Next, I measured the center of the stabilizer long-wise (12in) and drew a line straight down the middle. This helped me align the stabilizer to the plane and make sure everything is mounted straight. Here is reference pic:

IMG_2676.JPG


Next, I used more packaging tape on the stabilizer's leading edge for durability and protection:

IMG_2678.JPG


I then mounted the horizontal stabilizer and elevator combo by inserting the leading edge into the 3D printed "forks" at the end of the plane. In order to ensure that the stabilizer was mounted straight and centered, I took a large spool of 22 gauge wire, wrapped it around the center of one of the body cross supports, and zip tied it. I then used the excess wire as a measuring device: while pulling the wire tight to the plane's rear, lining the wire up with the center of the nose, and looking directly down the wire, I compared the location and angle of the excess wire with the line drawn at the 12in mark made earlier. I adjusted the stabilizer until it was mounted straight and centered. Once in the correct spot, I hot glued the assembly together. Here are a few pics:

IMG_2681.JPG


IMG_2682.JPG


I also did a double check on how straight the stabilizer was. I took the excess wire to the right corner of the leading edge and gripped the wire at that point. Without moving my grip on the wire, I brought the excess wire to the left corner of the leading edge and verified that the grip point fell exactly at the left corner. It's mounted straight! Here are some pics:

IMG_2683.JPG


IMG_2684.JPG


Next, I started to make the vertical stabilizer and rudder. The dimensions for this isn't quite as straight forward. The stabilizer's dimensions are 12in high by 9in long. The rudder is 3.5in wide, but has a diagonal cut near the bottom. Later in the build I realized this diagonal cut needs to be extended. Here is a pic for reference:

IMG_2679.JPG


The stabilizer and rudder outlines were cutout, scored, and taped in the same manner as the previous stabilizer/control surface combo. Here's another pic:

IMG_2680.JPG


I then mounted some L-brackets to the stabilizer for more reliable mounting to the horizontal stabilizer. The 3D print files for this bracket can be found here. I first hot glued one L-bracket to at the leading edge and (on the same side of the stabilizer) one near the trailing edge with about 4 3/4in distance between them. I then used a small screw driver to make holes in the foam where the L-bracket mounting holes are (2 each). I then used long M3 screws to mount the second set of L-brackets to the other side of the stabilizer and hot glued them in place. I then finished the diagonal cut for the elevator (as mentioned earlier). Here are the pics:

IMG_2685.JPG


IMG_2686.JPG


IMG_2687.JPG


I then used the center line on the horizontal stabilizer to mount the vertical stabilizer straight. The vertical stabilizer was hot glued in place. Here's some pics:

IMG_2688.JPG


IMG_2689.JPG


IMG_2690.JPG


IMG_2691.JPG


I then mounted the elevator and rudder servos. The placement of the servos is more or less arbitrary (within reason). The pictures speak for themselves and should be relatively easy to replicate. A few notes: the elevator servo needs a small 3D printed piece and two large zip ties on the bottom side of the horizontal stabilizer. This keeps the paper from separating from the foam where the servo is hot glued in place when put in high load conditions. I had this problem with my previous prototype. Here are some pics:

IMG_2697.JPG


IMG_2698.JPG


IMG_2699.JPG


IMG_2700.JPG


Here are some pics that show where exactly I mounted the elevator and rudder servos:

IMG_2695.JPG


IMG_2701.JPG


Also note that the control horns are inserted into the foam from the opposite side the controlling servo is on. This is so that I can apply hot glue on both sides of the control horn, making it more difficult to rip the horn from the control surface when under heavy load. Here are even more pics (lol):

IMG_2692.JPG


IMG_2693.JPG


IMG_2694.JPG



Once the servos where mounted, I zip tied the servo wires to the tail booms and finished zip tying other wires inside the fuselage. I made sure I zip tied just before and just after each servo extender connection. I also made sure that the white wires for both servos to be on the plane's left. This helped me make sure that I didn't plug in anything backwards.

Side note: I also added a micro USB cable (a long one) that plugs into the Teensy and is zip tied to one of the wire access ports in the rear of the plane (next to the LiDAR sensor). The part of the cable that plugs into my laptop is stored loose in the fuselage by literally stuffing the excess into the wire access port where it's zip tied. If the cable is needed when the cover is screwed on (i.e. updating flight firmware just before a flight), I just need to pull out the cable's excess and plug it into my computer!

Here are the pics:

IMG_2702.JPG


IMG_2703.JPG


IMG_2704.JPG


Lastly, I finished the fuselage cover. First, I took each cover piece and individually screwed them onto the plane. I then CA glued large popsicle sticks to the top and sides of the cover assembly pieces; making them into one solid cover piece. Here are the pics:

IMG_2708.JPG


IMG_2710.JPG


IMG_2709.JPG


IMG_2711.JPG


IMG_2712.JPG




I know that was a lot of info and can easily be confusing. Please ask if you have any questions!
 

Attachments

  • IMG_2696.JPG
    IMG_2696.JPG
    1.1 MB · Views: 0
  • IMG_2705.JPG
    IMG_2705.JPG
    922.3 KB · Views: 0
  • IMG_2706.JPG
    IMG_2706.JPG
    1.2 MB · Views: 0
  • IMG_2707.JPG
    IMG_2707.JPG
    962.1 KB · Views: 0

Power_Broker

Active member
Update #14.)

Today I worked out a couple of kinks software-wise in order to get the rudder, elevator, and nose-wheel servos to operate correctly. Even got to do a taxi test, but wasn't able to get a video of it.

This is a good opportunity to talk a little bit about how the pieces of software work together to control the servos. First, I'll discuss the ground station code, the radio communication protocol, and then the flight computer code.

Ground Station:
The ground station has two, double axis joysticks. Each axis has a potentiometer and outputs an analog voltage that is proportional to the position of the joystick. This means that the ground station has a total of 4 analog signals to sample in order to control the plane. Each of the 4 signals are sampled by the Teensy microcontroller using the analog input pins (on the Teensy board). For this project, I'm using the analog input pins 0, 1, 2, and 3. The Teensy's ADC (analog to digital converter) takes the sampled analog voltage and converts it to a 16 bit number that can be stored and used later in the software. Note that you must use "analogReadResolution(16);" in the code to get the full 16 bit range. This is because the Teensy's ADC is setup to return 10 bit values by default.

Once the signals are sampled, the Teensy converts the joystick outputs to their respective servo positions. This is done using the map() function. The 16 bit numbers for each servo position are then broken down into two bytes (each) since 16bits = 2bytes. I used bit-wise manipulation to do this:

MostSignificantByte = (ServoSignal >> 8) & 0xFF;
LeastSignificantByte = ServoSignal & 0xFF;


The MSB (most significant byte) is the first 8 bits in the original 16bit number ServoSignal.
The LSB (least significant byte) is the last 8 bits in the original 16bit number ServoSignal.

After determining all of the servo positions, the data is then sent to the ground station's XBee radio as a packet of serial data (in bytes). The format of the packet is extremely important and must be consistent for both the ground station and the flight computer - or else the data will not be transferred correctly.

Radio Communication Protocol:
The protocol I designed and implemented is simple and emphasizes speed. A single packet has 17 bytes in total and does not use delimiters. Here is a breakdown of each byte (in order):

Byte Number - Byte Value
0 - Start of packet byte (decimal 200) <-- this byte is constant and NEVER changes value
1 - Throttle message identifier (decimal 4) <-- this byte is constant and NEVER changes value
2 - Throttle value MSB (most significant byte)
3 - Throttle value LSB (least significant byte)
4 - Elevator message identifier (decimal 1) <-- this byte is constant and NEVER changes value
5 - Elevator value MSB
6 - Elevator value LSB
7 - Aileron message identifier (decimal 2) <-- this byte is constant and NEVER changes value
8 - Aileron value MSB
9 - Aileron value LSB
10 - Rudder message identifier (decimal 3) <-- this byte is constant and NEVER changes value
11 - Rudder value MSB
12 - Rudder value LSB
13 - Nose-wheel message identifier (decimal 5) <-- this byte is constant and NEVER changes value
14 - Nose-wheel value MSB
15 - Nose-wheel value LSB
16 - End of packet byte (decimal 100) <-- this byte is constant and NEVER changes value

Flight Computer:
The flight computer waits until at least 17 bytes are in the UART (Universal Asynchronous Receive and Transmit) input buffer. Once at least 17 bytes are detected, it searches for the "start of packet byte", or decimal 200. Any bytes read that do not match this value are trashed into oblivion. When the "start of packet byte" is found, it reads the rest of the bytes three at a time until the "end of packet byte" is found. Each group of 3 data bytes are processed separately and are assumed to include the message identifier, data MSB, and data LSB (in that order). These groups of bytes are then used to determine which servos need to be put at what positions. The flight controller then physically updates the servos by passing the new servo positions to the servo driver via I2C.

In the future, since any of the data bytes could hold the value of decimal 100, I will likely get rid of using an "end of packet" byte entirely to keep from prematurely dropping part of a valid radio packet.
 

Power_Broker

Active member
Update #15.)

I finished hot wire cutting the main wings today!

I ended going with a sheet of polyiso foam sheathing EPS from Lowes. The sheet was 4" by 8" by 2". Here's some pics:

IMG_2719.JPG
IMG_2718.JPG
I took off the adhesive covering that was on both sides before hot wire cutting.

In order to do the wire guides, I bought some thin aluminum sheet metal.

IMG_2729.JPG

Before cutting the wire guides, I first sketched the desired wing profile on foam board, cutting it out, and tracing the outline on the sheet metal. I then used snippers to cut out the outline and repeated the process for the other wing profile piece. The two holes are for the spar inserts. I also added cuts from the spar inserts to the top of the wing in order to get the hot wire in position to cut out the spar inserts. Lastly, I added screw mounting holes to attach the wire guides to the ends of the foam.

IMG_2730.JPG

IMG_2751.JPG


For the actual wire cutter, I used the DC power supply I posted about earlier. At 31V, the wire cutter pulls a little over 4A and was able to cut the foam like butter. The physical mounting of the wire changed since last post. I used two electric fence isolators and strung the wire between them. I also zip tied the wires to the cutting frame to make it easier to handle. Here are the pics:

IMG_2741.JPG

IMG_2742.JPG

IMG_2744.JPG

IMG_2753.JPG


In order to get the huge sheet of foam down to size before doing the profile cutout, I had to cut some straight wire guides from the excess sheet metal.

IMG_2748.JPG

IMG_2750.JPG


Here are some pics of the profile wire guides attached to the foam and the end product:

IMG_2752.JPG

IMG_2756.JPG

IMG_2757.JPG

IMG_2755.JPG


Here is a pic of the wing with a ruler for size reference:

IMG_2758.JPG
 

Attachments

  • IMG_2749.JPG
    IMG_2749.JPG
    2 MB · Views: 0

Power_Broker

Active member
Update #16.)

Trying to finish the main wing. It's coming slowly, but surely.

First, I got 2 really long .5" diameter dowels from Lowe's, cut each to the length of the wing, inserted them into the spar cutouts, and then hot glued the ends of each. Here is a pic:

IMG_2770.JPG

Then I used a screwdriver to puncture 8 holes through the top of the wing. There are two sets of two holes for each spar. Each set of two holes are 1.5" from the center of the wing with the respective spar in the middle of each of the sets of two holes. These holes allow zip ties to be wrapped around their respective spar (one zip tie on each side of the wing for both spars) and the cover piece. This provides an extremely reliable mount for the wing.

IMG_2767.JPG


IMG_2768.JPG


IMG_2769.JPG


IMG_2771.JPG

I then zip tied the wings to the cover piece and hot glued the sides of where the cover piece and wings met. This is to ensure that the wings do not become misaligned or slide side to side during flight.

IMG_2786.JPG


IMG_2787.JPG


Next, I cut a hole in the right wing for the pitot tube pressure sensor and wiring:

IMG_2766.JPG


IMG_2764.JPG


IMG_2765.JPG


IMG_2763.JPG


Lastly, I applied Mod Podge on the entire surface of the wing to make a hard "exoskeleton":

IMG_2773.JPG




Next, I plan on mounting the pitot tube probe, ailerons, and aileron servos.
 

Grifflyer

WWII fanatic
Looking good, How much weight did the modge podge add I've always wanted to try using it but I was concerned about weight...
 

Power_Broker

Active member
Well, I used the whole bottle since I had a lot of wing area to cover (both top and bottom). I didn't weigh the wings before and after, but from the bottle info, it must've been around 9-10 ounces. Looking back, I kinda wish I used fiberglass and epoxy due to weight, but the good news is that this wing is easily replaceable. I can hot wire a new one, apply the new hardening material, detach the old wing and zip tie/hot glue the new one to the cover piece.
 

Snarls

Gravity Tester
Mentor
Wow this is a very in depth build log. I remember seeing this thread when it started, but kept forgetting to check back. Nice job so far! And congrats on graduating! I myself just graduated with a B.S. in mechanical engineering.

Good to see someone doing a scratch build all the way down to the flight controller and transmitter. A challenge for sure, but far more fulfilling than popping an off the shelf flight controller in there. I'm doing a similar thing, albeit with far less sensors, with a diy ROV build right now.