Intro: DIY Arduino Remote Control and Lego RC Vehicle!!
Do you like Legos?
Do you like Arduinos?
Do you like RC things that you can bring to life with the flick of a thumb?
I certainly do, so today I’ll be showing you how to make something that combines all of the above into one and go over a ton of other useful techniques and best practices as well!
I’ll start by giving a brief description of what I made, and then I’ll follow with not just how to make it, but the reasons behind it too! By explaining all the steps involved (like the design, planning, 3D modelling, and even the Lego-building and laser-cutting!) and the decisions and thought process behind those steps (as well as the CAD files and code), I hope not only to share with you what you will need to make what I have, but also useful background and techniques that you can use not only in your own version of this project, but in all your other DIY projects too! Lastly, if there anything that I might have missed or that you need additional information or clarification about, or if you have any questions whatsoever, please feel free to ask me in the comments or to message me! Now lets get started!
As you might have guessed from the title or seen in the video, the project I've been hinting towards consists of two parts: a completely custom Arduino remote control, and a servo-powered RC Lego car!
The Lego part of the RC vehicle is a medium-sized chassis built around a Lego drivetrain with four-wheel drive and four-wheel steering. The RC part is a set of four standard hobby servos powering the drivetrain; an Arduino, for controlling everything; and an XBEE radio, for communication with the remote control. There is also an onboard power supply (it’s an RC car! Of course it has one!).
The second part of the project is the remote control. It’s about the size of a Gameboy Advance; has a 2.2” LCD color display; is built around an Arduino microcontroller; has a joystick, two potentiometers, and four buttons for input; and has the same type of XBEE radio module the RC vehicle does. All of this is housed in a custom enclosure made entirely from laser-cut acrylic. The remote control supports USB cable operation via the serial port on the Arduino, but it can also be operated off a 9V battery which can be mounted onboard, allowing the entire remote to be operated, well, remotely. Fun stuff.
Now that you know what you’ll be making, we can start actually making it.
Everything you'll need file-wise is available for download on my site, Kayrus.com.
Here's the link: www.kayrus.com/legos/diy_rc_zip (it should download automatically)
Included in the zip file are the latest Inventor part files (.ipt's), the combined AutoCAD drawing (.dwg), and the latest Arduino code for the car and Handuino (.ino's) and I'll let you all know if I make updates or improvements to these!
Step 1: Designing the Remote Control..
The first step to making a remote control of your own design is deciding what types of inputs and outputs/feedback you want your remote control to have. You should also consider what form factor you want your remote to have, because this may affect what types of inputs and outputs you can fit in it.. You could make it like the stand-up RC car controllers, with their steering knobs and triggers; you could make it larger and give it two joysticks and a couple of flip switches, like those RC plane remotes, or you could make it to your heart’s content and give it a built-in speaker for voice feedback and force-sensitive touch control (that's not a bad idea...)—the possibilities are only limited by your imagination...and the size of the battery you want to carry along with you (I'm not kidding).
For my remote, I eventually decided that I wanted something I could carry in the palms of my hands, like the Gameboy Advance I used to play with many years ago; something with a variety of input types, because I wanted to be able to use it for different applications; and something with immersive feedback capabilities so that I could know what was going on without the use of my computer.
Considering all this, I decided to give it a 2.2” LCD TFT color display from Adafruit Industries, because it was well-documented, well-priced, and known for its Arduino compatibility (most of Adafruit’s selection is!); fourpush-buttons in typical game-controller configuration; twopotentiometers with custom3D-printed caps for precise, but comfortable rotary input; and an off-the-shelf joystick with analog horizontal and vertical output (it was also supposed to let you click the joystick and use it as a button, but that function never actually worked as advertised).
After figuring out what I wanted, I did some conceptual sketches. This "design phase" is particularly important depending on how you plan to manufacture the actual enclosure (case, body etc.) of the remote. In my case, I planned to laser-cut the entire enclosure from transparent acrylic. This, however, is somewhat of a luxury if you're a student (like myself). Luckily, my school happens to have one that I can use (if I had one of my own I would be using it all the time), but don't worry if you don't have access to one, because not only are there other materials you can make your enclosures from, but there are other means of getting your parts laser-cut or 3D-printed for you! For example, Ponoko is one online service that can ship you your custom-made parts, but if that's too expensive or not your style, you should consider another building material, like Sugru, or consider cutting out your parts with an X-Acto knife. If you do use an X-Acto knife to cut out your parts, you probably won't be able to have them fit together without adhesives, but it still functions just as well (the design I laser-cut fits together without tape or adhesives).
If you do have access to a laser-cutter or 3D-printer (or on online service that can provide you with those tools), you'll have to design those parts using computer-aided design (CAD) software (like Inventor). The benefit of this type of software is that, in addition to being able to make parts precisely and with all sorts of features, you can also make the parts in an assembly and see how they all come together (we'll go over this later). Before you can do this in a computer, though, you should plan it all out on paper.
To plan your design out, you need to start by getting all the dimensions of the parts you want to use. Often this can be done by looking up the dimensions or original spec sheets for the parts online, but occasionally you may have to measure them yourself in the case that a specific dimension is not available or if you want to double or triple-check something. In the case that you do want or have to measure something yourself, I recommend the use of a caliper—they’re great for making precise measurements quickly and conveniently so, if you don’t have one, I highly recommend picking one up from your local hardware store or online.
Once you have the dimensions of all your parts, you need to figure out the layout of your remote. This includes not only the position of all the parts, but their orientation as well. At this stage, you don’t need to figure out exactly how the parts will be spaced out. Instead, it’s more critical that you figure out a design that will fit your needs and wants. In doing so, though, you still need to consider how the enclosure will come together, including where each part will go and what will keep them together (its a bit like a puzzle, but its fun!). You will also need to consider how you want to mount all the parts—you don’t need to figure out all the details now (like the diameter those holes need to be if you’re using nuts and bolts) but you should decide whether you want your parts to snap or press into place (most of mine do) or if you’re okay with hot-gluing them to each other or using some other adhesive or fastener.
While thinking about how to put the enclosure together, you should also be thinking about how to take it apart. This will depend on why you’re building the remote in the first place, but you need to think about the components inside the remote that you may want access to later on, and what type of access it is you want: or you okay with taking apart part of your remote just to reprogram it?What will you do if some wires disconnect or you need to replace a bad part? For my remote, I made it so that the back of the remote left the Arduino's top face completely exposed—this may be bad in the long run protection-wise, but the access it gave me to the ports was critical to my improvement of the remote and will allow for other capabilities to be added later on without the need for taking the whole thing apart (although I still do that occasionally just for the fun of it) (and yes, you most certainly can design a removable panel that gives you both access AND protection—I just didn’t get around to it).
Lastly, but not least importantly, you need to think about wiring. Yes. Wiring. In larger remotes, you don’t really need to, but in smaller remotes like mine, where there’s not a lot of leeway between the Arduino and the components, you need to think about how everything will fit or if you need to have access holes here and there (I sure did), or you might find later that its extremely difficult to put together. EXTREMELY DIFFICULT. Everything in my version fits (albeit just barely) and I don’t want to discourage you from pushing the boundaries of enclosure-design, but take it from me: it’s much better to account for things before you’ve built them than afterwards (unless, of course, you’re open to building them again).
Step 2: A Little Redirecting..
Once you have a design done with pencil and paper, it’s time for you to turn it into a reality:
If you’re not planning to use a laser cutter to cut out your parts (or a 3D printer to print them), the following few sections maynotbe as useful to you (you’ll want to stick around though for the RC car and the wiring and programming of everything) because the following is about using Inventor to model your design.
If you plan to make my remote exactly as I have, then the following isalso not necessary (although it may be useful here and in the future). Skip ahead to where I discuss the use of the laser cutter.
(NOTE: I don't have a laser-cutter, but if I had one, my project output would increase ten-fold and it would enable many of my shelved projects to come alive once again)
Step 3: 3D Modeling in Autodesk Inventor
For those of you ARE going to laser cut (or 3D print) your own design, our journey continues into the world of CAD. I used Autodesk Inventor to create my enclosure digitally, because it is a powerful tool that is available for free as a student. While many other CAD programs are available (like SolidWorks, or, for free, Google Sketchup, 123D and plenty of others), I will be showing you how to do everything using Inventor.
The first step is to open Inventor and create a new Assembly (a Standard.iam). From here you’ll want to click the “Create” button in the “Assemble” window. Type in the desired name for your first part under “New Component Name” and the desired storage location for it (keep all your parts in the same folder), and then click OK. Click anywhere on screen and then click “Create 2D Sketch” and click somewhere on the screen to select your drawing surface.
For each part you will need to make, this and the rest is basically the same. You start by creating a 2D sketch with lines and different shapes. In doing so, you’ll use such tools like Dimension, Trim, and the different Constraints a lot, so try to become familiar with them—trust me, it’s worth it.
When drawing your part, it’s important that it be formed in a closed loop. An example of a closed loop is if I were to take a piece of string and attach each end to the other to form a circle. If the two ends were not attached, the string might still have a shape, but it wouldn’t be in a closed loop.
When your sketch is ready, click “Finish Sketch” and then head over to the “Extrude” command under the “3D model” tab—this is what turns your 2D surface into a 3D model. Once you’ve opened the Extrude window, hover your mouse over the body of your sketch. If you’ve done your sketch correctly, the surface of it should change color (mine appears light gray). If not, you need to go back and edit your sketch by clicking Cancel, right clicking on your sketch, and clicking “Edit Sketch.” If it does change color, though, you’re set. Click on the sketch and Inventor will show it as a 3D part. Chances are, though, that there are parts of your sketch that aren’t meant to be extruded. If that’s the case, click on them again while holding the CTRL key. You can go back and forth selecting all the closed loops until your part is exactly as it should be, minus its thickness—that comes next. Since we are primarily laser-cutting the various enclosure parts from a single sheet of plastic or acrylic, all the parts will have the same thickness (mine was 1/8”)—that thickness is the amount we will want to extrude our 2D drawings. This is under the “Extents” and “Distance” form in the “Extrude” window. Type in the thickness with the right unit of measurement and then click OK. Once its extruded you’re set! That’s your first 3D piece! Now click “Return” on the right and you’ll be back in your assembly and able to make another part.
This is all you’ll need to make your parts, but if you want to see your parts come together (which makes it a lot easier to visualize and plan out things), you’ll have to do a little more work (but I highly recommend it and its actually quite simple once you get the hang of it). Basically, you have to tell Inventor how the parts should stick to each other—this relationship is called a Constraint, and there are many different types Inventor has to offer. It would take a while to explain each and every one of them and their different options, but you can figure it out just as effectively and much more quickly by just playing around with it on your own (and its fun too). All you have to do is open the Constraints window (or press CTRL + C), select a type of constraint, click the little number “1” button under "Selections" and select the surface of one object, and then click the little number “2” button and select the surface of a second object. If everything is okay, the two objects should now move together and be constrained, but for the constraint to remain, you have to click OK or APPLY. By using different constraints on different parts of the objects, you can make it so that they all fit together without any freedom to move around. The best part of this is that you can edit your parts while they are together (be careful, though, because this may remove one or more of your existing constraints, but you can easily redo them).
Step 4: From 3D to 2D
Once we know that all our 3D parts will fit together like we want, we need to turn them back into 2D so that the laser-cutter can cut them out. We will do this from Inventor, but it does get somewhat repetitive.
First, close the assembly that has all the parts in it. Then, go into the folder that you saved all the files and open each one at a time. For each part, right click on the main surface that you designed already (the part that looks like your original 2D sketch) and click “Export Face As.” You will have the option to save as either a DXF or a DWG. Besides issues of compatibility (maybe one program is older than the other), though, both are standard file types, although I end up turning everything into a DWG in the end when I send it to the laser cutter.
With all the part faces exported, you can close Inventor and open a 2D CAD program like AutoCAD. You’ll need this to create the necessary file for laser-cutting. Take the rest of this process with caution, though, because it may not apply so well to your specific laser-cutter (it does work on one I used at school, which is from Universal Laser Systems).
In AutoCAD, open a blank drawing (DWG). Create a rectangle from the origin and extend it into the first quadrant. This rectangle represents the available cutting area, so dimension it properly (the one I used had a 24” by 12” cutting area). Now you have to insert all the parts you’ve designed. Go to the Insert tab, click Insert, and select the file for one of your parts. Clicking OK will let you move the part around the drawing. Click to place it there—you can always move it again later with the Move tool under the Home tab. You’ll want to do this with all the parts, but it’s important to put them in the right place. For example, it’s okay to put parts next to each other, but leave at least an eighth of an inch of spacing between them (this will help you later when you have to remove that part from the laser-cut plastic and will ensure that the parts are properly cut out). Also, you need to make sure all your parts not only fit within the rectangle you initially drew, but that there is some margin as well. Leave at least half an inch around the borders. What’s important now is that the parts be distinguished from that bordering rectangle. This is done by keeping the rectangle and the rest of the parts on a separate layer (remember the color of the layer because this will be important later during the plot setup). When all of this is done, save the file and head over to the Plot command under the File menu.
Step 5: Plotting to a Laser-Cutter
In the Plot window in AutoCAD, there are a bunch of options that you have to set for everything to turn out okay. The ones that aren’t specific to the printer I used include setting the scale to 1:1, selecting the right plot area, making sure that the correct power settings are set, and that the correct material profile be loaded. I’ve attached some pictures of the setting windows that I went through in case they are of some use to somebody, but I don’t have the experience to say if the same will apply elsewhere or if these settings are the best (I can, however, say from experience that having the correct settings are important).
Step 6: Laser-cutting
If you have access to a laser cutter to begin with, you probably know what you’re doing already. Nevertheless, I will point out some things you should remember to do like aligning your material properly, aligning the height of the bed, and running through the cut without the laser (this is to see if everything will turn out alright before the actual laser is turned on).
The time it will take for the cut to finish depends on the material you are cutting the enclosure from. Once its cut, remove the parts and poke them out of the original sheet. Be careful with the thinner parts because they are fragile and pose a high risk for breaking. Try out all the parts. See how they fit together. If you’ve stuck with my original files and have all the power settings and focusing right, everything should fit together nicely and firmly. If there is something obviously wrong with the parts, go back to the drawing board and see what needs to change. It’s a learning process. I myself went through two or three complete cuts before I was happy with how it turned out. Since redoing the cut is to be expected, if you have the means, I recommend doing the first few cuts in a less expensive material. Then, once you’re surer about how everything will fit together should you use the final material.
Step 7: Finishing Details About the Remote
For you to be sure that the enclosure works (and for you to have a remote at all), there is still a lot that needs to be done. Secure all the components in their places and put the rest of the enclosure together. Does it fit and feel like you expected? Now’s the best time if you want to revise—it’s much harder to once things are soldered.
For those of you making my design, everything should fit into place with some pressing with the exception of the knob switch, LCD display, and the joystick.
If you’re happy with where the enclosure is going, get some standard electrical wire, a piece of string (ideally one that does not stretch much), and a wire-cutter. While you can probably guess what the electrical wire and wire-cutter are for, the piece of non-elastic string is my recommendation for determining how long you should be cutting your wires. Just connect the string to the component you will be wiring, and run it through your enclosure just like you would with the actual electrical wire. With that string you can gauge (no pun intended) how long your electrical wire will need to be. Leave an inch or so more than the exact length so that you will still have enough to rearrange your input and output pins—you can always have extra wire, but what you can’t have is not enough wire (in the case that you do, though, and everything is already secure, just take a second wire and solder it to the original short wire as an extension; then wrap the connection up with some electrical tape and tuck it away).
Once you have your wires, solder everything together, put the last pieces on and you’ll have a finished remote control of your or my own or design! Feels pretty great huh? Well it will feel better once you test it out and hook it up to an RC car. I have included some of my test programs and my final code—they should all work perfectly with my own design, but with a little tweaking, they can be adapted to enclosures of your own design too! If something’s wrong, check your program. Check it again. Once you’re sure it’s not a coding issue, it might be time to take out that voltimeter and test some of your circuitry—some faulty parts might be afoot. If everything works, though, you have my congratulations. Just hold onto that feeling while you’re building the RC car!
Step 8: The Lego RC Car
If you didn’t find anything else in this Instructable fun, this part’s for you. Think back to your childhood. Bring back all those hours you spent lost in colorful modular bricks. Or think all the way back to this morning when you skipped breakfast to play with your Legos…I’m not the only one...right?
The bulk of the RC Car is Lego. That means that you can basically build anything you want and, by the end of this, you’ll be able to send that monstrosity into the kitchen to wreak havoc from a remote location. My focus, for now, at least, will be on what I built: an all-wheel drive (with differentials), all-wheel steering, servo-powered Lego car. It is built from an assortment of Lego Technic pieces that I’ve collected over the years from sets and online stores (I highly recommend Bricklink for fulfilling all your Lego needs). The good thing is, though, that most of the parts are the more common ones, and the ones that aren’t so common are relatively new, so you can find them easily online (or use that ingenuity to work out an alternative contraption!).
It begins with each axle. The front and rear axles are identical and each operate separately from each other. While an arrangement could be made that would cut servo-usage in half by connecting both axles and syncing them together manually (i.e. running axles along the length of the vehicle to connect the steering and drive together), I thought that keeping them separate was just too clean of a solution. Each axle, then, has its own steering rack and differential—a differential is what allows the car to travel so smoothly. Essentially, it eliminates the problems caused when a vehicle is driving through a turn. When it does, the wheels on the outside of the turn will travel over a greater distance (and, thus, will turn more) than the wheels on the inside of the turn. If the two wheels were connected directly, either the axle would break or one of the wheels would start slipping. A differential allows rotational motion to be transferred to both of the wheels, while not dictating whether the split is even or not. It is driven by a bevel gear mounted perpendicularly to it. Universal joints run the rotational motion the differential provides through the steering joints and through to the wheels. The steering rack that turns the wheels back and forth is driven by a bevel gear and a geartrain—this geartrain makes sure that the limited rotation of the controlling servo motor is enough to turn the steering rack through its full range of motion.
All and all, the axle is rather standard function-wise, but the hardest part was fitting those functions into a small, but sturdy frame that was compatible with Servo motors. There are actually two parts to this: the first part is getting the output shaft of the servo to attach to a Lego axle; and the second part is getting the servo casing to fit nicely in a Lego housing.
The former I did with the use of the Servo attachments (normally included with the servo) and few Lego pieces—it’s just a matter using the right Servo attachment and of aligning the Lego wheel to the attachment well. If it’s not aligned properly, it will cause the axle to shift around when rotated, which is bad.
Getting the Servo to fit snugly into a Lego frame took a while to figure, but it is possible without the addition of tape or non-Lego objects.
Once the Servos are connected, you can build the rest of the chassis around them with no limitation on size or shape. Just consider where you will want to mount the electronics and batteries, and whether or not there is enough clearance on the sides for the wheels to turn without hitting the chassis.
Step 9: Bringing the Beast to Life: Installing the Electronics..
Now we can connect all the electronics together.
Get a breadboard of your choice and connect all the Servo pins so that each pin is by itself and is not connected to anything (see the pictures I’ve attached if you have no idea what I’m saying). Connect all the red pins of the servos to the red main on the side of your breadboard—this is the positive line and will be connected to the positive terminal of you battery. Do same with the black pins, but connect them to the black main instead—that’s ground. The third servo pin (mine are white and yellow) is your input pin. This third pin should be connected to one of your PWM digital output pins on the Arduino.
Now you need your XBEE radio and break-out board. Carefully connect these together by gently pushing the front end of the radio in a bit, and then the back a bit. Keep alternating, pushing just a little at a time. This will keep the radio’s golden little spins from bending or breaking (they’re more fragile than something like your servo pins). Plug the board into the breadboard. To know which pins you need to connect you need to look at the surface of the radio or the breakout board. The XBEE radio should have a 1 and a 20 on one end, and the rest is numbered from 1 to 20 counterclockwise. The only pins we need are VCC, DOUT, DIN, and GND—these are pins 1, 2, 3 and 10, respectively. VCC and GND are for powering the radio; DOUT and DIN are the pins used for receiving and sending signals through the radio (DOUT is what the radio is receiving, and DIN is what you want to send through it).
The GND pin should be connected to the same ground as everything else. The VCC or VIN (voltage in), though, should not be connected to the same positive pins that everything else is connected to, because the XBEE runs on 3.3 volts and nothing higher. Luckily, most microcontrollers have a 3.3 supply pin available so connect the VCC pin to that. If it doesn’t you’ll need to get a voltage regulator that can supply 3.3 volts. The DOUT and DIN pins should be connected to the RX and TX pins (pins 0 and 1 respectively). The RX and TX pins are what the Arduino uses for serial communication—they are the receiving and transmitting pins, respectively, so DOUT should be connected to RX, and DIN to TX.
Now it’s time to hook up your batteries. This part is a balancing act (unless you have spare voltage regulators), because the Arduino and Servos operate at different voltages. The Arduino can be powered at voltages between 7 and 12 V (those are the recommended values) and has a built-in 5V regulator that you can tap into (and a 3.3 V one that the XBEE is running off). The servos should be running at voltages between 4.8 and 6 V. I found that 4.8 or 5V wasn’t providing the performance I wanted, so I needed a way to power them at 6V—not lower and not higher. The issue is this: if I want to use AA batteries, the theoretical outputs I can achieve are 4.5, 6, 7.5, 9 etc. (increments of 1.5V). If the main power source runs at 6V, I can power the servos directly from the batteries, but this is under the recommended 7V minimum of the Arduino. If I run everything at 7.5 volts, I will overheat the servos, but I will provide the Arduino with enough power. The trick, though, is that those 1.5V increments are the theoretical voltage of an additional AA battery. In reality, not even a brand new AA battery will run at 1.5 V (and rechargeable ones certainly will not either), so I should be expecting voltages lower than 6 and 7.5. The problem is that as I get closer to 6V, I’m also getting closer to 5V—this is a risk for the Arduino, which runs on 5V. If it doesn’t have enough input voltage to regulate out 5V, it will reset or turn off. If I were powering the Arduino with fresh batteries and not connecting those batteries to anything else, I could probably get away with running it at 6V. However, since I’m running the servos off the same batteries, any voltage drop caused by the servos (which can be caused by stalling) would cause the “6V” supply to drop down to levels possibly below 5V. Ideally, voltage regulators would be used with a 9V supply to power the servos and Arduino independently, but I’ve also had success running it off 5 rechargeable batteries, which, combined, provide between 6 and 7.5V.
I just discussed using different combinations of AA batteries. To connect them, you’ll probably need a battery holder of some sort. Mine was a Lego Power Functions battery box and could hold up to 6 batteries. Since I only wanted 5 batteries, though, and I didn’t want to modify the battery box, I decided to make a fake battery from aluminum foil, a piece of Lego, and some tissues or paper towel. Rip off a piece of paper, wrap a 5-long Lego Technic beam with it to give it a nice round shape, and then wrap that with Aluminum foil. This should be long enough to connect the terminals that a AA battery would normally connect to.
Now comes the cruelest part of all: modifying a Lego piece. I thought long and hard about alternatives, but, in the end, it just had to be done. The battery holder, being made for Legos, has a Lego wire connection for connecting motors and other Lego devices. To use this connection to power our RC car, though, we just want a positive and a negative wire. This means that you’ll have to cut a Lego Power Functions wire in half, and strip the wires on the outside down so that you can solder a usable solid-core wire to it (In my defense, I kept both halves so that I could put them back together once this project was over…). Since the battery box has a built-in polarity switch, you won’t necessarily know which wire is positive and which wire is negative—you’ll have to pick one direction, test it with a voltimeter, and hook it up to the breadboard appropriately. Do this with caution, because you don’t want to fry all your components! No pressure.
The way I connected the battery was like this: hook up the battery’s positive connection to the same line that all the servos are connected to; connect the battery’s negative connection to the Arduino’s ground pin, and run a wire from the battery’s positive connection via the breadboard to the VIN pin on the Arduino (this is the voltage supply pin that feeds into the built-in voltage regulator). This way, all the grounds are shared, which needs to be so for everything to work.
Step 10: Coding! (and Some Extra XBEE Info!)
That’s basically all the hardware. Now, it’s just a matter of testing your components via code on the Arduino and programming the right serial communication protocol for the XBEEs (you also may have to change the pins I've assigned in my code if you wired you remote or car differently).
If you're coding this yourself, the serial communication can take a bit of back and forth if you’re new to it, but it’s just a matter of making sure everything's speaking the same language and speaking it on the same wavelength. As for as language goes, I've worked it out in my code so feel free to modify the code to your specific remote control or car design (or not modify it if you're doing the same thing as me).
As far as getting the XBEEs on the same wavelength, though, they should already be set and ready to go if you purchased them new (unless you want a higher data-transmission rate or if you have other XBEE projects near you, you shouldn't need to do anything to them for them to work). If you didn't purchase them new, its possible somebody changed the factory settings and that you will have to reconfigure them. There are tutorials online, but if there’s enough interest, I can go into detail about how to sync the radios and how to do the right testing, but it’s hard to generalize about that stuff.
>>UPDATE: After I replied to a question by carlos66ba, I have decided to include and elaborate on my response within the Instructable, since there is information that is potentially relevant for anyone working with XBEE communication!!
carlos66ba: Very nice setup. Can you also consider adding the arduino sketches and lego nxt programs? Also: have you thought if it wouldbe possible to interact directly via usb or to connect the xbee radio directly to the nxt?
Crtlego: YES, it is most certainly possible!
You'll need two things (besides an XBEE): a board to connect the XBEE to the USB, and the right software to communicate with the port.
For the board, I used this little guy from Sparkfun (https://www.sparkfun.com/products/8687). You'll need a mini-to-A USB cable if you want to use it with your computer, but you'll definitely need a board of some sort if you want to configure your XBEE!!
Software-wise, I've communicated directly with the XBEE with two different programs and they both have their plus-sides.
One is called X-CTU (search "x-ctu digi" in google and you can find it for installation). Its made by the same people who made the XBEE (Digi) and it gives you all the options and tools you'll need to configure all the settings of your radio if you don't like it out of the box. It also serves our purposes, though, by having a Terminal that lets you type out Serial data straight to the radio. Provided you have all the data transmission rates and channels set properly (which the program lets you view and configure rather easily), you could technically have your own private little chatroom with local XBEEs (or one on your own computer if you opened two windows up at the same time and connected two XBEEs to it).
The second one is called Termite, and its by CompuPhase (http://www.compuphase.com/software_termite.htm). This one's much simpler and is essentially the "Terminal" part of X-CTU. It still has the options needed to properly communicate through your USB port to the X-CTU, but, if I understand correctly, you cannot change the actual settings on the radio.
As far as controlling the RC car I built or doing other XBEE communication, though, both Termite and X-CTU are good places to start. Did I mention they are both free?
As far as XBEE and NXT communication goes, I'm not sure what the possibilities are (I never really experimented with the NXT in depth, even with my love for Lego). I imagine somebody has worked out a way to do communicate serially via USB with the NXT, so if that's possible, I suppose you could hook an NXT up to the XBEE? I know a couple of Lego fans that might like that..
With regards to programs and sketches, I have uploaded the latest stable release of my Arduino code/sketch for both the remote control and the Arduino on the car. They are in a zip file on my website along with the CAD files: http://www.kayrus.com/legos/diy_rc_zip
Step 11: Wrapping Up..
I think that’s it for now. I hope I didn’t lose too many of you on the way, but if I did, feel free to ask me any questions or comment anything you would like to see in more detail! Also, if you have any feedback or suggestions for how I should write future Instructables, I’m all ears! Lastly, if you actually manage to make something from this, I’D LOVE TO SEE IT. Send me pictures, send me links—I want to see what YOU have made! Happy Building!
I would like to acknowledge and thank Floyd Baker for partnering with me to develop the Handuino, and I would like to give a special thanks to me robotics teacher, Mr. Dela Cuesta, for providing Floyd and I not only with parts and materials and access to a laser-cutter, a 3D-printer, and the robotics lab during off hours, but also his guidance and experience. I would also like to thank Mr. Kosek for lending me the FTDI chips needed to reconfigure the XBEE radios and for his help with serial communication and processing.
First Prize in the
Remote Control Contest
Second Prize in the
Runner Up in the
Epilog Challenge V