Microcontrollers: The Arduino Diecimila

Lopa Nath ENGL 202C Section 18 March 14, 2012 Technical Description

Audience and Scope
The purpose of this document is to provide the reader with a basic understanding of an Arduino Diecimila microcontroller. The document will go over what exactly a microcontroller in general is, the main components of the Arduino Diecimila microcontroller, programming the Diecimila, and some uses of microcontrollers. After reading the document, the reader will be able to identify when they can use a microcontroller in a project, which options on the microcontroller they should use, and the importance of microcontrollers due to widespread use of them in today’s society. The intended audience is people new to the use of microcontrollers in the field of robotics. They know little about the use of microcontrollers, how they are set up, and what their purpose is. They would refer to this document when finding a suitable wiring method for a current project they might be working on. A robotics classroom in high school or college would be the ideal location for this document. This document will explain the basics of the Arduino Diecimila so further investigation into electrical concepts may be necessary for a thorough understanding of wiring processes.

Microcontrollers came into use in the 1970s and over the years have evolved in many ways including smaller size, faster processing speed, and a much cheaper price. These improvements have allowed microcontrollers to become more accessible to consumers. The functions that a microcontroller can provide and the ease with which they can be utilized have also led many people to use them in personal projects such as those involving robotics.

What is a microcontroller?
A microcontroller is an integrated circuit that performs many of the same tasks a computer would but is used in automatically controlled devices. The microcontrollers in these devices carry out specific tasks and make decisions preprogrammed by the user as opposed to personal computers which are more flexible for a user’s needs. Similar components of a computer and microcontroller:  Processing core  Memory  Input and output terminals that can be programmed

Figure 1: A microcontroller

Microcontrollers execute a program that the user stores onto it and makes decisions based on these instructions. In robotics, microcontrollers are used most often for logic and sensor interpretation, for example to receive data from sensors and make decisions based on this information.

Overview of the Arduino Diecimila
The Arduino Diecimila is a type of microcontroller. It is open-source and open-hardware which means that the design for the hardware and tools and code for the software are available for free which is why many people choose to use Arduino for their projects.

Specifics of the Arduino Diecimila
The Arduino Diecimila is 2.7 inches in length and 2.1 inches in width. It has 14 digital input/output pins, 6 of which can be used as Pulse Width Modulation (PWM) outputs, and 6 analog inputs. PWM, in short, is a way in which power output is controlled so that the power loss when switching electrical devices is very low.

In terms of memory, it has 14KB of programmable memory (stores code) and 1KB of Random Access Memory (RAM) and its clock speed is 16MHz. It also has a USB connection, a power jack, and a reset button. To use the Diecimila, it must be connected to a computer with a USB cable or to a battery and it contains all the components to then run. The board has a jumper to indicate whether to use USB or external power. For USB the jumper is placed on the two pins closes to the USB connector and for external, it is placed on the two pins closest to the external jack. The board operates on an external supply of 6 to 20 volts although 7 to 12 is recommended. Figure 2 below shows the locations of the various components on the Arduino Diecimila.

Figure 2: The Arduino Diecimila

Pins on the Arduino Diecimila
For input and output, the 14 digital pins can be used for either although it must be specified in the code using the functions pinMode(), digitalWrite(), and digitalRead(). Specialized functions of pins:  Pins 2 and 3 can be used to trigger interrupts on a low value, rising or falling edge, or a change in value using the attachInterrupt() function.  Pins 3, 5, 6, 9, 10, and 11 can be used for PWM output using the analogWrite() function.

Pin 13 has an LED built into it that is on when the pin is high value and off for low value.

An Brief Explanation of Pins
While the concept of pins can be confusing to many, it is important to understand the difference as they can provide various different uses. Digital pins only have two ends of a spectrum, high or low, on or off, 5 volts or 0 volts. For this reason, the digital pins are usually used for anything that does not vary. For example, to turn an LED on at full brightness, or off. Analog pins, however, are usually used for input and they can read various values between 0 and 1023 (for Arduino purposes). Analog is used for variable sensors such as a potentiometer because it will return the exact values that the sensor varies through. PWM, meanwhile, outputs between 0 and 5 volts. Because the output can be varied with PWM, it is most often used to power motors. It can also be used to light an LED with varying degrees of brightness as opposed to digital, where it is either fully on or fully off. The ground pin, lastly, is used to complete the circuit’s the user creates when wiring the different inputs and outputs. It represents 0 volts compared to anything else that is wired with it.

Programming the Arduino Diecimila
The programming language for Arduino is derived from the Processing programming language. It is, however, very similar to C. The main difference is that unlike in C where the program always enters at main(), the Arduino language does not have this. Instead, it has the function “void setup()” which is called whenever the hardware is reset and used for any setting up that needs to be done before the actual code is run. The function “void loop()” runs infinitely after the setup function exits and this is where the main coding is done. The Arduino is also not threaded so it cannot run parallel processes. It does however, as mentioned earlier while discussing pins, support interrupts.

Uses of Microcontrollers
Due to the quickly declining cost of microcontrollers and the vast possibilities of their functionality, they are present in many of the systems we use today such as:   Remote controls Toys

  

Power tools Appliances Medical devices

The progress made in the field of microcontrollers has been widely successful and continues to grow. They have come into use in everyday objects and can now be used at a low cost for everyday projects for those who are interested. They will inevitably continue to expand into more areas of our lives and being able to work with them gives users a greater understanding of how the tools they use everyday function.

References Figure 1: http://www.robotshop.com/content/images//basic-micro-basicatom40-mmicrocontroller-module-a.jpg Figure 2: http://arduino.cc/en/Main/ArduinoBoardDiecimila Information from http://arduino.cc/en/Main/ArduinoBoardDiecimila http://www.societyofrobots.com/microcontroller_tutorial.shtml