Professional Documents
Culture Documents
Robosapien Powered by MSP430 - 3
Robosapien Powered by MSP430 - 3
• Summary
Slide 2
MSP430@UBI-DEM
• The MSP430 microcontroller family is used in the
Electromechanical Engineering Department of the
University of Beira Interior (DEM-UBI) – Portugal in:
Electromechanical engineering classes and,
last year projects
• Due to:
its cost;
plenty of hardware starter kits and software integrated
development environments either free or with a reduced cost;
Amount of peripherals integrated in the μC;
rapid learning curve;
low power features;
high pinout counting;
C and C++ easy programming.
Among others… Slide 3
MSP430@UBI-DEM
• Electromechanical Engineering classes
• Introduction to Microprocessors:
Description of the various systems embedded in a microcontroller;
Architecture characteristics;
Memory Hierarchy;
Internal modules;
Input/Output ports;
Peripherals;
Programming language Assembler / C;
Arithmetic;
Communications networks.
Light Signal
sensor conditioning
I/O
Signal
Tilt sensor
conditioning
I/O
I/O
Buttons USART
PC data transmission
Light
sensor Comparator Relay Heating
Indoor
ADC
Light
Relay Motor
sensor Comparator
I/O
Outdoor
Motor Speed
Temperature LCD Controller and Direction Light
Sensor Control
S
Development board Indoor light sensor Slide 6
MSP430@UBI-DEM
• Electromechanical Engineering classes
• Robotics (Lab examples):
MSP430 control board and software for the FESTO robot.
LED’s Buttons
I/O
End
Optical
ADC
course
I/O
Photocouplers Optical
switch Drivers
Photocouplers
Position
Comparator USART
Sensor
MOTOR
Rotational optical sensor Linear optical sensor for longitudinal movement Slide 7
MSP430@UBI-DEM
• Electromechanical Engineering classes - Robotics:
Slide 9
Who is RoboSapien?
• RoboSapien (RS) is a toy-like biomorphic robot.
• It is capable of:
a walking motion;
grasp objects with either of its hands
throw grasped objects with mild force;
Slide 11
Who is RoboSapien?
• RoboSapien views.
Frontal view, seven motors move the robot. Side view.
Slide 12
Who is RoboSapien?
• Dynamic walking gait of RoboSapien.
(1) The trunk motor tilts the upper body to the right. The center of
mass shifts over the right foot. The left foot lifts from the
ground.
(2) The leg motors move into 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,4) Symmetrical to (1,2).
Slide 13
Programming of the RoboSapien
• The RS controller, is equipped with a basic level of
programmability.
Slide 14
RS’s Remote Control
• The RS’s remote control unit has 21 different buttons.
With the help of two shift buttons, 67 different robot-
executable commands are accessible.
Bulldozer Burp Right pick up
Fart (Oops) High Five Right strike 1
Original RoboSapien
Slide 16
User modifications
• Some words of the Robot Tech Support, from WowWee Ltd.
in http://www.robosapien1.com/resources/official-mod-guide/
Slide 17
User modifications
• Mark Tiden designed the RS to be easily modified or
hacked;
clearly labeled;
Slide 18
User modifications
• microbi’s Robosapien mods (http://www.angelfire.com/droid/rsv2/)
• Active mods: hand-beams, hand-Led’s, heartbeat, voice
off, tunnel-beam, blue EYES
Original RoboSapien
Slide 19
User modifications
• RoboSapienPets RoboSapien page (http://www.aibohack.com/robosap/)
• Active mods: SuperSapien microcontroller mod,
color and motion tracking CMUCam
Original RoboSapien
Slide 21
Controller U2
• M means motors,
• P means input or output port,
• VDD is raw battery voltage (caution: fluctuates wildly)
Original RoboSapien
Slide 22
Controller U2 - Connections
Left shoulder Right Shoulder
Motors
M2- M2+ Vcc P1.3 P1.6 Vcc M4- M4+
Original RoboSapien
Slide 23
Controller U2 - Connections
Left shoulder Shoulder position switch Right Shoulder
M2- M2+ Vcc P1.3 P1.6 Vcc M4- M4+
Original RoboSapien
Slide 24
Controller U2 - Connections
Left elbow Right elbow
P1.2 Motors M3+
Vcc M3-
Vcc Vcc
Original RoboSapien
P1.1 P2.7
P2.6 P1.4
Vcc Vcc
M1+ Vcc
M1- P1.5
Slide 25
Controller U2 - Connections
Left elbow Right elbow
P1.2 Finger switch M3+
Vcc M3-
Vcc Vcc
Original RoboSapien
P1.1 P2.7
P2.6 P1.4
Vcc Vcc
M1+ Vcc
M1- P1.5
Slide 26
Controller U2 - Connections
Left elbow Right elbow
Elbow position switch
P1.2 M3+
Vcc M3-
Vcc Vcc
Original RoboSapien
P1.1 P2.7
P2.6 P1.4
Vcc Vcc
M1+ Vcc
M1- P1.5
Slide 27
Controller U2 - Connections
Left elbow Right elbow
Arm LEDs
P1.2 P1.5
Vcc Vcc
Vcc Vcc
Original RoboSapien
P1.1 P1.4
P2.6 P2.7
Vcc Vcc
M1+ M3-
M1- M3+
Slide 28
Controller U2 - Connections
Left leg/hip Right leg/hip
Motors
M6+ M7-
M6- M7+
Original RoboSapien
Tilt
M5+
M5-
Slide 29
Controller U2 - Connections
Head
Vcc P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 IR-OUT Gnd Vrx
Original RoboSapien
Slide 30
Controller U2 - Connections
Head
Vcc P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 IR-OUT Gnd Vrx
Original RoboSapien
Slide 31
Controller U2 - Connections
Component Speakers
Vcc VDD Vcc P1.4 SPK1 SPK1 IN OUT Fr VDD Fr
Component
Original RoboSapien
Slide 32
Controller U2 - Connections
Component Foot switch Speakers
Vcc VDD Vcc P1.4 SPK1 SPK1 IN OUT Fr VDD Fr
Component
Original RoboSapien
Slide 33
Original RoboSapien Controller U2
Slide 34
Original RoboSapien Controller U2
Slide 35
Original RoboSapien Motor driver U3
Slide 36
IR commands
• To input commands is used the direct serial input to the
IR-OUT pin (active low signals, 1200 bps).
• BTW: The first bit (msb) is always 1 (valid codes are from
0x80 to 0xFF)
Slide 37
IR commands
• Header: signal goes low for 8/1200 sec.
• If the data bit is 0: signal goes high for 1/1200 sec, and
low for 1/1200 sec.
• If the data bit is 1: signal goes high for 4/1200 sec, and
Original RoboSapien
Slide 38
RoboSapien Replication
• The RS has the following devices and sensors:
Electromechanical engineering classes - Robotics
IR receiver;
Power switch;
Microcontroller;
Seven motors (hands, arms, feet and hip);
Four foot touch sensors;
Two hand touch sensors,
Sound sensor;
Seven LEDs;
An external IR remote control.
Slide 39
Signal Analysis
• Digital signals acquired from the electronic board ports;
Electromechanical engineering classes - Robotics
TDS220 oscilloscope.
• For the robot combined movements, a PM3580 Logic
Analyzer was used.
Slide 41
Single motor signal graphics
• Illustration of the output signal from the original
Electromechanical engineering classes - Robotics
Slide 43
Combined motors graphics
• Example: Output Ports Signals for the function “Oops”.
Electromechanical engineering classes - Robotics
• Signal “M1+” (Left Elbow Out) is “high”, for 531 msec and
the rest of the time (2125 msec) is “low”.
• Signal “M3+” (Right Elbow Out) presents the same signal.
• Both elbows executes the movement at the same time.
Slide 44
New RS Brain – MSP430
• Removal of the original microcontroller from the RS
Electromechanical engineering classes - Robotics
electronic board.
M1+ P6.0 Left Elbow Elbow goes out, and opens gripper
M1- P6.1 Left Elbow Elbow goes in, and closes gripper
M2+ P6.2 Left Arm Arm goes up
M2- P6.3 Left Arm Arm goes down
M3+ P6.4 Right Elbow Elbow goes out, and opens gripper
M3- P6.5 Right Elbow Elbow goes in, and closes gripper
M4+ P6.6 Right Arm Arm goes up
M4- P6.7 Right Arm Arm goes down
M5+ P2.0 Hip Left leaning
M5- P2.1 Hip Right leaning
M6+ P2.2 Left Foot Foot goes back
M6- P2.3 Let Foot Foot goes forward
M7+ P2.4 Right Foot Foot goes back
M7- P2.5 Right Foot Foot goes forward Slide 46
Hardware - PCB board
• Microcontroller: MSP430F149;
Electromechanical engineering classes - Robotics
• Resources:
Motors: P6.0 – P6.7 , P2.0 – P2.5;
LEDs: P4.0 – P4.7;
IR: P1.1;
Switches: P1.2 – P1.3;
Slide 47
Hardware - PCB board
+3.3
P1 R1
TDO/TDI 47K C15 +3.3
Electromechanical engineering classes - Robotics
1 2
TDI
3 4 +3.3
TMS
5 6 10nF R2
TCK
7 8 330R
9 10
RST/NMI P5
11 12
P14
13 14 4
P13
DS1 3
Header 7X2 P12
LED3 2
P11/IR
RST/NMI
TDO/TDI
1
XT2OUT
XT2IN
Switch
TMS
TCK
TDI
P62
P61
P60
P6
+3.3 LED8
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
C4 C3 8
LED7
10uF 100n 7
LED6
6
AVcc
DVss
AVss
P6.2/A2
P6.1/A1
P6.0/A0
RST/NMI
TDO/TDI
TMS
P5.6
P5.5
TCK
XT2OUT
P5.7
TDI/TCLK
XT2IN
LED5
5
1 48 LED4
DVcc1 P5.4 4
P63 2 47 LED3
P6.3/A3 P5.3 3
P64 3 46 LED2
P6.4/A4 P5.2/SOMI1 2
P65 4 45 LED1
C1 P6.5/A5 P5.1/SIMO1 1
12pF P66 5 44
P6.6/A6 P5.0/STE1
P67 6 43 P47 LED
P6.7/A7 P4.7/TB7
7 uP1 42 P46
VREF+ P4.6/TB6
8 MSP430F149 41 P45
XIN P4.5/TB5
2
1 9
XOUT P4.4/TB4
40 P44 P4
Y1 10 39 P43 P67
VeREF+ P4.3/TB3 8
85SMX 11 38 P42 P66
VREF-/VeREF- P4.2/TB2 7
12 37 P41 P65
P2.2/CAOUT/TA0
P1.0/TACLK P4.1/TB1 6
P2.6/ADC12CLK
13
P11/IR 36 P40 P64
P2.1/TAINCLK
P1.1/TA0 P4.0/TB0 5
3
P2.3/CA0/TA1
P2.4/CA1/TA2
P1214 35 P63
P1.2/TA1 P3.7 4
P3.2/SOMI0
P3.1/SIMO0
P2.0/ACLK
P1315 34 P62
P3.0/STE0
P1.3/TA2 P3.6 3
P2.5/Rosc
P2.7/TA0
P1416 33 P61
C2 P1.4/SMCLK P3.5 2
12pF P60
1
P1.5
P1.6
P1.7
P3.3
P3.4
Motores1
P3
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
P2 +3.3 P25
6
P24
2 C5 C6 5
P23
P20
P21
P22
P23
P24
P25
P30
P31
P32
P33
1 100n 10uF 4
LED7 P22
3
LED3 LED5 P21
2
LED1 P20
R9 Q7 1
P46
P42 R5 Q3 P44 R7 Q5 BC847 Motores 2
P40 R3 Q1 BC847 BC847
4K7
BC847
4K7 4K7
4K7
LED8
LED2 LED4 LED6
Slide 48
Electromechanical engineering classes - Robotics Hardware - PCB board
Slide 49
Software – Operations Principle
Timers
[0] [1] [2] [3] [4] [13] [14]
Electromechanical engineering classes - Robotics
Slide 51
Software – Background task
BackGround Task Flow Chart
Electromechanical engineering classes - Robotics
Start
Initialization
No
Any
Command?
Yes
Decode
Command
Load Command
Action
Slide 52
Software – System task System Task Flow Chart
Start
Electromechanical engineering classes - Robotics
Movement
No
On ?
Motor (M1+)
Motor (...) Yes
Motor
No (M7-)
Motor (n)
Enable
Motor (n)
No Switch On? No
Enable
Motor (n)
No
Yes Enable
Yes Get next
Yes
Decrement Timer (n)
Get next
Yes
Timer (n)
Decrement Timer (n)
Get next
Timer (n) Debounce
Decrease Timer (n)
Timer (n)
Timer (n) = 0? Yes
Timer (n) = 0?
No Timer (n) = 0?
No Timer (n) = 0? Timer (n) = 0?
Yes
Switch On? No
No Timer (n) = 0? Yes
Yes Desable
Yes Motor (n) Yes
Desable Yes
Change Motor (n)
Yes
Motor (n)
Value
Desable
Change Motor (n) Motor (n) Put STOP
Value Command
Change Motor (n)
Value
END
Refresh all
Motors value
Slide 53
Software – IR command task
Commad IRS State Machine
Inicialization
Electromechanical engineering classes - Robotics
Comunication OFF
Clear TBR
Preamble NOT valid
Capture on rising edge
Timeout Condition
Clear TBR
Capture on falling edge Validate
Initialize data Preamble
Preamble is valid
Clear TBR
Capture on falling edge
Valid Commad Initialize data
Clear TBR
Capture on falling edge
Initialize data Communication On
Put command in the ring buffer Signal Higth
Timeout Condition
Clear TBR
Capture on falling edge
Initialize data Slide 54
Project conclusions
• Successful attempt in the substitution of RoboSapien
Electromechanical engineering classes - Robotics
Slide 55
Future work
• Include wireless communications like ZigBee;
Electromechanical engineering classes - Robotics
Slide 56
MSP430@UBI-DEM
• Last year projects
Slide 58
Global Architecture of the system
• Application block diagram (Analog and digital blocks)
since the microphone to the speaker.
Last Year Projects
Slide 59
MSP430 used peripherals
• MSP430 Digital peripherals:
• ADC12,
• Timer_A and Timer_B,
• flash memory.
Last Year Projects
Slide 60
Important States
• 2 important states: Recording and Reproduction
• Reproduction state: digital part and the 2nd analog part will
be actives.
• The voice signal is sent to the PWM output by TImer_B.
• A filter was developed to improve the PWM DAC signal,
which is amplified and sent to the speaker. Slide 61
Microphone and Conditioning system
• Pre-amplifying circuit and low pass filter
• Microphone: input jack 3,5 mm (J1)
• Amplifying stage: Active low pass filter (TI OA
TLE2141CP)
Last Year Projects
R4
+5V
56k
C3
+5V
R1 470p D1
1k1
7
8
C1 R3 2
6 R7 Liga ao canal 0
4.7u 1k1 3 IC1a do ADC12
R2 1 18k C4
680 5 TLE2141CP 10n
no MSP430F449
D2 (pino 95)
4
+5V
R5 R6
1 J1
2 27k 11k
4
5 C2
3
Microfone 4.7u
Slide 62
PWM DAC and active filter
• The PWM DAC is constituted by two RC series low pass
filters.
to an analog signal.
Slide 63
PWM DAC and active filter
• Before amplifying the signal, it is used an Sallen-Key low
pass filter with unitary gain.
• 2 resistors (R10 e R11),
• 2 condensers (C7 e C8)
Last Year Projects
7
8
Liga à saída R8 R9 R10 2 Liga ao
compare do 6 amplificador
1k 1M 1k8 R11 3 IC1b
Timer_B C6 1
de áudio
C5
no MSP430F449 0.22u 470p 18k 5 TLE2141CP
(pino 77)
4
C8
4.7n
Slide 64
Audio amplifier
• Volume control: tension divider (R12 and R13)
• Limit the input audio signal level.
• Amplifying circuit: Audio amplifier Philips TDA7052
Last Year Projects
+5V
C10
220u
C11
Slide 65
Using MSP430F449 OLIMEX kit
• 3 external interfaces: JTAG, AEXT and EXT
• AEXT interface - ADC12
• EXT interface – Access to multiplexed ports.
Last Year Projects
Slide 66
PWM signals - Software
• Erasing flash memory by segments
Step Description
1 Stop Watchdog timer
Last Year Projects
Slide 67
PWM signals - Software
• Write words in flash memory
Step Description
1 Stop Watchdog timer
Last Year Projects
Slide 68
Storing voice signals - Software
• Flash memory used: 370 Kbytes
• Duration of speech: 15,3 sec
Last Year Projects
Slide 69
Using Timer_A - Software
• Speech signal sampling frequency: 1953 Hz = 512 μsec.
Slide 70
Using ADC12 - Software
• Conversion reference voltage: 0 – 3 V.
Slide 71
MatLab verification
• Word saved in flash memory: “hello”
Last Year Projects
Slide 72
Using Timer_B - Software
• PWM outputs each 512 μsec.
Slide 73
Serial communication DAC
• 2nd choice for the global architecture of the system.
• Substitution of the PWM DAC for a serial communication
DAC.
Last Year Projects
• Using the same peripherals but also the USART in SPI mode.
• Allows sending the serial data synchronized to the 12 bits DAC
(TI TLV5616CP).
Slide 74
Using USART - Software
• 2nd choice for the global architecture of the system.
• Substitution of the PWM DAC for a serial communication
DAC.
Last Year Projects
R4
+5V
56k
C6
+5V
R1 470p D1
1k1
7
8
C1 R3 2
6 R7 Liga ao
4.7u 1k1 3 IC1a pino
R2 1 18k C7
680 5 TLE2141CP 10n
15 de AEXT
4
+5V D2
R5 R6
1 J1
2 27k 11k
4
5 C2
3
Microfone 4.7u
Slide 76
Last Year Projects Serial communication DAC
Slide 77
Serial communication DAC
Liga ao Liga ao Liga ao
pino 1 pino 5 pino 4
de EXT de EXT de EXT
C4
+5V
IC2 0.22u
7
1 8 8
DIN VDD
2 7 R10 2
SCLK OUT
3 6 6
CS REFIN
4 5 1k8 R11 3 IC1b
FS AGND
R8 1
TLV5616CP 18k 18k 5 TLE2141CP
4
C8
Last Year Projects
4.7n
Liga ao C3
pino 7 R9 4.7u
18k
de EXT
+5V
C5
220u
C9
R12 IC3
470k 100n 1 8
VP OUT2
2 7
IN NC
3 6
GND1GND2
C10 4 5 1 J2
NC OUT1
2
100n TDA7052 4
R13 R14 R15 5
330k 10k 10k 3
Headphone
Slide 78
Last Year Projects Breadboard development
Slide 80
Project conclusions
• Using PWM signals:
Low quality of the sound reproduced
Due to the sampling frequency (1953.125 Hz)
Speech duration: 15,3 sec
Last Year Projects
Pattern recognition.
Slide 83
Acknowledgments
• This project was partially funded by Texas Instruments;
• Christian Speck
(TI Europe Business Development);
• Robert Owen
(TI University Programme Manager: Education &
Communications).
Slide 84