Building the ATmega Board Build a circuit with the ATMega168 microcontroller. Site: iCODE Course: Machine Science Guides (Arduino Version) Book: Building the ATmega Board Printed by: Ivan Rudnicki Date: Wednesday, July 30, 2014, 03:25 PM Contents About the ATmega Board Collecting Your Components About the Microcontroller Identifying Pins on the Microcontroller About the USB Programming Board Assembling the ATmega Board Making an Efficient Layout (Optional) Powering the ATmega Board About the ATmega Board The ATmega Board is a configuration of wires and components on the breadboard that allows you to rapidly build programmable electronics and robotics projects. The board's key component is an ATmega168 microcontroller: a computer on a chip. The microcontroller can be programmed with a set of instructions, or code, which determines how it operates. Figure 1 shows the completed ATmega Board. Figure 1. ATmega Board. Collecting Your Components In order to build the ATmega Board, you will need the components listed in the table below and shown in Figure 2: Part Quantity Description A 1 ATmega168 microcontroller B 1 Capacitor (0.1uF) C 8 10 Prebent jump wires, various lengths D 1 10K Ohm resistor E 1 USB programming board F 1 USB cable G 1 Voltage regulator (optional for use with alkaline batteries) Figure 2. Components needed for ATmega Board. About the Microcontroller The ATmega Board's microcontroller, shown in Figure 3, is the ATmega168 from Atmel Corp. This is an example of an 8bit microcontroller. Figure 3. ATmega168 microcontroller. In recent years, microcontrollers have been incorporated into more and more everyday products, from portable electronics to home appliances and automobiles. Figure 4 shows some of the many systems in modern automobiles that rely on microcontrollers. Figure 4. Automobile systems that rely on microcontrollers. Identifying Pins on the Microcontroller The ATmega168 has 28 pins. Pin 1 is a reset pin, and it is marked with a small round indentation on the top of the chip. A map of the ATmega168’s 28 pins is shown in Figure 5. Look closely at the chip and make sure you can identify pin 1. Figure 5. Map of the pins on the ATmega168. In addition to having pin numbers, many pins are also designated as "ports," such as Port A, Port B, Port C, etc. Ports can be used to connect the ATmega168 to other components. About the USB Programming Board The USB programming board is a small printed circuit board that lets your computer communicate with the microcontroller. The programming board translates between the computer's universal serial bus (USB) communication protocol and the microcontroller's transistortransistorlogic (TTL) serial communication protocol. Figure 6 shows the position of the USB programming board's 10 pins. Figure 6. USB programming board. The USB programming board features two LEDs to indicate when the board is transmitting or receiving data, as well as a reset button, which can be used to reset the microcontroller. (The USB board can also be used to supply power to the breadboard. For more information, see the Powering the ATmega Board section.) Assembling the ATmega Board Figure 7 presents a schematic of the ATmega Board, with the components labeled. Note that the orientation of the pins on the picture of the chip does not correspond to their physical position on the device. Also, the schematic does not illustrate how the circuit should be laid out on the breadboard; it simply shows how the components should be connected. You are free to lay out the circuit any way you want, provided the connections are made as shown. Figure 7. Schematic of ATmega Board. As a starting point, it is a good idea to insert the chip so that its two rows of pins straddle the groove in the center of the breadboard, as shown in Figure 8. Figure 8. Chip straddling the center channel. Positioning the chip this way ensures that no pin on the chip is tied to any other, and leaves space on either side for connections to other components. Making an Efficient Layout (Optional) After you make all the connections shown on the schematic, you may want to reposition some components and wires to achieve a more efficient layout. Figure 9 shows one possible way to set up the board. Figure 10 shows the alignment of the pins on the underside of the USB programming board. Figure 9. One way to set up the ATmega Board. Figure 10. Aligning the pins on the underside of the programming board. Powering the ATmega Board Unlike the LED or the sevensegment display, the ATmega microcontroller requires that the voltage difference between power and ground be within a specific range (~2.7 to ~5.5 volts) in order to function properly. Four rechargeable AA cells connected in series supply about 5.2 volts, so these can be used in the battery pack without modifying the power circuit. On the other hand, four non rechargeable (alkaline) AA cells supply in excess of 6.0 volts, necessitating the use of a voltage regulator to produce a voltage difference within the specified range. A voltage regulator is included in the kit for this purpose, and can be installed as shown in Figure 11, if needed. Figure 11. Installing the voltage regulator for use with alkaline batteries. Note that the regulator should NOT be aligned exactly with the threeprong bent connector. Figure 12 shows a schematic of the power circuit with the voltage regulator. With the text on the regulator facing towards you, the pins are numbered 1 to 3, from left to right. Pin 1 connects to the battery power, pin 2 connects to the battery ground, and pin 3 provides a steady 5.0 volt output. Figure 12. Voltage regulator schematic. It is also possible to power the ATmega Board by connecting one additional pin on the USB programming board to power. This is simpler than connecting an external battery pack, but requires that the ATmega Board remain tethered to the user's computer at all times. It also limits the amount of current that can be collectively drawn by components on the board to about 100 milliamps (see important note below). Figure 13 shows how to connect the USB programming board so that it powers the ATmega Board. Figure 13. Connecting the USB programming board to power. IMPORTANT NOTE While it is safe to power LEDs, the piezo speaker, and the LCD using USB power, it is unsafe to power components that draw higher current, such as servo motors. Be sure to remove the jump wire shown in Figure 13 before connecting any motors or other highcurrent components. Failure to do so can result in permanent damage to the USB programming board.