GoRobotics - Robotics news, robot projects

Archive for the ‘Microcontrollers’ Category

Carlitos’ Projects: Speech-Controlled Arduino Robot

Posted on March 1st, 2011 in Microcontrollers, Projects, Robotics Projects, Robots

We all dream of having appliances and machines that can obey our spoken commands. Well, let’s take the first step towards making this happen.  In this second iteration of Carlitos’ Projects, we are going to build a speech-controlled Arduino-based robot.

Speech Controlled Arduino Robot

You may be thinking that making such a robot must be a very complex task. After all, humans take many years before they can understand speech properly. Well, it is not as difficult as you may think and it is definitely lots of fun. The video below illustrates how to make your own speech-controlled Arduino rover.

After watching the video, read below the detailed list of parts and steps required to complete the project.

Materials

  • A DFRobotShop Rover kit. It constitutes the robot to be controlled.
  • A VRbot speech recognition module. It processes the speech and identifies the commands.
  • Two Xbee RF communication modules. They create a wireless link between the speech recognition engine and the robot.
  • An Arduino Uno. Controls the speech recognition module.
  • An IO expansion shield. Allows to connect the Xbee module to the DFRobotShop Rover
  • An Xbee shield. Allows to connect an Xbee module to the Arduino Uno.
  • Male headers. They are required by the Xbee shield.
  • A barrel jack to 9V battery adaptor. Allows to power the Arduino Uno trough a 9V battery.
  • An LED. It is not required since the IO expansion shield already has one but it can provide a more visible activity feedback.
  • An audio jack. It will be used to connect the microphone. This is optional
  • A headset or a microphone (a microphone is included with the speech recognition module).

Tools

  • Wire Cutter. It will be used to cut the leads off components.
  • 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.
  • A Hot-glue gun in order to stick the components together.
  • A computer . It programs the DFRobotShop Rover and the Arduino Uno using the Arduino IDE.

Putting it Together

  1. Assemble the DFRobotShop Rover and mount the IO expansion shield, an Xbee Module and the LED. Se the picture above or the video for further information.
  2. Solder the headers onto the Xbee shield. Also solder four headers on the prototyping area as shown below. Do not like soldering? Then keep reading since there is no-solder-required version of the project.
    Speech Engine - 2
  3. Connect the four headers to the corresponding pins as shown below.
    Speech Engine - 3
  4. As shown above, you can also mount the headphone jack and use the cable included with the microphone in order to connect it to the VRbot module microphone input.
  5. Put the shield onto the Arduino and connect the battery.
    Speech Engine - 4
  6. Connect the VRbot speech recognition module wires and the microphone.
    Speech Engine - Back
  7. Program the DFRobotShop Rover and the Arduino Uno with these programs respectively:
    dfrobotshop_serial.zip and VRbot.zip
  8. Start talking to your robot! Say “forward”, “backward”, “left”, or “right” in order to make the robot move in the desired direction. The word “move” shown in the video has been removed from the program in order to improve the performance.

Go Further

Now that you have the basic program you can create new commands in order to build upon this project. For instance, it would be nice to program a “dance” command that would make the rover execute a predefined choreography. It is also possible to use this knowledge to control other devices such as lamps, TV sets, and more.

You can find more information about using the VRbot speech recognition module here:

In our case, we used two of these robots in order to create a ball-fetching challenge at the CRC 2011 with high-school and CEGEP students. As shown below, the students and general public loved the game.


CRC - Robot Fun

CRC - More Robot Fun


Get your own

RobotShop put together a full kit that you can buy in order to get started with speech control. This kit is a bit different than the project shown and does not require any soldering and uses the microphone included with the VRbot module:

DFRobotShop Rover – Speech Control Kit

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.

Arduino + Toy = Robot!

Posted on December 14th, 2010 in Microcontrollers, Projects, Robots, Sensors

This is a nice video from a while ago describing how to quickly and cheaply put together a robot by using an old RC toy, an Arduino (actually a Seeeduino), a Ping distance sensor and a couple of other components.

More in-depth videos of the construction below.

We are eager to see our readers go crazy and build their own robots from old toys.

Via DinoFab.

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.

Mouse Controlled Robotic Arm

Posted on July 23rd, 2010 in Articles, Microcontrollers, Motors, Robots
Mouse Controlled Robotic Arm

Oleg put together this pretty neat robotic arm that he can control using a standard USB mouse. He used a Lynxmotion robotic arm with a wrist upgrade, an Arduino as the brain, a USB Host shield in order to interface a regular computer mouse, and a custom made servo motor controller.

This is a rather clever design and, as shown in the video below, all the degrees of freedom of the arm can be controlled by combining the motion of the mouse and the scroll wheel, and the clicking of the mouse buttons.

Via Hack a Day (via Circuits@Home)

Subscribe to the RobotShop Blogs RSS feed!

Enter your email address: