Microcontrollers

Robot MCUs ¶ 

By Gareth Branwyn

Most bots have brains. Even BEAM robots, simple analog bots, popular with hobbyists, use analog ICs and combinations of resistors, capacitors, and transistors to oscillate (pass back and forth) a signal (via the IC), and time and amplify that signal (the RCs and the transistors) to move a robot or to get it to do something useful. The majority of small robots use what are called microcontroller units (or MCUs, or even µCs, if you wanna get really geeky about it). An MCU is a computer on a chip that contains a processor, a clock and timers, memory, and input/out lines. These tiny computers are usually flash-programmable (you download a program onto it coded on another computer) or are single-use and have a program baked into them (and are not re-programmable). You may have heard the term "embedded systems" before, which basically is what an MCU is: a tiny computer embedded in your car, your household appliances, medical instruments, and thousands of other applications.

Block Image

CPU – As with any computer, the central processing unit (CPU) is the traffic controller for the whole system, for executing programming instructions, and for processing the data of inputs and outputs.

Clocks – Some MCUs have clocks built right into the chip. Many MCU boards have a clock (aka “crystal oscillator”) on them that the MCU uses. Either way, these clocks affect how fast the MCU can perform its duties. Clock speeds are measured in MHz. On MCUs, clock speeds from 4MHz up to 75MHz are common. (The ATmega328 used in some of the Arduino family, including the Solarbotics Ardweeny, runs at up to 20MHz, a common MCU speed.)

Memory (Program and Data Memory) – Most popular MCUs use Flash memory, which enables you to read and write to the memory space over and over again. Like all EEPROM (electrically erasable programmable read-only memory), Flash retains data in it even when powered down. Flash memory is where the programs and permanent data are stored. As with your desktop computer, RAM is where all of the temp data (such as sensor input) is stored. The size of the EEPROM or Flash limits the size of the programs you can run on your MCU. The amount of RAM limits the amount of temporary data the controller can handle.

I/O (Analog and Digital) – Physical pins on the MCU chip, or more likely, broken out into plug-in "headers" on the MCU PCB, enable you to plug sensors and other components into the controller. In buying an MCU, you always want to make sure you have enough inputs for the sensors you'll be using (and a few more for future additions). Most MCUs have bidirectional I/O pins that can be programmed for input or output. If there are fixed I/O pins (as opposed to bidirectional), there are usually fewer outputs available. Some MCUs have both regular output pins and pins specifically designed for motor control.

PWM (Pulse Width Modulation) – PWM is a way of creating a controllable output signal, for controlling the speed of motors, the intensity of lights, etc., by pulsing a digital signal on/off (aka the "duty cycle") to create a sort of faux continuous wave/analog signal. The speed of the on/off pulses are so fast, they smooth out, like a waveform. The on-time percentage, or pulse width, determines the speed of the modulation.

UART (Universal Asynchronous Receiver/Transmitter) – The way that an MCU talks to the world, and the computer that feeds it programs, is through a serial data connection; that serial communication, which gets translated back into parallel communications on either end of the pipe, is usually handled by the UART chip (or region of a chip). The UART feeds to a serial port, which is usually a set of male pins for a female header (think: plug) or a serial-to-USB converter jack. On the Ardweeny board, there's a 6-pin male header into which can be plugged a serial-to-USB conversion cable, or a serial-to-USB breakout board (a little PCB) into which a standard USB cable can be plugged.

ADC (Analog-Digiital Converter) – Computers are, of course, digital creatures. But a lot of the inputs (and the sensors that love them) are analog. For a digital machine to understand an analog signal, it must first be converted into something approximating the on/off, binary nature of that digital machine. The mechanism for doing that is called an analog-digiital converter (or ADC). Most MCUs have these available on several pins. You can go the other way too, using a DAC (digital-analog converter), but that functionality is not common on most MCUs.

Other parts usually found on an MCU board are a power supply circuit – with a voltage regulator, power input jack, power selection switch or jumpers, communication ports (such as the serial-to-USB port mentioned above), and other communications types (such as I2C, a comms connection standard designed for embedded systems), a reset switch (reboot! reboot!), status indicator LED(s), and a power switch. Oh, and power output pins, for sending power out to sensors and other circuitry you wish to power from the board.

If you are using Arduino to control your CoasterBot, check out this basic SlideShare intro to Arduino. A general introduction to microcontrollers can also be found in a simple SlideShare presentation.

Also, check out the official Arduino site for tons of documentation and datasheets on the different MCU hardware used in Arduino.

Comments Add Note Comments are onturn off

No comments.