HARDWARE HACKING VILLAGE - Building drones, the hard way
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Number of Parts | 322 | |
Author | ||
License | CC Attribution 3.0 Unported: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/39891 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | |
Genre |
00:00
FrequencyProjective planeRoboticsStudent's t-testSocial classRouter (computing)BuildingComputing platformNP-hard
00:34
Computing platformInternetworkingInternet der DingeRoboticsComputing platformInternetworking
01:06
RobotMathematicsRouter (computing)Computing platformRoboticsEndliche ModelltheorieRouter (computing)Roundness (object)RoboticsOpen setChemical equationRoutingPiRadon transformTexture mapping
02:27
RoboticsMultiplication signSerial portInterface (computing)TouchscreenMedical imagingDistanceData compressionMotion captureRouter (computing)Estimator
04:11
Process (computing)Control flowQuadrilateralRoundingGroup actionComputer programmingStability theoryProcess (computing)Ring (mathematics)Game controllerRootTexture mappingWeb pageRadon transform
05:37
QuadrilateralCartesian coordinate systemGame controllerHydraulic motorSlide ruleComputer architecture
06:13
Client (computing)UDP <Protokoll>Wave packetGamma functionDependent and independent variablesGame controllerReading (process)CuboidLatent heatSign (mathematics)Nintendo Co. Ltd.Server (computing)Multiplication signInterprozesskommunikationRemote administrationReal-time operating systemProcess (computing)Order (biology)Nichtlineares Gleichungssystem2 (number)Video game consoleWeb pageHydraulic motorScheduling (computing)Slide ruleQuicksortRouter (computing)Computer architectureDefault (computer science)Axiom of choiceCalculationWindowRing (mathematics)Semiconductor memoryClient (computing)Set (mathematics)Remote procedure callMultilaterationConstraint (mathematics)Complete metric space
09:19
Router (computing)System on a chipBefehlsprozessorRouter (computing)Bus (computing)VirtualizationGraphics processing unitPersonal identification numberSoftwareWindow
10:09
Serial portRouter (computing)Modul <Datentyp>Module (mathematics)Table (information)Serial portGraphics processing unitBus (computing)Module (mathematics)Personal identification numberEndliche ModelltheorieComputer hardwareBefehlsprozessorNormal (geometry)Latent heatKernel (computing)SoftwareCodeDevice driverInformation
11:41
Serial portRouter (computing)Computing platformAngleReal numberVelocityCartesian coordinate systemSerial portReal numberMultiplication signMoving average
12:46
Cartesian coordinate systemForceComputing platformRouter (computing)Multiplication sign
13:16
Computing platformRouter (computing)GAUSS (software)Compass (drafting)Data bufferOrder (biology)AngleLinear programmingoutputComputer fileKernel (computing)Email
14:16
Digital filterGame theoryStability theoryKalman-FilterMultiplication signChemical equationApproximationReal numberOrder (biology)Nichtlineares GleichungssystemEuler anglesAngleMereologyLogical constantMetropolitan area networkReading (process)Binary multiplier
16:43
Matrix (mathematics)Discrete element methodCartesian coordinate systemProcess (computing)OvalDarstellungsmatrixTerm (mathematics)Order (biology)Data miningMultiplication signMereologyEuler angles
18:37
VelocityAngleCartesian coordinate system2 (number)FluxAbsolute valueData conversionAngle
19:05
Information managementEuler anglesMedical imagingAlgorithmTerm (mathematics)Computer animation
19:39
Dedekind cutError messageAngleTerm (mathematics)Degree (graph theory)Point (geometry)NumberSet (mathematics)Software testingApproximationDifferent (Kate Ryan album)INTEGRAL
20:50
IntelINTEGRALPower (physics)Error messageMultiplication signDerivation (linguistics)INTEGRALComputer animation
21:47
Error messageSample (statistics)Derivation (linguistics)Error messageVariable (mathematics)Endliche ModelltheoriePoint (geometry)Set (mathematics)Transformation (genetics)Term (mathematics)Computer animation
22:33
Game controllerAnglePrincipal ideal domainRouter (computing)VelocityWhiteboardComputing platformDigital signalGame controllerRow (database)GradientHydraulic motorComputer hardwareReal-time operating systemCalculationStaff (military)Router (computing)
23:27
Process (computing)BefehlsprozessorGastropod shellBroadcast programmingScheduling (computing)Real numberExecution unitMeasurementInertialsystemComputing platformRouter (computing)Scheduling (computing)Library (computing)CuboidProcess (computing)Default (computer science)
23:55
Process (computing)Physical systemKernel (computing)Computer hardwareGame controllerComputerProcess (computing)Default (computer science)CuboidRouter (computing)Hydraulic motorWeb page
24:24
TransmitterUDP <Protokoll>Event horizonRouter (computing)Query languageProcess (computing)Control flowServer (computing)Web 2.0Router (computing)ApproximationWeb pageRemote procedure callComputer animation
24:58
Control flowJoystickSuite (music)Android (robot)Medical imagingModule (mathematics)Meeting/Interview
25:46
Web pageIntercept theoremFrequencyProjective planeAuthentication
26:27
Multiplication signVibrationTerm (mathematics)MereologyWeightFilter <Stochastik>EstimatorMathematics
29:21
Hacker (term)Software-defined radioWeightMaxima and minimaControl flowWeightMaxima and minimaRegular graphCore dumpMereologyRule of inference
30:10
Network topologyLatent heatFunction (mathematics)Control flowFunction (mathematics)Multiplication signMereologyGame controllerMicrocontrollerInternet forumProcess (computing)Goodness of fitWordModule (mathematics)Clique-width
30:56
Random numberRadon transformPersonal identification numberCircleTable (information)Mobile WebRoute of administrationGame controllerSheaf (mathematics)Endliche ModelltheorieInternet forumCore dumpGoodness of fitProcess (computing)
32:02
Functional (mathematics)Mobile appFunction (mathematics)Personal identification number
32:31
Local area networkPersonal identification numberFunctional (mathematics)WordRow (database)Information
33:05
Level (video gaming)Power (physics)Hydraulic motorState of matterComputerPower (physics)Entire functionObservational studyLevel (video gaming)
33:45
Hydraulic motorMereologyPower (physics)Maxima and minimaDigital electronicsEndliche ModelltheorieChannel capacity
Transcript: English(auto-generated)
00:00
Hello, welcome to this talk. I'm David Melendez and I want to share with you several projects that I have been over the years. So, well, the title of this talk is Building Drones
00:21
the Hard Way, because we are talking about three robots, one each with their particularities. So I named this project Trust Robotic Router Platform at the beginning, and the leitmotif
00:46
was a low or nothing cost of embedded platforms, the Internet of Things, and they use whatever is lying around. And I don't like to recycle, don't recycle at all, simply reuse. So for
01:10
the first two robots, I decided to use a router. Some of you may know the Lynxys, it's a very
01:22
classic router. So like seven years ago, I decided to build my first robot, it's called Texas Ranger. So we are going to see why. The main reason is to use the Lynxys. Seven
01:43
years ago, there was no Raspberry Pi or maybe Arduino, but it was very new. So I decided to use a Lynxys and a homemade PIC board, homemade. So I loaded two Lynxys,
02:07
the Linux OpenWRT, and we got everything. And the second one was a drone. We are talking about all of them with the LaFonera 2201, a very old model indeed. So the round one
02:29
is the Robotic Ranger. You can Google it, and you will find a lot of stuff about this. But I would like to share with you this robot, but this was the first time
02:45
with a robot. So this robot has a Lynxys, two boards, an AP camera, and two guns. The two guns are made with plastic guns, turned backwards, and all the bullets
03:10
fall into the camera. So I only need a transistor to make work the gun from the PIC. The PIC
03:24
was connected directly to the Lynxys by serial port, and we have an interface. And the laser was used to estimate the distance between the robot and, for example, the wall,
03:44
by calculating the distance between the most bright light on the screen, the capture screen by IP camera, the router decompress the image, and then, well, it calculates, estimates
04:05
the distance between the robot and the wall. So the first one is the Texas Ranger, and
04:26
the Texas Ranger is the same technology at the beginning, because I still use OpenWRT, and I was to program the stabilization process inside the router, because I decided to program
04:46
my own stabilization program and avoid any kind of board, like a pilot or so on, just for fun and to learn how the stabilization process works, and I would like to share with you my insights.
05:06
So the telemetry and control, the first attempt was a success. It was by control by the web page of the router, by
05:22
K-Strux by Haberscript, but I found that was not very comfortable to pilot the drone, especially when the drone can kill you, because it's too big. So we all know the ABC
05:41
for quadcopters and drones, so we can skip this slide. I think that we all know we have four motors, two spinning clockwise and the other two spinning counterclockwise, so we have a complete control over all the axes. You want to turn to one side, we spin faster,
06:10
one motor and the other. Well, this is the architecture of the Atropos. This kind of slide is for troll you, so don't be afraid. We have a La Fonera in the front
06:33
with a background process, but at the beginning we have a client in a web page with an iframe
06:46
taking the camera. The first time it was an IP camera, and we have a control for this one. This is not an RC, it's a USB trainer, so it's like a remote control, like with PlayStation and
07:08
so on. La Fonera takes the commands through our Wi-Fi and tells to the main process all the commands from the pilot. That flight control runs inside the Linux box,
07:28
inside the Linux router, and it has to be some kind of special tweaks in order to achieve some kind of real-time execution. We know that Linux is not indeed
07:45
by default a real-time operating system, so we have a special policy scheduling policy to achieve this some sort of real-time response.
08:03
So we need to exit, we need to read sensors, make equations and send the command to the motors in a fixed time, in a specific fixed time. So we cannot make 100 calculations in a second
08:21
and 200 in another second, because you have to be very time constrained. We are talking about that later. So the inter-process communication is made by certain memory for fast response, and the sensors are the Wii Motion Plus and the Wii Nunchaku. It was taken from the
08:48
Nintendo Wii console, because like six or seven years ago, it was not so easy to buy a complete set of sensors, and the best choice was to go to the supermarket,
09:05
buy some Wii sensors, not having the Wii console, and connect it to the router lights. So the first step we need to identify in the router is, where are the lights?
09:30
Because the lights are GPUs. So if we have enough GPUs identified, we could make a virtual I2C bus by software. So I could identify four pins,
09:51
for example, the LED network activity or the Wi-Fi activity, we have several pins identified here.
10:01
So I could make two I2C buses to connect the Wii Motion and the Wii Nunchaku. Well, this is some kind of professional soldering. This is pretty awesome, I know.
10:22
So we have the GPUs, let's attach to that, and the serial port, that is useful too, as you know. And there are the steps to compile the model of the I2C.
10:46
You don't have a driver, because you don't have a specific hardware with I2C. Simply you create an I2C bus, but by software, it's not related to any specific hardware.
11:03
So we have to load these modules, and that's the commands, we tell to the kernel middle which pins of the CPU are related to clock and the data. So we will bus 0 and bus 1,
11:23
with the GPUs 4, 7, 3, and 1. So I leave this information, we load the module at the start, and we can throw the I2C detect command as normal. But this is the serial port
11:46
of the Funera, it's no real mystery here. And I would like to explain how it works a little, and why I need a Wii Motion Plus for the Atropos.
12:03
Well, Wii Motion Plus is a gyroscope, so we have a three axis, pitch roll and yap. But it gives me angular velocity. To take the real angle, we multiply angular velocity by time. But there is a problem, it drifts.
12:26
If you multiply over and over time, it will drift. And it's the same problem that if you are too drunk, and you turn around enough times, you can go to the ground.
12:46
So we need an accelerometer to cancel that drift, and the accelerometer is taken from the
13:06
drift, and takes only when the drift has to be cancelled. The other time is not necessary. And the magnetometer, this is not mandatory, because it only cancels the course angle,
13:26
so it's optional. Well, in order to read with the I2C, with a Linux program, one of the easiest ways to read it is including the I2C header of the Linux kernel,
13:47
and we rate it like a regular file. We can ask for the specific sensor that we want to read,
14:03
by sending an IOCTL command to read the gyroscope or the accelerometer. This is the funny part, because we have to mix these two sensors to obtain an attitude,
14:33
and the real motion of how the drone is moving, in order to react and send the proper commands
14:43
to keep the drone stabilized. All this is managed by the autopilot easily, you can put the autopilot and everything works fine. But if you want to make this by ourselves, we have to deal with this shit. But it's a pretty fun shit, because
15:08
the first approach that I made was the poor man Kalman filter. Do you know Kalman filter, please? How many? One? Well, it's fun. You? Okay, two.
15:33
It's pretty fun. The original paper was the balancer filter of the
15:50
approximation, the first approach was to take the angle of the gyroscope, multiply for delta time. Delta time is the time between reads. That is because it's important to keep reads
16:04
at the same time, because dt is fixed, it's a constant. So you can remove that from the equation if we have a fixed delta time. So, this is our first approximation,
16:22
so we have some kind of stabilization, because I'm taking into account very much the gyroscope, but too little the accelerometer. You have here the games, and we have some kind of
16:42
stabilization, but this is the funniest part, because what happens if the drones, this is the sensor, and the sensor takes into account this turn, this turn, and this, pitch,
17:04
roll, and yaw. Its axis is related to each axis of the sensor, but what happens is, I'm moving like this. The pitch is no longer the pitch, the yaw is no longer the yaw.
17:21
The yaw is not the last movement, it's not the same movement. Again, we have a yaw, and the yaw is like this, but the yaw now is not like this,
17:46
it's like this, but the related axis of the sensor remains the same. The yaw for the sensor still is that, but for the drone, no more. That pretty stuff is blown mine from the first time,
18:07
because we need a three plus three matrix transformation in order to transform the coordinates of the sensor to the coordinates of the drone. So we have a nine values
18:29
that is related to the x of the aircraft, is related to the x, well, you see that, okay. So we have to work, once we have the conversion between the axis of the drone at the axis of the
18:46
sensor, we have three things. Absolute angle, radiance, we have angular velocity, radiance per second from gyroscope, and the angular acceleration, radiance per second per second.
19:02
Okay, so don't go away, please. Once we have an attitude, we have to send a proper command to motor, but what command,
19:21
what quantity, what fucking shit of anything. So we have this algorithm that you can, it's taken from the Wikipedia, okay, this image, you can search for that. And we have three terms, okay. We have the proportional term that this, we have a zero, I have to say
19:46
at zero angle to say stability size, okay. My set point is zero, but I am at 10 degrees. My error is minus 10 degrees, so you have to, I have to take into account the error
20:05
that this is the difference between I am and where I am to, I want to stay. So I multiply the error by a number, which number? I have no idea. I have no fucking idea.
20:23
The first approximation is, okay, let's test, okay, and you test. You put the drone like a segue, fix it with only movement with one angle, and you test how its behavior. But it's not enough. You can't control a drone with a proportional
20:48
gain because it's not enough. You have to take into account the integral. Don't throw me things, please. The integral is,
21:02
it only takes into account how much time I am with the error, okay. It's like you take the mouse, and you naturally, your brain, are calculating the integral. Because if I can't lift the mouse, my brain without notice, I'm not noticing that, but my brain will send more
21:30
power to my hand to lift the mouse. That is the integral. I'm not on time with the error,
21:40
so I accumulate the error to correct. And the other one is the derivative. The derivative thing takes into account how much speed I'm approaching or leaving my set point, okay. So I have to take into account that returns, and I have to tune it by 3-line error, okay.
22:06
It's the best way, although you have the real model of your drone, almost all the variables, and you can calculate Laplace transform and so on, okay. But for poor men, you can
22:32
try to real an error. So this is an STP, because we applied a PD to angular velocity, but
22:41
over the roof, we apply a P controller. This is just for the record. So this is the Atropos with a professional grade mounting with all the stuff. And once we have calculated all the calculations, we have to send to the motors the signal. So
23:10
the signal is a PWM, a pulse width modulation, that it cannot be made inside the router,
23:20
because it's not in real time. We have a specific hardware. So I use a PIC, okay. This is the real-time scheduling from the process inside of the Linux box. This is only for if you want to investigate. I use the SKET priority library.
23:48
So in a policy of first in, first out, okay. So there is some process by default in the Linux
24:00
box that they are useless, okay, that's the what's wrong, because this is what happens if the router hangs with I'm flying my drone, okay. It makes no sense. Well, we see the
24:20
motors and so on. And this is how I control the drone throughout the web page. This was my first approximation with Ajax, but I had to tweak the
24:40
the web server, because too much, too fast Ajax petitions, queries, they are too much for the router. So I have to tune the web server, okay. That's the remote.
25:03
And this is only a joystick, okay. It's a regular joystick. And I would like to say some things about Android, because I was thinking about to
25:22
avoid a PC to control my drone. Okay, I'm going to put all my stuff, my piloted stuff to a tablet, okay. So I have to recompile the whole image only for a tiny and ridiculously
25:41
module of joidep.co. So, thank you. And the last one was in a talk in Spain, a guy sent to me the authentication package to the Wi-Fi of the drone. It was not so funny, okay.
26:08
So I decided to make my own protocol by Wi-Fi, but I explained in the talk before this, you can find it with the project interceptor, you can find the DEFCON
26:27
web page. This is my project interceptor. It's made with chopsticks, because if I make with a 3D printer, nobody believes me that this is my drone, okay. So, and I like this sheet.
26:45
I like to make things with my hands, okay. So I decided to make a much smaller drone than the Atropos, because Atropos can kill me, especially when I travel with it
27:05
with the airport. So I decided to make a hands-side drone. This time with our regular sensors, that you can buy in Chinese dealers and so on, but there are some things that
27:29
they have to take into account. First of all, that Chinese sensors, maybe they are not documented, okay. Maybe you can tune the filters and maybe your drone
27:46
has too much vibrations. If you look close enough, look at this.
28:05
What do you think that that could be? Well, there are the English term, thermo fusible, with this kind of pipes you take to protect wires with the solar.
28:33
Shrink to it, thank you. As a dampening, okay, to take into account the vibrations.
28:46
So it was enough, and I attached a 20 euro cent coin to make the sensor the perfect weight to absorb the vibrations, okay. I have to do this because I can't tweak the
29:05
filters of the sensor, but it has an advantage. That sensors make all the math stuff for me, or not all, but the first part, okay, the real estimation.
29:22
It's not bad yet, 40 dollars, no seriously, and it has hacking capabilities, and the ideas have to minimum size and weight. So it is based on the
29:53
tiniest, but it's like a router, it's like a regular router, but you only have the board,
30:01
okay. I have no commission for this, but you can see all the parts, that's the big core, and the interesting part is it has four pulse width modulation outputs, and that's because I
30:23
can't avoid an extra microcontroller for my setup. But there is a problem, when you build the big core, only two modules of the pulse width modulation are enabled.
30:44
The other two are for word debugging, okay, good job. So we have to disable UART and enable the other one. But I went to the forum of the big core, and a random guy asked,
31:04
how can I disable all four pulse width modulation pins, and the big core creator as well, huh, this is a hard way. You download the OpenWRT, you find the the
31:21
protocol, the DTS, the DTS is the pin definition of the big core, okay. DTS, your mobile has a DTS, the Raspberry Pi has a DTS, it defines how the pins are defined, okay.
31:43
So you have to understand the pin control section, and better take the circle. So then you can enable this module, and you will be a good Linux hacker, good job man, very helpful. So this is what you need to enable the four pulse width modulation
32:11
outputs, and disable the debugging UART. So we have to redefine the pins, but we have a pin name, but and a pin function. This can be tricky, because we have UART function
32:28
and UART name. If you can see that, we have the UART pins, but with the
32:46
not the word function, but the pulse width modulation function, okay. We redefine the and we have. This is only for the record, the data set, that you can, you have to take this
33:03
information, and this is my pretending that I'm knowing that I'm doing my work. The power stage of the interceptor drone is not performing with an
33:22
electronic speed controller as usual, because I choose a brushed motors, okay, brushed motors, doesn't need an entire electronic speed controller, it's only needed one MOSFET, a capacitor, and a SCOTY diode.
33:46
Why we need some kind of stuff, a part of the MOSFET? That is because the motors, when we power the motors, we are putting power on the circuit, okay, but we are not
34:07
powering the motors at maximum capacity, okay, we are modulating more or less the power. So, what happens when we turn on and off the switch of the motor? The motor generates
34:30
electricity, because it is spinning, it acts as a generator, so we have a standard electricity flowing as normal, but we turn off the motor, we have the
34:48
counter-electromotive force, okay, that this generates, puts a current in the circuit, not from the battery, but from the motors, and it could harm the
35:03
circuit, so we have to suppress it with the capacitor and the SCOTY diode.