Just adding a link to the code I wrote for this project.
https://github.com/halbrd/Hexalib
Will's Fairly Cool Research Project(s)
Friday, 2 December 2016
Monday, 19 October 2015
Week 11
As I mentioned in the last entry, while testing the LiPo battery, I was still having problems with the current supply to the servos and Arduino board. As it turns out, the problem was right in front of me the whole time. While testing the battery, I was connecting it to the hexapod's power wires with alligator clips. It didn't occur to me until this point that they would be severely limiting the current being supplied to the servos and Arduino board. I actually figured this out after running the hexapod for about 30 seconds, and when disconnecting the alligator clips, found that they were extremely hot. The reason for this is as follows:
Current flows through a given path at a "quantity" (in amps) dictated by the most resistant part of the path. A very comparable analogy is that of water travelling through a series of pipes: it can only travel as fast as it does through the most restrictive bottleneck in the path. Considering a simple straight pipe; it doesn't matter if 90% of the pipe is a metre wide, if there is a part of it that is only a millimetre wide, the overall flow of the water is only as fast as the maximum flow going through that millimetre bottleneck (making the pipe as effective as a pipe that is entirely 1 millimetre in diameter). The same principles apply to current flow. Furthermore, if a large amount of current is run through a wire with such a bottleneck, the result will be a lower current flow (dictated by the bottleneck) with heat being generated around the bottleneck.
Resistance of a wire (conceptually equivalent to the width of a water pipe bottleneck (high resistance = narrow pipe)) is given by the formula:
Resistance = (resistivity of material * length of wire) / cross-sectional area
In short: high resistivity (the intrinsic resistance of a material) and long length raise resistance, while a thicker wire lowers the resistance.
Now, I'm not sure what metal these alligator clips were made of, but since they're silver-coloured I know it's not copper, which has one of the lowest resistivities of all metals, meaning that its resistivity is relatively high (or at least higher than it otherwise could be). It's worthy of note that the wire itself is copper, but the clips are not, and in this case, the difference in resistivity of copper doesn't make the difference. This indicated that they were not meant to carry large amounts of current (current on the scale of an Arduino board would be fine, but the much higher current that I was trying to use was too much). Furthermore, the actual wire in them was not very thick (low cross-sectional area). Finally, the actual contact between the teeth of the clamps and the battery contacts was extremely thin (since the teeth are pointy, it was really just the tip). Altogether this meant that the alligator clips had extremely high resistance, which was limiting the current being supplied to the hexapod. Mystery solved!
The obvious solution to this was to exchange the alligator clips for something else, but before I swapped them out, I had another current-bottleneck-related problem. I ran the hexapod for a bit too long, and an even weaker bottleneck made itself known: The very thin jumper wire (shown below) that carried all of the current for the servos melted clean in half. Specifically, the ground wire melted, breaking at the white wire's end of the soldered join, shown by the arrow.
So now I had no way of powering any of the servos. Obviously, this was a problem, and one that would have happened immediately had I supplied the part with 15A. It's also entirely possible that this was actually the cause of the bottleneck that I thought I solved by replacing the alligator clips; regardless, both of the possibilities needed to be fixed.
My solution was to get some thicker wire rated for higher current and create a single piece that took input from the battery and split it into the two clusters shown above and the barrel jack used to power the Arduino. This required a fair bit of soldering, but ultimately wasn't too difficult. I didn't take any photos of it before installing it, so I've tried to make the photos below as clear as possible.
Current flows through a given path at a "quantity" (in amps) dictated by the most resistant part of the path. A very comparable analogy is that of water travelling through a series of pipes: it can only travel as fast as it does through the most restrictive bottleneck in the path. Considering a simple straight pipe; it doesn't matter if 90% of the pipe is a metre wide, if there is a part of it that is only a millimetre wide, the overall flow of the water is only as fast as the maximum flow going through that millimetre bottleneck (making the pipe as effective as a pipe that is entirely 1 millimetre in diameter). The same principles apply to current flow. Furthermore, if a large amount of current is run through a wire with such a bottleneck, the result will be a lower current flow (dictated by the bottleneck) with heat being generated around the bottleneck.
Resistance of a wire (conceptually equivalent to the width of a water pipe bottleneck (high resistance = narrow pipe)) is given by the formula:
Resistance = (resistivity of material * length of wire) / cross-sectional area
In short: high resistivity (the intrinsic resistance of a material) and long length raise resistance, while a thicker wire lowers the resistance.
The type of alligator clip that I used
Now, I'm not sure what metal these alligator clips were made of, but since they're silver-coloured I know it's not copper, which has one of the lowest resistivities of all metals, meaning that its resistivity is relatively high (or at least higher than it otherwise could be). It's worthy of note that the wire itself is copper, but the clips are not, and in this case, the difference in resistivity of copper doesn't make the difference. This indicated that they were not meant to carry large amounts of current (current on the scale of an Arduino board would be fine, but the much higher current that I was trying to use was too much). Furthermore, the actual wire in them was not very thick (low cross-sectional area). Finally, the actual contact between the teeth of the clamps and the battery contacts was extremely thin (since the teeth are pointy, it was really just the tip). Altogether this meant that the alligator clips had extremely high resistance, which was limiting the current being supplied to the hexapod. Mystery solved!
The obvious solution to this was to exchange the alligator clips for something else, but before I swapped them out, I had another current-bottleneck-related problem. I ran the hexapod for a bit too long, and an even weaker bottleneck made itself known: The very thin jumper wire (shown below) that carried all of the current for the servos melted clean in half. Specifically, the ground wire melted, breaking at the white wire's end of the soldered join, shown by the arrow.
So now I had no way of powering any of the servos. Obviously, this was a problem, and one that would have happened immediately had I supplied the part with 15A. It's also entirely possible that this was actually the cause of the bottleneck that I thought I solved by replacing the alligator clips; regardless, both of the possibilities needed to be fixed.
My solution was to get some thicker wire rated for higher current and create a single piece that took input from the battery and split it into the two clusters shown above and the barrel jack used to power the Arduino. This required a fair bit of soldering, but ultimately wasn't too difficult. I didn't take any photos of it before installing it, so I've tried to make the photos below as clear as possible.
The cable is shown by the green arrows.
The cable supplies power to the Arduino via the barrel jack.
The cable splits into the splitters so that the servos can be plugged in underneath.
The battery is plugged in underneath.
With the electrical system now at a standard that wouldn't cause it to melt under operation, I had to mount the battery on board, since I obviously don't want the hexapod to be dragging it around. Thankfully, with the current now uninhibited, the hexapod is actually surprisingly strong, and can support the weight of everything (including the battery) with ease.
I had hoped to store the battery between the top and bottom body parts, where it would be more out of the way, but it wouldn't fit. Ultimately, I used the low-tech but undeniably functional option of taping it to the top of the frame and then sticking the Arduino on top of it by tying it down with twist ties going through the screw holes. As you can probably tell, at this point I had stopped bothering to try to do things with "proper" hardware, but I have no doubt that these construction choices worked as well as any other option.
And so, after nearly a semester of work, I finally had a fully functional hexapod!
JUST KIDDING. Cue the next problem.
I had hoped to store the battery between the top and bottom body parts, where it would be more out of the way, but it wouldn't fit. Ultimately, I used the low-tech but undeniably functional option of taping it to the top of the frame and then sticking the Arduino on top of it by tying it down with twist ties going through the screw holes. As you can probably tell, at this point I had stopped bothering to try to do things with "proper" hardware, but I have no doubt that these construction choices worked as well as any other option.
In this photo, you can see the masking tape and black twist ties
that I used to secure everything to the frame.
And so, after nearly a semester of work, I finally had a fully functional hexapod!
JUST KIDDING. Cue the next problem.
The longitudinal (up-and-down) hip servo on the mid-right leg died during testing. The problem was that one of the small plastic gears inside of it snapped into bits - no chance of an easy fix. Thankfully, I bought 20 servos, needed 18 to build the hexapod, with 1 DOA, leaving 1 spare. I'm going to cut the dead servo's wires close to the servo itself and resolder, essentially replacing nothing other than the servo, since pulling out and replacing the wires further down the track would be much more work.
Once that's done, the last item of business this semester will be wiring an on/off switch. Ideally I'd do it across the power supply, but I'm pretty sure that most basic electrical switches couldn't handle 15A (now is as good a time as any to mention that 15A is NOT the normal operating current; I'm using it as an upper bound so that the hexapod can handle operation in any forseeable condition). However, giving the state of the switch to the program means that my code has to constantly check if it's supposed to stop, which adds complication to the program that I'd like to avoid.
A minor additional problem that I'm facing is that the nice compact switches that I bought from Jaycar (first image below) seem to have metal casing, which I fear might be able to short components on the Arduino if it touches the wrong things. The plastic switch that I have (second image below) shouldn't have that problem, but it's much bulkier.
The outer casing seems to be metal, but I'm not sure how conductive it is.
This switch is pretty bulky and inconvenient.
Semester break/Week 10
This entry was written much later than the weeks it describes, but the content it covers is still purely relevant to those weeks.
While the results from the LiPo battery tests were pretty good (all legs can run at the same time, which is a step up from anything else I've tried), I was still having problems with the power supply, just to a lesser extent. When the power was connected, the servos would jerk about once a second for 5 or so seconds before the hexapod would start moving correctly. I don't fully understand what's going on during this process, but I do know that it's basically a loop of:
1. Arduino receives power, starts up
2. Servos suck all of the current
3. Arduino turns off from lack of power and waits for a moment
I really didn't know why this was happening. Neither voltage nor current (battery: 7.8V, up to 100A; requirements: 6V, ~15A peak) should have been a problem with this battery, and while I seemed to be getting more current than with the 9V battery I was using before, it still wasn't enough. I also tested the output of the battery with an ammeter/voltmeter, which reported correct amounts of both commodities.
My initial thought was that I had messed up the battery by accidentally shorting it a couple of times for a brief moment. According to forum posts, however, this shouldn't have caused the problem I was experiencing, as long as it was for very short amounts of time (which it was), and if the battery was really messed up, it should either have puffed up (in which case I should be running for cover) or not be working at all*. Since neither of these were the case (and the ammeter/voltmeter were reporting normal levels), I had no idea why it wasn't getting enough current. This also boded poorly for the hexapod's performance once the battery was mounted; low current = low servo strength, and the battery is quite bulky and heavy.
* (Fun fact: I learned that in the case that it wasn't working at all, it would have been the design of the battery intending to fail safely. (Some of) the connections in the battery are aluminium, which has a reasonably low melting point. In the case of an extended short circuit, the high current that would be flowing through these connections would generate a lot of heat, and melt the aluminium connection, thus breaking the circuit (and the battery). This means that the battery would be dead (trying to fix those aluminium connections is a pretty bad idea), but it wouldn't generate extreme amounts of heat or become particularly dangerous.)
I eventually figured out that the cause of the current problem, but that happened in Week 11, so I'll cover that in next week's entry.
I also got rotation working over the semester break. It was reasonably straightfoward, since it's basically the same as walking, but with different starting points and leg movements. It uses the same principle of grouping legs into 2 groups of 3, and just moves the legs in the same rotational direction, instead of cardinal direction. Here's a video of it rotating left:
Unfortunately, the amount that it actually rotates in a given amount of steps (the unit I used when specifying how far to rotate) is unreliable. That is, the amount rotated in 3 steps is not always half what it rotates in 6 steps, or 3 times what it rotates in 1 step. This is due to the fact that it drags its legs when starting to rotate, rather than cleanly lifting them off the ground. It's definitely something that I could improve later, though.
While the results from the LiPo battery tests were pretty good (all legs can run at the same time, which is a step up from anything else I've tried), I was still having problems with the power supply, just to a lesser extent. When the power was connected, the servos would jerk about once a second for 5 or so seconds before the hexapod would start moving correctly. I don't fully understand what's going on during this process, but I do know that it's basically a loop of:
1. Arduino receives power, starts up
2. Servos suck all of the current
3. Arduino turns off from lack of power and waits for a moment
I really didn't know why this was happening. Neither voltage nor current (battery: 7.8V, up to 100A; requirements: 6V, ~15A peak) should have been a problem with this battery, and while I seemed to be getting more current than with the 9V battery I was using before, it still wasn't enough. I also tested the output of the battery with an ammeter/voltmeter, which reported correct amounts of both commodities.
My initial thought was that I had messed up the battery by accidentally shorting it a couple of times for a brief moment. According to forum posts, however, this shouldn't have caused the problem I was experiencing, as long as it was for very short amounts of time (which it was), and if the battery was really messed up, it should either have puffed up (in which case I should be running for cover) or not be working at all*. Since neither of these were the case (and the ammeter/voltmeter were reporting normal levels), I had no idea why it wasn't getting enough current. This also boded poorly for the hexapod's performance once the battery was mounted; low current = low servo strength, and the battery is quite bulky and heavy.
* (Fun fact: I learned that in the case that it wasn't working at all, it would have been the design of the battery intending to fail safely. (Some of) the connections in the battery are aluminium, which has a reasonably low melting point. In the case of an extended short circuit, the high current that would be flowing through these connections would generate a lot of heat, and melt the aluminium connection, thus breaking the circuit (and the battery). This means that the battery would be dead (trying to fix those aluminium connections is a pretty bad idea), but it wouldn't generate extreme amounts of heat or become particularly dangerous.)
I eventually figured out that the cause of the current problem, but that happened in Week 11, so I'll cover that in next week's entry.
I also got rotation working over the semester break. It was reasonably straightfoward, since it's basically the same as walking, but with different starting points and leg movements. It uses the same principle of grouping legs into 2 groups of 3, and just moves the legs in the same rotational direction, instead of cardinal direction. Here's a video of it rotating left:
Unfortunately, at the time of recording, the mid-right leg's longitudinal servo was dead.
Unfortunately, the amount that it actually rotates in a given amount of steps (the unit I used when specifying how far to rotate) is unreliable. That is, the amount rotated in 3 steps is not always half what it rotates in 6 steps, or 3 times what it rotates in 1 step. This is due to the fact that it drags its legs when starting to rotate, rather than cleanly lifting them off the ground. It's definitely something that I could improve later, though.
Thursday, 24 September 2015
Week 9
As mentioned in my previous post, the battery that I ordered arrived on Monday.
Regardless of these looming problems, I'm comfortable that I can say that I have a working v1.0 now. Having achieved the awkward walk using the leftover test code, I rewrote the entire code base using object orientation and best coding practice. This took me maybe 3 hours in total, much of which was consumed by packaging the Hexapod class and its subclasses as an Arduino library to get around some annoying linking issues. The OO structure of the library is reasonably simple:
The need for a separate class for left legs and right legs is due to how the servos handle angles. They're all the same insomuch as they have the same points of reference and rotate the same way given the same input, but that is exactly why they react differently depending on which side they're on. If a servo is in a left knee, for example, then increasing the angle value will cause the knee to bend inwards. However, in a right knee, everything is mirrored, except for the servo's idea of direction, meaning that increasing the angle value will cause the knee to extend. This means that in order to have a function FlexKnee(int degrees) that behaves the same for all legs, it needs to be a different function depending on which side the leg is on. This is the only (significant) difference between the classes.
In order to use my library, I simply instantiate a new Hexapod object. In the default constructor, the legs are instantiated with hard-coded parameters (for servo pins and positions) specifically for my hexapod. This isn't the most extensible approach, since you have to modify the library to change those values, but I've already taken some liberties in assuming that this library will only be used for my hexapod (at least, without any tweaking), and it's nice to simply be able to call Hexapod(), rather than trying to pass 36 parameters. That said, it wouldn't be too hard to adapt the class to a similarly structured hexapod.
The library's code can be viewed [ here ].
Having migrated away from the monstrous test file that was controlling the walking in my last post, I tweaked all of the stored servo position values to ensure that they were level when holding themselves in the rest position. This meant that I had a good reference point for the walking algorithm, which ultimately works by applying a series of offsets to the rest position. The result of this rewrite and retweak is a much smoother walk. I can also increase the speed much more reliably. The video below displays the new walk.
I'm hoping that the in-place rotation algorithm will be as simple as modifying the walking algorithm such that the slow-moving legs move in the other direction. We'll see in the coming week.
It's a 2 cell lithium polymer battery, giving it an output voltage of 7.4V (just over the servos' rating of 6V, which is fine), with a capacity of 3300mAh and a maximum current output of around 100A. Holy crap. Suffice it to say that I won't have any current problems any more, since the maximum current that I can expect the whole robot to draw is around 2A.
Unfortunately, the battery is even bigger and heavier than I had feared, so getting it mounted on/in the hexapod could be challenging, and the weight of the battery could be a serious problem, but we won't know until it gets mounted.
Regardless of these looming problems, I'm comfortable that I can say that I have a working v1.0 now. Having achieved the awkward walk using the leftover test code, I rewrote the entire code base using object orientation and best coding practice. This took me maybe 3 hours in total, much of which was consumed by packaging the Hexapod class and its subclasses as an Arduino library to get around some annoying linking issues. The OO structure of the library is reasonably simple:
The need for a separate class for left legs and right legs is due to how the servos handle angles. They're all the same insomuch as they have the same points of reference and rotate the same way given the same input, but that is exactly why they react differently depending on which side they're on. If a servo is in a left knee, for example, then increasing the angle value will cause the knee to bend inwards. However, in a right knee, everything is mirrored, except for the servo's idea of direction, meaning that increasing the angle value will cause the knee to extend. This means that in order to have a function FlexKnee(int degrees) that behaves the same for all legs, it needs to be a different function depending on which side the leg is on. This is the only (significant) difference between the classes.
In order to use my library, I simply instantiate a new Hexapod object. In the default constructor, the legs are instantiated with hard-coded parameters (for servo pins and positions) specifically for my hexapod. This isn't the most extensible approach, since you have to modify the library to change those values, but I've already taken some liberties in assuming that this library will only be used for my hexapod (at least, without any tweaking), and it's nice to simply be able to call Hexapod(), rather than trying to pass 36 parameters. That said, it wouldn't be too hard to adapt the class to a similarly structured hexapod.
The library's code can be viewed [ here ].
Having migrated away from the monstrous test file that was controlling the walking in my last post, I tweaked all of the stored servo position values to ensure that they were level when holding themselves in the rest position. This meant that I had a good reference point for the walking algorithm, which ultimately works by applying a series of offsets to the rest position. The result of this rewrite and retweak is a much smoother walk. I can also increase the speed much more reliably. The video below displays the new walk.
I'm hoping that the in-place rotation algorithm will be as simple as modifying the walking algorithm such that the slow-moving legs move in the other direction. We'll see in the coming week.
Monday, 21 September 2015
Tuesday, 15 September 2015
Week 8
I've done a lot on the hexapod since week 6 but, paradoxically, not much has happened. On Elliott's advice I soldered the power wires together by leg, so each leg now has 1 power, 1 ground, and 3 signal wires, instead of 3 power/ground (9 wires total), which simplifies the wiring problem that I had. Near the bottom left you can see the leg that I had soldered (but not heat-shrinked), while the rest of the legs are pre-solder.
I also repurposed some of the clipped connectors from the servos into a splitter for the power pins, to combine all of the leg's previously combined power and ground wires.
The signal wires for the servos are all at the end of the board.
And the power wires all connected.
As discussed in previous posts, servos draw a lot of current, and unfortunately none of the power sources immediately available to me can provide enough for 18 servos. I'm pretty sure that USB Type B (the connection used by this Arduino board) only supports the USB 2.0 specification, which can only provide around 100 mA of current. Given that the servos will draw around 250 mA each at full capacity, 100 mA for the entire thing is pitifully low and nowhere near enough for the entire robot. Interestingly, though, it can operate two legs on that 100 mA, wherein it powers 6 servos, with 4 of them actively moving. Obviously giving the servos an eighth (or less) of their desired current is sub-ideal, but it's good to know the lower bound of how much current it can run on, so that I have a clearly defined minimum, knowing that anything above that will be better.
I have a couple of options with regard to the power supply. The first is a handful of AAs connected in parallel, stacking their voltage to 6V and (hopefully) having enough current output in 1 row. If this isn't enough, I can always add another parallel-wired row, wired to the other row in series, to double the current. This works in theory, but I tried doing this with 4 AAs today, and didn't have any success. However I connected them, I didn't get any reaction to the power from the servos, so I assume that I either miscalculated the voltage/current supply, misunderstood the power requirements, connected something incorrectly, or the batteries were dead. Regardless, it's an unideal solution to begin with, so I'm going to explore the other options first.
The other (and idealistically better) option is to use a rechargeable Lithium-ion or Lithium-polymer battery pack. This is the power supply used by most hexapods I've seen online. They range greatly in voltage and capacity, but I should be able to get a 6V LiPo battery with 2.2Ah for $20 from http://rcworld.com.au. They're pretty big, and I'll have to make sure that it's not too big to fit in the chassis or too heavy to be supported by the legs. Alternatively, I could try using a Li-ion battery, which tend to be much smaller and lighter (think smartphone battery size) than the LiPo batteries, albeit with less power.
I also repurposed some of the clipped connectors from the servos into a splitter for the power pins, to combine all of the leg's previously combined power and ground wires.
Once all of the power wires were sorted, I soldered ends onto the signal wires and plugged them all in. The result is certainly still messy, but tolerably so.
And the power wires all connected.
As discussed in previous posts, servos draw a lot of current, and unfortunately none of the power sources immediately available to me can provide enough for 18 servos. I'm pretty sure that USB Type B (the connection used by this Arduino board) only supports the USB 2.0 specification, which can only provide around 100 mA of current. Given that the servos will draw around 250 mA each at full capacity, 100 mA for the entire thing is pitifully low and nowhere near enough for the entire robot. Interestingly, though, it can operate two legs on that 100 mA, wherein it powers 6 servos, with 4 of them actively moving. Obviously giving the servos an eighth (or less) of their desired current is sub-ideal, but it's good to know the lower bound of how much current it can run on, so that I have a clearly defined minimum, knowing that anything above that will be better.
I have a couple of options with regard to the power supply. The first is a handful of AAs connected in parallel, stacking their voltage to 6V and (hopefully) having enough current output in 1 row. If this isn't enough, I can always add another parallel-wired row, wired to the other row in series, to double the current. This works in theory, but I tried doing this with 4 AAs today, and didn't have any success. However I connected them, I didn't get any reaction to the power from the servos, so I assume that I either miscalculated the voltage/current supply, misunderstood the power requirements, connected something incorrectly, or the batteries were dead. Regardless, it's an unideal solution to begin with, so I'm going to explore the other options first.
The other (and idealistically better) option is to use a rechargeable Lithium-ion or Lithium-polymer battery pack. This is the power supply used by most hexapods I've seen online. They range greatly in voltage and capacity, but I should be able to get a 6V LiPo battery with 2.2Ah for $20 from http://rcworld.com.au. They're pretty big, and I'll have to make sure that it's not too big to fit in the chassis or too heavy to be supported by the legs. Alternatively, I could try using a Li-ion battery, which tend to be much smaller and lighter (think smartphone battery size) than the LiPo batteries, albeit with less power.
Monday, 7 September 2015
Week 6
This past week and a half has probably seen the most progress in the whole project. First of all, the printing of the rest of the body was finished. I also bought the Mega 2560 board that I'll be using to control the hexapod. Here are all of the parts that will be going into the build:
I then connected servos to the legs and "hip" joints, and screwed them into the body parts.
The frame of the hexapod came together without too much difficulty, and now that everything is screwed in, it's reasonably sturdy.
As you can probably tell, wire management is quickly becoming a problem. I'm probably going to have to cut and solder the servos' wires, since the length required varies greatly depending on what position the servo is in (hip or knee joints). This is the wiring to connect 2 legs to the board externally:
For the time being, I've taped the wires to the body with enough slack to move completely. I still haven't figured out how I'm going to wire them in the long run.
On the topic of the walking algorithm; there are two approaches that I have considered, one simpler, and the other more effective. The first is to simply have the leg move in a square loop, and have the leg groups move in reflectively opposite loops. Basic pseudocode (ignoring the technicalities of coding concurrent movement) for this would be:
while (walking)
group1.MoveUp()
group2.MoveDown()
group1.MoveForward()
group2.MoveBackward()
group1.MoveDown()
group2.MoveUp()
group1.MoveBackward()
group2.MoveForward()
This should work, but it's not really what needs to be done to move effectively. A six-legged insect walks by using three legs to hold itself off the ground while the other three are lifted up and moved forward. In the time that the moving set of legs are lifted up, moved forward, and lowered back down, the other set only moves backwards while remaining on the ground.
while (walking)
group1.MoveUp()
group1.MoveForward()
group1.MoveDown()
group2.MoveBackward()
group2.MoveUp()
group2.MoveForward()
group2.MoveDown()
group1.MoveBackward()
In pseudocode, this is not really any more complicated. However, due to how concurrent movement of servos must be coded, it is definitely more difficult to implement.
Wednesday, 26 August 2015
Week 5
The rest of the leg test parts finished printing, and they fit almost perfectly. Here's a quick video of the hip and knee joints moving.
The code behind this motion is as follows:
#include <Servo.h>
// Instantiate servos
Servo sFLcoxaLat; // Rotation around the vertical axis
Servo sFLcoxaLon; // Rotation around the horizontal axis pointing forward
int pFLcoxaLat = 0;
int pFLcoxaLon = 0;
// Instantiate global figures
int servoSpeed = 2;
void setup() {
sFLcoxaLat.attach(2);
sFLcoxaLon.attach(3);
}
void loop() {
// Raise femur
for(pFLcoxaLat = 0; pFLcoxaLat <= 90; pFLcoxaLat += servoSpeed)
{
sFLcoxaLat.write(pFLcoxaLat);
delay(15);
}
// Extend tibia
for(pFLcoxaLon = 0; pFLcoxaLon <= 90; pFLcoxaLon += servoSpeed)
{
sFLcoxaLon.write(pFLcoxaLon);
delay(15);
}
// Lower femur
for(pFLcoxaLat = 90; pFLcoxaLat >= 0; pFLcoxaLat -= servoSpeed)
{
sFLcoxaLat.write(pFLcoxaLat);
delay(15);
}
// Retract tibia
for(pFLcoxaLon = 90; pFLcoxaLon >= 0; pFLcoxaLon -= servoSpeed)
{
sFLcoxaLon.write(pFLcoxaLon);
delay(15);
}
}
Really, it's quite simple for what it does. Each motion that the hexapod will make, such as walking and turning, will just be a function with similar contents to those of loop() above.
The code behind this motion is as follows:
#include <Servo.h>
// Instantiate servos
Servo sFLcoxaLat; // Rotation around the vertical axis
Servo sFLcoxaLon; // Rotation around the horizontal axis pointing forward
int pFLcoxaLat = 0;
int pFLcoxaLon = 0;
// Instantiate global figures
int servoSpeed = 2;
void setup() {
sFLcoxaLat.attach(2);
sFLcoxaLon.attach(3);
}
void loop() {
// Raise femur
for(pFLcoxaLat = 0; pFLcoxaLat <= 90; pFLcoxaLat += servoSpeed)
{
sFLcoxaLat.write(pFLcoxaLat);
delay(15);
}
// Extend tibia
for(pFLcoxaLon = 0; pFLcoxaLon <= 90; pFLcoxaLon += servoSpeed)
{
sFLcoxaLon.write(pFLcoxaLon);
delay(15);
}
// Lower femur
for(pFLcoxaLat = 90; pFLcoxaLat >= 0; pFLcoxaLat -= servoSpeed)
{
sFLcoxaLat.write(pFLcoxaLat);
delay(15);
}
// Retract tibia
for(pFLcoxaLon = 90; pFLcoxaLon >= 0; pFLcoxaLon -= servoSpeed)
{
sFLcoxaLon.write(pFLcoxaLon);
delay(15);
}
}
Really, it's quite simple for what it does. Each motion that the hexapod will make, such as walking and turning, will just be a function with similar contents to those of loop() above.
The rest of the body will take about 6 hours of elapsed printing time to complete, so I've left a list of required parts that will hopefully be completed overnight for pickup on Friday. Optimistically, I think construction could be complete by the end of this coming weekend.
Tuesday, 25 August 2015
First print
The femur part of the leg (equivalent of the thigh) successfully printed. Here's a photo of it.
The resolution and quality of the print are very good, with no blemishes at all. The slots for the servo arm were almost perfect, being just slightly larger than the arms themselves. I'll have to secure them somehow, even if it's something as simple as Blu-Tack.
The remaining parts of the leg (the tibia (shin) and coxa (hip)) are currently printing and should be ready in about half an hour.
The resolution and quality of the print are very good, with no blemishes at all. The slots for the servo arm were almost perfect, being just slightly larger than the arms themselves. I'll have to secure them somehow, even if it's something as simple as Blu-Tack.
The remaining parts of the leg (the tibia (shin) and coxa (hip)) are currently printing and should be ready in about half an hour.
Monday, 24 August 2015
Servos arrived
The servos arrived today. Here's an emotive pseudo-selfie I took with them.
Of the 20 that arrived, 1 was faulty, which is fine, since I ordered 2 extras for that reason. They don't have quite as much torque as I was expecting, but after fashioning a hook and testing their lifting capability, I think they should have plenty of power for the application.
On Wednesday I should be able to get started printing the chassis, and hopefully be into construction by the end of the week.
I'm not sure what I was thinking at the time.
Of the 20 that arrived, 1 was faulty, which is fine, since I ordered 2 extras for that reason. They don't have quite as much torque as I was expecting, but after fashioning a hook and testing their lifting capability, I think they should have plenty of power for the application.
On Wednesday I should be able to get started printing the chassis, and hopefully be into construction by the end of the week.
Wednesday, 19 August 2015
Week4
***Blogger deleted this post. Apparently in this case Ctrl+Z was a convenient shortcut for "irreversibly delete all text in the HTML editor". This is the rewrite, and as such is a but rushed and light on details.***
I did a good bit of research into servos today. I ended up ordering 20, to allow for 2 faulty ones since they're fairly low quality. Hopefully I won't have that many failures, but I'd be in trouble if I had to wait another 1-2 weeks for replacements to ship. The model I bought is the TowerPro SG90, which are a reasonable balance of torque (1.8kg/cm) vs cost (and far, far cheaper than Jaycar's $30 per servo).
Elliott recommended an ultrasonic rangefinder for use later on in the project, if I get that far.
Most excitingly, amidst concerns that I would have to design and construct the chassis and legs of the hexapod from scratch, which would have been extremely time consuming, I found this Thing on Thingiverse. It's a complete set of parts made specifically for SG90 servos, and I found it after ordering them. I still can't believe my luck.
Next up on the list of things to do is finish the design/parts list, start printing the chassis, and start wiring the circuit in anticipation of the servos arriving.
I did a good bit of research into servos today. I ended up ordering 20, to allow for 2 faulty ones since they're fairly low quality. Hopefully I won't have that many failures, but I'd be in trouble if I had to wait another 1-2 weeks for replacements to ship. The model I bought is the TowerPro SG90, which are a reasonable balance of torque (1.8kg/cm) vs cost (and far, far cheaper than Jaycar's $30 per servo).
Elliott recommended an ultrasonic rangefinder for use later on in the project, if I get that far.
Most excitingly, amidst concerns that I would have to design and construct the chassis and legs of the hexapod from scratch, which would have been extremely time consuming, I found this Thing on Thingiverse. It's a complete set of parts made specifically for SG90 servos, and I found it after ordering them. I still can't believe my luck.
Next up on the list of things to do is finish the design/parts list, start printing the chassis, and start wiring the circuit in anticipation of the servos arriving.
Tuesday, 18 August 2015
Arduino test #1
I bought a Freetronics Eleven on Sunday so that I could test my ideas at home, to see if they're viable. I haven't had time to do too much with it, but by splicing two example scripts (one to make an LED blink and another to make a servo sweep back and forth), I made it do both of those. Here's a video!
I'm a little worried that the servos might not be strong enough for the legs. I might have to double them up, which will add complexity to the design, since servos are fairly big on the scale of a small robot.
[EDIT]: On further research, it looks like one servo will provide plenty of torque, so that's one problem out of the way to make way for the next one that's popped up: holy crap, servos are expensive. Jaycar has them at around $30 each, and I need 18, minimum 12. Oh dear. eBay has listings of 5 for $15, but they're probably quite crappy.
[EDIT 2]: I uploaded the script that I used in the video to https://gist.github.com/halbrd/5a69cab14f40a11429cddb73a1ca7262.
I'm a little worried that the servos might not be strong enough for the legs. I might have to double them up, which will add complexity to the design, since servos are fairly big on the scale of a small robot.
[EDIT]: On further research, it looks like one servo will provide plenty of torque, so that's one problem out of the way to make way for the next one that's popped up: holy crap, servos are expensive. Jaycar has them at around $30 each, and I need 18, minimum 12. Oh dear. eBay has listings of 5 for $15, but they're probably quite crappy.
[EDIT 2]: I uploaded the script that I used in the video to https://gist.github.com/halbrd/5a69cab14f40a11429cddb73a1ca7262.
Wednesday, 12 August 2015
Week 3
This week, we narrowed down what my research project will actually involve. The Arduino hexapod is pretty much locked in at this point (and I can't change the url of the blog). In theory, it should be very doable, since the most basic structure of the hexapod is just an Arduino board and 2 (or 3, depending on design) servos (or more likely stepper motors for their greater strength) per leg, with the legs themselves and a chassis. Anything else is, ultimately, optional. That said, I'm not by any means assuming that it will be that simple. I have no doubt that there will be plenty of obstacles to overcome.
After the project description is finished, I'll start the design.
After the project description is finished, I'll start the design.
This is the first post! It is a test!
I'm fairly optimistic about this project. I wonder how long that will last.
Subscribe to:
Posts (Atom)


























