2019 was a sad year for robotics and space enthusiasts alike as the Opportunity rover 'died' on Mars after a record-breaking 15 years of operation. This tutorial describes our journey in the construction of a rover based on the mentioned marvel of engineering. It makes a great summer project and can be endlessly elaborated upon until you reach a machine with a complexity rivaling Curiosity or Opportunity.
The project took us (a group of 3 high school students) about a week and a half to complete, with an average of around 1.5 hours of work per day. Keep in mind, however, that we were often improvising the design and therefore experienced errors that you can avoid.
The finished rover operates great on almost all surfaces, but the wheel design makes it optimal for outdoor operation. Feel free to investigate the far reaches of your personal wilderness with the rover's live streaming, or go look for that tennis ball you lost a while back, at night, with the help of the rover's headlight.
Please keep in mind that this is not necessarily the way to build your rover, but rather an explanation of how we built ours, and how you could model yours after a similar fashion.
Please note that many of the photographs include on-screen notes. So be sure to look at all photos when building the project. Overall, the main purpose of this tutorial is to provide a photographic journey of our project, with suggestions to help you along. I think that there's a lot in this project that deserves to be improved so I've shown many different ways of doing things, where possible.
Supplies:This is a minimalistic list of supplies required to build the basic version of the robot.
Hardware:
- Screws, nuts, bolts (assorted)
- Robot chassis frame (the one we used can be found as a kit here, however, any similar frame will do)
- 3D printed chassis components- we used this for everything except the main body. The parts can be printed in any filament type or color.
- Assorted aluminum pre-machined or raw plates, bars, etc. We used some VEX EDR robotics equipment for the suspension on the rover because we were pressed for time; however, this is easy to build on your own from wood
- Assorted plastic sheets (varying thicknesses)
- 2x foam rollers, about 8-10cm in diameter
Electronics (what we used):
Sensors: HC-SR04 (ultrasonic sensor), gas sensor, raindrop sensor, humidity sensor. I am not specifying a manufacturer because these are widely available on Amazon and eBay, as well as "official" retailers, and very easy to find. You may also want to add or take away sensors based on your own preferences. H-bridge modules: The rover operates off 3x L298N modules, such as are found here. You can probably manage with a single module, but this will decrease max current per branch and overall be prone to easier burnout. Batteries: any standard power bank with a 5V, 2A output, with a micro USB connector for the Raspberry Pi, such as this. You will, in consequence, need a USB to micro USB cable. The rover itself runs off a 12V 1.3Ah rechargeable lead-acid battery, such as the one here. The battery that runs the motors must conform to the H-bridge module's max power ratings (be sure to double-check this on your own). Motors: We used the same motors as found on the Thingiverse website: https://hobbyking.com/en_us/133rpm-brushed-motor-w... These are the ones that the chassis is designed for. Servos: https://www.amazon.com/SunFounder-Digital-Helicop... Miscellaneous components: Basic, run-of-the-mill electronics components and related equipment
- Raspberry Pi 3 with NOOBS installed on a microSD | Or an Arduino of any type, although I do not provide any code or specific wiring diagrams for this alternative
- A computer
- Modem (if possible)
A basic understanding of the typical rocker-bogie system is helpful when building this project. See:
This video reference provides good visualization as to how this mechanism works.
The idea behind this design is that it can overcome many different obstacles with minimal shock to the scientific payload the rover may be carrying. This is accomplished by linking the two sides with a 1st class lever, the fulcrum being the rover's base. In this setup, there is no definite fulcrum and load, however; the lever merely averages out any movements generated by the two legs. This is an extremely useful application. This device is known as a differential bar.
We apply this design in our robot tom minimize shaking and unevenness because we control the robot via live stream and the less shaking, the better. In general, some sort of suspension is better because it increases the longevity of the electronics inside. This specific type is good for climbing over obstacles.
As well, it looks the coolest. (Sources say this is why it was chosen by NASA for Curiosity...)
The real rovers have pivoting front and rear wheels, which decreases wear when turning. For our purposes it will do to omit theses mechanisms because any minor deterioration we can fix, unlike a robot which is on another planet. I will discuss how you can add this later on.
Step 2: Building the Chassis: Version 1This is the version that this tutorial focuses on.
Obviously, you will need a 3D printer to get the parts printed out or at least access to one. There are many online services that will print things for you at little cost. You should follow the instructions found on https://www.thingiverse.com/thing:1318414 for details on how to assemble the legs of your rover. You will need 3/4 PVC tubing for this, as well as other components that are listed there. Credit to M. Larkin for sharing his design with the public.
The metal frame, to be used as the base for all additional superstructures, can be manufactured by yourself if you don't have one handy, as we did. The main thing is that the frame is large enough to contain all the H-bridges and rigid enough to withstand common use. The frame will be under considerable stress so make sure it is strong enough that you cannot bend it with your hands. Alternatively you can use any commercially available container, as long as it is rigid.
We attached the two leg assemblies together by means of a threaded rod. This allowed the base to pivot until we added the differential bar. See the photos for the explanation.
Our base had a screw-on plate onto which we attached other devices. Depending on what you are using, you may or may not have this option, so be sure to plan accordingly. You will want to have all high-power applications mounted underneath, so keep this in mind as well.
Mount your battery underneath the robot. We attached it with zip ties to the threaded rod. The closer it is to that rod, the better; for that threaded rod is carrying all the weight and there's no point in putting too much stress on any other part of the platform. If you have space inside the container, then you can try mounting it inside, just make sure that any chance of short circuiting is null.
The advantage of having a closed box for the main base is that anything you mount inside will be protected from external elements. If not waterproof, it will be at least easier to carry.
Step 3: Building the Chassis: Version 2If you don't have a 3D printer or prefer not to use one, you can build the rocker-bogie chassis on your own from piping. The one pictured was built using an old curtain rod. Don't worry about the fancy gears up top, I'll go into that later.
You may purchase or use commercial bearings as pictured, or, if you're not very concerned about the longevity of your rover, you can make them out of plywood or plastic. A diagram with the main points you should strive for is included above as well.
Key things to keep in mind are:
- Rigidity. That joint you made may seem "good enough" but "good enough" will quickly deteriorate to "broken" when you start driving your rover around. It's better to over-design your robot rather than the opposite.
- Weight. Obviously it shouldn't be light enough to be blown away, but the excess weight will put unnecessary strain on your drive motors. The heavier it is, the harder it will be to traverse obstacles.
You can use the same motors if you choose to go down this path, or you could buy more powerful ones. The ones we used weren't as strong or long-lasting as we had hoped. A better option would be something like this.
Try to use locking nuts whenever possible- these will last longer. Things tend to loosen very quickly when under constant stress.
The acrylic frame was cut out with a hacksaw but has turned out too flimsy so far. I may have to redo the design.
Step 4: Mounting the ElectronicsYour electronics should be mounted in an easily accessible but protected location. What was done in the example build is a plate with the electronics pre-wired and securely mounted on a piece of acrylic. If repairs are required, all that has to be done is take off the metal cover, and all is within reach. It's quite difficult to break anything when the cover is on, however.
What we didn't do but should have done was set up the Raspberry Pi after a similar fashion.
Be careful with your wiring- it's better to overdo safety than the opposite. Even plain grass tears up connections pretty quickly, so zip tie all loose wires and cover soldered connections with electrical tape.
Step 5: Wheels and MotorsAt the time of the build, we didn't have any commercial wheels that were suitable for outdoor operation, so we decided to make our own from gym foam rollers.
The rollers we purchased from the dollar store for about $4 each- they were each large enough to make 4 wheels. We cut them lengthwise into segments about 3" long, and glued wood backings to the inside, in order to drill a hole in the wheel structure for a smaller axle.
The wheels were mounted on brass couplers, which were in turn attached to the motor shafts. Some superglue was added to all joints to ensure they would not slip during operation- as the wheels are attached to the couplers by means of a bolt, this is a possibility. Threadlocker was also used on the clamping screws in the couplers.
The motors and corresponding mounts of this specific design are meant to fit together, and you will only require some nuts and bolts to clamp the collars onto the motor body. You may find that the motor is still loose, in which case you can put some tape on the outside until the diameter more closely matches that of the collar- we had to do this with a few motors.
Step 6: TurretThe turret serves to facilitate directing the camera at various points of interest. We included an LED headlight to enable operation in darker areas, and an ultrasonic sensor to measure the distance between the camera and whatever we are looking at.
The physical structure is built of pre-machined aluminum parts we found in our school, left behind by a robotics team we used to have at some point. Once again, it is not hard to build something like this yourself, and you are likely to be able to find something similar on Thingiverse. You can buy a similar gimballing camera mount on Amazon, here. Alternatively, you could 3D print something like this.
The idea is to rotate the camera up and down and side to side with two servo motors.
Mount the camera, LED headlight and ultrasonic sensor close together, using small screws and/or super glue to secure them. We used transparent acrylic because it is easy to cut and looks nice.
Step 7: Solar PanelsOne of the key attractive features of this robot is its solar panels. They are perhaps unique in the sense that they were made from the cheap solar lights you would buy at a dollar store. Instinctively, you might feel that this can't be all it takes to power this robot- and in fact, you're right. All these panels do is recharge the power bank that is used to power the Raspberry Pi.
6 of these turned out to be enough to charge the power bank. The assembly is wired as 2 sets in parallel of 3 panels in series.
The power bank is set in "charge" mode by turning on a switch, and the solar array is wired to a micro USB that can plug into the bank for charging. Obviously this is a very primitive method of charging but this area was not required for completion of the project. There are countless tutorials online on designing a solar power charging station that you can follow. However, those will require you to purchase higher-power panels than the ones pictured.
Step 8: ElectronicsThe basic electronic configuration is shown in the diagram above. Since you may choose to configure your setup, you may have to change some variables in the code but those are superficial details. If you want to use the "template" code that I've provided later on, be sure to go with this exact wiring setup. Otherwise, it does not matter overmuch.
What you need to pay attention to here are the connections for the H-bridges and servos, as these are the ones the program uses. You can power the Raspberry Pi from the +5V output on the H-Bridges as well, although depending on the current drain this may cause undesirable effects with operation. The LED mount is merely 4 LEDs in parallel with a 220ohm resistor, connected to +5V from one of the H-Bridges. You may want to install either a mechanical or transistor switch so that you can turn off the light when you don't need it.
Any additional sensors use the +5V from the H-bridges.
Step 9: Setting Up Your PiThis is where I'm going to be ambiguous, for a few reasons.
As most people don't have access to a computer they can use for one sole purpose, they are probably going to things differently. This "different" method is in fact the popular and "correct" method for using your Raspberry Pi.
- When working on this project, we were provided with an old computer that was essentially broken down. We repaired it, installed ubuntu, and ran some programs that you shouldn't run on any half-decent computer in order to use it as an interface with the Raspberry Pi.
- The "correct" method is also well-documented. For this reason, I'll tell you what to do rather than how to do it.
Assuming you have some experience with Raspberry Pi, you probably have already been able to connect to it wirelessly. If not, follow the tutorial below:
https://rimstar.org/science_electronics_projects/c...
You will also need some sort of modem for remote operations. In our experimentation, we were able to get around 40m away when the modem was in a direct line of sight with the Raspberry Pi. This means you might want to mount your modem somewhere high, preferably outside (if that's where you're operating).
If you do not have access to a modem you can still operate the rover with a tethered cable by following this tutorial:
https://rimstar.org/science_electronics_projects/c...
Step 10: Code and FeedbackOnce again, I'll be somewhat less precise in indicating what you should do. The code I have attached should be referred to as a template to build upon- it is limited to simple controls. Double-check to make sure your wiring matches the pinout used in the code; if you followed the wiring diagram in the previous step you should be good to go. None of the sensors are used in the template, but adding them to the code is not a hard thing to do. Copy this code to a text file and save as an executable file (.sh) on your Raspberry Pi.
The program is separate from the live camera feed, so you need to arrange your windows in such a way that you can see both. You can watch some screen recordings of our operating sessions to get a feel for what to expect from the template code.
The program will print out commands that it receives for debugging purposes in the command-line interface. You can expand on this to have it return data on battery voltage, weather, distance traveled, etc. Alternatively, you can use the pygame window that opens on startup (to read keyboard input) to display visual data.
You should be able to control the movement of the chassis with the up, down, left, and right keys. A, S, D and W are used to control the servo mount with the camera. Pressing X resets the camera turret to its default position.
Step 11: Swiveling WheelsThe real rovers sent to Mars have higher mobility than our monstrosity, partially because all 6 of its wheels can swivel. This enables strafing (moving side to side without changing orientation) and rotation without any lateral friction on the wheels.
If you're going to have swiveling wheels, the 3D-printable version won't do. The design does not allow for the construction of an additional platform that will house a motor to control rotation.
Here you can see my second and current project of the type.
You have a few alternatives as to how you can do it. High-power servos are available for sale which have enough torque to rotate a wheel assembly as needed, but these are a) limited to 180 degrees and b) expensive. I have not tried these for this type of application.
If you have a few geared stepper motors lying around (especially if you dabble in DIY CNC design), you can use those. They are fairly robust and powerful. If you don't have them, however, it's not cheap either. It's not hard to mount them (you can see how I did that above).
The third alternative is to use a small dc motor in conjunction with a worm gear to create a strong swiveling mount. This is comparatively cheap but isn't easy to build. Unlike the other two alternatives, you also need to install a rotary encoder or potentiometer to measure rotation because the DC motor cannot be controlled in terms of angle, only time it is on and voltage.
Step 12: Giving Your Rover a PurposeThe problem with most hobby-related robot projects is that they're built without any specific purpose in mind. It's always a good idea to design some sort of challenge for your robot to accomplish, regardless of how purposeless it may seem.
The 3D-printed rover that most of this tutorial is about was meant to compete in a school challenge representing a real Mars mission- we had to find a specific object in a courtyard and read off of a label from a room with no view of the outdoors. As you can see from the screenshot above, we were successful. The implementation of a challenge into the project meant that we had to complete multiple tests on reliability for various subsystems of the rover. Not only did this improve the final product's performance, but it was fun to do as well.
If challenges aren't up your alley, a specific task is still a good thing to have because it directs your energy towards ensuring functionality. No task to accomplish means that your rover has no specific purpose, so it's difficult to ascertain what needs to work well and what doesn't. An example could be the second, more advanced rover in this article- it is being built to act as a remote mobile observatory. It will have to be weatherproofed, unlike the first rover, because it will not always be operating in ideal conditions. As well, the general structure is adjusted to make room for a telescope that will have a high-resolution camera at one end.
It's things like this that make building robots on your own much more enjoyable.
Step 13: ImprovementsThere's a lot more that could be done. A few things include:
- A "night vision" camera, with infrared headlights to allow for unobtrusive nighttime spying. I think this application is particularly useful for monitoring areas with high skunk populations to determine when it's safe to walk the dog (or not). Here's an example camera:
https://www.amazon.ca/Smraza-Raspberry-Camera-Modu...
- A robot powered entirely from solar energy, kind of how early Mars rovers did it. You would need a substantial number of solar cells and recharge batteries for most of the day. It would be an interesting challenge to see how long you could operate a robot remotely with absolutely no human interaction.
- A robotic arm mounted on the robot. See if you can bring back an artifact located some distance from your abode. An added challenge would be to do this at night. The greatest challenge of all would be to avoid running into any skunks.
Etc. There are many ways you can go after you have a basic rover, or the know-how to build one. Hopefully, you found this tutorial interesting to read and helpful in your robotics endeavors. If you liked it, feel free to vote for it in any contest it may be in!
Step 14: Photos
Comments