ubi >> contents 1 copyright 2009 texas instruments all rights reserved chapter 15 advanced...

58
UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt Chapter 15 Advanced Laboratories RoboSapien powered by MSP430 MSP430 Teaching Materials 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.msp430.ubi.pt Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt

Upload: wayne-ferrand

Post on 30-Mar-2015

229 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents1

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

Chapter 15Advanced Laboratories

RoboSapien powered by MSP430

MSP430 Teaching Materials

Texas Instruments IncorporatedUniversity of Beira Interior (PT)

Pedro Dinis Gaspar, António Espírito Santo, Bruno Ribeiro, Humberto SantosUniversity of Beira Interior, Electromechanical Engineering Department

www.msp430.ubi.pt

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

Page 2: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents2

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

Contents

RoboSapien powered by MSP430

What is RoboSapien?

How RoboSapien works? Analysis of the dynamics and kinematics of the robot Analysis of all sensors, actuators and signal conditioning

MSP430 integration (PCB board and electronics)

MSP430 C code programming

Tests and development of new functionality

2

Page 3: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents3

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

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.

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.

3

RoboSapien powered by MSP430 (1/2)

Page 4: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents4

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

The robotics topics involve both in mechanical and electronic engineering. Projects involve both hardware and software development, tailored to a specific application.

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 MSP430;

Instrumentation and measurements for the sensor signal conditioning and data acquisition;

C/C++ programming.

4

RoboSapien powered by MSP430 (2/2)

Page 5: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents5

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

The RoboSapien is a humanoid robot designed by Mark W. Tilden, marketed by WowWee (www.wowwee.com/) for the toy market;

The RoboSapien measures approximately 34 cm in height and its weight is about 2.1 kg, including four mono (D) type batteries located in its feet;

5

What is RoboSapien? (1/7)

Page 6: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents6

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

What is RoboSapien? (2/7)

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 on-

board memory for later execution; Sensor-keyed instruction set, performing a specific set of

actions in conjunction with a specific sensor system.

RoboSapien is capable of: Walking motion; Grasping objects with either of its hands; Throwing grasped objects with mild force.

It has a small loudspeaker unit, which can emit several different sounds.

6

Page 7: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents7

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

What is RoboSapien? (3/7)

Some words of the Robot Tech Support, from WowWee Ltd.:

“The RoboSapien 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.robosapien1.com/resources/official-mod-guide/

7

Page 8: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents8

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

What is RoboSapien? (4/7)

This biomorphic robot was designed to be easily modified or hacked, the electronics inside the RS being easily accessed and clearly labelled;

A growing community has devoted themselves to modify and add new functionalities to the robot: http://www.robocommunity.com/

Some features have been added in order to provide new features to the RS:

8

Page 9: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents9

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

What is RoboSapien? (5/7)

Microbi’s Robosapien mods: http://www.angelfire.com/droid/rsv2/ Active modifications: hand-beams, hand-LEDs, heartbeat, voice off, tunnel-beam, blue eyes.

Robosapien RF Sound Mod: (http://home.comcast.net/~robosapien/rfmod.htm)

Robosapien Camera Mod: (http://home.comcast.net/~jsamans/robo/robocam.htm) Active modifications: wireless camera,

wireless radio, frequency audio and

pc control.

9

Page 10: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents10

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

What is RoboSapien? (6/7)

RoboSapienPets RoboSapien page: http://www.aibohack.com/robosap/ Active mods: SuperSapien microcontroller mod,

color and motion tracking CMUCam

Mark C’s Robosapien Hacking Site: http://homepages.strath.ac.uk/~lau01246/robot/myhackrs.shtml Active mods: microcontrollers (PicMicro

controllers, and Palm Pilot controllers for

the Robosapien)

10

Page 11: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents11

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

What is RoboSapien? (7/7)

Robocup German Open 2005 tournament: 2 teams of 3 RSs each played the 1st 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 RoboSapien”, Proceedings of The 9th RoboCup International Symposium, Osaka, Japan, July 2005)

11

Page 12: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents12

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

How RoboSapien works? (1/4) Step 1: Analysis of the robot kinematics and dynamics

The first task consists in the analysis of the robot dynamics and kinematics (evaluation of the robot movements and its characteristics).

This task requires testing the RS movements.

12

Page 13: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents13

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

A. Analysis of the RS movements:

13

How RoboSapien works? (2/4) Step 1: Analysis of the robot kinematics and dynamics

Page 14: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents14

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

How RoboSapien works? (3/4) Step 1: Analysis of the robot dynamics and kinematics

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.

14

Page 15: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents15

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

How RoboSapien works? (4/4) Step 1: Analysis of the robot dynamics and kinematics

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 robot-executable commands are available.

15

Page 16: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents16

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

How RoboSapien works? (1/21) Step 2: Actuators, sensors and signal conditioning analysis

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.

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

16

Page 17: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents17

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

RS’s PCB (Controller U2 and Motor Driver U3) 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.

17

How RoboSapien works? (2/21) Step 2: Actuators, sensors and signal conditioning analysis

Page 18: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents18

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

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 U2;• Motor driver U3;• 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.

18

How RoboSapien works? (3/21) Step 2: Actuators, sensors and signal conditioning analysis

Page 19: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents19

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

A. Motor controller (U2) connections: Details of the connections to the motors of the U2 controller.

Shoulder motors:

19

How RoboSapien works? (4/21) Step 2: Actuators, sensors and signal conditioning analysis

Page 20: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents20

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

A. Motor controller (U2) connections: Details of the connections to the motors of the U2 controller.

Elbow motors:

20

How RoboSapien works? (5/21) Step 2: Actuators, sensors and signal conditioning analysis

Page 21: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents21

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

A. Motor controller (U2) connections: Details of the connections to the motors of the U2 controller.

Hip and trunk motors:

21

How RoboSapien works? (6/21) Step 2: Actuators, sensors and signal conditioning analysis

Page 22: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents22

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

B. Position switches and touch sensor connections: Details of the connections to the switches of the U2 controller.

Shoulder position switches:

22

How RoboSapien works? (7/21) Step 2: Actuators, sensors and signal conditioning analysis

Page 23: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents23

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

B. Position switches and touch sensor connections: Details of the connections to the switches of the U2 controller.

Elbow position switches:

23

How RoboSapien works? (8/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 24: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents24

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

B. Position switches and touch sensor connections: Details of the connections to the switches of the U2 controller.

Finger touch sensors:

24

How RoboSapien works? (9/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 25: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents25

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

B. Position switches and touch sensor connections: Details of the connections to the switches of the U2 controller.

Feet touch sensors:

25

How RoboSapien works? (10/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 26: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents26

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

C. LEDs connections: Details of the connections to the LED of the U2 controller.

Finger LED connections:

26

How RoboSapien works? (11/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 27: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents27

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

C. LEDs connections: Details of the connections to the LED of the U2 controller.

Eye LED connections:

27

How RoboSapien works? (12/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 28: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents28

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

D. Command and power connections: Details of the command and power connections.

Command and power connections:

28

How RoboSapien works? (13/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 29: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents29

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

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).

29

How RoboSapien works? (14/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 30: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents30

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

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.

30

How RoboSapien works? (15/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 31: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents31

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

(a) Output signal vs. motor input signal. (b) Left elbow movement from the inside

to outside and vice-versa.

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:

31

How RoboSapien works? (16/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 32: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents32

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

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”.

32

How RoboSapien works? (18/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 33: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents33

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

Commands Eye pattern Commands Eye pattern Awake

Angry

Down right

Startled

Down left

Sleep

Look up

Off

Confused

Wink

Look down

Program mode

Up right

Program right reflex

Up left

Program left reflex

Listen

Program sonix reflex

Listen

F. Analysis of the eyes pattern:

Evaluate the eye pattern (6 LEDs – P2.0 to P2.5) depending on the command that is executed:

33

How RoboSapien works? (19/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 34: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents34

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

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 kHz);

34

How RoboSapien works? (20/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 35: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents35

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

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”: 0xB1.

35

How RoboSapien works? (21/21)Step 2: Actuators, sensors and signal conditioning analysis

Page 36: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents36

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 Integration (1/9)

Development of a PCB to facilitate connections to the MSP430;

Microcontroller: MSP430F149;

Resources: Motors: P6.0 – P6.7 , P2.0 – P2.5; LEDs: P4.0 – P4.7; IR: P1.1; Switches: P1.2 – P1.3;

This task requires the fabrication

and assembly of the components

and devices on the proposed PCB.

36

Page 37: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents37

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 Integration (2/9)

New PCB schematics:

37

C410uF

TC

KT

MS

TD

IT

DO

/TD

I

RS

T/N

MI

XT

2INX

T2O

UT

DVcc11

P6.3/A32

P6.4/A43

P6.5/A54

P6.6/A65

P6.7/A76

VREF+7

XIN8

XOUT9

VeREF+10

VREF-/VeREF-11

P1.0/TACLK12

P1.1/TA013

P1.2/TA114

P1.3/TA215

P1.4/SMCLK16

P1.5

17

P1.6

18

P1.7

19

P2.0/A

CL

K20

P2.1/T

AIN

CL

K21

P2.2/C

AO

UT

/TA

022

P2.3/C

A0/T

A1

23

P2.4/C

A1/T

A2

24

P2.5/R

osc25

P2.6/A

DC

12CL

K26

P2.7/T

A0

27

P3.0/S

TE

028

P3.1/S

IMO

029

P3.2/S

OM

I030

P3.3

31

P3.4

32

P3.533

P3.634

P3.735

P4.0/TB036

P4.1/TB137

P4.2/TB238

P4.3/TB339

P4.4/TB440

P4.5/TB541

P4.6/TB642

P4.7/TB743

P5.0/STE144

P5.1/SIMO145

P5.2/SOMI146

P5.347

P5.448P

5.549

P5.6

50P

5.751

XT

2OU

T52

XT

2IN53

TD

O/T

DI

54T

DI/T

CL

K55

TM

S56

TC

K57

RS

T/N

MI

58P

6.0/A0

59P

6.1/A1

60P

6.2/A2

61A

Vss

62D

Vss

63A

Vcc

64

uP1MSP430F149

100nC3

+3.3

330RR2

TDO/TDITDITMSTCK

RST/NMI

+3.31 23 45 67 89 1011 1213 14

P1

Header 7X2

12pF C1

12pF C2

23

14

Y185SMX

12

P2 +3.3

100nC5 C6

10uF

DS1LED3

1234

P5

Switch

P12P13P14

P31

P32

P33

12345678

P6

LED

P40P41P42P43P44P45P46P47

P40

P41

P42

P43

P44

P45

P46

P47

P20P21P22P23P24P25

P20

P21

P22

P23

P24

P25

R147K

10nF

C15

+3.3

+3.3

P60

P61

P62

P63P64P65P66P67

P60P61P62P63P64P65P66P67

P30

123456

P3

Motores 2

12345678

P4

Motores1

P11/IR

P11/IR

P12P13P14

4K7

R3

4K7

R4

4K7

R5

4K7

R6

4K7

R7

4K7

R8

4K7

R9

4K7

R10

LED1

LED2

LED3

LED4

LED5

LED6

LED7

LED8

LED1LED2LED3LED4LED5LED6LED7LED8

Q1BC847

Q2BC847

Q3BC847

Q4BC847

Q5BC847

Q6BC847

Q7BC847

Q8BC847

Page 38: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents38

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

Pin U2 controller P6.0 M4+ P6.1 M4- P6.2 M5+ P6.3 M5- P6.4 M6+ P6.5 M6- P6.6 M7+ P6.7 M7-

MSP430 Integration (3/9)

New MSP430 PCB Connector Motors_1 connections to the RS controller:

New MSP430 PCB Connector Motors_2 connections to the RS controller:

38

Pin U2 controller P2.0 M1+ P2.1 M1- P2.2 M2+ P2.3 M2- P2.4 M3+ P2.5 M3-

Page 39: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents39

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 Integration (4/9)

New MSP430 PCB Connector LED connections to the RS controller:

39

Pin U2 controller RS location LED position Figure LED1 (P4.0) L1 Left eye Upper

LED2 (P4.1) L2 Left eye Middle

LED3 (P4.2) L3 Left eye Lower

LED4 (P4.3) L4 Right eye Middle

LED5 (P4.4) L5 Right eye Upper

LED6 (P4.5) L6 Right eye Lower

LED7 (P4.6) L7 Left gripe LED8 (P4.7) L8 Right gripe

Page 40: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents40

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 Integration (5/9)

New MSP430 PCB connector switch connections to the RS controller:

(*) 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.

40

Pin U2 controller RS location P1.1 IR P1.2 LFT / LFG Left foot + Left finger P1.3 P1.4 RFT / RFG Right foot + Right finger

(* ) LEL Left elbow (* ) LSH Left shoulder (* ) REL Right elbow (* ) RSH Right shoulder

Page 41: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents41

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 Integration (6/9)

New MSP430 PCB masks:

41

Page 42: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents42

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 Integration (7/9)

Remove the original U2 controller from the RS PCB:

42

(a) RoboSapien PCB board without microcontroller. (b) Original ASIC.

Page 43: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents43

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 Integration (8/9)

The next task requires soldering wires onto the RoboSapien PCB at each pin location of the U2 controller:

43

Page 44: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents44

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 Integration (9/9)

44

Examples: MSP430 mounted on the back of the RoboSapien PCB; Connections to the original PCB assembled in the RS.

(a) Connections to the RoboSapien PCB. (b) New PCB with the MSP430.

Page 45: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents45

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (1/13)

45

Project files:

C source files: Chapter 15 > Lab11a > main.c

Chapter 15 > Lab11a > Global.h

Chapter 15 > Lab11a > Commands.h

Chapter 15 > Lab11a > Commands.c

Chapter 15 > Lab11a > Actions.h

Chapter 15 > Lab11a > Actions.c

Page 46: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents46

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (2/13)

46

Overview:

The C code allows the MSP430 to control the RS movements.

Page 47: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents47

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (3/13)

47

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 MSP430F149 resources:

• Timer_A;• Timer_B;• I/O ports;• Interrupts;

Page 48: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents48

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (4/13)

48

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 Step2E and Step2F.

Page 49: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents49

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (5/13)

49

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 Step2E and Step2F.

Page 50: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents50

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (6/13)

50

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.

Page 51: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents51

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (7/13)

51

Software application organization:

A. Organization of the information required for the RS actions (continued):

Data Movement (1) Data Movement (2) Data Movement (3) Data Movement (n)

Access table

n= Max RS accions

ActPtr[]

Page 52: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents52

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (8/13)

52

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.

Page 53: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents53

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (9/13)

[0] [1] [2] [3] [4] [13] [14]

0004252643 00

01693319531525 00

00000 00

00000 00

00000 00

[0]

[1]

[2]

[13]

[12]

Timers

Mot

ors

0

1

0

0

0

1

1

0

0

0

Motor State

Motor Initial Value

Motor 1M1+

M1-

HI

HI

Low

Low

0

1

2

3

4

t [ms]525 531 319 1693

4252643

M1 +

M1 -

5

M1

MotorState

Clockwise

Cclockwise

StopedM1+, M1- are logical motors;

Both represent the physical motor M1;

Note: M1+, M1- cannot have the same high state (short circuit)

Example: M1 = state 0

If M1+ = High & M1- = Low

then, M1 runs counter clockwise

53

Software application organization:

B. Logic motors:

Page 54: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents54

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (10/13)

54

Software application organization:

C. Software architecture:

Page 55: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents55

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (11/13)

55

Software application organization:

D. Background task:

Page 56: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents56

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (12/13)

56

Software application organization:

D. System task:

Page 57: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents57

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

MSP430 C code programming (13/13)

57

Software application organization:

E. IR command task:

Page 58: UBI >> Contents 1 Copyright 2009 Texas Instruments All Rights Reserved  Chapter 15 Advanced Laboratories RoboSapien powered by MSP430

UBI

>> Contents58

Copyright 2009 Texas Instruments All Rights Reserved

www.msp430.ubi.pt

Tests and development of new functionalities

The final task consists of performing tests to evaluate the robot movements and perform fine-tuning;

Proposals for the development of new functionalities;

Examples: Wireless communications instead of IR remote control; Voice commands (use other devices in the MSP430 family); Integrate sensors (optical, acoustics and others...); Digital camera to provide more autonomy for the RoboSapien.

Now, it is up to you! Try to reach the next phase of the RoboSapien evolution.

58