Long time no see…
I should have written this a long time ago, but things have gotten in the way…
The arduino quad has come a long way since my last post, it’s built and it has gone through a couple of circuit revisions and software variants. I had a lot of problems on the way and I still haven’t fixed most of them.
Anyway, I decided to build it from FR4 which is PCB reinforced fiberglass. I love to build using this material because it’s very strong but still a bit flexible. The disadvantage of course, is the fact that you have to etch the copper off the board before you cut it and a lot of fiberglass dust is created when working with FR4 and that’s not really good for your health.
On to the build
Having a 3d model of the quad made in Solidworks, I made the drawings and printed them out to scale, then cut out the paper parts, marked them on the FR4 and used a coping saw and a dremel with a thin cutoff disc and abrasive cylinders to make and finish my parts. This took about half a day. I went through about 5 coping saw blades because the dremel made a lot of fine dust which made a mess but the saw made courser particles and they were easier to clean up, plus, there’s a smaller chance to screw up with the saw going slowly.
I assembled the servos on to the parts using the screws that came with them and the circular horns. No issues here.
I designed the shield for the Arduino in Eagle and made a few mistakes, for example not taking into account the length of the servo wires. I just put all of the headers in a line and some of the wires were stretching a bit when the legs were fully extended.
Another mistake was the method used to supply 5v to the servos. I hadn’t expected them to need more than 1.5A. Biiig mistake. I only put a 7805 voltage regulator on the shield with a big heatsink and, obviously, it didn’t last more than a few seconds. After reading some posts online about supplying power to a lot of servos I found that due to their design, you can’t put more 7805s in parallel because one of them will take most of the load, so basically I had to choose between a UBEC, which is basically a switching regulator, and no regulator at all. The problem with the UBEC was that I didn’t have one and 6 amp UBECs are over my budget, but this would be the most efficient way to get the power down from the LiPo’s ~8V to the 5V I needed. So I decided to take a risk and go without a regulator hoping that 12 servos would cause a big enough voltage drop to not cause problems. Baaad idea! Apparently servos don’t run without smoke in them, and as soon as one of them let the magic smoke out, I decided that I needed another solution to my voltage problem.
After a couple of weeks of pondering whether or not to buy a UBEC, it dawned on me that it would be possible to use a voltage regulator for each of the four legs thus each regulator would have to supply only three servos. The second version of the shield included a header for a Sparkfun Bluesmirf Silver bluetooth module which would allow me to send commands to the quad from a phone or a PC. Naturally, I didn’t account for the thickness of the heatsinks that would be mounted on the 7805s and I had to unsolder two of them, mount them on a single heatsink and run wires to the board… oh well. At least now I have a good power supply (even though some decoupling capacitors would have been a good idea now that I think about it).
Moving on to the main problem of this quad.
The jitter is strong in this one… Due to the fact that I’m not using PWM pins on the Arduino because there aren’t enough, after a lot of googling, it turns out that arduino can’t supply a constant signal to the servos and this results in twitching of the servos. Basically, every 20ms you send a high signal to the servo. The time you hold the signal high determines what angle the servo goes to. The problem is that the arduino isn’t able to produce signals of consistent width. It’s either this or the cheap servos. Or both. If it’s the servos, I’m scrapping the project. Because of this, I haven’t really concentrated on the gait program, the only thing I did was the inverse kinematics.
After thinking things over, my conclusion is that dedicated servo hardware is needed. So i found the PCA9685 (datasheet) which is a I2C bus PWM LED driver with 16 channels and 12 bit resolution. This means that I only need two arduino pins to control all of the servos and I can add a few more for sensors or something. By the way, if this fixes the parkinsonian behaviour of my bastard four legged child then I will consider replacing the arduino with a Raspberry Pi which opens up a whole new world of possibilities.
I got the idea to use the PCA9685 seeing that adafruit made a servo driver with it. Because shipping would cost more for me than the board, I ordered the chip from Mouser and plan to use it in the third version of the quad shield using the schematic from the adafruit board. I found it only in a SMD package so this means the quad will get its first double sided PCB. I started designing the shield on circuits.io but before being able to complete it something went wrong and now I can’t edit it nor view it. Half a day down the drain I think.
The third version of the shield will have the PCA9685, two additional servo headers, the bluetooth module header, and if I have room, a voltage divider for measuring battery voltage.