Coding Coding Coding
Yeah, so no visual update today. But now I am in the coding phase. So far, this is what I have gotten done:
- Homing code that can be run in the main loop as the Uno only has 2 hardware interrupts and I need 3 for each leg.
- A robust proportional regulator that runs the leg at a given speed. The static friction in the motors seems to be pretty high so they need a bit of a kick to get started. The P-regulator gives that initial kick and can then keep the motors moving at very low speeds.
- A framework that accepts commands over the serial port without blocking
- A framework to live-stream raw data from the device so I can visualize it in Matlab
- A Matlab-script that parses the data and shows me the dynamics.
All-in-all, the motors and drivers seem to be extremely capable and go up to max speed in about 0.2s. Now I have also learned how H-bridges can break motors to a stand-still which means I can also stop the legs in a similar timeframe.
Mounting The Legs Part 1
So my first print of the new legs got ruined because of two level shifts. But Eric was nice enough to restart the print. So another 48 hours and 200g of plastic later I could go an pick up the finished print. I found there was some warping on some of the axels, but nothing that hinders their function.
A little cleanup later, and we have a pretty set of parts. Here I haven’t drilled out the support structures inside of the holes, though. That turned out to be rather hard and I have broken one so far by drilling straight through it.
If There Were No Tears The Lesson Was Not Learned
Yeah, so I had some setbacks. When putting it all together, I noticed that 3 of the legs moved nicely, but the other three did not move well at all and I could see the plastic flex as the motors turned.
I had clearly made one of the simple beginner mistakes. I had designed a stiff design that required tight tolerances, without having the manufacturing techniques to get tight tolerances. The holes in the leg axels are simply drilled and that does not give me a round and precise enough hole for the axels to be perfectly colinear with the shaft. Then I tighten the set screw and I get a stiff and crooked machine. Not good at all.
Putting It All Together Part 1
Yesterday I wrapped the controller board as well. Now, all connections are in place on both boards.
I checked for shorts and found one, so I hope that was the only one….
I also collected the 3d-printed covers to protect the wires above. A single quick move with a screwdriver could really mess things up otherwise….
And with that, I am starting to put everything together.
So now I will slowly connect things one by one to see that it all works and nothing is broken…..
Complete Driver Board
So I wrapped the entire driver board, and it worked perfectly on the first test. So now I have a board with three dual-driver cards that can power and controll a total of 6 motors complete with all of their detectors.
Also, I don’t think I have uploaded a picture of the entire development setup. In the foreground, you see the backside of the powerboard with all of its wires. In the background, you see another board with two mini-computers on it. One is an Arduino that I use for the real-time stuff. Here you see an Uno mounted, which does not have enough pins to control all of the 6 motors (7 pins per motor means 42 pins, of which 6 analog-in and 6 PWM). So the plan is to place my Due there to be able to controll all motors at the same time.
Mix And Match
So lots of tiny pieces on the way now.
First up I realized that a Resperry Pi Zero W is super tiny and allows me to maintain an entire development environement onboard. As soon as it boots, it connects to the internet and I can ssh directly to it. If I install platformio and a console text editor then I can keep the entire development environment onboard.
Second, I have a complete set of breaker plates being printed.
New Power Board
Time to add the full det of 6 legs, so i need a new board to mount the motor drivers.
I took the time to draw up a cleaner design and it is looking very promising. So far, I only wired up a single breaker, but all of the power rails are in place which should allow for massive power and clean wiring even when everything is connected.
Mass Production Starting
So the last weeks I have mostly written code. I now have a nice framework with a command parser that can do the basics.
Today, I felt I was ready to start building the remaining four legs so I can try out the full six-legged locomotion. That means that I will need to buy all of the parts so that will be rather expensive….
But today, I started with printing out 4 sets of legs and began the machining of the leg axles.
Leg Regulator Finally In Place
So I went to the makerspace today to make sure I could debug any driver electronics issues I might have had with the oscilloscope.
It turns out that I probably did not have any and the motor seems to kick in at about 1.5-1.7V which I think is OK. I get about the same values if I use a power cube as if I use the on-board driver so all is good.