Drone control: Difference between revisions

From Rsewiki
 
(32 intermediate revisions by the same user not shown)
Line 7: Line 7:
== Hardware ==
== Hardware ==


== Drone software ==
Build on a hand-wired PCB as a prototype


There are two versions of the drone firmware, one for the motor test (mostly performance of a single motor) without the need of the prop-sheld and a full version to be used on the flying drone.
[[Drone control hardware]]
<!-- [[File:schematic_rev0.png | 150px]] -->


To get the source code - see section "software and files" below.
== Drone software ==
 
=== Motor test firmware ===


The motor test firmware is in the "motortest" directory.
[[Drone firmware]]


To compile the source for a Teensy 3.5 or 3.6 the Teensiduino needs to be installed first.
== Magnetometer calibration ==


Install Teensiduino, see https://www.pjrc.com/teensy/td_download.html .
Calibration is used using a calibration version of firmware and a calibration app from Prop Shield manufacturer.  
Start with installing the most recent supported version of Arduino, then overlay this by installing the Teensiduino.


Once installed the directory needs to be prepared for compilation.
[[Drone compass calibration]]


====Linux====
== ESC calibration ==


make shortcut links to libraries and compiler. The shourtcut described below assumes you have installed arduino version 1.8.9 (and Teensiduino) in your home directory, change as appropriate:
The drone control uses ESC pulse width from 1 to 2 ms, and all ESCs should be calibrated to use this range.


cd drone_ctrl/motortest
[[ESC calibration]]
ln -s ~/arduino-1.8.9/hardware/teensy/avr/libraries
ln -s ~/arduino-1.8.9/hardware/teensy/avr/cores/teensy3
ln -s ~/arduino-1.8.9/hardware/tools/
ln -s tools/teensy
 
The last link is just to start the firmware upload app. make upload will work too.
 
=== Drone firmware ===
 
This is not ready yet.


== Propeller - motor performance ==
== Propeller - motor performance ==


Measured with the app below, using the motor 3508-700KV Turnigy Multistar 14 Pole Brushless and a 14x5.5 carbon propeller.
[[Drone motor performance]]
The ESC is a Hobby-wing x-rotor 40A controller.
[[File:3508-700-14x5.5-11v.png | 150px]]
 
=== Time responce ===
 
[[File:3508-700-14x5.5-11v.png | 600px]]
 
With 11 V supply (3 lipo cells).
From 1.1ms to the ESC (idle) to 1.9ms almost full throttle. The ESC update frequency is 400 Hz.
 
[[File:3508-700-14x5.5-15v.png | 600px]]
 
With 11 V supply (4 lipo cells). note that 30 amps is not sustainable, the motor gets hot fast.
 
=== Trust 3508-700 14x5.5 ===
 
Transfer gain measurement from ESC pulse width to trust.
The Hobby Wing controller is calibrated to 1ms=off, 2ms=full power.
 
[[File:trust-3508-700_14x5.5.png | 600px]]
 
Normal size propeller (14x5.5) for the motor. The translation for ESC pulse to trust is almost linear.
The thrust increases with the square of the rotation speed, but drag increases with power 3 of the rotation speed, so the end result is almost linear.
The maximum thrust is about 1kg (10N).
 
Data for the graph above is
% Measurement from esc,motor,propeller test
% file created 2020-10-04 17:49:57.982360
% 1: esc value (motor 1) 0=1ms, 1024 = 2ms
% 2: rps (motor 1) a rotations per second)
% 3: rps (motor 1) b rotations per second)
% 4: Motor voltage (volt)
% 5: total current (amps)
% 6: thrust force (gram force)
% 7: CCV (rotation direction)
% 8: Temperature motor (deg C)
% 9: Temperature ESC (deg C)
100 8.27 8.27 11.3 0.1 10 0 38.8 33.3
200 18.89 18.91 11.3 0.4 54 0 28.8 27.9
250 24.78 24.78 11.3 0.7 92 0 27.2 28.0
300 30.11 30.16 11.3 1.2 136 0 27.8 27.6
350 35.65 35.65 11.1 1.7 192 0 27.2 28.2
400 40.33 40.54 11.2 2.5 246 0 26.3 28.7
450 44.49 44.47 11.3 3.6 300 0 27.4 28.4
500 49.34 49.33 11.3 4.5 371 0 26.8 28.5
550 54.00 54.01 11.4 5.8 440 0 27.9 29.2
600 58.11 58.07 11.2 7.2 523 0 27.0 29.3
650 61.94 61.71 11.0 9.0 600 0 27.0 30.0
700 65.24 65.20 11.0 10.3 660 0 27.6 29.8
750 68.22 68.67 11.2 12.5 730 0 29.2 30.6
800 71.01 71.14 11.3 14.4 806 0 31.7 30.3
850 73.87 73.89 11.5 16.7 870 0 32.1 29.1
900 76.76 76.62 10.8 18.7 930 0 33.0 31.3
 
=== Trust 3508-700 18x5.5 ===
 
[[File:trust-3508-700_18x5.5.png | 600px]]
 
Oversize propeller (18x5.5). The translation for ESC pulse to thrust is almost linear here, with lower RPM and higher motor current.
 
Data for the graph above with 18" propeller is
% Measurement from esc,motor,propeller test
% file created 2020-10-04 17:40:42.147504
% 1: esc value (motor 1) 0=1ms, 1024 = 2ms
% 2: rps (motor 1) a rotations per second)
% 3: rps (motor 1) b rotations per second)
% 4: Motor voltage (volt)
% 5: total current (amps)
% 6: thrust force (gram force)
% 7: CCV (rotation direction)
% 8: Temperature motor (deg C)
% 9: Temperature ESC (deg C)
100 5.95 5.95 11.3 0.2 12 0 24.7 28.3
200 16.19 16.18 11.2 0.8 112 0 24.7 28.2
300 24.77 24.76 11.2 2.2 270 0 24.7 28.8
400 31.39 31.42 11.0 4.7 440 0 23.9 29.5
500 36.94 36.98 11.2 9.0 640 0 25.1 30.0
550 38.70 38.70 11.3 10.5 700 0 25.8 31.4
600 40.72 40.56 11.0 12.5 770 0 28.4 32.4
650 41.95 42.14 10.7 14.6 840 0 29.1 35.4
700 43.73 43.73 11.1 18.5 890 0 33.1 37.1
750 44.79 44.83 10.8 20.2 960 0 35.0 37.9
800 45.53 45.56 11.8 22.3 1000 0 39.6 39.0
 
=== Software and files ===
 
The files for these results is in our subversion repository:
 
Install subversion - https://subversion.apache.org/packages.html - and from a command line
 
svn checkout svn://repos.gbar.dtu.dk/jcan/mobotware/drone_ctrl
cd drone_ctrl/trunk/motortest_gui
ls
  - motortest_gui.py is the application below.
  - plot_rpm_sensor.m is the Matlab script to make the plots above.
  ... other support and data files.
cd drone_ctrl/trunk/doc/Matlab
  - Simulink version of hexacopter drone


== Motor test app ==
== Motor test app ==


[[File:motortest_gui.png | 600px]]
[[Drone motor test app]]
 
[[File:motortest_gui.png | 120px]]
== MATLAB simulation ==
 
[[File:drone_ctrl_simulink.png | 800px]]
 
Simulink model of hexacopter.


[[File:drone_ctrl_sim_hex.png | 600px]]
==Matlab simulation==


Sim mechanics simulated hex-drone hoovering.
[[Drone MATLAB simulation]]
[[File:drone_ctrl_sim_hex.png | 120px]]

Latest revision as of 09:49, 21 December 2020

Drone project

This project is intended to be a rather simple core drone stabilizer application based on Teensy and the prop shield.

Intended to be expanded with an outer control loop with a non-realtime sensor, e.g. GNSS, camera or laser scanner.

Hardware

Build on a hand-wired PCB as a prototype

Drone control hardware

Drone software

Drone firmware

Magnetometer calibration

Calibration is used using a calibration version of firmware and a calibration app from Prop Shield manufacturer.

Drone compass calibration

ESC calibration

The drone control uses ESC pulse width from 1 to 2 ms, and all ESCs should be calibrated to use this range.

ESC calibration

Propeller - motor performance

Drone motor performance

Motor test app

Drone motor test app

Matlab simulation

Drone MATLAB simulation