Pi2 Tank with Pan/Tilt camera and led headlights.
This will be my 3rd foray into tank building and now that I have learned the basics I will concentrate more on the design side of the physical tank. This will be a slow build so check back often.
One lesson learned along the way that is extremely important is the chassis. Does it provide enough real estate to accommodate the Pi, the required battery packs and any other hardware you might wish to attach, i.e., lighting, camera, robotic arm, etc. My second tank failed this test completely. While it was a good tank with respect to operation it was very difficult to configure for battery storage, cameras (I gave up), etc. This third tank will meet these requirements. It has a large base plate with lots of predrilled holes mostly of the M3 and M4 diameters This will allow for the use of extruded aluminum rails of the 20X20 MM type from which I can build storage areas for batteries, etc. Also of importance are the motors, especially the gear ratio. Are you looking to build a speed demon or a work horse. Also do you want motors with encoders. These require a different level of expertise and a different hardware configuration. If you get a motor with encoders you can remove the encoder and use just two wires or you can just attach “+” “-“ wires of the 6 wire bundle from your encoder to your motor hat.
The use of 20X20 extruded aluminum does add a bit more complexity to the build. Namely how do I cut it? and more importantly how do I cut it square? Both questions are answered simply by stating you build yourself an “aluminum jig” and use a quality hack saw with a T24 (refers to number of teeth) blade. Here are a few pictures that will answer all of your questions.
You can click on the following pics for an expanded view.
Now for question not answered. First let me say that I am not endorsing any particular vendor/merchant. That must be your choice. Where to buy? Most of this build for me will be with components from Adafruit . This includes the Pi, MotorHats, aluminum bar, plates, screws, leds, etc. The tank chassis was purchased from: AliExpress (the vendor/merchant in this provided link) . My experience with both of these merchants has been most positive. With respect to the tank chassis there are many different types and configurations and different vendors from the one I linked to. The vendor I “linked to” was most responsive to questions asked and made recommendations. Other were not so responsive due to language difficulties. Remember these are Chinese vendors and their grasp of English may not be that good and your “grasp” of Chinese is probably worse so be patient and polite. Read the specs on the chassis posted by your vendor. It should provide you with information about the motor and assembly instructions (no the tank is not assembled when you get it and it does not come with assembly instructions but it is fairly easy to assemble regardless of the the chassis you buy. Of the tree tank chassis I have purchased all were complete and included a few “extra nuts/bolts”. What was missing were lock washers which I purchased locally at a big box store. Most carry M4 (metric) stuff and a few carry M3. The lock washers are not absolutely needed but I prefer using them to ensure that things don’t come loose with use.
Lets begin the build.
|Initial assembly of the main components: base plate, two side plates and both motors with drive sprockets attached (more about them later). I am trying to see how these parts fit together so that I may determine how to add a battery compartment and the “parts” necessary to build it. All the exposed nuts and bolts connecting the base plate with the side plates in this picture are M3 with the added lock washers. On the side plates you will notice some odd nuts. These are T-nuts. These did not come with the chassis kit but were ordered to support the installation of the 20X20 extruded aluminum rail. Unfortunately for my configuration Adafruit only sells T-nuts tapped for M4 bolts. I needed T-nuts that would accommodate the 20X20 rail and also accommodate M3 bolts. The holes drilled in the side plates are M3 size. I was able to locate these at AliExpress. The motors with drive sprockets were installed to reveal any possible issues with the battery compartment. I am glad I did this because the motor connectors required additional space which I would not have noticed had I waited to install the motors later.|
|This shows the cut aluminum rail sliding onto the T-nuts. These nuts are designed to fall in and out of the rail’s channel but during tightening they will turn 90 degrees and bite the rail holding it firmly if you do it the right way.|
|Here is the right way: Let gravity do its part. The first picture shows the nut lengthwise in the channel so the bar will fall out of position. The second picture show how the nut turned 90 degrees engaging the channel and securing the bar to the side frame. Do the middle nut first because it is not visible from either end and you must be sure that it “turned” and grabbed the channel, then do either end bolt next and visually inspect.|
|Here are two battery packs. The white is a regulated power bank for the Pi2 and the other will deliver power to the MotorHat and the motors. They are just laid in place as we “build as we go”.|
|We have now cut some Plexiglas to attach to the rails. For now it lays on the rails. Remember this tank is upside down in these pics. Not sure if I will use the two-hole fasteners or not. For now just building on the go.Plexiglas can best be cut with a Plexiglas knife. They are cheap and they cut and score a channel into the glass allowing you to easily snap it along the channel. Stanley knifes will cut but not score and I don’t believe they do as good a job.Oh!! Did you notice how clean the cuts are on the 20X20 bar?|
|Drilled out the Plexiglas plate for mounting to the rails using M4 bolts and T-nuts. Notice how the T-nut drops into the rail channel in the second picture and that it rotates 90o when tightening as shown in the third picture.|
|Plexiglas plate in place with two aluminum support braces at mid point on the rails. I decided to add these to provide additional support to the Plexiglas. Also I have turned the motors 90o to move their electrical connectors away from the Plexiglas.|
|Under glass and other views.|
|Added two 5MM led holders. The predrilled holes were too large so I had to use metal washers on both sides to mount the led holders.|
robotic arm arrives. see build and software to control it here
|after playing with the robotic arm started to move on with the tank build. Using an Adafruit Perma-Proto Pi board (it fits nicely) I soldered the board to handle the led headlight interface. Picture is not that good but …. I then mounted it to the motor HATS below it using nylon standoffs.|
|At this point I am playing with battery positioning storage. Two battery packs (12V, and 6V) are required for the drive motors and Leds and a third battery pack (an Adafruit PowerBank) for the Pi2 . These must be placed for easy removal for charging. This is always a challenge. The picture to the right shows the placement of the 12V and 6V packs. A later picture will show the placement of the PowerBank.|
|Placed an 8×10 piece of Lexan on top of the rails. The battery packs (not shown fit underneath the Lexan). The Pi2 with two motor HATS and the led circuit PCB is loosely placed to get an idea of how to run wires.|
|Lego baseplate is place on top of the Lexan (it provides the strength that the base plate lacks).|
|Playing with Lego Blocks. Notice the PowerBank for Pi2 (white brick in these pics). The legos toward the bottom of the pic will provide a “cable tray” for the camera’s USB cable. The camera will mount to the small grey elevated base plate OR it might use standoffs.|
|Taking a different approach to camera mount and tow (robotic arm) capability. I disassembled the robotic arm and made two arms. Both arms will employ 4 servo motors combined and not 6 as in the original configuration. This configuration required a different configuration to the front of the tank and required extending the rear of the base platform.|
|To the right is how it will look.|
|Here is how we got to the above configuration:||
Note above how the T-nuts hold the front black bracket to the aluminum rail.The rail is also fashioned to the tank’s base plate using the same arrangement.
|The small USB camera became a problem to mount because it was basically a PCB board with a lens. I could not find a mount for it so I started to look at “printing” my own mount. I spent days reading about 3D printers and how to build a 3D print from scratch to finish. Luckily I found a local company to print a mount for me. So off to CAD school. Click to see results of camera enclosure.|
|122415 – Have completed the physical build of the tank and you will note that there are differences from the above pictures. For example, different style battery packs, use of M4 standoffs, etc. Just cosmetic and you will probably go through the same gyrations in your build. These pictures show the “stacked” Pi2 column with two MotorHATS, a PCB for Led Headlights, and I added two switches to power on/off the two battery packs (not shown) for the MotorHAT and the SevoHAT. I have totally abandoned the the Lego approach and am awaiting the arrival of a 3D printer from which I hope to fashion a tank body, cable trays, battery compartments etc. The current weight of the tank is 5 lbs. with battery packs.Now to install the software. This procedure will provide the steps necessary to implement a PS3 Game Controller. Refer to this page for how to install all required software .|
Here is a vdeo of a static test of the almost completed tank. The tank is controlled by a PS3 game controller utilizing bluetooth, a RaspberryPi 2, two Adafruit MotorHats, a led circuit board and 3 battery pack power sources. The forward arm mount is not done at this time.