19
Build the Machine Science XBoard, with a programmable microcontroller. Site: iCODE Course: Machine Science Guides Book: Assembling the XBoard Printed by: Guest User Date: Monday, May 24, 2010, 10:46 AM name http://guides.machinescience.org/mod/book/print.php?id=706 1 of 19 5/24/2010 12:47 PM

Build the Machine Science XBoard, with a programmable

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Build the Machine Science XBoard, with a programmable

Build the Machine Science XBoard, with a programmable microcontroller.

Site: iCODECourse: Machine Science GuidesBook: Assembling the XBoardPrinted by: Guest UserDate: Monday, May 24, 2010, 10:46 AM

name http://guides.machinescience.org/mod/book/print.php?id=706

1 of 19 5/24/2010 12:47 PM

Page 2: Build the Machine Science XBoard, with a programmable

Assembling the XBoard

The Challenge: Build the XBoardCollecting Your ComponentsAbout the MicrocontrollerInstalling the MicrocontrollerAbout the OscillatorInstalling the OscillatorAbout the CapacitorInstalling the CapacitorIdentifying Your Programming HardwareSetting Up the USB Programming LinkageAbout the LCDInstalling the LCDMore Practice with SchematicsFinal Hardware Check

name http://guides.machinescience.org/mod/book/print.php?id=706

2 of 19 5/24/2010 12:47 PM

Page 3: Build the Machine Science XBoard, with a programmable

The Machine Science XBoard is a configuration of wires and components on the breadboard that willallow you to rapidly build sophisticated electronics and robotics projects. The XBoard's keycomponent is a PIC microcontroller: a tiny computer on a chip. The microcontroller can beprogrammed with a set of instructions, called code, which determine how it behaves. The XBoard willbe the control center for many Machine Science projects, from digital stopwatches to remote-controlled robots! Figure 1 shows the completed XBoard.

Figure 1. The Machine Science XBoard.

name http://guides.machinescience.org/mod/book/print.php?id=706

3 of 19 5/24/2010 12:47 PM

Page 4: Build the Machine Science XBoard, with a programmable

In this challenge, you will build the XBoard by adding a microcontroller to thebreadboard. You will also connect a variety of different components to thebreadboard, including an oscillator, a capacitor, a reset button, and a programminglinkage. In the next unit, you will practice programming the microcontroller, using an

existing code file.

name http://guides.machinescience.org/mod/book/print.php?id=706

4 of 19 5/24/2010 12:47 PM

Page 5: Build the Machine Science XBoard, with a programmable

The components needed to build the XBoard are listed in the table below and shown in Figure 2.

Part Quantity DescriptionA 1 Microcontroller (PIC16F877)B 1 Liquid crystal displayC 1 Resistor (4.7K-Ohm)D 1 Oscillator (4.0-megahertz)E 1 Capacitor (0.1-microfarad)F 1 USB programming boardG 17 Jump wires (6 yellow, 6 orange, 2 long red, 1 short red, 1 brown, 1 white)

Figure 2. XBoard components.

name http://guides.machinescience.org/mod/book/print.php?id=706

5 of 19 5/24/2010 12:47 PM

Page 6: Build the Machine Science XBoard, with a programmable

The microcontroller is the XBoard's "brain," a tiny computer on a chip, which can be programmed toperform specific tasks. The XBoard's microcontroller, shown in Figure 3, is just like those found inmany commercial devices. It has 40 pins, which plug directly into the XBoard.

Figure 3. The XBoard's microcontroller.

In recent years, microcontrollers have become smaller, more powerful, and less expensive. As a result,they have been incorporated into more and more everyday products, from cell phones and pagers tohome appliances and automobiles. Figure 4 shows some of the systems in modern automobiles that relyon microcontrollers.

Figure 4. Automobile systems that rely on microcontrollers.

name http://guides.machinescience.org/mod/book/print.php?id=706

6 of 19 5/24/2010 12:47 PM

Page 7: Build the Machine Science XBoard, with a programmable

1. Orient your breadboard so that hole A1 is inthe lower-left corner.

2. Orient the microcontroller so that the pinsare pointing down, and the small circularindentation is in the lower-left corner of thetop face.

3. Find pin 1, which is directly beneath thecircular indentation on the microcontroller.

4. Insert the microcontroller into thebreadboard, aligning pin 1 with hole C7, asshown in Figure 5. Be sure all 40 pins areproperly aligned before applying pressure toinsert the microcontroller. NOTE: You mayhave to bend the pins slightly to align them. Onceall the pins are aligned, be sure to pushmicrocontroller firmly down until it CLICKSINTO PLACE.

Figure 5. Top view of the breadboard with the microcontroller installed.

name http://guides.machinescience.org/mod/book/print.php?id=706

7 of 19 5/24/2010 12:47 PM

Page 8: Build the Machine Science XBoard, with a programmable

To perform its tasks, the microcontroller needs to keep track of time. It does this with an oscillator, acomponent with a crystal that vibrates at a constant 4 million times per second. The oscillator is likethe XBoard's "clock." By dividing each second into many small units, oscillators help coordinate theactions of the microcontroller. The oscillator has three pins. The middle pin connects to ground. Theouter pins connect to the microcontroller via jump wires. Figure 6 shows the oscillator.

Figure 6. The XBoard's oscillator (left) and a clock (right).

name http://guides.machinescience.org/mod/book/print.php?id=706

8 of 19 5/24/2010 12:47 PM

Page 9: Build the Machine Science XBoard, with a programmable

1. Carefully insert brown, white, and yellowjump wires into the board, as shown in Figure7. The brown wire connects hole B20 to holeB30. The white wire connects hole A19 to A28.The yellow wire connects hole A29 to ground.

2. Insert the oscillator, with the printed text onthe component facing you (Figure 7). Theoscillator's three prongs should go in holesD28, D29, and D30. NOTE: You may have totrim excess wire from the oscillator's prongs inorder to seat it as shown.

Figure 7. XBoard with the oscillator installed.

name http://guides.machinescience.org/mod/book/print.php?id=706

9 of 19 5/24/2010 12:47 PM

Page 10: Build the Machine Science XBoard, with a programmable

Like many electronic devices, the microcontroller is sensitive to surges in power, which can cause it tomalfunction. Occasionally, the battery pack's power surges. To even out these surges, the XBoard hasa component called a capacitor, which stores the extra electricity during a surge and then releases itslowly. The capacitor protects the microcontroller, just as a surge protector protects your computerfrom power surges in your home. Figure 8 shows the capacitor.

Figure 8. The XBoard's capacitor (left) and a home surge protector (right).

name http://guides.machinescience.org/mod/book/print.php?id=706

10 of 19 5/24/2010 12:47 PM

Page 11: Build the Machine Science XBoard, with a programmable

1. Insert one end of the yellow wire into holeA18 and the other end into ground. Similarly,insert one end of the orange wire in hole A17and the other end into power, as shown in thevideo and Figure 9.

2. Install the capacitor on the board, insertingthe capacitor's two prongs into holes B17 andB18. NOTE: You may have to trim excess wirefrom the capacitor's prongs in order to seat it asshown in Figure 9. If the capacitor has text on it,be sure that the text is facing towards themicrocontroller. If it has no text, or text on bothsides, you may insert it in either orientation.

Figure 9. XBoard with the capacitor installed.

3. Next, make two more connections to power and ground on the top side of the chip, connectinghole J15 to power and hole J16 to ground, as shown in Figure 10.

name http://guides.machinescience.org/mod/book/print.php?id=706

11 of 19 5/24/2010 12:47 PM

Page 12: Build the Machine Science XBoard, with a programmable

Figure 10. Power and ground connections on the top of the microcontroller.

name http://guides.machinescience.org/mod/book/print.php?id=706

12 of 19 5/24/2010 12:47 PM

Page 13: Build the Machine Science XBoard, with a programmable

To program the microcontroller, you must establish a linkage between your computer and the PICmicrocontroller. Kits shipped after June 2009 include a USB programming board with two rows ofmale headers that plug into the breadboard to the left of the chip. Instructions for installing these newerunits are included in this tutorial. Instructions for older programmers are included in the Older KitComponents section. Figure 11 shows the programming components included in Breadboard StarterKits of different ages, starting with the oldest.

Figure 11. Serial (top) and USB (bottom) programming linkages.

name http://guides.machinescience.org/mod/book/print.php?id=706

13 of 19 5/24/2010 12:47 PM

Page 14: Build the Machine Science XBoard, with a programmable

The newest version of the USB programming linkage comprises a mini USB cable and a programmingboard with two rows of five pins. This design provides more stability on the breadboard. The newdevice also has an integrated reset button, eliminating the need for a separate button switch on thebreadboard.

1. Using two long red jump wires, connect hole I1 to hole I21, and hole H2 to hole H22, as shownin Figure 12. Then, use a short red jump wire to connect hole B5 to B7, use a yellow jump wire toconnect hole A3 to ground, and use a 4.7K-Ohm resistor to connect hole A5 to power, as shown.NOTE: The 4.7K-Ohm resistor has a yellow band, a purple band, a red band, and a gold band. Youmay have to trim excess wire from the resistor in order to seat it as shown.

Figure 12. Jump wires for XBoard's programming linkage.

2. Orient the USB programming board so that the mini-USB jack is on the left side. Insert thetwo five prong-headers into the breadboard on either side of the center groove, in holes E1 to E5and F1 to F5, as shown in Figure 13.

Figure 13. Inserting the USB programming board.

name http://guides.machinescience.org/mod/book/print.php?id=706

14 of 19 5/24/2010 12:47 PM

Page 15: Build the Machine Science XBoard, with a programmable

3. Connect the mini-USB cable to the USB programming board, as shown in Figure 14.

Figure 14. Connecting the USB cable.

4. Connect the free end of the USB cable to any free USB port on your computer, as shown inFigure 15.

Figure 15. Connecting the USB cable to your computer.

name http://guides.machinescience.org/mod/book/print.php?id=706

15 of 19 5/24/2010 12:47 PM

Page 16: Build the Machine Science XBoard, with a programmable

A liquid crystal display (LCD) contains a thin layer of liquid crystal that changes from light to darkwhen electricity is supplied to it. The XBoard's LCD can display text and graphics, like a miniaturecomputer screen. LCDs are everywhere--in digital watches, household appliances, and handheld videogames. Figure 16 shows the XBoard's LCD.

Figure 16. Liquid crystal display (LCD).

name http://guides.machinescience.org/mod/book/print.php?id=706

16 of 19 5/24/2010 12:47 PM

Page 17: Build the Machine Science XBoard, with a programmable

1. Using a yellow jump wires, connect hole J29 to power. Use two orange wires to connect holesJ28 and J30 to ground. Use a fourth orange wire to connect hole J24 to hole J27, as shown inFigure 17.

Figure 17. XBoard with jump wires for LCD installed.

2. Insert the LCD's pins into holes I17 to I20 and holes I25 to I30, as shown in Figure 18.

Figure 18. Aligning LCD's pins on XBoard.

name http://guides.machinescience.org/mod/book/print.php?id=706

17 of 19 5/24/2010 12:47 PM

Page 18: Build the Machine Science XBoard, with a programmable

Figure 19 shows a schematic diagram of the XBoard. Can you identify each element in the schematic?

Figure 19. Schematic of XBoard.

name http://guides.machinescience.org/mod/book/print.php?id=706

18 of 19 5/24/2010 12:47 PM

Page 19: Build the Machine Science XBoard, with a programmable

Before moving on to the next challenge, take a few minutes to check your hardware set-up.The following checklist will help you ensure that your XBoard is ready for programming.

Microcontroller: Pin 1 should be in hole C7. The microcontroller should be pushed firmly downinto the breadboard.Oscillator: The oscillator's pins should be in holes D28, D29, and D30. The text on the oscillatorshould face you.Capacitor: The capacitor's pins should be in holes B17 and B18. If the capacitor has text on it,the text should face away from you (toward the chip). If the capacitor has text on both sides, itcan be oriented either way.Reset button: If your board has a manual reset button, the button's pins should be in holes C3and C5. The short red jump wire should connect holds B5 to B7.Programming linkage: The long red jump wires should connect hole I1 to hole I21, and holeH2 to hole H22.LCD: The right-most pin of the LCD should be in hole I30.Battery leads: As always, the red lead from the battery pack should align with a red line hole,and the black lead should align with a blue line hole.Power and ground: A single red jump wire should connect the power (red line) holes on the topof the board to the power (red line) holes on the bottom of the board. Also, a single red jumpwire should connect the ground (blue line) holes on the top of the board to the ground (blue line)holes on the bottom of the board.

name http://guides.machinescience.org/mod/book/print.php?id=706

19 of 19 5/24/2010 12:47 PM