MSP 430 Teaching Materials UBI Chapter 15 Advanced
MSP 430 Teaching Materials UBI Chapter 15 Advanced Laboratories Robo. Sapien powered by MSP 430 Texas Instruments Incorporated University of Beira Interior (PT) Pedro Dinis Gaspar, António Espírito Santo, Bruno Ribeiro, Humberto Santos University of Beira Interior, Electromechanical Engineering Department www. msp 430. ubi. pt >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 1
Contents UBI q Robo. Sapien powered by MSP 430 q What is Robo. Sapien? q How Robo. Sapien works? § Analysis of the dynamics and kinematics of the robot § Analysis of all sensors, actuators and signal conditioning q MSP 430 integration (PCB board and electronics) q MSP 430 C code programming q Tests and development of new functionality >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 2
Robo. Sapien powered by MSP 430 (1/2) UBI q. Robotics is being increasingly used as a vehicle for motivating students to learn: § Embedded systems; § Artificial intelligence; § Computer science; § And even general science and engineering. q. Typically, laboratory classes for courses using robotics involve the construction and programming of simple robots, typically composed of: § Microcontroller; § Sensors; § Remote communication devices; § DC or stepper motors; mounted in all types of robot bodies. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 3
Robo. Sapien powered by MSP 430 (2/2) UBI q. The robotics topics involve both in mechanical and electronic engineering. Projects involve both hardware and software development, tailored to a specific application. q. This advanced laboratory takes a multidisciplinary approach and integrates together topics from different knowledge areas: § Control systems, for the different control approaches; § Embedded systems based on the MSP 430; § Instrumentation and measurements for the sensor signal conditioning and data acquisition; § C/C++ programming. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 4
What is Robo. Sapien? (1/7) UBI q. The Robo. Sapien is a humanoid robot designed by Mark W. Tilden, marketed by Wow. Wee (www. wowwee. com/) for the toy market; q. The Robo. Sapien measures approximately 34 cm in height and its weight is about 2. 1 kg, including four mono (D) type batteries located in its feet; >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 5
What is Robo. Sapien? (2/7) UBI q. Is preprogrammed for different motions and is controlled by an infra-red (IR) remote controller: § Users can string together movement commands to form either macros or mini-programs (sets of instructions); § Send a set of instructions to the RS by IR, and save it in onboard memory for later execution; § Sensor-keyed instruction set, performing a specific set of actions in conjunction with a specific sensor system. q. Robo. Sapien is capable of: § Walking motion; § Grasping objects with either of its hands; § Throwing grasped objects with mild force. q. It has a small loudspeaker unit, which can emit several different sounds. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 6
What is Robo. Sapien? (3/7) UBI q. Some words of the Robot Tech Support, from Wow. Wee Ltd. : q“The Robo. Sapien is designed for modification. Here is the short hint list for the budding RS hacker. First off, we must warn you that completely replacing the RS brain should only be attempted by those with a lot of time, electronic skills, and programming ego. You don’t have to though — if you carefully remove the connectors and lift the RS motherboard, on the back you will find all inputs and outputs labeled, and right next to gold pads convenient for soldering wires…” in http: //www. robosapien 1. com/resources/official-mod-guide/ >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 7
What is Robo. Sapien? (4/7) UBI q. This biomorphic robot was designed to be easily modified or hacked, the electronics inside the RS being easily accessed and clearly labelled; q. A growing community has devoted themselves to modify and add new functionalities to the robot: § http: //www. robocommunity. com/ q. Some features have been added in order to provide new features to the RS: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 8
What is Robo. Sapien? (5/7) UBI q. Microbi’s Robosapien mods: § http: //www. angelfire. com/droid/rsv 2/ § Active modifications: hand-beams, hand-LEDs, heartbeat, voice off, tunnel-beam, blue eyes. q. Robosapien RF Sound Mod: § (http: //home. comcast. net/~robosapien/rfmod. htm) q. Robosapien Camera Mod: § (http: //home. comcast. net/~jsamans/robocam. htm) § Active modifications: wireless camera, wireless radio, frequency audio and pc control. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 9
What is Robo. Sapien? (6/7) UBI q. Robo. Sapien. Pets Robo. Sapien page: § http: //www. aibohack. com/robosap/ § Active mods: Super. Sapien microcontroller mod, color and motion tracking CMUCam q. Mark C’s Robosapien Hacking Site: § http: //homepages. strath. ac. uk/~lau 01246/robot/myhackrs. shtml § Active mods: microcontrollers (Pic. Micro controllers, and Palm Pilot controllers for the Robosapien) >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 10
What is Robo. Sapien? (7/7) UBI q. Robocup German Open 2005 tournament: § 2 teams of 3 RSs each played the 1 st soccer match for humanoid robots worldwide; § Head replaced by a PDA, allowing a display of its environment using the camera; § Information sent to a PC though the IR of the PDA. (Sven Behnke, Jurgen Muller, and Michael Schreib, „Playing Soccer with Robo. Sapien”, Proceedings of The 9 th Robo. Cup International Symposium, Osaka, Japan, July 2005) >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 11
How Robo. Sapien works? (1/4) UBI Step 1: Analysis of the robot kinematics and dynamics q The first task consists in the analysis of the robot dynamics and kinematics (evaluation of the robot movements and its characteristics). q This task requires testing the RS movements. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 12
How Robo. Sapien works? (2/4) UBI Step 1: Analysis of the robot kinematics and dynamics q A. Analysis of the RS movements: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 13
How Robo. Sapien works? (3/4) Step 1: Analysis of the robot dynamics and kinematics UBI q A. Analysis of the RS movements: § Dynamic walking pattern: • (1) The trunk motor tilts the upper body to the right. The centre of mass shifts over to the right foot. The left foot lifts from the ground; • (2) The hip motors move in opposite directions, resulting in a forward motion of the robot. As the upper body swings back, the left foot regains contact with the ground; • (3) Similar to (1). The trunk motor tilts the body to left; • (4) Similar to (2). Hip motors move in other direction. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 14
How Robo. Sapien works? (4/4) Step 1: Analysis of the robot dynamics and kinematics UBI q B. Analysis of RS’s remote control commands: § The RS’s remote control unit has 21 different buttons; § With the help of two shift buttons, 67 different robotexecutable commands are available. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 15
How Robo. Sapien works? (1/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q The next task requires a dismantling procedure to allow detailed analysis of the: § Actuators (motors); § Regulation electronics; § Sensors and respective signal conditioning; § PCB included with the original robot. q A procedure for dismantling the RS in order to give it additional features is detailed in: http: //personal. strath. ac. uk/mark. craig/robot/robos. shtml >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 16
How Robo. Sapien works? (2/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. RS’s PCB (Controller U 2 and Motor Driver U 3) is easily accessed and clearly labelled: § M: Motors; § P: Input or output port; § VDD: Raw battery voltage (fluctuates wildly); § Vcc: Regulated voltage (Vcc = 3. 6 V); § Gnd: Universal ground. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 17
How Robo. Sapien works? (3/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. Tasks: § List and investigate the functions of: • All the components and devices included on the PCB; • Actuators, sensors and output devices; § Determine the mechanical and/or electrical characteristics of: • Controller U 2; • Motor driver U 3; • Power switch; • Motors: shoulder (2); elbow (2); hip (2) and trunk (1); • Foot touch sensors (4); • Finger touch sensors (2); • End course position switches (shoulders and elbows); • Sound sensor; • Eight LEDs (fingers (2) and eyes (6)); • IR receiver and external IR remote control. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 18
How Robo. Sapien works? (4/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. A. Motor controller (U 2) connections: § Details of the connections to the motors of the U 2 controller. § Shoulder motors: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 19
How Robo. Sapien works? (5/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. A. Motor controller (U 2) connections: § Details of the connections to the motors of the U 2 controller. § Elbow motors: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 20
How Robo. Sapien works? (6/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. A. Motor controller (U 2) connections: § Details of the connections to the motors of the U 2 controller. § Hip and trunk motors: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 21
How Robo. Sapien works? (7/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. B. Position switches and touch sensor connections: § Details of the connections to the switches of the U 2 controller. § Shoulder position switches: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 22
How Robo. Sapien works? (8/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. B. Position switches and touch sensor connections: § Details of the connections to the switches of the U 2 controller. § Elbow position switches: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 23
How Robo. Sapien works? (9/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. B. Position switches and touch sensor connections: § Details of the connections to the switches of the U 2 controller. § Finger touch sensors: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 24
How Robo. Sapien works? (10/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. B. Position switches and touch sensor connections: § Details of the connections to the switches of the U 2 controller. § Feet touch sensors: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 25
How Robo. Sapien works? (11/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. C. LEDs connections: § Details of the connections to the LED of the U 2 controller. § Finger LED connections: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 26
How Robo. Sapien works? (12/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. C. LEDs connections: § Details of the connections to the LED of the U 2 controller. § Eye LED connections: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 27
How Robo. Sapien works? (13/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. D. Command power connections: § Details of the command power connections. § Command power connections: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 28
How Robo. Sapien works? (14/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. E. Acquisition and analysis of digital port signals: § Continue with the analysis of the digital signals acquired from the ports on the PCB; § Evaluate the original microcontroller control output ports when the robot performs a specific command function; § Define the time sequence of the active/inactive motor in each specific movement; § Procedure: • List the active/inactive time of each motor: o Single movement (single motor); o Combined movements (more than one motor). >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 29
How Robo. Sapien works? (15/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. E. Acquisition and analysis of digital port signals: § Task: § Use an oscilloscope to acquire the signals used for single movements; § If available, use a logic analyzer to acquire the signals used for the combined movements signals; § Connect probes to the output port pins. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 30
How Robo. Sapien works? (16/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. E. Acquisition and analysis of digital port signals: § Single motor signal analysis: • Compare the output signal from the original microcontroller and the signal that the motor receives. • Examples: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 31
How Robo. Sapien works? (18/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. E. Acquisition and analysis of digital port signals: § Analysis of signals for combined actions: • Connect probes to the original microcontroller ports to measure the digital signals with a logic analyzer. • Example: combined movement: “Oops”. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 32
How Robo. Sapien works? (19/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. F. Analysis of the eyes pattern: § Evaluate the eye pattern (6 LEDs – P 2. 0 to P 2. 5) depending on the command that is executed: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 33
How Robo. Sapien works? (20/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. G. Analysis of the IR commands: § Using a logic analyser, determine the IR command digital value (port IR-OUT) for each movement command of the remote controller. § Serial communication specifications: • Direct serial input to the IR-OUT pin (active low signals, 1200 bps); • Timing based on 1/1200 second clock (~ 0. 833 msec) Signal is normally high (idle, no IR); • Data bits: for each of the 8 data bits, space encoded signal depending on the bit values (Sends the most significant data bit first). (Carrier is 39. 2 k. Hz); >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 34
How Robo. Sapien works? (21/21) Step 2: Actuators, sensors and signal conditioning analysis UBI q. G. Analysis of the IR commands: § Serial communication specifications: • Preamble: signal goes low for 8/1200 sec; • data bit = 0: signal goes high for 1/1200 sec, and low for 1/1200 sec; • data bit = 1: signal goes high for 4/1200 sec, and low for 1/1200 sec; • Example: Command “Wake Up”: 0 x. B 1. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 35
MSP 430 Integration (1/9) UBI q. Development of a PCB to facilitate connections to the MSP 430; q. Microcontroller: MSP 430 F 149; q. Resources: § Motors: § LEDs: § IR: § Switches: P 6. 0 – P 6. 7 , P 2. 0 – P 2. 5; P 4. 0 – P 4. 7; P 1. 1; P 1. 2 – P 1. 3; q. This task requires the fabrication and assembly of the components and devices on the proposed PCB. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 36
MSP 430 Integration (2/9) UBI q. New PCB schematics: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 37
MSP 430 Integration (3/9) UBI q. New MSP 430 PCB Connector Motors_1 connections to the RS controller: q. New MSP 430 PCB Connector Motors_2 connections to the RS controller: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 38
MSP 430 Integration (4/9) UBI q. New MSP 430 PCB Connector LED connections to the RS controller: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 39
MSP 430 Integration (5/9) UBI q. New MSP 430 PCB connector switch connections to the RS controller: q(*) These connections were not used because the code has been developed to take into account the shoulders and elbows motors active period time, to obtain the end positions. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 40
MSP 430 Integration (6/9) UBI q. New MSP 430 PCB masks: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 41
MSP 430 Integration (7/9) UBI q. Remove the original U 2 controller from the RS PCB: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 42
MSP 430 Integration (8/9) UBI q. The next task requires soldering wires onto the Robo. Sapien PCB at each pin location of the U 2 controller: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 43
MSP 430 Integration (9/9) UBI q. Examples: § MSP 430 mounted on the back of the Robo. Sapien PCB; § Connections to the original PCB assembled in the RS. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 44
MSP 430 C code programming (1/13) UBI q. Project files: § C source files: Chapter 15 > Lab 11 a > main. c Chapter 15 > Lab 11 a > Global. h Chapter 15 > Lab 11 a > Commands. c Chapter 15 > Lab 11 a > Actions. h Chapter 15 > Lab 11 a > Actions. c >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 45
MSP 430 C code programming (2/13) UBI q. Overview: § The C code allows the MSP 430 to control the RS movements. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 46
MSP 430 C code programming (3/13) UBI q. Resources: § TIMER_A is configured in compare mode, providing an ISR once every 1 msec; § Timer_B is configured in capture mode, providing an ISR to implement the receiver command task; § This application makes use of the following MSP 430 F 149 resources: • Timer_A; • Timer_B; • I/O ports; • Interrupts; >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 47
MSP 430 C code programming (4/13) UBI q. Software application organization: § Definition and implementation of the command receiver task (Commands. h and Commands. c); § Implements all the functions of the system task, to drive the motors and LEDs, and monitor the switches (Actions. h and Actions. c); § Defines the movement tables ACTION DATA TABLES (main. c): • Times when to toggle each motor state (active/inactive); • LED patterns; • Motors initially active; • Motors enabled; • Data from Step 2 E and Step 2 F. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 48
MSP 430 C code programming (5/13) UBI q. Software application organization: § Definition and implementation of the command receiver task (Commands. h and Commands. c); § Functions of the System task to drive the motors and LEDs, and monitor the switches (Actions. h and Actions. c); § Define the movement tables ACTION DATA TABLES (main. c): • Time to toggle each motor state (active/inactive); • LED patterns; • Motors initially active; • Motors enabled; • Data from Step 2 E and Step 2 F. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 49
MSP 430 C code programming (6/13) UBI q. Software application organization: § A. Organization of the information required for the RS actions: • The table pointers ensure rapid access to the “access table” information: o Contains all the structure addresses (move data); o Movements = data structures “data movements ()”; o Structure = {time, sequence, initial state, stop}; o Each motor starts at the initial state and toggles between states On and Off when the timer decreases to 0; o When a counter reaches 0, the next timer is activated; o The motor stops if the counter reaches 0 and the next counter contains a count of zero. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 50
MSP 430 C code programming (7/13) UBI q. Software application organization: § A. Organization of the information required for the RS actions (continued): >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 51
MSP 430 C code programming (8/13) UBI q. Software application organization: § B. Logic motors: • The RS motors have 3 states: o Rotate clockwise; o Rotate counter clockwise; o Stop. • Control of each motor is implemented as two logic signals. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 52
MSP 430 C code programming (9/13) UBI q. Software application organization: § B. Logic motors: Example: M 1 = state 0 If M 1+ = High & M 1 - = Low then, M 1 runs counter clockwise M 1+, M 1 - are logical motors; Both represent the physical motor M 1; Note: M 1+, M 1 - cannot have the same high state (short circuit) >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 53
MSP 430 C code programming (10/13) UBI q. Software application organization: § C. Software architecture: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 54
MSP 430 C code programming (11/13) UBI q. Software application organization: § D. Background task: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 55
MSP 430 C code programming (12/13) UBI q. Software application organization: § D. System task: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 56
MSP 430 C code programming (13/13) UBI q. Software application organization: § E. IR command task: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 57
Tests and development of new functionalities UBI q. The final task consists of performing tests to evaluate the robot movements and perform fine-tuning; q. Proposals for the development of new functionalities; q. Examples: § Wireless communications instead of IR remote control; § Voice commands (use other devices in the MSP 430 family); § Integrate sensors (optical, acoustics and others. . . ); § Digital camera to provide more autonomy for the Robo. Sapien. q. Now, it is up to you! Try to reach the next phase of the Robo. Sapien evolution. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www. msp 430. ubi. pt 58
- Slides: 58