GoRobotics - Robotics news, robot projects

Posts Tagged ‘How To’

How To Make a Robot: Lesson 9 – Assembling a Robot

Posted on August 2nd, 2011 in How To Make a Robot

Lesson 9 - Assembling a Robot

Lessons Menu:

Now that you have chosen all the basic building blocks used to make a robot, the next step is to design and build a structure or frame which keeps them all together and gives your robot a distinct look and shape.

Making the Frame

There is no “ideal” way to create a frame since there is almost always a trade-off to be made; You may want a lightweight frame but it may need to use expensive materials or end up too fragile. You may want a robust or large chassis but realize it will be expensive, heavy or hard to produce. Your “ideal” frame may be complex and take too much time to design and create when a simple frame may have been just as good. There is also rarely ever an “ideal” shape, but some designs can certainly look more elegant in their simplicity, while others can attract attention because of their complexity.

Materials

There are many materials you can use to create a frame. As you use more and more materials to build not only robots but other devices, you will get a better feeling as to which is most appropriate for a given project. The list of suggested building materials below include only the more common ones, and once you have tried a few, feel free to experiment with ones not on the list, or merge some together.

Use existing commercial products

RoboBrrd by RobotGrrlYou have likely seen school projects which were based on existing mass produced products such as bottles, cardboard boxes, Tupperware, etc.  This is essentially “re-purposing” a product and has the potential to either save you a lot of time and money, or create added hassle and headache. The amazing RoboBrrdto the left is a very good example of how to repurpose materials and make a very capable robot out of them.

Basic construction material

Cardboard robot from tweenbots.comSome of the most basic construction materials can be used to make excellent frames. One of cheapest and most readily available materials is cardboard, which you can often find for free and can be easily cut, bent, glued and layered. Example: You can create a reinforced cardboard box which looks a lot nicer and is more proportional in size to your robot. You can then spread epoxy or glue to make it more durable and then paint it.

Flat structural material

Talking Animatronic Robot HeadOne of the most common ways to make a frame is to use a standard material such as a sheet of wood, plastic or metal, and add holes for connecting all the actuators and electronics. A durable piece of wood tends to be fairly thick and heavy, whereas a thin sheet of metal may be too flexible. Example:   A flat ⅛” piece of dense wood can be easily cut with a saw, drilled (without fear of shattering), painted, sanded, and more. You can connect devices to both sides (for example connect the motors and caster wheels to the bottom, and the electronics and battery to the top) and the wood will still remain intact and solid.

Laser cut / bent plastic or metal

Thing-O-Matic Makerbot.comIf you are at the stage where you are prepared to have a frame outsourced, the best options are still to have the part precision cut using a laser or water jet. Having a company produce a custom part is ideal only if you are confident in all your dimensions, since mistakes can be quite costly. Companies which offer computer controlled cutting services many also offer a variety of other services including bending and painting.

3D printing

Turtle Shell Racer3D printing a frame is rarely ever the most structurally sound solution (because it is built up in layers), but this process can produce very intricate and complex shapes which would not be possible (or very difficult) by other means. A single 3D printed part can contain all the necessary mounting points for all electrical and mechanical components while saving considerable weight. As 3D printing becomes more popular, the price of producing parts will also go down.  A very prominent advantage of 3D printing is not only that your design is easy to reproduce, it is also, easy to share. For instance, you can click on the turtle shell example on the left and get all the design instruction and CAD files.

Polymoph

Polymorph is really in a class on its own; at room temperature, Polymorph is a hard plastic, but when heated (in hot water for instance), it becomes malleable and can be shaped into intricate parts, which then cools and solidifies into durable plastic parts. Normally, plastic parts require high temperatures and molds, making them off-limits to most hobbyists. Example: You can combine different shapes (cylinders, flat sheets etc) to form complex plastic structures which look production. You can also experiment with basic molding, the Polymorph robotic arm is a good example of what you can achieve with this material.

Putting the Robot Together

Given the selection of materials and methods, how do you get started? Follow the steps below to create an aesthetic, simple and structurally sound smaller sized robot frame. Prototype frames made out of (a) paper, (b) cardboard, and (c) metal.
  1. Settle on a construction material choice.
  2. Get all the parts that you robot will require (electrical and mechanical) and measure them. If you don’t have all your parts on hand, you can refer to the dimensions provided by manufacturer’s
  3. Brainstorm and sketch a few different designs for the frame. Don’t go into too much detail.
  4. Once you settle on a design, make sure the structure is sound and that the components would be well supported.
  5. Draw each part of your robot in paper or cardboard at 1:1 scale (real size). You can also draw them using CAD software and print them out.
  6. Test your design in CAD and in real life with your paper prototype by test fitting each part and connections.
  7. Measure everything again! and once you are absolutely sure your design is correct, start cutting the frame into the actual material. Remember, measure twice and cut once!
  8. Test fit each component before assembling the frame in case modifications are require.
  9. Go crazy and assemble your frame using hot glue, screws, nails, Duck tape or whatever other binding technique you choose for your robot.
  10. Fit all the components onto the frame and voila: you have just created a robot from scratch!

Assembling the Robot Components

Step 10 from the list above deserves to be elaborated upon. In previous lessons, you had chosen the electrical components and actuators. Now, your need to get them all working together. For the following section we will use generic cable colors and terminal names that only cover the common case. As always, the datasheet and manuals are you bests friends when understanding how robotic equipment works.

Connecting Motors to Motor Controllers

A DC (gear) motor, or DC linear actuator will likely have two wires: red and black. Connect the red wire to the M+ terminal on the DC motor controller, and the black to M-. Reversing the wires will only cause the motor to spin in the opposite direction. A servo motor, there are are three wires: one black (GND), red (4.8 to 6V) and, yellow (position signal). A servo motor controller has pins matching these wires so the servo can be plugged directly to it.

Connecting Batteries to a Motor Controller or a Microcontroller

Most  motor controllers have two screw terminals for the battery leads labelled B+ and B-. If your battery came with a connector and your controller uses screw terminals, you may be able to find a mating connector with pigtails (wires) which you can connect to the screw terminal. If not, you may need to find another way to connect the battery to the motor controller while still being able to unplug the battery and connect it to a charger. It is possible that not all the electromechanical products you chose for your robot can operate at the same voltage and thus may require several batteries or voltage regulation circuits. See bellow the usual voltage levels involved in common hobby robotics components:
  • DC gear motors – 3V to 24V
  • Standard Servo motors – 4.8V to 6V
  • Specialty Servo motors – 7.4V to 12V
  • Stepper motors – 6V to 12V
  • Microcontrollers usually include voltage regulators – 3V to 12V
  • Sensors – 3.3V, 5V and 12V
  • DC motor controllers – 3V to 48V
  • Standard batteries are 3.7V, 4.8V, 6V, 7.4V, 9V, 11.1V and 12V
If you are making a robot with DC gear motors, a microcontroller and maybe a servo or two, it is easy to see how one battery may not be able to power everything directly. We recommend nevertheless, choosing a battery which can directly power as many devices as possible. The battery with the greatest capacity should be associated with the drive motors. For example, if the motors you chose are rated a nominal 12V, your main battery should also be 12V, then you can use a regulator o power a 5V microcontroller. Without going into details, NiMH and LiPo are the top two choices for small to medium-sized robots. Choose NiMh for a cheaper price and LiPo for a lighter weight. Warning: Batteries are powerful devices and can easily burn your circuits if they are connected incorrectly. Always triple check that the polarity is right and that you device can handle the energy provided by the battery. If you are not sure, don’t “guess”. Electricity is much faster than you, by the time you realize something is wrong, the magic blue smoke already escaped your device.

Connecting Motor controllers to Microcontroller

A microcontroller can communicate with motor controllers in a variety of ways:
  • Serial: The controller has two pins labelled Rx (receive) and Tx (transmit). Connect the Rx pin of the motor controller to the microcontroller’s Tx pin and vice versa.
  • I2C: The motor controller will have four pins: SDA, SCL, V, GND. Your microcontroller will have the same four pins but not necessarily labelled, simply connect them one to one.
  • PWM: The motor controller will have both a PWM input and a digital input for each motor. Connect the PWM input pin of the motor controller to a PWM output pin on the microcontroller, and connect each digital input pin of the motor controller to a digital output pin on the microcontroller.
  • R/C: To connect a microcontroller to an R/C motor controller, you need to connect the signal pin to a digital pin on the microcontroller.
Regardless of the communication method, the motor controller’s logic and the microcontroller need to share the same ground reference (this is achieved by connecting the GND pins together) and the same logic high level (this can be achieved by using the same V+ pin to power both devices). A logic level shifter is required if the devices don’t share the same logic levels (3.3V and 5V for instance)

Connecting Sensors to a Microcontroller

Sensors can be interfaced with microcontrollers in a similar way than motor controllers. Sensors can use the following types of communication:
  • Digital: The sensor has a digital signal pin that connects directly to a digital microcontroller pin. A simple switch can be regarded as a digital sensor.
  • Analogue: Analogue sensors produce an analogue voltage signal that needs to be read by an analogue pin. If your microcontroller does not have analog pins, you will need a separate analog to digital circuit (ADC). Also, some sensors some with the required power supply circuit and usually have three pins: V+, GND and Signal. If a sensor is a simple variable resistor for instance, it will require you to create a voltage divider in order to read the resulting variable voltage.
  • Serial or I2C: the same communication principles explained for motor controllers apply here.

Communication device to microcontroller

Most communication devices (e.g. XBee, Bluetooth) use serial communication, so the same RX,TX, GND and V+ connections are required. It is important to note that although several serial connections can be shared on the same RX and TX pins, proper bus arbitration is required in order to prevent cross-talk, errors and madness in general. If you have very few serial devices, it is often simple to use a single serial port for each one of them.

Wheels to motors

Ideally, you would have chosen wheels or sprockets which are designed to fit the shaft of the motor you chose. If not, hopefully there is a hub which fits between the two. If you find that the wheel and motor you have chosen are not compatible with one another and cannot find a suitable hub, you may need to find another hub which connects to the wheel but has a smaller bore, you would then drill out the hub’s bore to the same diameter as the shaft.

Electrical components to frame

You can mount electronics to a frame using a variety of methods. Be sure that whatever means you use do not conduct electricity. Common methods include: hex spacers, screws, nuts, double-sided tape, Velcro,  glue, cable ties, etc.

Practical Example

  1. Settle on a construction material choice.
  2. We are getting the following parts in order to measure and test fit them:
  3. We will try to stay close to a 6 sided box, but may have had to make modifications in order to accommodate for all parts
  4. Some modifications need to be done to the design in order to accommodate for all parts such as:
    • Add more mounting holes for the battery pack
    • Add more mounting points for servos or other accessories
    • Refined the hole placement.
  5. The cardboard frame will be made by printing the design onto white cardboard (or gluing a printed paper sheet onto cardboard), cutting it, bending it and using (hot) glue in order to reinforce the bends, edges and surfaces.
  6. We completely assembled the robot using the cardboard frame in order to make sure everything fits properly.
  7. We measure everything again and once we were absolutely sure about the design, we had it professionally manufactured.
  8. Test fit each component in case modifications are require.
  9. The frame is made in one piece so no assembly is required
  10. Assembled the robot incorporating lots of accessories.
RobotShop - Robotics at your serviceFor further information on learning how to make a robot, please visit the RobotShop Learning Center. Visit the RobotShop Community Forum in order to seek assistance in building robots, showcase your projects or simply hang-out with other fellow roboticists.

How to Make a Robot – Lesson 6: Controlling Your Robot

Posted on January 17th, 2011 in How To Make a Robot

Lesson 6 – Controlling your robot; wired, wireless or autonomous?

Lessons Menu:

The definition we have chosen for a “robot” requires the device to obtain data about its environment, make a decision, and then take action accordingly. This does not exclude the option of a robot being semi-autonomous (having aspects which are controlled by a human and others which it does on its own). A good example of this is a sophisticated underwater robot; a human controls the basic movements of the robot while an on-board processor measures and reacts to underwater currents in order to keep the robot in the same position without drifting. A camera onboard the robot sends video back to the human while onboard sensors may track the water temperature, pressure and more. If the robot loses communication with the surface, an autonomous program may kick-in causing it to surface. If you want to be able to send and/or receive commands from your robot, you will need to determine its level of autonomy and if you want it to be tethered, wireless or fully autonomous.

Tethered

Direct Wired Control

Tamiya Remote Controlled ForkliftThe easiest way to control a vehicle is with a handheld controller physically connected to the vehicle using  a cable (i.e. a tether). Toggle switches, knobs, levers, joysticks and buttons on this controller allow the user to control the vehicle without the need to incorporate complex electronics. In this situation, the motors and a power source can be connected directly with a switch in order to control its forward/backwards rotation. Such vehicles usually have no intelligence and are considered to be more “remote controlled machines” than “robots”.

Advantages

  • The robot is not limited to an operating time since it can be connected directly to the mains
  • There is no worry about loss of signal
  • Minimal electronics and minimal complexity
  • The robot itself can be light weight or have added payload capacity
  • The robot can be physically retrieved if something goes wrong (very important for underwater robots)

Disadvantages

  • The tether can get caught or snagged (and potentially cut)
  • Distance is limited by the length of the tether
  • Dragging a long tether adds friction and can slow or even stop the robot from moving

Wired Computer Control

Little Hercules AUVThe next step is to incorporate a microcontroller into the vehicle but continue to use a tether. Connecting the microcontroller to one of your computer’s I/O ports (e.g. a USB port) allows you to control its actions using a keyboard (or keypad), joystick or other peripheral device. Adding a microcontroller to a project also may require you to program how the robot reacts to the input. Instead of using a laptop or desktop computer, netbooks are often a desirable choice because of their low price, small size and low weight.

Advantages

  • Same advantages as with direct wired control
  • More complex behaviours can be programmed or mapped to single buttons or commands.
  • Larger controller choice (mouse, keyboard, joystick, etc.)
  • Added onboard intelligence means it can interface with sensors and make certain decisions on its own

Disadvantages

  • Cost is higher than a purely tethered robot because of the added electronics
  • Same disadvantages as with direct wired control

Ethernet

Ethernet RJ45 ConnectorA variation on computer control would be to use an Ethernet interface. A robot that is physically connected to a router (so it could be controlled via the Internet) is also possible (though not very practical) for mobile robots. Setting-up a robot that can communicate using the internet can be fairly complex, and more often than not, a WiFi (wireless internet) connection is preferable. A wired and wireless combination is also an option, where there is a transceiver (transmit and receive) connected physically to the internet and data received via the internet is then sent wirelessly to the robot.

Advantages

  • Robot can be controlled trough the Internet from anywhere in the world
  • The robot is not limited to an operating time since it could use Power over Ethernet (PoE).
  • Using Internet Protocol (IP) can simplify and improve the communication scheme.
  • Same advantages as with direct wired computer control

Disadvantages

  • Programming involved is more complex
  • The tether can get caught or snagged (and potentially cut)
  • Distance is limited by the length of the tether
  • Dragging a long tether adds friction and can slow or even stop the robot from moving

Wireless

Infrared

IR RemoteInfrared transmitters and receivers cut the cables connecting the robot to the operator. This is usually a milestone for beginners. Infrared control requires “line of sight” in order to function; the receiver must be able to “see” the transmitter at all times in order to receive data. Infrared remote controls (such as universal remote controls for televisions) are used to send commands to an infrared receiver connected to a microcontroller which then interprets these signals and controls the robot’s actions.

Advantages

  • Low cost
  • Simple TV remote controls can be used as controllers

Disadvantages

  • Needs to be line of sight
  • Distance is limited

Radio Frequency (RF)

RF Data TelemetryCommercially available Remote Control (R/C) units use small microcontrollers in the transmitter and receiver to send, receive and interpret data sent via radio frequency (RF). The receiver box has a PCB (printed circuit board) which comprises the receiving unit and a small servo motor controller. RF communication requires either a transmitter matched/paired with a receiver, or a transceiver (which can both send and receive data). RF does not require line of sight and can also offer significant range (transmission distance). Standard radio frequency devices can allow for data transfer between devices as far away as several kilometres and there is seemingly no limit to the range for more professional RF units.

XBee and Zigbee modules use RF for communication, but allow the user to vary many of the communication parameters involved. These modules have a specific footprint (layout) and are only produced by certain companies. Their main advantage is that they provide a very robust easy to set up link and take care of all of the communication protocol details.

Many robot builders choose to make semi-autonomous robots with RF capability since it allows the robot to be as autonomous as possible, provide feedback to a user and still give the user some control over some of its functions should the need arise.

Advantages

  • Considerable distances possible
  • Setup can be straightforward
  • Omni directional (impeded but not entirely blocked by walls and obstructions)

Disadvantages

  • Very low data rate (simple commands only)
  • Pay attention to the transmission frequencies – they can be shared

Bluetooth

Bluetooth Data TelemetryBluetooth is a form of RF and follows specific protocols for sending and receiving data. Normal Bluetooth range is often limited to about 10m though it does have the advantage of allowing users to control their robot via Bluetooth-enabled devices such as cell-phones, PDAs and laptops (though custom programming may be required to create an interface). Just like RF, Bluetooth offers two-way communication.

Advantages

  • Controllable from any Bluetooth enabled device (usually additional programming is necessary) such as a Smartphone, laptop, desktop etc.
  • Higher data rates possible
  • Omnidirectional (does not need line of sight and can travel a little through walls)

Disadvantages

  • Devices need to be “paired”
  • Distance is usually about 10m (without obstructions)

WiFi

Wi-FiWiFi is now an option for robots; being able to control a robot wirelessly via the internet presents some significant advantages (and some drawbacks) to wireless control. In order to set up a WiFi robot, you need a wireless router connected to the internet and a WiFi unit on the robot itself. For the robot, you can also use a device that is TCP/IP enabled with a wireless router.

Advantages

  • Controllable from anywhere in the world so long as it is within range of a wireless router
  • High data rates possible

Disadvantages

  • Added programming required
  • Maximum range is usually determined by the choice of wireless router

GPRS / Cellular

Cell PhoneAnother wireless technology that was originally developed for human to human communication, the cell phone, is now being used to control robots. Since cellular frequencies are regulated, incorporating a cellular module on a robot usually requires added patience for programming as well as an understanding of the cellular network system and the regulations.

Advantages

  • Robot can be controlled anywhere it has a cellular signal
  • Direct satellite connection is possible

Disadvantages

  • Setup and configuration can be complex – NOT for beginners
  • Each network has its own requirements / restrictions
  • Cellular service is not free; usually the more data you transmit/receive the more money you will need to pay.
  • System is not (yet) well setup for robotics use

Autonomous

MicrocontrollersThe next step is to use the microcontroller in your robot to its full potential and program it to react to input from its sensors. Autonomous control can come in various forms: pre-programmed with no feedback from the environment, limited sensor feedback and finally complex sensor feedback. True “autonomous control” involves a variety of sensors and code to allow the robot to determine by itself the best action to be taken in any given situation.

The most complex methods of control currently implemented on autonomous robots are visual and auditory commands. For visual control, a robot looks to a human or an object in order to get its commands. Getting a robot to turn to the left by showing a piece of paper with arrow pointing left is a lot harder to accomplish than one might initially suspect. An auditory command such as “turn left” also requires quite a bit of programming. Programming a variety of complex commands like “get me a drink from the fridge” or “get my shoes, they’re near the front door” is no longer fantasy but requires a very high level of programming, and a lot of time.

Advantages

  • This is “real” robotics
  • Tasks can be as simple as blinking a light based on one sensor readings to landing a spacecraft on a distant planet.

Disadvantages

  • It’s only as good as the programmer; if it’s doing something you don’t want it to do, the only option you have is to check your code, modify it and upload the changes to the robot.

Practical Example

For our project, the goal is to create an autonomous rover capable of making a decision based on external input from sensors. Should the robot “misbehave” it will be physically close and shutting it off will not be an issue. However having the option of semi-autonomous (wireless) control to allow us the option of making a remote-controlled vehicle is also attractive. We will not have the need for tethered control.

Arduino Shields

The microcontroller chosen in the previous lesson uses what are called “shields” which are essentially ad-on boards specific to the Arduino’s pin layout. There are many shields, including ones that allow for Ethernet, Xbee, or Bluetooth communication. There is even a shield that allows for GPRS (i.e. cellular) communications. The basic robot will therefore have no additional modules, though it is important to note that it does have wireless communication capability.

RobotShop - Robotics at your serviceFor further information on learning how to make a robot, please visit the RobotShop Learning Center. Visit the RobotShop Community Forum in order to seek assistance in building robots, showcase your projects or simply hang-out with other fellow roboticists.

Carlitos’ Project: RGB LED Mood Cube

Posted on January 14th, 2011 in Microcontrollers, Miscellaneous, Projects, Robotics Projects

This is the first in a series of electronic or robotic DIY projects. These projects are accompanied by instructional videos that will help you trough the many steps involved in completing the task at hand. For this first iteration, we are making an RGB LED Mood Cube.

Glowing colour-changing objects are always cool. So why not make your own? Mood lights have been around for some time and, while it is cool to have a colour changing light, it would be even cooler to have something more complex and geekier. An RGB LED Mood Cube seems to be the way to go.

RGB LED Mood Cube Fully Assembled

In this project, we are going to build a 4x4x4 RGB LED cube that can be used to display cool colourful patterns. This project should be straight-forward and the most significant difficulty will be soldering all the connections for the cube structure and the 64 LEDs (since they are RGB, this means 256 joints for the LEDs alone!). In short, if you are looking to have a cool mood-light and get razor-sharp soldering skills, this is the right project for you.

Below you can see the video of the LED cube being put together and the final result.

If you need more information or you simply prefer written instruction, here you will find the full list of materials, tools, instructions and documents required for the build.

Materials

  • An LED Cube Kit. Provides the LEDs and all the structure required to create an LED cube.

  • A Rainbowduino. It is a special Arduino built to control up-to 192 LEDs.

  • A UartSB (USB-to-serial adaptor). A USB to serial interface that is used to program the Rainbowduino (or for serial communication in general) trough a USB port.

  • A USB Cable. A cable to hook-u the UartSB to the Computer

  • A 9V Wall Adapter. A power supply that will power the cube once the assembly and programming are done.

Tools

  • A Wire Cutter. It will be used to cut the leads off components.

  • A Soldering Iron. In order to solder all the (many) connections, a soldering station might be preferable since it provides steady and reliable temperature control that allows for easier and safer soldering (you have less risk of burning the components if the temperature is set correctly).

  • Third Hand. This is not absolutely required, but it is always useful for holding components and parts when soldering.

  • Flat Head Screwdriver. This will be used for un/tightening terminal blocks

  • A computer . It programs the Rainbowduino using the Arduino IDE.

Putting it Together

  1. The first step is to assemble the LED cube kit. This kit is much easier to put together than the more common way of constructing an LED cube using the LED leads as the supporting structure.

    The kit includes all the parts required to hold the LED together and takes care of all the complex wiring. Full instruction on how to put the cube together are available in PDF format.

  2. Once the cube is assembled, we need to drive it in order to display cool stuff in it. For this, we use the Rainbowduino, an Arduino clone created specifically for driving massive amounts of LEDs. The cube fits directly on top of the Rainbowduino, and can provide power to it by using the included JST cable. When connecting both modules together, it is important to make sure the “Green” male headers from the LED cube match the “Green” female headers on the Rainbowduino. Also, it is important to set the Rainbowduino switch to “JST”.

    RGB LED Cube and Rainbowduino Power Connected

  3. Now that all electrical connections are done, we need to write some software in order to make it display cool stuff in our new cube. We took the liberty of modifying, cleaning and updating the plasma code readily available for the Rainbowduino. This new code should display a nice smooth wave as of colours that propagates softly though the cube. The code can be downloaded from here: Rainbowduino-RGB-LED-Matrix-Plasma.zip.

    In order to upload this code to your Rainbowduino, you will need to use the Arduino software, so, if it is not already done, it has to be installed. Also you will need to install the USB-to-Serial adaptor drivers.

  4. Once the code and the Arduino software are downloaded and installed, simply unzip the code and open the .pde sketch file found inside of the unzipped folder using the Arduino software. Then, upload the sketch to the Rainbowduino using the USB-to-serial interface.

    Rainbowduino with Serial Interface (UartSB) and USB Cable

  5. Now that the Rainbowduino is programmed, simply remove the USB interface, plug-in the power adapter and admire the light show!

    RGB LED Mood Cube Connected to the Power Supply

Additional Programming and Hacking

Of course, colourful lights are pretty and everything, but for those of you who would like to program your own patterns and animations, there are functions in the provided code that allow you to set the LEDs individually. You could also add some sensors and make the cube interactive. There are even some Xbee headers that could be used to send information to the cube remotely from a nearby computer Using an Xbee module.

On the physical side, you can make a cover for your cube out of paper, plastic, fabric or whatever other materials you have on hand (make sure the material is translucent though)

Finally, at the end of the construction, you will have many RGB LEDs and a bunch of male and female headers left-over. Make sure you put them to good use in your next project.

Getting Your Own LED Cube

RGB LED Mood Cube Full Kit

For those of you wishing to make their own cube, you can use your own parts and buy the missing materials separately or you can get all the components in a convenient kit at RobotShop.

RGB LED Mood Cube - 1

You are also invited to share your results and experience in the RobotShop Forum and by simply leaving a comment below.

How to Make a Robot – Lesson 5: Choosing a Motor Controller

Posted on November 10th, 2010 in How To Make a Robot
How To Make a Robot - Lesson 5 - Choosing a Motor Controller

Lessons Menu:

Now that the general shape, the actuators (or motors) and the brain for the robot have been chosen, it is time to make things move. The first question many beginners have when building their first robot is “how do I control the motors?” After a bit of research, the word motor controller comes up a lot.

What is a motor controller and why do I need it?

Motor Controllers

A motor controller is an electronic device (usually comes in the shape of a bare circuit board without enclosure) that acts as an intermediate device between a microcontroller, a power supply or batteries, and the motors. Although the microcontroller (the robot’s brain) decides the speed and direction of the motors, it cannot drive them directly because of its very limited power (current and voltage) output. The motor controller, on the other hand, can provide the current at the required voltage but cannot decide how fast the motor should turn. Thus, the microcontroller and the motor controller have to work together in order to make the motors move appropriately. Usually, the microcontroller can instruct the motor controller on how to power the motors via a standard and simple communication method such as UART (a.k.a. serial) or PWM. Also, some motor controllers can be manually controlled by an analogue voltage (usually created with a potentiometer). The physical size and weight of a motor controller can vary significantly, from a device smaller than the tip of your finger used to control a mini sumo robot to a large controller weighing several Kg. The weight and size of a motor controller usually has a minimal impact on the robot, until you get into small robotics or unmanned aerial vehicles. The size of a motor controller is usually related to the maximum current it can provide. Larger current also means having to use larger diameter wires (the smaller the gauge number, the larger the diameter).

Motor Controller Types

Since there are several types of actuators (as discussed in lesson 3), there are several types of  motor controllers:
  • Brushed DC motor controllers: used with brushed DC, DC gear motors, and many linear actuators.
  • Brushless DC motor controllers: used with brushless DC motors.
  • Servo Motor Controllers: used for hobby servo motors
  • Stepper Motor Controllers: used with unipolar or bipolar stepper motors depending on their kind.

Choosing a Motor Controller

Motor controllers can only be chosen after you have selected your motors/actuators. Also, the current a motor draws is related to the torque it can provide: a small DC motor will not consume much current, but cannot provide much torque, whereas a large motor can provide higher torque but will require a higher current to do so.

DC Motor Control:

  1. DC MotorThe first consideration is the motor’s nominal voltage. DC motor controllers tend to offer a voltage range. For example, if your motor operates at 3V nominal, you should not select a motor controller that can only control a motor between 6V and 9V. This will help you cross off some motor controllers from the list.
  2. Once you have found a range of controllers that can power the motor with the appropriate voltage, the next consideration is the continuous currentthe controller will need to supply.You need to find a motor controller that will provide current equal to or above the motor’s continuous current consumption under load. Should you choose a 5A motor controller for a 3A motor, the motors will only take as much current as they require. On the other hand, a 5A motors is likely to burn a 3A motor controller. Many motor manufacturers provide a DC motor’s stall current, which does not give you a clear idea of the motor controller you will need. If you cannot find the motor’s continuous operating current, a simple rule of thumb is to estimate the motor’s continuous current at about 20% to 25% of the stall current. All DC motor controllers provide a maximum current rating – be certain this rating is about double that of the motor’s continuous operating current. Note that when a motor needs to produce more torque (for example going up an incline), it requires more current. Choosing a motor controller with built-in over current and thermal protection is a very good choice.
  3. The Control method is another important consideration. Control methods include  analogue voltage, I2C, PWM, R/C, UART (a.k.a. serial). If you are using a microcontroller, check to see which pin types you have available and which motors are viable for you to choose. If your microcontroller has serial communication pins, you can choose a serial motor controller; for PWM, you will likely need one PWM channel per motor. Control Methods
  4. The final consideration is a practical one: Single vs. dual (double) motor controller. A dual DC motor controller can control the speed and direction of two DC motors independently and often saves you money (and time). The motors do not need to be identical, though for a mobile robot, the drive motors should be identical in most cases. You need to choose the dual motor controller based on the more powerful DC motor. Note that dual motor controllers tend to have only one power input, so if you want to control one motor at 6V and the other at 12V, it will not be possible. Note that the current rating provided is almost always per channel.

Servo Motor Control:

Hitec HS 645 MG Servo Motor Since standard hobbyist servo motors are meant to use specific voltages (for peak efficiency), most operate at 4.8V to 6V, and their current consumption is similar, the steps for the selection are somewhat simplified. However, you may find a servo motor that operates at 12V; it is important to do additional research about a servo motor controller if your servo motor is not considered “standard”. Also, most hobby servo motors use the standard R/C servo input (three wires which are ground, voltage and signal)
  1. Choose the control method. Some servo motor controllers allow you to control the servo’s position manually using a dial/switch/buttons, while others communicate using UART (serial) commands or other means.
  2. Determine the number of servos to be controlled . Servo controllers can control many servos (usually 8, 16, 32, 64 and up). You can certainly select a servo motor controller capable of controlling more servos than you will need.
  3. As with DC motor controllers, the control method is an important consideration.

Stepper Motor Control:

  1. Stepper MotorsIs the motor you selected unipolar or bipolar? Choose a stepper motor controller type accordingly, though a growing number are able to control both types. The number of leads is usually a dead give-away of the motor type: if the motor has 4 leads, then it is bipolar; should it have 6 or more leads, then it is unipolar.
  2. Choose the motor controller voltage range to match your motor’s  nominal voltage .
  3. Find out how much current per coilyour motor requires, and find out how much current (per coil) the stepper motor controller can provide.If you cannot find the current per coil, most manufacturers list the coil impedance, R . Using Ohms Law (V=IR), you can then calculate the current (I).
  4. As with DC motor controllers, the control method is an important consideration.

Linear Actuator Control:

Linear ActuatorsLinear actuators come in three main flavours regarding their control method.: DC, R/C, or position feedback. Most DC linear actuators use a geared DC motor, so a DC motor controller is usually appropriate. However, some linear actuators take R/C servo input, so you would select a servo motor controller. Should an R/C controlled linear actuator operate at a higher voltage than the servo controller’s range, the actuator may include separate wires for the higher supply voltage required.

Other Actuators:

Many “miscellaneous” electromechanical devices such as muscle-wire, solenoids, or even powerful lights need to be controlled using motor controllers. Below are some questions to determine if your actuator might need a motor controller:
  • Higher current requirements: any device that requires over 0.1A usually needs its own controller
  • Higher voltage requirements: if the actuator operates above the microcontroller’s voltage (usually 5V or 3.3V), it usually cannot be directly connected to a microcontroller
For more information regarding actuator control and communications method, please visit the RobotShop Learning Center.

Practical Example

Solarbotics GM9 In the previous lesson, we had chosen the Solarbotics GM9 gear motors. Below are this motor’s specifications:
  • Gear Ratio: 143:1
  • Unloaded RPM (3V): 40
  • Unloaded RPM (6V): 78
  • Unloaded Current (3V): 50mA
  • Unloaded Current (6V): 52mA
  • Stall Current (3V): 400mA
  • Stall Current (6V): 700mA
  • Stall Torque (3V) : 44.44in*oz
  • Stall Torque (6V) : 76.38in*oz

Applying the steps:

  1. The nominal voltage is 3V or 6V.
  2. There is no mention of continuous current, though the stall torque at both voltages is provided: 400mA and 700mA. If we take 25% of these values, the continuous current can be approximated at 100mA to 175mA. To be safe we can take the larger value.
  3. We have chosen a microcontroller that has many different pins including serial, PWM, analog and digital.
  4. Our little rover will be using two identical motors, so we can use a dual motor controller.
Given the above criteria, we are looking for a motor controller with the following specifications:
  • Voltage range can accommodate a 3V to 6V motor
  • Continuous current at least 350mA per channel (low power category)
  • Communication method is PWM, I2C or analog (or several of these)
  • Dual motor control is preferred.
By Looking at the Brushed DC Motor Controllers Comparison Table (imperial version), several motor controllers fit the criteria:
  • RB-Dim-19 (6-18V, 5A, dual.  Analogue and Serial interfaces with many safety features)
  • RB-Pol-16 (1.5-6V, 5A, dual.  Low cost controller with serial interface)
  • RB-Pol-22 (6-16V, 9A, dual,  PWM interface)
  • RB-Spa-397 (5-16V, 2A, dual,  serial interface)
  • RB-Ada-02 (4.5-36V, 0.6A,  dual. Arduino shield with PWM interface)
  • RB-Cri-15 (6-58V, 10A, single, PWM)
  • RB-Cri-14 (6-58V, 10A, single, PWM)
  • …  and many more.
There are a variety of other motor controllers which meet the criteria above which would work as well. In order to reduce this list, cost and features would need to be considered. For example, there is no need to consider a high current (10A) motor controller which is understandably more expensive than a 5A controller. We can also eliminate all single motor controllers. The one controller that stands out from the rest is RB-Pol-16 because of its lower voltage range; this means that, should we decide to power the motor at 3V, it would fall within this controller’s voltage range. The other controller of interest is RB-Ada-02 because it is made specifically for the microcontroller we selected (i.e the Arduino Uno). However, the one downside to RB-Ada-02 is that no additional shields can be installed afterwards. The Pololu dual motor controller was ultimately chosen because of its lower voltage range and price. Pololu Low Voltage Dual Serial Motor Controller 5A 1.5V-6V RobotShop - Robotics at your serviceFor further information on learning how to make a robot, please visit the RobotShop Learning Center. Visit the RobotShop Community Forum in order to seek assistance in building robots, showcase your projects or simply hang-out with other fellow roboticists.

How to Make a Robot – Lesson 4: Understanding Microcontrollers

Posted on October 12th, 2010 in How To Make a Robot, Microcontrollers

How to Make a Robot Lesson 4: Understanding Microcontrollers

Lessons Menu:

Understanding Microcontrollers

Various Microcontrollers

What is a microcontroller?

You might be asking yourself what is a microcontroller and what does it do? A microcontroller is a computing device capable of executing a program (i.e. a sequence of instructions) and is often referred to as the “brain” or “control center” in a robot since it is usually responsible for all computations, decision making, and communications. In order to interact with the outside world, a microcontroller possesses a series of pins (electrical signal connections) that can be turned HIGH (1/ON), or LOW (0/OFF) through programming instructions. These pins can also be used to read electrical signals (coming form sensors or other devices) and tell whether they are HIGH or LOW.

Microcontroller and Development Board

Most modern microcontrollers can also measure analogue voltage signals (i.e. signals that can have a full range of values instead of just two well defined states) through the use of an Analogue to Digital Converter (ADC). By using the ADC, a microcontroller can assign a numerical value to an analogue voltage that is neither HIGH nor LOW.

What can a microcontroller do?

Although microcontrollers can seem rather limited at first glance, many complex actions can be achieved by setting the pins HIGH and LOW in a clever way. Nevertheless, creating very complex algorithms (such as advanced vision processing and intelligent behaviours) or very large programs may be simply impossible for a microcontroller due to its inherent resource and speed limitations. For instance, in order to blink a light, one could program a repeating sequence where the microcontrollers turns a pin HIGH, waits for a moment, turns it LOW, waits for another moment and starts again. A light connected to the pin in question would then blink indefinitely. In a similar way, microcontrollers can be used to control other electrical devices such as actuators (when connected to motor controllers), storage devices (such as SD cards), WiFi or Bluetooth interfaces, etc. As a consequence of this incredible versatility, microcontrollers can be found in everyday products. Practically every home appliance or electronic device uses at least one (often many) microcontroller. For instance TV sets, washing machines, remote controls, telephones, watches, microwave ovens, and now robots require these little devices to operate. Unlike microprocessors (e.g. the CPU in personal computers), a microcontroller does not require peripherals such as external RAM or external storage devices to operate. This means that although microcontrollers can be less powerful than their PC counterpart, developing circuits and products based on microcontrollers is much simpler and less expensive since very few additional hardware components are required. It is important to note that a microcontroller can output only a very small amount of electrical power through its pins; this means that a generic microcontroller will likely not be able to power electrical motors, solenoids, large lights, or any other large load directly. Trying to do so may even cause physical damage to the controller.

What are the more specialized features in a microcontroller?

Special hardware built into the microcontrollers means these devices can do more than the usual digital I/O, basic computations, basic mathematics, and decision taking. Many microcontrollers readily support the most popular communication protocols such as UART (a.k.a. serial or RS232), SPI and  I2C.This feature is incredibly useful when communicating with other devices such as computers, advanced sensors, or other microcontrollers. Although it is possible to manually implement these protocols, it is always nice to have dedicated hardware built-in that takes care of the details. It allows the microcontroller to focus on other tasks and allows for a cleaner program. Analogue-to-digital converters (ADC)  are used to translate analogue voltage signals to a digital number proportional to the magnitude of the voltage, this number can then be used in the microcontroller program. In order to output an intermediate amount of power different from HIGH and LOW, some microcontrollers are able to use pulse-width modulation (PWM). For example this method makes it possible to smoothly dim an LED. Finally, some microcontrollers integrate a voltage regulator in their development boards. This is rather convenient since it allows the microcontroller to be powered by a wide range of voltages that do not require you to provide the exact operating voltage required. This also allows it to readily power sensors and other accessories without requiring an external regulated power source.

Analogue or Digital?

Below you can find two examples that illustrate when to use a digital or analogue pin:
  1. Digital and Analog Arduino Example SchematicDigital: A digital signal is used in order to assess the binary state of a switch. As illustrated below (on the left side of the solderless breadboard), a momentary switch or push button closes a circuit when pressed, and allows current to flow (a pull-up resister is also shown). A digital pin connected (through a green wire in the picture) to this circuit would return either LOW or 0 (meaning that the voltage at the pin is in the LOW range, 0V in this case) or a HIGH (meaning the button is pressed and the voltage is at the HIGH range, 5V in this case).
  2. Analogue: A variable resistor or potentiometer (as shown towards the right side of the board below) is used to provide an analogue electrical signal proportional to a rotation (e.g. the volume knob on a stereo). As illustrated below, when a potentiometer is connected to a 5V supply and the shaft is turned, the output will vary between 0 and 5V, proportionally to the angle of rotation. The ADC on a microcontroller interprets the voltage and converts it to a numeric value. For example, a 10-bit ADC converts 0V to the value “0”, 2.5V to “512” and 5V to “1023”. Therefore if you suspect the device you plan to connect will provide a value that is proportional to something else (for example temperature, force, position), it will likely need an analogue pin.

Digital and Analog Arduino Example

 

What about programming?

ProgrammingBeing afraid of programming microcontrollers is getting old fashioned. Unlike the “old days” where making a light blink took advanced knowledge of the microcontroller and several dozen lines of code (not to mention parallel or serial cables connected to huge development board), programing a microcontroller is very simple thanks to modern Integrated Development Environments (IDE) that use up-to-date languages, fully featured libraries that readily cover all of the most common (and not so common) action, and several ready-made code examples to get beginners started. Now-a-days, microcontrollers can be programmed in various high-level languages including C, C++, C#, Processing (a variation of C++), Java, Python, .Net, and Basic. Of course, it is always possible to program them in Assembler but this privilege is reserved for more advanced users with very special requirements (and a hint of masochism). In this sense, anyone should be able to find a programming language that best suit their taste and previous programming experience. IDEs are becoming even simpler as manufacturers create graphical programming environments. Sequences which used to require several lines of code are reduced to an image which can be connected to other “images” to form code. For example, one image might represent controlling a motor and the user need only place it where he/she wants it and specify the direction and rpm. On the hardware side, microcontroller developments boards add convenience and are easier to use over time. These boards usually break out all the useful pins of the microcontroller and make them easy to access for quick circuit prototyping. They also provide convenient USB power and programming interfaces that plug right into any modern computer. For those unfamiliar with the term, a Development Board is a circuit board that provides a microcontroller chip with all the required supporting electronics (such as voltage regulator , oscillators, current limiting resistors, and USB plugs) required to operate. If you are not planning to design your own support circuit, buying a development board is preferable to simply getting a single microcontroller chip. Note: Robot programming is covered in greater depth in Lesson 10.

Why not use a standard computer?

It is apparent that a microcontroller is very similar to a PC CPU or microprocessor, and that a development board is akin to a Computer motherboard. If this is the case, why not simply use a full computer to control a robot?

Desktop Computer v.s. Microcontroller

As a matter of fact, in more advanced robots, especially those that involve complex computing and vision algorithms, the microcontroller is often replaced (or supplemented) with a standard computer. A desktop computer includes a motherboard, a processor, a main storage device (such as a hard drive), video processing (on-board or external), RAM, and of course peripherals such as monitor, keyboard, mouse etc. This type of system is usually more expensive, physically larger, more power hungry. The main differences are highlighted in the table below.

Microcontroller Personal Computer
Example Atmega328 Intel Pentium Core 2 Duo
RAM 1KB 4000000KB (4GB)
Storage 15KB 15000000KB (1000GB)
Power 0.1W 600W
Voltage 12 12
Input/Output Pins USB, RS232
Wireless Bluetooth*, RF* Bluetooth
Video None 1000000KB (1GB)
Price $4 to $300 $400 to $2000
Internet WiFi* or Ethernet* WiFi or Ethernet
*Available as optional additions on many microcontrollers.

Choosing the right Microcontroller

Unless you are into BEAM robotics, or plan to control your custom robot using a tether or an R/C system (which, based on our definition from Lesson 1 would not be considered a robot), you will need a microcontroller for any robotic project. For a beginner, choosing the right microcontroller may seem like a daunting task, especially considering the range of products, specifications and potential applications. There are many different microcontrollers available on the market: Arduino, BasicATOM, BasicX, POB Technology,  Pololu, Parallax and more. When considering the right microcontroller, ask yourself the following questions:
  1. Which microcontroller is the most popular for my application? Of course making robots or electronic projects in general is not a popularity contest, but the fact that a microcontroller has a large supporting community or has been successfully used in a similar (or even the same) situation could simplify your design phase considerably. This way, you could benefit from other user’s experience and among hobbyists. It is common for robot builders to share results, code, pictures, videos, and detail successes and even failures. All this available material and the possibility of receiving advice from more experienced users can prove very valuable.
  2. Does it have any special features the robot requires? As popular as a microcontroller might be, it must be able to perform all the special actions required for your robot to functions properly. Some features are common to all microcontrollers (e.g. having digital inputs and outputs, being able to perform simple mathematical operations, comparing values and taking decisions), while others need specific hardware (e.g ADC, PWM, and communication protocol support). Also memory and speed requirements, as well as pin count should be taken into consideration.
  3. Are the accessories I need available for a particular microcontroller? If your robot has special requirements or there is a particular accessory or component that is crucial for your design, choosing a compatible microcontroller is obviously very important. Although most sensors and accessories can be interfaced directly with many microcontrollers, some accessories are meant to interface with a specific microcontroller and even provide out-of-the-box functionally or sample code.

What does the future hold?

As the price of computers has gone down, and advances in technology make them smaller and more energy efficient, single-board computer have emerged as an attractive option for robots. These single-board computers are essentially computers you may have used about 5 years ago, and incorporate many devices into one board (so you cannot swap anything out). They can run a complete operating system (Windows and Linux are most common) and can connect to external devices such as USB peripherals, LCDs etc. Unlike their ancestors, these single-board computers tend to be much more power efficient.

Practical Example

In order to choose a microcontroller, we compiled a list of features / criteria we wanted:
  1. The microcontroller’s cost must be low while including a development board (below 50$)
  2. It must be easy to use and well supported. It is also important to have lots of documentation readily available.
  3. It should be programmed in C or a C-based language.
  4. It must be popular and have an active user community.
  5. Since the robot will be used as a general purpose platform, the microcontroller should be very feature rich in order to allow for broad experimentation. In this sense, it should have several analogue and digital pins, as well as an integrated voltage regulator.
Since our robot will use two motors, the microcontroller will need two digital pins for direction control, and two PWM pins for speed control (this will be explained in more detail in Lesson 5). The robot will also transmit and receive data so it will need to support the UART (a.k.a. serial or RS232) communication protocol in our case.  We would also like the option of adding other sensors and devices in the future so analogue pins and many extra digital pins would be appropriate. The upcoming RobotShop Microcontroller comparison table allows us to compare the main features of one microcontroller with another. The Pololu and Arduino microcontrollers seemed to conform best to the above criteria. In order to select a specific microcontroller from these two manufacturers, each was researched in order to determine the amount of available material, code, user community, Google hits and more. Arduino Uno The Arduino Duemilanove (recently replaced by the Arduino Uno) was ultimately chosen based on price vs. features and because of the concept of “shields” (separate accessory boards you plug and stack onto the microcontroller which add specific functionality). Also, Arduino is rather popular, there are many sample projects, and its community is very active. RobotShop - Robotics at your serviceFor further information on learning how to make a robot, please visit the RobotShop Learning Center. Visit the RobotShop Community Forum in order to seek assistance in building robots, showcase your projects or simply hang-out with other fellow roboticists.
Subscribe to the RobotShop Blogs RSS feed!

Enter your email address: