This video documents the complete process of building a 3D-printed hexapod robot over approximately 400 days, covering mechanical design using Autodesk Inventor, electronics with Arduino and servo motors, and programming including inverse kinematics calculations and Bézier curve path planning. The project demonstrates key robotics concepts such as degrees of freedom, PWM signal control for servos, LiPo battery systems, and the importance of iterative design and prototyping. The creator learned valuable lessons about material selection (ABS vs PLA), circuit protection (flyback diodes, capacitors), and wireless communication challenges, ultimately producing a functional hexapod capable of walking, turning, and performing simple tasks like high-fives.
DIY Hexapod Robot Build: Mechanics, Electronics, and Code
Added:over the last year I've built this robot it's called hexapod because it has six legs which are useful for walking in tough Trin it can walk [Music] dig and even high five there's going to be a short version of this video on my main Channel but this is a deep dive I'm going to walk you through the whole process of building a robot the mechanical engineering electronics and coding I'm going to show you all the mistakes and all the things I did right if you are new and don't know what this or this is that's fine I'm going to explain everything and if you aren't new there are still going to be some more advanced stuff later so you should get something out of it all right let's build a hexa robot at day one of the actual build I had an optimistic view in the next two months I'm going to build a hexus robot that's going to climb walls like a spider this estimate turn out to be inaccurate anyway I started with a single leg I'm going to use these seral motors which are basically a DC motor with a gearbox which reduces speed and increases torque this motor has three cables two are for the power and one is for information and if you're new to electronics you might think you only need one cable for the power but I'm going to show you why you need to I'm powering up the Ser with 7 WTS and if you connected it like this nothing would happen because you need a lower potential where the electric table flow to so I'm going to add ground which is 0 WS and now the electricity flows from the 7 Vols through the servo into the ground and delivers power to it okay the Sero is powered now we somehow need to tell it to move to some angle and that's what this thir cable is for the orange one it carries a pwm signal which looks like this and it basically turns on and off the input voltage and it's defined by duty cycle so here the duty cycle would be something like8 because most of the time uh the voltage is on and here the duty cycle would be5 because the voltage is half time on and half time off and to encode the angle information we could say that the duty cycle of zero means the angle is zero and if the duty cycle is one one the angle is 180° or whatever the max angle is in practice you don't need to know any of this just connect the servo to a supply voltage ground and a digital pen then you can set the Sero angle in Arduino IDE and upload the code all right we know how to use the servos so let's design the L it's going to have three of these motors this is the minimal amount because you need at least one motor for each AIS it's going to move along the number of movement AIS is known as degrees of freedom this leg can move in X Y and Z so it has three degrees of freedom and you can guess that the number of degrees of freedom is usually equivalent to the number of Motors we could also make it rotate around this axis and then it would have 6° of freedom but for that we would need six Motors and that would be Overkill there are some weird examples where the number of degrees of freedom isn't equivalent to the number of motors for example this 2D arm has five Motors this tip can move in X and Y and it can also rotate so it has only 3° of redom even though it has five Motors but usually for simple linkages like this like it's equivalent I opened up Autodesk Inventor which is a get software for 3D modeling to model an object you create a 2d sketch and extrude it by adding and subtracting objects you can model anything after finishing my shitty model of the lag I exported it as an STL file and opened it in Kura which is a slicer program here you can choose the infill layer height and other print settings I set the infill to 20% saved the gcode and started printing for the material I chose petg because I for it's stronger than PL although harder to print I glued all the pieces together and coded a basic movement I coded the movement in angles so the leg doesn't move straight and I also [ __ ] up the kit so one of the AES is crooked but that doesn't really matter because it was just a prototype I was powering thiso with the Arduino 5 volt and ground pins but now this leg has three motors and the Arduino doesn't have that many pins so I used the breadboard the breadboard has many pins connected to together so you can power them with the Arduino [Music] pins now these two lines are both powered so this is the 5vt and this is the ground line and you can connect multiple motors to it you're basically multiplying the Arduino pins but the 5vt Arduino pin has a maximum current of about 1 amp so if you connect three motors to this power line the current is going to be divided so each motor is have a Max current of3 amps and that might not be enough to power them so you have to be careful with this also breadboards are used for prototyping they are not reliable and later we'll upgrade to pcbs which I'll talk about done at day five I focused on the inverse kinematics and I'll let past me explain what that is I built this one leg which is made from three Ser Motors I can set the angle of each motor and the leg will move to some position this isn't very useful since the movement is essentially random what I want is to tell the leg to move to some position and let the robot figure out the angles this is called inverse kinematics I solve it by writing down the equations and transferring them into code I can now move the leg in the x y z or any other direction I want solving the ik involves drawing a bunch of triangles if you want the whole solution you can just Google hexapod inverse schematics but here I'm just going to give you the feel for it we know this end position because that's the input and we also know L1 L2 and L3 because these are the physical dimensions of the leg however you modeled it that's the dimensions and our goal is to find M through angles Theta 1 theta 3 and th 2 and for that we going to use Pythagoras and cosine La so Pythagoras if you have a right triangle and you know two sides you can calculate it the first and with cosine law if you have any triangle and you know all three sides you can calculate any angle inside of it we are going to focus on theta 3 right now so I've made this triangle and we can calculate l because it's just the [Music] pagor now we have this closed triangle we know all the sides and we can calculate data for you with goose sign [Music] law we have data free we could calculate Theta 1 and Theta 2 similarly but I'm going to stop here in practice if you want an analytical solution meaning you have a function that outputs the angles you you have to solve it by hand basically but if you have a more complicated linkage you can use numerical methods and optimization techniques and you'll get an approximate solution I have ik as a function in my code which translates the X Y and Z into Theta 1 2 and three so I can code the movement of the leg in spatial coordinates and the code translates it to the Joint angles since I could easily go to the movement of the leg it was time to make the leg path so far I've built one leg which can move in the X Y and Z axis my aim is to combine these movements in a specific way which allows the robots to walk I could let the leg Trace out a triangle like this the problem are these sharp Corners the leg is moving in One Direction and I'm telling it to move the other way the next millisecond this causes the motors to overload instead of a triangle I'm using this smooth path which is called a bzier curve this curve is C2 continuous which roughly means that the force acting on the life changes gradually and not abruptly this makes the leg movement smooth and doesn't wear out the motors so this is what the leg path looks like there's a straight line at the bottom this is when the leg is in contact with the ground and then the leg lifts up and returns back to the starting position this leg path is made from a straight line and three of these bzier curves I generated this curve in met lab and I saved the points so the adino doesn't have to calculate this curve and just lose them the reason I chose B curves is because they are C2 continuous so if this leg pth wasn't C2 continuous the acceleration of the motors could look something like this so there will be a step change in the acceleration which isn't great for the motors and since this is C2 continuous it means that the acceleration is going to look at worst something like this so it changes gradually and this is generally better for the motors the whole like path has 100 points 50 for the line and 50 for the B acures and this is because when the robot walks it always has three legs on the ground and three legs in the air so you want the leg to spend the same amount of time at the ground as it spends in the swing phas oh one other thing you might think that for this line you would need only two points but uh that's actually wrong for two reasons the first reason is that you would have no way of regulating the speed because the leg would move as fast as the servo Motors would let it and the second reason is that this line is straight but only in spatial coordinates in joint space it's more complicated let's say you have this leg and want to move it straight up into this position and in both of these positions this angle is 90° so you would expect it to move like this but since this motor has the same angle it doesn't have to move at all and so what would happen is this motor would rotate and the path would be this circle so if you want to move it in a straight line you need to interpolate in between the positions the position of the like is defined only at those points and if you want it to move in a straight line you would have to do an interpolation and the path in between these points could be something weird but if you make enough of these points it should be approximately straight line at day 12 it was time to design the rest of the robot by this time I had already ordered another 16 Silo Motors I buy almost everything from AliExpress and this isn't sponsored or anything I'm just going to give you a quick tip if you check this Choice box and you buy stuff for $10 or more you're going to get free shipping and the stuff is going to arrive in 2 weeks or less I generally try to find the cheapest parts that are still decent and all the parts are used for this robot are going to be linked in the description you don't have to buy it with my links it just supports me if you do the modeling took me 5 days which sounds like a lot but this assemble has 150 parts and they all have to fit together this is the body of the robot where the electronics goes and quick tip you see this big flat surface don't do this make it 3D or at least at rips so it doesn't Flex that much I had to redesign this part later the bottom part has mounting holes and the whole robot is 70 CM wide which is quite a failure because I wanted to make it as small as possible and now it barely fits through a door now I was just going to wait for the motors and printed the parts in the meantime 34 days later I was still waiting for the motors you see AliExpress ships the order to your country this is fine but from there it gets delivered to your home by a local delivery company which means I'm [ __ ] because in my country the delivery company is this piece of [ __ ] so I was just praying it would get delivered sometime because I spent $200 on the motors at this point I also started making YouTube shorts so the footage will be vertical for the next few minutes while I was waiting I printed the body and a single like I chose ABS because the petg I tried before wasn't rigid at all and abs should be even stronger I joined the parts together with bolts and square knots because I didn't know that heated inserts exist I was happy with how it looked but it was really heavy I redesigned the ti which is this part to add a great R of motion I attached the leg to the front of the robot so I had to rotate the like PA by 60° I did this by adding 60° to the first joint which wasn't ideal since it rotated the path around that joint instead of the center of the leg path I was starting to lose all hope but at the day 62 2 months after I had placed the order the motors finally came I repl the old once bred some new parts and assembled two more legs I updated the code so it generates two more passs for the edit likes I tried powering it with the notebook but the motors draw too much current so I had to switch to LiPo battery already the 11 volt battery is connected to BU converter which reduces the voltage to 7 volts which the motors need I also added a switch for the battery next I will probably write a code for turning robot while printing the remaining three legs since the robot had three legs I had to upgrade to the power supply before I was using a notebook to power the Arduino to power the breadboard to power the servo Motors but the Arduino 5vt pin doesn't have enough current to support N9 Servo Motors so I switched to a lipo battery I was a bit confused when I bought my first LiPo battery so I want to clear some things up lipo stands for Lithium Polymer and these batteries are usually the go to because they have high currents and high energy density there are two main things you want to consider when buying a lipo battery the first thing is voltage and the second thing is capacity for the voltage you're going to find these batteries in 3.7 volt increments and that's because how they are made LiPO batteries are made from these 3.7 volt cells and you can stack these up to create high voltages and this is what the s means in LiPO batteries so let's say we have a 2s SLO battery that means it has two of these cells connected in series in series these voltages add up and you get 2 * 3.7 Vol which is 7.4 Vol you could also connect these cells in parallel then the voltage would stay the same but the capacity and the maximum current would be double I'm going to use this 3s LiPo battery that means the voltage is going to be 3 * 3.7 Vol which is 11. 1 volts the voltages I talk about are minimum voltages so if this battery is dead it's going to have this voltage and if you charge it up the voltage is going to be higher for example a 2s LiPo battery has 7.4 volts when it's discharge and when you charge it 200% it's going to have 8.4 Vols and you can use this to check how charged the battery is so if it's 8.4 Vols you know it's 100% charge chared if it's 7.4 Vols you know it's completely that all right the capacity is expressed in milliamp hours and this is a really useful unit although I use amp hours usually this battery is 2200 Milah hours which means it's 2.2 amp hours and this means it can provide 2.2 amps for 1 hour and it also means it can provide 1 amp for 2.2 hours these batteries also have a c rating which helps you calculate the maximum current the battery can provide this battery has a c rating of 10 C and if you multiply it with the capacity you get the max current so the max current for this battery is 2.2 amp hours times the 10 you rating which is 22 amps so if if you're going to power anything under 22 amps it's good and if you power something that requires 50 amps the batter is going to explode there are two easy ways to destroy these batteries one is to completely drain it if it's dead and you keep using it you're going to destroy it and the second way is to pull a high curent from them either by connecting something that requires a high current or very easy way is to just short Str at this so if I connect it the ground and the 11 volt pins together with a cable the cable has a very low res resistance so there will be insane currents like thousands of amps and the cable would melt and the battery would explode to charge these batteries you need a specific charger I got this balance charger it cost $5 and it can charge 2s and 3s LiPO batteries and what the balance charger does is that when you have a 2s LiPo battery you can just charge it with the voltage like this because then this one cell could get most of the voltage and this cell could be that so you need a balanced charger that charges both of the cells separately at day 95 I had made some progress and the robot was actually able to take his first steps I was at the hospital for last month but I managed to assemble the remaining fre likes I wrote a code to make them move and tested it then I printed a stand for the robot so I can test all of the legs easily since I finished all the legs I let the robot take its first steps the robot only walks forward it has no control system or sense of the environment yet it walks slowly and take small steps because I miscalculated the the power requirement I already ordered a battery with lower voltage so I don't have to use debug converter which only provides 15 amps the battery has plenty of power but the back converter has a maximum current of only 15 amps which is barely enough for the robot to walk the motors would also start moving randomly or they wouldn't move all at the same time at day 112 I improved the electronics the old robot didn't have enough power because I was using a high voltage battery with a bu converter which didn't provide enough current so I had to redesign the circuit I bought a 7vt battery and connected it directly to the motors so I don't need to worry about not having enough current next I changed the bread board for an Arduino Shield which lets me connect all of the motors easily I also solded a flyback diode and a capacitor on the Arduino for more stable power supply now the robot can walk faster and take bigger steps in the next video I will write a code to make the robot run and maybe add a remote control joystick since the back converter wasn't good enough and I couldn't find a better one I had to figure out something else I could use a resistor to make a voltage divider with a voltage divider you have an input voltage and you can set the output voltage by choosing these two resistors let's assume that all the motors are just a one giant resistor RM and we want to pick the resistor R to lower the voltage accordingly if these two resistors were both 100 ohms the output voltage would be 1 half of the input voltage and if this resistor was 100 ohms and this one was 200 ohms the output voltage would be 1/4 of the input voltage so that's how this formula works and this sounds great we can pick another resistor R and lower the voltage however we want but there's a few issues with this the first issue is that this resistor dissipates its energy by turning it into heat so not only are you wasting energy but you also have a giant heater inside of your robot the other issue is that all the motors aren't just one big resistor they have capacitance and inductance and this creates an impedance which is basically a variable resistance so this is going to behave differently than you would expect the other option would be to use a 2s LiPo battery the 2s LiPo battery has a voltage of 7.4 volts which isn't that high but that's the voltage when the battery is dead when it's fully charged the voltage is 8.4 volts which is significantly higher so this could damage the motors the other issue is that it could also mess with the p gains if you have a motor and you want to turn it 90° this sounds pretty straightforward but it isn't this is kind of a stupid example but let's say you wanted to turn this ruler by 90° you could do it slowly and that would work but it would be slow or you could do it really quickly and then the ruler W overshoot and start vibrating so we have to find a tradeoff between speed and no vibrations and that's what the P ID controller inside of this Ser motor does the p ID controller is defined by fre constants and they have been tuned to the motor's operating voltage so if you input a higher voltage it's not going to be tuned well and my guess is that since the voltage is higher the speed is going to be higher so the motors could start vibrating a bit these options aren't great but I decided to go with the TOs Lio battery because it's the easiest the sensor Shield I added has the power ground and digital pin next to each other which makes it easy to connect the servos the Arduino Shield was better than the breadboard but it still needed some upgrades I added two upgrades a bulk capacitor and a flyback diode in this circuit I have a 2s LiPo battery powering a motor you would expect the voltage of the motor to be just the battery voltage 8 volts but I have 18 Motors here and they pull a lot of current so the battery can't always maintain this voltage therefore the voltage is going to some Ripple and to get rid of this Ripple and provide more stable power you can use a capacitor you can think of a capacitor as a battery that takes some time to charge and to discharge in this example we have a battery and a switch which connects the battery to a resistor and a capacitor if we look at the capacitor voltage and flip the switch the the battery voltage isn't going to jump straight to the capacitor it's going to take some time to charge up so at first the capacitor voltage is zero and then it rises to the battery voltage over time now if we took this capacitor charge to the battery voltage and put it in a new circuit with a switch and a load resistor at the start the capacitor has the battery voltage and then when we flip the switch it's going to discharge to the resistor which is going to dissipate the energy in heat so as you can see the capacitor takes some time to charge and discharge and we can use this property to filter out the battery Ripple and this circuit where you have an input voltage a resistor and a capacitor where you read the output voltage is called a low pass filter low pass filter means it lets low frequency signals pass and blocks high frequencies so in this example when we flip the switch the voltage jumps to the battery voltage from zero which is a high frequency signal so it resist the change for a long time but if we increase the battery voltage over time the capacitor voltage could be very similar low pass filters are widely used in electronics you use them to filter out noise or to power a more stable power supply the second upgrade I added was a flyback diode with we have a circuit with a battery and an inductor when we close this switch there's going to be a current flowing from the battery to the inductor the inductor is a coil of wire and when you pass a current through it it creates a magnetic field this creates an electromagnet and these inductors are inside of Motors that's how the motors work now when we open the switch you would expect the inductor to just lose all the current and all the voltage but that's not how it works because it has accumulated energy in its magnetic field and now it has to dissipate it somehow so there's still going to be a current flowing but now since the circuit is open it has nowhere to go so there's going to be a huge voltage Spike across this inductor which can cause Sparks over the switch or worse if you control the switch with an Arduino the spark can go through the Doo and destroy it to solve this issue we can add a flyback diode a diode lets current pass only in one way so before it was doing nothing because the current was flowing through the inductor back to the battery but now since we have this closed loop the current flows from the inductor and discharges to this diode so the energy from the collapsing magnetic field is dissipated into the diode and this protects the switch and the ardino in general when you have a DC motor powered by a battery you can add a capacitor and a diode for more stable power supply and to protect the circuit this is what a capacitor looks like and this is what the diode looks like although I used a short key diode which looks like this [Music] after day 112 I encountered some major issues and stopped recording the progress on YouTube I even considered not finishing the robot which brings us to this 200 day pause pretty much from day one I was working on a remote controller behind the scenes I bought NRF 24 chips and a hc5 in case the NRF didn't work I assumed this was going to be pain but I wasn't prepared for what was to come after weeks of work I managed to make a transmitter with an arduno UNO two NRF chips and a [Music] joystick since I could control the robot remotely I also coded a simple turning sequence where the legs on one side moved in the opposite direction as you can tell the RC didn't work the plastic feet slipped and the Turning sequence wasn't ideal despite this an even bigger issue arrived this is the sensor Shield I'm using it has a terminal block where you input the batteries ground and voltage it Powers the ground pins the VCC pins by 8 volts and it has digital pins which are connected to the Arduino the arduino's ground pin is connected to the sensor Shields ground the 5vt pin isn't connected to anything and the VN pin is the voltage input pin so you don't have to use your laptop to power the Arduino you can just use the ground and win pins the VN pin takes in 6 to 20 volts and it's connected to the VCC pin of the sensor Shield so this is great with the battery we can power were not only the Sero Motors but also the Arduino or at least this is how I thought it worked in reality the win pin isn't connected to anything and the VCC pin is connected straight to the 5V pin so all this time I was powering the ardos 5vt pin with the 8 volts from the battery this fried the uo over time this was a setback for sure I looked for a shield which could power 18 Silver Motors at 8 WT but I couldn't find one I could have made my own Shield but aert who's building this robot 2o has already made a shield for his hexapod so I just downloaded the files from his Discord server and order the pcbs thank you asers oh by the way I'll get to what pcbs are later because I ended up designing one for the remote controller since the pcbs came from China they went through our local deliver company again they had arrived a few weeks before Christmas and the staff told me they don't have enough time to find my package so they took my number and said they would call after Christmas nobody called so I went to the post office and they told me they had shipped the order back so not only did I waste 6 weeks waiting for my order I had to buy the pcbs again because the cost of res shipping was somehow higher than just buying new ones now I had to wait another two weeks on top of the time I had already wasted I tried to file a complaint for their website but it was broken I wonder why I found a guy who was responsible for dealing with this stuff I emailed him and even got on a call with him I explained the situation and he was like yeah that sucks we can't do anything unless you suas or something though so yeah anytime I order something now I'm not sure if I'll get it in time or if I'll get it at all great service after 2 weeks I finally received the new package I soldered and connected the Acer's PCB it was the same as the sensor Shield but better because the battery voltage goes into the VN pin of the arino the main purpose is still to make the wiring easier and again I added capacitors and a flyback diode the robot worked the same as before for but now it could work faster without burning the arino to prevent slipping I added this white foam which worked but the foam wore off over time so I switched to a black foam seal which was more durable nothing was burning now so it was time to update the code I added crawl mode where the robot can move in any direction but the body isn't running this is the leg path which the tip of the leg follows and from the top it just looks like a line This is the robot from the top and each leg has its own leg path so right now the robot could walk forwards and backwards if I wanted the robot to walk to the right or 40° to the right I would have to rotate each of the leg paths around the tip of the leg for this I wrote two functions the first one wrote rotates a point around the origin you can do this by just multiplying the point coordinance by a rotational matorx and if this says nothing to you don't worry it's pretty easy because once you write this out you get these two simple equations where gamma is the angle you want to rotate to the point by and X and Y are just the point coordinates so with these two equations you can rotate the point around origin and since the leg path it's just a bunch of points this also rotates the whole leg path if you look at my robot I want to rotate the leg path around the tip of the leg but the way I calculated my inverse kinematics I have my origin at the body so I need to rotate the leg path not around the origin but around this point and for that I wrote this second function this function uses a pretty cool trick since we know how to rotate around the origin we can just move the origin to the pivot point we can do this by subtracting the Pivot Point coordinates after that we can just use the rotational Matrix like before and after the rotation is done we just add back the Pivot Point coordinates to translate the origin back to where it was so we take this origin we move it to the pivot point we rotate around the pivot point and then we move the origin back this way I can rotate each of the leg paths around the tip of the leg and change the direction of the whole robot at this point I started having some mechanical issues the lower body was bending a lot so I had to reprint it I had printed the whole robot from ABS which is a terrible choice if you don't have a 3D printer with a heated enclosure because as the ABS cools it shrinks a lot and the 3D printed layers don't fuse together well so the final part is going to break easily and it also isn't too rigid I printed the new lower body from PLA and also redesigned it to be more rigid although I may have overdone it because it was really heavy I used heat set inserts for all the volted joints if you didn't know a heat set insert is a nut you heat it with a so drawing iron press it into plastic hole wait for it to cool off and then you can screw bolts into them these make strong bolted joints I printed a new upper body also from pla with holes for the Sero cables because the old design didn't have these holes accessible then the legs started falling off so I reprinted all the tbls with the newly printed Parts I was able to ramp up the speed and get a decent performance I like this step he makes at the end the remote control stopped working completely so I switched from the NRF chips to a 443 MHz module this worked better but it was still [ __ ] because most of the time it didn't respond it worked only sometimes and only on a few meter distance the robot started breaking down again so I reprinted all the mechanical loaded Parts which is like 90% of them if I knew I would have to reprint the whole robot I would have redesigned it I also printed a new stand for testing the robot I got to a point where the robot was kind of working apart from the remote controller so I did some more coding and created a video showcasing the upgrades me through thousand sh you had me blown away I was around for you to play [Music] when I made this video the remote control stopped working completely so I was forced to hard code all the movements which was very annoying I added Ripple gate the gate I used to this point is called tripod it's where the robot has three legs on the ground and three legs in the air and each leg is offset by half a cycle with the raple gate the robot leaves the legs one by one this makes the movement look more spider like and in my opinion creepy the next upgrade I added was body control the robot's body has six degrees of freedom because it can move in x y z and it can also rotate around these AES so you get pitch roll and Y the translation was pretty simple if I want to move the body up I just move the legs down so I I take the distance I want to move the body up by and I subract it from the legs position the rotation was more challenging but it still wasn't too bad I assumed that the legs lay on a plane and I rotated the plane in the opposite direction and want to rotate the body I calculated the height difference and I add it to the leg [Music] position even more I can rotate this plane and if I rotate it by by 90° instead of pitch I get roll and what you saw in the video is I made the plane spin at a constant speed so the robot was wobbling I wanted to hook this to the joystick so I could walk with the robot and wobble at the same time but I was out of luck because of the RC the last upgrade I added was turning I was able to Cod the robot to walk around in a circle of any radius this is how I derived equations so this is the robot from the top these points are the legs of the robot this origin is the center of the robot and these arcs are the leg pass from the top as you can see the leg passs are no longer lines but they are circles there are four circles in total and they all share a single point which as you can guess is the center of rotation so right now this robot would walk around in circles around this point one thing to note is that all of these arcs have the same angular size so if this one was 4° this outer one would be 40° too this one is just longer because it's on bigger radius at first I divided this problem into two sub problems inner and outer leg this is the triangle I created for the inner leg this is the center of rotation this origin is the center of the robot's body and this point point is the midpoint of the arc by doing some maths I derive the X and Y coordinates of the midpoint of the arc by changing Theta according to this equation you sweep out the whole Arc this triangle defines this left upper leg but you can change this angle to define the two other legs as well so if the angle was zero this triangle would be a line and it would correspond to this left leg and if the angle was - 60° it would be this left lower leg the equations for the outer legs turn out to be the same the x is just flipped because I flip the coordin system what's nice about this is we can choose any turning radius and my original plan was to hook the turning radius to a joystick so it would be like steering a car if you move the joystick to the left the robot would start turning to the left and the more you moved it the more the robot would turn unfortunately I didn't have a working RC so I just coded the robot to walk around in a circle since I finally had something to show this marked the end of my 200 day pause and I started recording the progress on YouTube again I even managed to get the remote control working but ever since I made the robot stiffer the like started vibrating so this was the focus of my new video at day 377 this is my robot I've been working working on for the past year and I'm getting pretty close to finishing it but it has a problem that when it walks the legs just start vibrating like crazy and he looks like he's about to give a presentation I tried fixing this by adding a gap which adds friction to each joint so it vibrates less but the gaps aren't strong enough so they just fall off after a few minutes so so that's the issue I'm going to solve today this is a part of the lag and this is the cap which adds friction to this joint it is bolted to this part above it and this cap cannot rotate because if it did it would just unscrew the bolt and fall off so to stop it from rotating I added this square pack which fits into a square hole and this constrains the move movement the issue I'm having right now is that this square pack is too small so it just snaps and then the cap falls off this is the old cap and I know it's tiny but the reason I designed it like this is because I didn't want to redesign other parts but since it's snapped off I have to do it [Music] anyway and to with this part redesigned I need to make this part bigger and this part bigger as [Music] well I'm not showing it here but I have to disassemble the whole leg just to change these three parts it takes about 20 minutes and eventually I'm going to have to do this for all of the legs which is six times so it's going to be super painful after changing the leg I let the robot walk for about 10 minutes just to test out the new cap and it works really well the old caps fell off and the new one is still attached so I'm going to change all of the legs I built this robot just for fun but I think it could actually be useful because it can navigate in tough terrain and climb Hills but this robot has another problem these feet are terrible they dig into the ground and they also slip I originally had a piece of foam seal at the end but it wasn't strong enough so it just broke what I want to do is to snip off the tip of the leg and glue a new tip on the leg which is going to have a sphere of silicone at the end so that should get rid of the slipping I just printed a new tip for the leg it has a sphere at the end and I'm going to cast a silicone sphere around it this should provide better traction and decrease the load of the motors I'm just playing with the dimensions right now so this is the third and hopefully final prototype this is the mold I printed and you can see that when I take the tip of the leg and click it into place it holds it at the center of the mold the idea is that I'm going to take these two parts of the mold and bolt them together I'm going to fill up the mold with silicone and then I'm going to click into place the tip of the leg so there should be no bubbles in the silicone this silicone is made by combining two parts A and B and I just realized that my part B is hardened which it shouldn't be so I'm just going to dilute it in some alcohol and see if it works so as I said I'm just going to crush the part B into powder and this will definitely work it looks like it's getting solid so I'm going to pour it into the mold and hope for the [Music] best this silicone still isn't solid I think the part B is just dead it probably underwent some reaction and didn't just dry up so I'm going to order new silicone and finish the legs in a week or so with the vibration s it I wanted to make a remote controller so I made a prototype at day 393 I've been making some serious progress on my robot although I haven't upgraded the remote control yet this is mainly because it's perfect but I'm going to make some minor adjustments nonetheless and with them the robot should be able to do some interesting stuff so this is my current controller and I know what you're thinking why isn't it in that beautiful plastic capap it's because I added this slider and hooked it to the height of the robot so when I move the slider up the robot lifts from the ground and when I move it down the robot crouches I'm going to add more buttons joysticks and make an actual controller but before that I need to change something since my last video I changed all of the friction caps so the legs don't vibrate as much but now the hexapod doesn't fit onto the stand because I increased the size of the gxa joint since I've increase the size of the kxa joint this Gap doesn't exist and These Arms have nowhere to go so I'm going to make them shorter the arms are now shorter so they don't need this Gap at all [Music] this stand is fixed so let's make the controller first I made a sketch on my new whiteboard I got recently then for each of the controls like the joystick the switch the sliders and the button I printed these attachments when when you print stuff the plastic always expands and shrinks so the dimensions change therefore I always print smaller sections of the final part to get the dimensions right and then at the end I print the whole part I modeled the full controller and now I'm going to slice it in Kur which generates the G-Code for my 3D printer but before I do that I'm going to show you the power of bigger nozzles with the standard point 4 mm nozzle this Sprint takes about 7 hours and when I change it for a 1 mm nozzle it takes only three just as I started printing the controller the silicone I ordered in my last video finally came so I can finish the feat for my hobot the molds are made from two pieces bolted together and the plastic tip of the leg clicks into place the silicone is made from Parts A and B Part B is 2% of the mixture but how the [ __ ] do you measure that so I'm going to put more and this should also make it solidify quicker [Music] the feet should be solid in an hour or two so let's assemble the controller both of the joysticks are bolted to the base plate the two sliders click into place the button is bolted do switch and the battery click into place and there's a breadboard in the middle all right the easy part is done now I'm going to wire up the electronics I've just connected the battery through a switch to the arino and I'm reading its voltage through a voltage divider because if you drain the battery you basically destroy it the battery is at about 12 Vols right now and I thought about adding a capacitor to smooth out the readings but the wave form is already smooth so I don't need it I also added an indicator light for the battery now it's blinking because the battery is turned off and this indicates a low voltage when I turn on the battery the light stays on and this indicates that the battery is sustainable so in practice when I turn on the controller the battery is going to be on and if the voltage gets too low it starts blinking I've just connected this button and it's going to control the gates of the robot so there's a counter in the code and when you press this button it increases the value of the come through by one and each value is going to correspond to a gate which is basically the movement type of the robot and by pressing this button you're going to cycle through these Gates so this is the value of the counter and you can see that when I press it it always increases by one and then it overflows and sometimes when you connect buttons like this you get a problem called bouncing which is when you press the button once but it sends a few signals and this is due to the mechanical vibrations of the button I don't have this problem so I didn't have to do any debouncing the sliders have been added I actually connected them wrong at first so I blew one up but fortunately I bought three and here you can see the value of the slider I've just added both of the joy sticks and also the transmitter and now this thing is basically done you can see that when I move the joystick it corrects its movement it goes up and down and now it's time to do the hardest part which is connecting the transmitter to the receiver if this isn't the best looking controller you've ever seen I don't know what is after a few painful hours I managed to connect the robot to the transmitter so I'm going to take him outside and see how he walks but before that I'm going to attach the Silicon Feit [Music] all right let's see how he walks with his new feet so the robots took one step and the feet immediately fell off well there goes 10 hours of my life at least my dog likes them hopefully we'll have better luck with the controller you control the movement of the robot with the right joystick and with the right slider you control the height of the robot if you move the left slider you control the radal distance of the legs and now I'm going to change the gate and you can see he works differently he lifts the legs one by one and now I've changed it back before I give up on the feet my girlfriend suggested I use super Gloom I'm not sure how well it holds on silicone but I'm going to try that and hopefully I won't glue my fingers together because that's what happens every [ __ ] time I try to use [Music] this and of course I spilled the glue on my finger if it sticks to the feet as well as it sticks to my finger I think this should be all right all right I'm going to glue the rest of the feet but with a key difference this time I'm using gloves now I'm just waiting for the glue to dry and I didn't bother recording the glueing because I was too busy not spilling the glue on myself but uh he looks like a flower it's kind of funny to test the new feet I buil this obstacle course and D robot has to tug his feet in so he fits in between the skateboard and the chainsaw of course and then he was supposed to Traverse this mountain made out of shoes and he broke his leg after shedding a couple tears I took du apart and fortunately it wasn't a broken Sero motor it was just a loose bolt so I tightened it and put it back error finally I just played with the robot I put a 5 L water bottle on the ground and let him walk over it I even tried balancing him on the top of the bottle so yeah this robot is starting to be real fun the new controller works the next step is to make a new controll with PCB that's going to look even better if you can believe it at day 444 I edited the most exciting update yet robots are everywhere they build our cars save lives and even Explore distant [Music] planets well this is my robot and it's pretty useless so today I'm going to take all my engineering knowledge and teach him how to high five [Music] have you ever wondered how this robot walks I mean each leg moves in a straight line so the robot goes forward and then it lifts up and returns to the starting position but how do you explain this to robot so this is the like of the robot it has three motors and what you can do is to rotate each motor by some angle and the leg will move to some random position but what if you wanted the leg to follow this curve so it actually makes the robot move forward well then you want the exact opposite because this curve is defined in spatial coordinates so we want something that when you input the spatial coordinates you get out the Angles and the function that calculates this is called inverse kinematics don't mind this leg we'll get to that later so instead of setting these angles and letting the leg move to some random position I tell the code to move the leg let's say 50 mm that way and the code calculates these necessary angles to generate this curve I wrote the code and I saved all of the points of the curve I'm feeding these points to the robot and the robot calculates the necessary angles but what if I wanted to do more advanced movements like what if I wanted to tilt this robot or make it do high fives I would have to write a code that generates curves for each of the legs and I could do that but I have a better idea this is blender you can do many things with this program but I'm using it for animation so I've made this animation and then I wrote a script that saves the positions of the legs and when you run the script it generates this text file with all of the positions and it also generates this bit of a code to make my life easier then I just take this and paste it into my main Arduino code load Lo it to the robot and it does exactly what the animation does so instead of generating curves for each of the leg I just do this animation and then I paste it into the main script and you might think that if I want it to rotate the body I would need to save its position too but the six positions of the legs actually completely define the movement of the whole robot and this took me like 5 days but now it would take only 20 minutes this was my first time working with blender and I want to show you what I did roughly to get to this point I started by modeling the robot SL I modeled each link on top of each other and I've put in the exact dimensions the physical robot has this is really important these are just objects and they don't move so you have to add Armature where you define how the objects are linked together with the Armature I was able to add inverse kinematics I chose the tip of the leg to be Target and with a few clicks I was able to move the leg and have blender calculate the angles with the leg finished I modeled the robot's body and parented the leg to the body after that I copied and paste it the like five more times and and then the robot was finished with the robot modeled you can key frame the location go a few frames in the future move the robot somewhere key frame it again and then when you play it back the robot moves after I transfer this to the real robot I noticed that there's a difference between the real robot and the simulation for example with this sitting animation I have to tilt the robot's body in blender just to make the real robot have zero tilt I triple checked the physical dimensions and it seems to line up with the simulation so I'm not sure where this error comes from but it's really annoying because I wanted to code a whole dancing sequence for the robot but it would take too long because with the error I have to check each movement in real life which takes up a lot of time so just to recap I rotate the robot in blender the blender generates the spatial coordinates which I paste to the Arduino and the Arduino calculates the inverse kinematics and outputs the angles of the motors so I control animations of the robot with this controller and don't be fooled by the beautiful design it's actually pretty [ __ ] it only has one button and I need at least three so I'm going to upgrade the controller and then I'm going to make him high five do you see this mess pcbs let you transform all the ugly wiring into a nice little circuit board at first I didn't know what the [ __ ] a PCB is but when I found out it turned out to be simple and very useful let's say we have this simple circuit with a battery and a capacitor and we want to filter out the battery voltage if we wanted to make this circuit into a PCB we could use spin headers to plug in the battery and to take the voltage out and in between them we could use this capacitor to connect the components to the PCB like this capacitor we need two holes in the PCB we plug the capacitor in and then from the other side we solder it to the PCB this makes an electrial connection after you're done making the schematic in your software you need to assign Footprints the footprints are the physical dimensions of the holes and the Penning of the components the padding is a thin layer around the holes where you put the shoulder this is what the footprints for the pin headers look like and this is the footprint for the capacitor after you're done assigning all the footprints you can start making traces traces are the electrical and physical connections of the different Footprints most pcbs have two layers you could make all the connections you can on one layer and then when you run out of space you make the rest of the connections on the second layer and even then if you run out of space you can use something called vas which connect the two layers together so if you had a trace you couldn't pass you can use two vases to create a bridge usually you want to have a ground layer where you have only ground connections and then on the second layer you create the rest of the Rices two things I want to add the components are either THD or SMD THD stands for througho technology so the components go through the PCB and you solder it from the back side SMD means surface mounted device if you had this chip you would just place it onto the PCB put so ring paste onto the pins melt the soering paste with hot air this would melt the thin and attach it to the padding the second thing I want to talk about is the copral layers so this is the crosssection of the PCB you have an insulator and from both sides is coated with copper if you wanted to make this Trace you could machine out everything that is in the trace but this will be a huge waste of time so what they do instead is they just machine out a border around that trace and this saves a lot of time because you only need to machine that small border that's why when you look at the traces on the PCB each Trace has two lines and the two lines are the Border I designed my PCB in Key Cat it was a freep process first I opened up schematic editor this is where I made all the connections this is the arduno Nano it doesn't have to look like the real thing this is just to define the connection for example this is the VN pin it's connected to 12 Vols and this is a pin header where I'm going to connect the battery and it's also connected to the 12 volts so these two are going to be linked after I connected all the components like the joysticks the sliders and the buttons I assigned the footprints some of the footprints like the pin headers are in the library but if you want something more specific you usually have to create the footprint yourself this is quite annoying but once you do it once or twice it doesn't take that much time after I assigned the footprints it was time to open up the PCB editor this is where you define the dimensions of the board and you can choose the layers and make the physical traces and since we def find all the connections in the schematic editor this forces us to not [ __ ] up for example these two pins are linked and I can't connect this pin to anything [Music] else after you're done making all the traces you can view your PCB in the 3D viewer and then you just export the gal files and send it to a PCB manufacturer [Music] these Helping Hands are great man I hate soering but this is cool dop [Music] nice all right let's make some animations for the high five he just lifts up his leg waits for the hand and then executes the high five now this robot has six legs and each leg has three degrees of freedom X Y and Z so that's 18 vectors and these five legs aren't moving so to save space my code ignores them which is why the vectors have only a single element okay so now I want to make the robot dig so at first he's going to sit back like this and then he's going to dig into the ground with his two front feet [Music] okay so this is the first animation he just sits and now I'm going to make second animation where he's actually digging with his [Music] feet okay that's it I'm not going to animate the second leg because it's just the mirror of the first one and this is again to Safe space now in the ardino code I just pasted the animations and I have these three states sit dig and high five and to go from one state to another I'm using a switch case structure so when I press the SE button it's going to activate State 20 and it's going to execute only this part of the code which is the sitting animation and then when I want to go to The Dig State I just press another button and it's going to execute the digging animation and this type of programming is commonly used in embedded systems and I've also programmed this robotic arm the same way all right let's have some [Music] fun in the I'm in the the I'm in the the I'm in [Music] the it's been a long journey but we have finally reached the end these are the most recent Clips I filmed when I took the robot shopping at a 440 [Music] this was my first time using an arino 3D printing and generally building a robot it took over a year to build and apart from some exceptions I really enjoyed it I planned to do so much more with the robot but after some consideration I decided it was time to retire it I'm going to make a video on my main Channel explaining why now let's zoom out look at the biggest challenges and what I would do differently wireless communication this was the biggest bottleneck of this project I spent so much time on it that it hurts to talk about the best I got was an RC that occasionally worked within a 2 m range I tried many things but never got it to work I'll try using ESP now for my future robots since I've heard it's not completely [ __ ] weight the robot weighed 5 kg which is 2 kg more than I had ABS I had printed the robot in ABS which prints terribly on Andro 3 this part with a higher weight resulted in mechanical failures of almost all the parts sensor Shield I hadn't checked the wiring diagram which would have told me it wasn't usable in my situation non iterative design I hadn't tested the robot properly and build the first design I had in mind I then had to reprint the entire robot modularity I had the designed the robot to have as few parts as possible then when I needed to change one part I had to take apart the whole robot hexapods PCB there was a short circuit somewhere in the hexapods PCB so I couldn't upload the code when the PCB was connected to the arino this made it a nightmare to code robot vibrations the servers vibrated a lot which caused the bolts to unscrew compliance the robot had no compliance so when the robots like C something think the S broke upper body I had put the cable hols in the upper body so when I wanted to open the robot I have to take out all the cables first now I'm going to talk about what I've learned and some tips I would have used when prototyping design everything as simple as possible you can improve the Aesthetics and optimize once you have a working prototype make the design modular so you don't have to disassemble the whole robot to change a single part make the design expandable for example add mounting holes for attaching things in the future make it easy to access the main parts like Motors and the electronics add a hole for the Arduino CA so you can code the robot without disassembling it don't print in ABS if you don't have a printer for it use thread Locker to prevent balls from getting unscrewed make a voltage reader for your battery first so you won't destroy it by draining it make custom pcbs you'll save yourself time and have the electronics more ordered don't buy the cheapest solder you will save time and energy also use flux and helping heads make the code easy to read use common all use functions don't repeat code give variables and functions meaningful names and explain them in comments document the code write roughly what the code does at its beginning or in a text file I've learned a lot and will definitely make a wi in the future to finish what I wasn't able to this time but now I want to make a different robot and work on my other projects the hexapod ended up costing about3 to $400 all the parts are in the description tell me what you think about this video was it too long did I explain something poly let me know thank you for watching and I'll see you in the next one
Up Next

Rotation Matrices in Python | Robotics Kinematics Computation
@asodemann3
58.6K views•2017-06-11

RatSLAM: Biologically Inspired Robot Mapping and Navigation
@milfordrobotics
20.9K views•2012-08-03

How to Build a Self-Balancing Robot: Arduino Nano & MPU6050
@easytechzones
16.8K views•2022-03-09

Introduction to Robotics | Stanford CS223A Lecture 1
@stanford
744.4K views•2008-07-22
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Robotics



![Jak programować w C? | #15 [Arduino]](https://i.ytimg.com/vi/9BaWincwwTk/maxresdefault.jpg)




























![[ROS Q&A] 049 - How to navigate while avoiding obstacles](https://i.ytimg.com/vi/k3axKeaS66A/hqdefault.jpg)






