Pololu m3pi User’s Guide
- 1. Overview
- 2. Assembly
- 3. Using the m3pi
- 4. The Expansion Board in Detail
The m3pi robot is an upgraded version of our popular 3pi robot, consisting of a 3pi robot base connected to an m3pi expansion board that simplifies augmenting your robot’s capabilities with an mbed development board (or other microcontroller boards), wireless modules, and sensors.
|Pololu 3pi robot on a 3/4" black line.|
- Max speed of around 100 cm/second
- Regulated motor voltage (performance is unaffected by battery voltage)
- 5 reflectance sensors on underside of leading edge for line following and maze solving
- 8×2 character LCD for debugging, feedback, and user interfaces
- Piezo buzzer for simple sounds and music
Please see the 3pi robot product page for a more comprehensive description the 3pi’s features and 3pi resources (user’s guide, projects, videos, etc).
The rest of this user’s guide will help you get started with your m3pi robot or expansion kit.
Thank you for your interest in the m3pi robot or m3pi expansion kit for the 3pi robot. If you need technical support for this product or have any feedback you would like to share, you can contact us directly or post on our forum. We would also be delighted to hear from you about any of your projects and about your experience with the m3pi robot. Tell us what we did well, what we could improve, what you would like to see in the future, or anything else you would like to say!
|Fully-assembled Pololu m3pi robot.|
Fully-Assembled m3pi Robot with mbed Socket
The following connectors and components are already installed on the fully-assembled m3pi robot (as shown in the picture on the right):
- mbed socket
- XBee socket
- USB A connector
- 2-pin battery-charging header
- Power pushbutton
- Two general-purpose pushbuttons
- 6-pin shrouded ISP connector
- All of the pins needed to connect to the 3pi robot base (male headers on the expansion PCB and matching female headers on the 3pi base)
|Hardware included with the Pololu m3pi robot.|
The fully-assembled m3pi robot also includes some optional hardware and connectors:
- One 1×11 0.1″ female header and one 1×12″ female header for adding a Wixel socket to the m3pi
- Three red shorting blocks, three yellow shorting blocks, and three black shorting blocks (the 3pi base ships with three blue shorting blocks already in place)
- Two red LEDs and two green LEDs
- One 12″, 6-pin ISP cable
m3pi Expansion Kit for 3pi Robot
|Pololu m3pi expansion kit.|
The m3pi expansion kit PCB has all of the surface-mount components populated, but none of the through-hole components ship soldered in. When combined with a 3pi robot (not included), the m3pi expansion kit includes everything required to make your own fully-assembled m3pi robot as pictured in the section above. These components are shown in the picture on the right and include:
- Two 2×20 0.1″ female headers for adding an mbed socket
- One 1×11 0.1″ female header and one 1×12″ female header for adding a Wixel socket
- Two 1×10 2mm female headers for adding an XBee socket
- One extended 2×7 0.1″ male header and two extended 1×2 0.1″ male headers for connecting the expansion PCB to a 3pi base
- One 2×7 0.1″ female header and one 1×2 0.1″ female header for soldering to the 3pi base so it can accept the male connectors of the m3pi expansion PCB
- One 1×2 0.1″ female header for use as a charge port on the expansion PCB
- Three 1×2 0.1″ male headers for use with shorting blocks for optional configuration of m3pi PCB connections (three blue shorting blocks are also included)
- One 6-pin shrouded ISP connector that can be used with the included 12″, 6-pin ISP cable to optionally let the mbed program the 3pi base
- One USB A connector (can be used when the mbed is acting as a USB host)
- Three pushbuttons for use as a power button and two general-purpose buttons on the expansion PCB
- Four screws, spacers, and nuts for mounting the expansion PCB to the 3pi base
The m3pi is designed to be easily augmented by several additional components that are not included with the m3pi:
- 4 AAA batteries. Any AAA cells will work, but we strongly recommend NiMH batteries, which are rechargeable and can be purchased from Pololu or at a local store. If you use rechargeable batteries, you will also need a battery charger. Battery chargers designed to connect to external series battery packs may be used with the m3pi’s battery charger port. To install the batteries, you must remove the m3pi expansion PCB and 3pi LCD; this rather cumbersome process only needs to be performed once if you use rechargeable batteries.
When you replace the LCD and m3pi expansion PCB after installing the batteries, please be very careful to plug the headers into the correct slots in the correct orientation. Plugging these in incorrectly could permanently damage your m3pi robot!
|Pololu m3pi robot with mbed and Wixel modules socketed.|
|Pololu m3pi robot with mbed and XBee modules socketed.|
- An mbed. The m3pi was designed to work with an mbed development board as the main robot controller, and using an mbed allows you to get the most out of your m3pi. This is an optional component, however, as the m3pi can still function without an mbed. The m3pi robot ships with the mbed socket already installed.
We offer a combination deal that consists of an m3pi robot and an mbed NXP LPC1768 development board.
- Wireless serial modules. The m3pi features sockets that can be used for a Pololu Wixel, an XBee, or some other wireless serial module (e.g. Bluetooth):
- Two Wixels. You can use a pair of Wixels to add wireless capability to your m3pi. The m3pi expansion board has space for a Wixel socket, and the Wixel’s serial lines can be routed to a socketed mbed or directly to the 3pi base with shorting blocks (in this latter configuration, the Wixel can actually be used as the main robot controller of the m3pi instead of an mbed). Note that installing a Wixel socket will prevent the use of the XBee socket, so the m3pi robot ships with the Wixel socket headers included but not soldered in.
- Two XBees. You can also use a pair of XBees to add wireless capability to your m3pi. The m3pi expansion board has space for an XBee socket (and the m3pi ships with this socket already installed), and the XBee’s serial lines can be routed to a socketed mbed or directly to the 3pi base with shorting blocks.
- Other wireless serial modules. The m3pi PCB has general-purpose space to add other wireless serial modules (e.g. Bluetooth) instead of a Wixel or XBee. The pins for this are connected to prototyping space that makes it easy to then make the appropriate connections to your module’s power pins and serial lines.
- A Soldering iron and solder. A soldering iron is required for assembling the m3pi expansion kit. The m3pi robot can be used out of the box without any soldering, but a soldering iron could still come in handy if you want to install a Wixel socket or make use of the robot’s prototyping space for custom circuits or the addition of sensors. An inexpensive soldering iron will work, but you might consider investing in a higher-performance soldering iron if you will be doing a lot of work with electronics. See Section 2 for more information on assembling the m3pi.
- A desktop or laptop computer. You will need a personal computer for programming the m3pi. If you are using an mbed development board as your main robot controller, there are no drivers or software to install as the entire mbed toolchain is web-based. See Section 3.a for more information on getting started.
- Sensors. The 3pi base features five integrated reflectance sensors along the underside of its leading edge. These sensors can be used for applications such as line following and maze solving. If you want to enhance the m3pi’s ability to interact with its environment, however, you might want to add additional sensors, such as accelerometers and gyros for tracking position and orientation or distance sensors for detecting obstacles.
- AVR Programmer. If you already own a 3pi robot and intended to upgrade it with the m3pi expansion kit, chances are you already own an AVR programmer like our USB AVR programmer, and you will likely want to use this programmer to load the 3pi serial slave program as you build your m3pi robot. If you purchased the fully-assembled m3pi, the included 3pi robot base ships pre-programmed with a serial slave program, and if you plan on using a separate microcontroller, like an mbed or a Wixel, as the main robot controller. However, an AVR programmer is required if you want to use the 3pi’s AVR microcontroller as your main robot controller.
If you ordered a fully-assembled m3pi robot, your m3pi expansion board and the included 3pi robot are already populated with all of the standard components except for the Wixel socket headers, because these would interfere with the XBee socket. If you want to use a Wixel, please see the Wixel Socket portion of Section 2.a. Otherwise, you can skip this section and move on to using your m3pi robot!
Note: Assemby of the m3pi expansion kit into an m3pi robot requires soldering. No soldering is required if you order the fully-assembled m3pi robot.
This section will guide you through adding components to the top side of the m3pi expansion board, which requires through-hole pins to be soldered on the underside of the PCB. Please note that the components you actually need depend on how you plan on using the board, so you do not need to install components you know you will not be using. For example, if you never plan on using your mbed as a USB host, you do not need to solder in the USB A connector. Section 4 contains detailed descriptions of these components and can help you determine which components you will need for your particular application. However, there is no harm in installing them all, and doing so gives you maximum flexibility (maybe you’ll change your mind down the road and decide you want to try out using the mbed as a USB host after all).
|Assembly location diagram for the m3pi’s top-side components and headers.|
|Assembly location picture for the m3pi’s top-side components and headers.|
|Pololu m3pi expansion kit after assembly.|
If you want to use an mbed development board as the main controller of your m3pi robot, you should solder the two 2×20 0.1″ female headers to create a socket for the mbed as shown in the two diagrams at the top of this section. See Section 4.a for more information on the mbed socket.
If you want to use an XBee module to add wireless functionality to your m3pi robot, you should solder the two 1×10 2mm female headers to create a socket for the XBee as shown in the two diagrams at the top of this section. Note that the XBee headers are the only included female headers with a 2mm (0.079″) pitch, so they are noticeably smaller than all the rest. See Section 4.a for more information on the XBee socket.
Battery Charge Port
The expansion PCB makes it difficult to reach the battery charge port on the 3pi robot base, so it has connectors that bring the port up to the expansion PCB for easier access. One of the included 1×2 0.1″ female headers can be used as a battery charge port when soldered to the m3pi expansion PCB as shown in the two diagrams at the top of this section. See Section 4.f for more information about the battery charge port.
The m3pi expansion kit includes three pushbuttons that can be used to add a power button and two general-purpose user buttons to the m3pi expansion PCB. The locations for these buttons are shown in the two diagrams at the top of this section. See Section 4.c for more information about the pushbuttons.
If you want to be able to connect the serial lines of an XBee or Wixel wireless module directly to the serial lines of the 3pi base (e.g. to use the Wixel as the m3pi’s main controller or to make the m3pi a serial slave to a remote device), you should solder the three included 1×2 0.1″ male headers to create the serial jumpers shown in the two diagrams at the top of this section. Be sure to solder the ends of the headers to the PCB so that the full extent of the long ends protrude up. The included shorting blocks can then be placed over the protruding header pins to establish the alternate serial connections. See Section 4.a for more information about the serial jumpers.
USB A Connector
The m3pi expansion kit includes a USB A header that lets you connect USB devices to your mbed if it is programmed to act as a USB host. Please note that when installing the USB A connector, the two large protrusions from the case must be soldered to the PCB along with the four logic pins. These large protrusions provide structural support for the connector when they are soldered into the large holes in the PCB. The location for the USB A connector is shown in the two diagrams at the top of this section. Please see Section 4.h for more information about the USB A connector.
If you want to use your mbed as an AVR programmer (e.g. to reprogram the microcontroller on the 3pi base), you should solder the shrouded and keyed six-pin (2×3) 0.1″ male header to the m3pi PCB as shown in the two diagrams at the top of this section. Please note that this header can be installed two different ways, but only one orientation is correct: pin 1 on the header, denoted by a triangle in the plastic, must connect to pin 1 on the PCB, denoted by a caret on the silkscreen and an octagonal pad (and the gap in the shroud faces the LCD cutout). This header will not work if it is installed incorrectly, so please verify the orientation before you start soldering. Please see Section 4.g for more information about the AVRISP connector.
If you want to add wireless functionality to your m3pi robot with a Wixel module (or if you want to use the Wixel, which is programmable, as the main controller for your m3pi rather than an mbed), you should solder the included 1×11 and 1×12 0.1″ female headers to create a Wixel socket as shown in the following picture:
|m3pi locations for the 1×11 and 1×12 0.1″ female Wixel socket headers.|
Note: The Wixel socket headers are taller than the XBee socket headers, so you will no longer be able to use the XBee socket once you add the Wixel socket. For this reason, the fully-assembled version of the m3pi does not ship with the Wixel socket installed.
Please see Section 4.a for more information about the Wixel socket.
The m3pi expansion board connects to the 3pi robot base via three extended male headers:
|2×7 and two 1×2 0.1″ extended male headers used to connect the m3pi expansion PCB to the 3pi robot base.|
The ends of these headers should be soldered to the m3pi expansion PCB in the locations shown in the pictures below; the long ends will plug into female headers on the 3pi robot base.
This requires the headers to be inserted through the appropriate through-holes from the underside of the PCB and then soldered on the top side of the PCB.
It is very important that the headers be soldered in straight or else they won’t line up properly with the headers on the 3pi robot base. We recommend you initially solder just one header pin and then check to see if the header is straight. If it is, proceed with soldering the rest of the pins. If it isn’t, melt the solder joint with your soldering iron and adjust the header (Note: the soldered header pin will get when you do this, so do not touch this pin while making the adjustments!). It is very difficult to straighten a crooked header that is soldered in multiple places.
The m3pi expansion kit includes a 2×7 0.1″ female header and a 1×2 0.1″ female header that must be soldered to the 3pi robot base to act as receptacles for the extended male headers you just soldered to the m3pi expansion PCB:
The 2×7 female header becomes the 3pi expansion header and the 1×2 female header becomes the 3pi power button header; the 3pi ships with the 1×2 female battery charge port header already soldered in. These two female headers should be soldered to the 3pi robot in the locations denoted by the red boxes in the picture below:
|To connect the m3pi expansion PCB to the 3pi robot, female headers (red) and standoffs (yellow) are required.|
With these headers soldered in place, your 3pi will have the three female headers it needs to accept the three extended male headers you soldered to the m3pi expansion board:
|3pi robot female headers that connect to the male headers on the underside of the m3pi expansion PCB.|
Note: Be very careful to plug the expansion board into your 3pi correctly. The female headers do not strictly enforce proper positioning or orientation on their own. Additionally, remember to add batteries to your 3pi before you plug in the m3pi expansion board. We strongly recommend you use rechargeable batteries for your m3pi robot.
Four nylon standoffs, screws, and nuts are included for creating a more secure physical connection between the m3pi expansion board and the 3pi robot base. The screws work with the four large holes around the edge of the m3pi expansion board and the 3pi robot.
|When assembly is complete, you should have an m3pi robot that looks something like this (depending on which components you added in Section 2.a):|
The m3pi robot was designed to work with an mbed development board as the main robot controller, sending serial commands to a slave 3pi base, but it can also be used with a programmable Wixel module as the main robot controller or as a wireless interface for a remote main controller, or you can let the 3pi itself be in control by programming it directly to do what you want. How you get started with the m3pi will depend on the way you decide to use the robot.
The m3pi was designed as a robot platform for an mbed development board, and using an mbed as the main controller of the m3pi robot is the easiest way to take advantage of all the features of the m3pi. The mbed also adds plenty of processing power and free I/O lines to the m3pi robot.
As long as the 3pi robot base is running its stock serial slave program or the most recent version of the 3pi demo program, a socketed mbed can control the 3pi base through a series of serial commands while simultaneously performing high-level tasks like wireless communication (e.g. via a Wixel, XBee, Bluetooth, or Wi-Fi), route planning, sensor processing, and data logging. The m3pi cookbook on mbed.org provides a high-level overview of using the mbed with an m3pi and a sample “hello world” program.
The general procedure for programming an mbed controlling an m3pi is very similar to normal mbed development:
- Turn off the m3pi and connect the mbed via USB to your computer; the mbed does not need to be disconnected from the m3pi.
- Compile your m3pi program in the mbed online compiler.
- Copy the downloaded program file to the mbed’s mass-storage drive.
- Disconnect USB, and turn the m3pi back on.
The 3pi robot included with the fully-assembled m3pi is pre-programed with a serial slave program that works well with the m3pi library; many of the serial-slave commands are supported by the m3pi library. To use the library in your mbed program, either base your program off of an existing m3pi program or click the “import this library into a program” link on the m3pi library webpage.
If you are using the m3pi expansion kit to upgrade your 3pi robot to an mbed-controlled m3pi robot, you should use your AVR programmer to load the serial slave program onto the 3pi. The source code for the serial slave program is included with the Pololu AVR library, as is a precompiled hex file.
To control the base, the mbed communicates serially with the 3pi’s serial slave program at 115,200 bps. If you ordered a fully-assembled m3pi robot, the included 3pi ships with a special demo program that waits for five seconds on startup for a serial command. If the 3pi does not receive a serial command during this initial five seconds, it goes into a demo mode that shows off the various features of the 3pi. To avoid going into demo mode, the mbed should at least send one command within the first 5 seconds of turning on (a good choice would be
m3pi.cls(), which clears the LCD).
For more information on how the mbed connects to the 3pi base and other m3pi peripherals, see Section 4. The m3pi mbed library makes it possible to use the m3pi robot without knowing exactly which pins connect to which peripherals, but advanced users might find this information useful if they are modifying the library or writing their own.
The m3pi robot has a socket for a Wixel module. The Wixel can be used with its stock wireless serial app to easily add wireless functionality to your m3pi robot, or you can take it a step further and program it to act as the main controller of your m3pi.
As long as the m3pi expansion board has shorting blocks on its three serial jumpers and the 3pi robot base is running its stock serial slave program (or the most recent version of the 3pi demo program), a socketed Wixel can control the 3pi base through a series of serial commands while simultaneously performing high-level tasks like wireless communication, route planning, and sensor processing.
There is currently no Wixel library specifically for controlling the m3pi, so there is a bit more programming involved in getting started with the Wixel than with the mbed. The serial commands for controlling the 3pi base are documented in the section of the 3pi user’s guide on the serial slave program. The 3pi robot included with the fully-assembled m3pi is pre-programed with this serial slave program.
If you are using the m3pi expansion kit to upgrade your 3pi robot to a Wixel-controlled m3pi robot, you should use your AVR programmer to load the serial slave program onto the 3pi. The source code for the serial slave program is included with the Pololu AVR library, as is a precompiled hex file.
The m3pi robot is a fully functional robot without any additional hardware modules or microcontroller boards: the microcontroller on the 3pi base can be programmed directly to perform your desired behaviors. The main benefit of the m3pi expansion board in this case is room for extra sensors and electronics along with sockets for wireless modules. The 3pi does not have a lot of free I/O lines for connecting additional electronics, but the few it does have can be accessed on the m3pi expansion board. For more information on accessing the 3pi pins from the expansion board, see Section 4.i. For more information on how the 3pi’s serial lines connect to the wireless sockets, see Section 4.a.
To get started using the m3pi with the 3pi in control, please see the 3pi user’s guide.
Note: This option requires an AVR programmer, such as our USB AVR programmer. If you plan on using another microcontroller board, such as an mbed or Wixel, and your 3pi is running the 3pi serial slave program, no AVR programmer is required.
The m3pi expansion board makes it easy to add an mbed development board as the m3pi’s main controller, and it supports the addition of one of several different wireless modules (see Section 1.c for more information). The following diagram shows where these modules connect on the m3pi expansion PCB:
The m3pi expansion board ships as shown in the above picture, with the headers required to make sockets for these modules included but not soldered in. The m3pi robot ships with the mbed and XBee socket headers already soldered in. Headers for the Wixel socket are included but not soldered because they would interfere with the XBee socket. The orange highlighted area in the above diagram consists of six columns of linked pins that you can use with other wireless serial modules, such as Bluetooth. The pins in this general-purpose space are not connected to the serial lines of the mbed or 3pi base, so you would need to route the appropriate pins to the appropriate places yourself (the exact routing depends on the pin-out of your module). No headers are included for this general-purpose wireless serial module space.
The m3pi expansion PCB connects mbed pins P9 and P10 directly to the serial RX (PD0) and TX (PD1) pins of the 3pi base, respectively. It also connects mbed pin P8 to the 3pi’s reset pin (PC6) through a level-shifting MOSFET. The level shifter also acts as an inverter, so driving P8 high resets the 3pi. The 3pi serial and reset pins can also be connected directly to a socketed Wixel or XBee via a set of three jumpers, which allows you to use the 3pi as a wireless serial slave without an mbed, or you can program the Wixel to serve as the robot’s main controller. The following diagram shows how the mbed and jumpers connect to the 3pi robot base:
|m3pi serial and reset connections to the 3pi robot base.|
Note: You should use these jumpers if your m3pi robot has a socketed mbed.
The m3pi expansion PCB also connects mbed pins P27 and P28 to the serial TX and RX pins, respectively, of the Wixel and XBee sockets, and it connects mbed pin P26 to the Wixel and XBee socket reset lines (driving P26 low resets the wireless devices). This means that the mbed NXP LPC1768 can use one UART to send and receive wireless data while using a second UART to control the 3pi base. (The mbed NXP LPC11U24 only has one UART and cannot interface with a wireless module while controlling the 3pi.)
|m3pi serial and reset connections between the XBee or Wixel and the mbed.|
The following schematic shows the m3pi’s serial connections:
|m3pi schematic diagram of the serial connections between the various components.|
The unused Wixel and XBee pins are connected together as shown in the diagram below. It is not possible to simultaneously use a Wixel and XBee, so these connections exist to provide more multiple convenient access points for each of the unused Wixel and XBee pins.
|General-purpose Wixel or XBee pins can be accessed at multiple points on the m3pi expansion PCB.|
Warning: The mbed, Wixel, and Xbee use 3.3 V logic and the 3pi uses 5 V logic. While the mbed pins are 5V-tolerant, the Wixel and XBee pins are . All of the dedicated connections between components on the m3pi expansion board perform the required level shifting, but you must be careful if you make your own connections to free Wixel or XBee pins. The m3pi expansion board has several general-purpose level shifters that you can use to safely make your own connections between components (see Section 4.d for more information).
|m3pi power nets.|
The expansion board’s power comes from the three power rails of the 3pi robot base: VBAT, VBST, and VCC. VBAT is the battery voltage, which is supplied by the 3pi base’s four AAA cells. VBAT will change over time as the batteries discharge, and the nominal voltage depends on whether you are using alkaline or NiMH cells. VBST is the output of a 9.25 V boost regulator supplied by the battery voltage; this voltage remains constant even as the batteries discharge. VCC is the output of a 5 V linear voltage regulator supplied by the boosted voltage. All square pads on the expansion PCB are ground.
The mbed is powered from VBST, the Wixel is powered from VBAT, and the USB A connector gets its 5 V from VCC. The XBee receives its power from the mbed’s 3.3 V VOUT, which means . If you want to use an XBee without an mbed, you will need to provide your own 3.3 V power supply for it.
If you want to add your own sensors or custom electronics, you can access these power rails using the set of 3pi pins near the center of the board (see Section 4.i for more information).
The expansion PCB has designated connection points for three pushbuttons: a push-on/push-off power button connected in parallel with the power button on the 3pi base, a general-purpose pushbutton connected to mbed pin P21 on one side and ground on the other, and a general-purpose pushbutton that is not connected to anything except a set of prototyping pins on each side. This last button can be connected to an arbitrary mbed or Wixel I/O line to create a second user-interface pushbutton.
|General-purpose pushbutton on the m3pi expansion PCB.|
A ground pad is conveniently placed next to the pads connected to the right side of this general-purpose pushbutton, which makes it easy to connect one side of the button to ground.
|m3pi general-purpose 2/3 voltage dividers and MOSFETs with schematic diagrams.|
The m3pi expansion board has four general-purpose 2/3 voltage dividers that can be accessed by the set of four upper “HV” and “LV” pins (pictured to the right) located between the Wixel and XBee socket pins. These voltage dividers can be used to safely connect 5 V outputs to 3.3 V inputs (the Wixel and XBee do not have 5V-tolerant pins): connect the 5 V signal to one of the four HV pins and then connect the corresponding LV pin to the Wixel or XBee 3.3 V pin of your choosing. The voltage dividers are not connected to anything by default.
The expansion board also has two general-purpose MOSFET circuits that can be accessed by the set of two lower “HV” and “LV” pins (pictured to the right) located between the Wixel and XBee socket pins. These circuits can be used as inverters, level-shifters (e.g. to convert a 3.3 V Wixel output to a 5 V signal), or for driving larger loads (up to 200 mA) than you can with a Wixel or Arduino I/O pin alone (e.g. high-current LEDs or relays). The MOSFET circuits are not connected to anything by default. The circuit incorporates a BSS138 MOSFET (N-channel, 50 V, 200 mA, 1.5 V maximum gate threshold voltage).
The eight red LEDs on the expansion PCB connect directly to mbed pins P13 through P20. The LEDs connect to the pins sequentially, with the outer-most LED connected to pin P13. The LEDs connect to ground through an appropriate current-limiting resistor, so they can be turned on by driving the corresponding mbed output high. If you aren’t using an mbed, you can control the LEDs by connecting I/O lines to the appropriate mbed socket pins.
The LEDs are evenly distributed both radially and horizontally, which means they can conceivably be used for persistence of vision displays when the m3pi robot is spinning in place or driving straight. In practice, we have found that the robot does not drive fast enough in a straight line for the naked eye to perceive persistence of vision (though it could still work if you use a camera to take a picture with a long exposure time as the robot drives), but it does spin fast enough when rotating in place for the naked eye to perceive persistence of vision displays (see the pictures below).
|m3pi charge port.|
The m3pi expansion PCB has a two-pin charge port in the front-left corner of the robot that can be used to recharge your m3pi robot if you are using rechargeable batteries. The fully-assembled m3pi robot ships with a female 0.1″ header soldered into this port; the m3pi expansion kit includes the header but it is not soldered in. The charge port provides a direct connection to the batteries and can be used with a charger capable of charging four NiMH or NiCD cells (depending on what you’re using) in series. The iMAX-B6AC charger works well for this purpose; other such chargers are readily available in hobby stores for charging electric model airplane battery packs. The positive side of the batteries is labeled on the charge port by a white “+” on the PCB silkscreen.
Please note that rechargeable batteries are not required as the 3pi can use regular alkaline cells, but we strongly recommend investing in some NiMH cells and a charger. If you use non-rechargeable batteries, you will need to regularly replace them, which each time requires the somewhat cumbersome process of removing the m3pi expansion board and the 3pi LCD.
The AVRISP connector on the m3pi expansion board exists for advanced users who want to reprogram the AVR on the 3pi base, or it can be used to restore the default AVR program should the original become corrupted in some way. We do not expect the typical user to make use of this feature.
|m3pi connections between the mbed and the AVRISP header.|
The m3pi expansion PCB features space for a 6-pin AVRISP header that connects to the mbed’s SPI pins—P5 (MOSI), P6 (MISO), and P7 (SCK)—and uses mbed pin P23 to connect control the target reset line. The fully-assembled m3pi robot ships with a keyed, shrouded 0.1″ male AVRISP header soldered to the PCB; the m3pi expansion kit includes this header, but it is not soldered in. If you are assembling the m3pi expansion kit and want to include an AVRISP header, please make sure to align it properly: pin 1 on the header, denoted by a triangle in the plastic, must connect to pin 1 on the PCB, denoted by a caret on the silkscreen and an octagonal pad.
The AVRISP connector is not used to program anything on the m3pi expansion PCB. Rather, it allows you to turn your mbed into an AVR programmer that can be used to reprogram the AVR on the 3pi base if so desired. Simply upload an appropriate program to the mbed and connect the AVRISP header on the m3pi expansion board to the AVRISP header on the 3pi base using the included 6-pin AVRISP cable. Note that the target’s VDD is not routed to the mbed but rather to a set of three prototyping pins. We suggest you connect the AVRISP target VDD to the mbed pin of your choosing and monitor the target voltage while programming so as to avoid programming an unpowered or under-powered AVR.
Note: Programming an unpowered or under-powered AVR can permanently disable it.
If you own a dedicated AVRISP programmer, we suggest you use it rather than the mbed if you want to reprogram the AVR on your 3pi.
|m3pi USB A connector.|
The m3pi expansion PCB has space for a USB A connector that connects to the mbed’s USB pins (D+ and D-). The fully-assembled m3pi robot ships with the USB A connector soldered to the PCB; the m3pi expansion kit includes this connecor, but it is not soldered in.
The USB A connector allows the mbed to act as a USB host and interface directly with USB devices. For example, you could plug a USB flash drive into your m3pi and have your robot log data to it as it drives around. This connector is only required if you want to use your mbed as a USB host; it does not serve the same function as the mbed’s mini-B USB connector, which is used to program the mbed.
The m3pi expansion board has access to a number of pins from the 3pi base via a 20-pin header near the center of the PCB:
|m3pi PCB header for accessing pins on the 3pi robot base.|
Two rows of pins are identical, with columns connected by traces on the underside of the PCB. Typical users might find this header is useful for accessing power for additional sensors and custom electronics (see Section 4.b). Advanced users may also find this header useful for accessing the free or partially free I/O lines of the 3pi base’s AVR microcontroller. If you want to use the 3pi’s microcontroller as the main controller of the m3pi robot, you can connect your extra electronics to these I/O lines on the expansion board. If you are using the mbed as your main controller, these I/O lines will probably not be very useful.
Pins PD0 and PD1 are also free by default on the 3pi (i.e. they are not connected to anything on the 3pi other than AVR I/O pins). These are the 3pi’s hardware serial pins, and the default 3pi firmware uses these pins to receive commands that tell the 3pi base what to do. These pins connect to serial lines on the m3pi’s mbed socket and can be connected through jumpers on the m3pi expansion board directly to the serial pins of a socketed Wixel or XBee wireless module (see Section 4.a). If you want to use these as general-purpose I/O lines, you can access them through the appropriate mbed socket pins. Alternatively, you can use your favorite microcontroller board to control your m3pi by routing its serial pins to PD0 and PD1 through the mbed socket and sending the appropriate serial commands. The commands for the 3pi’s default serial slave program are documented in section 10.a of the 3pi user’s guide.
|m3pi mbed socket pins that connect to PD0 and PD1 on the 3pi base.|
You can find out more about these I/O lines from section 10.c of the 3pi user’s guide. The most relevant part of that section is quoted below:
You can freely use PD0 and PD1 for general-purpose digital I/O, or you can use them for serial communication with another microcontroller, a serially-controlled device, or a computer (note that you will need to convert the signal to RS-232 levels or USB to communicate with a computer).
In addition to PD0 and PD1, the 3pi robot has a limited number of I/O lines that can be used as inputs for additional sensors or to control additional electronics such as LEDs or servos. These I/O lines can be accessed through the pads at the center of the 3pi, between the two motors, labeled PD0, PD1, ADC6, ADC7, and PC5. If you are using an expansion kit, these lines are brought up to the expansion PCB.
Pins PC5, ADC6, and ADC7 are all connected to 3pi hardware via removable shorting blocks. By removing the shorting block, you can use these pins for your own electronics. Pin PC5 can be used as either a digital I/O or an analog input. When its shorting block is in place, it controls the emitters for the IR sensors; when its shorting block is removed, the emitters are always on. Pin ADC6 is a dedicated analog input that connects to a voltage divider circuit that monitors the battery voltage when its shorting block is in place, and pin ADC7 is a dedicated analog input that connects to the user trimmer potentiometer when its shorting block is in place.
Note: 3pi pin PB3 doubles as a 3pi motor driver input and an AVR programming pin. We strongly recommend that you not connect this pin to anything.
By default, pin PC5 is an AVR output whose state depends on what the 3pi is doing with its line sensors, even with the PC5 jumper removed. Unless you modify the 3pi base firmware appropriately, do not connect an output to this pin!
|Prototyping space on the m3pi expansion PCB.|
The unused areas of the m3pi expansion PCB have been configured for use as general-purpose prototyping space. The through-holes are connected in a breadboard-like pattern denoted on the top silkscreen by thick, white lines between holes. You can use this prototyping space to cleanly and easily add sensors or other custom circuits to your m3pi robot. The traces that connect the prototyping holes are all on the underside of the expansion PCB and can be selectively cut to modify the configuration of the prototyping space.