Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
68 views

Get Introduction to Microcontroller Programming for Power Electronics Control Applications: Coding with MATLAB® and Simulink® 1st Edition Mattia Rossi free all chapters

Power

Uploaded by

yumpiosuheb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
68 views

Get Introduction to Microcontroller Programming for Power Electronics Control Applications: Coding with MATLAB® and Simulink® 1st Edition Mattia Rossi free all chapters

Power

Uploaded by

yumpiosuheb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Download Full Version ebook - Visit ebookmeta.

com

Introduction to Microcontroller Programming for


Power Electronics Control Applications: Coding
with MATLAB® and Simulink® 1st Edition Mattia
Rossi
https://ebookmeta.com/product/introduction-to-
microcontroller-programming-for-power-electronics-control-
applications-coding-with-matlab-and-simulink-1st-edition-
mattia-rossi/

OR CLICK HERE

DOWLOAD NOW

Discover More Ebook - Explore Now at ebookmeta.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

C Programming for the PIC Microcontroller: Demystify


Coding with Embedded Programming Hubert Henry Ward

https://ebookmeta.com/product/c-programming-for-the-pic-
microcontroller-demystify-coding-with-embedded-programming-hubert-
henry-ward/
ebookmeta.com

Advanced Control of Power Converters: Techniques and


Matlab/Simulink Implementation (IEEE Press Series on
Control Systems Theory and Applications) 1st Edition Hasan
Komurcugil
https://ebookmeta.com/product/advanced-control-of-power-converters-
techniques-and-matlab-simulink-implementation-ieee-press-series-on-
control-systems-theory-and-applications-1st-edition-hasan-komurcugil/
ebookmeta.com

Chess Explained The c3 Sicilian 1st Edition Sam Collins

https://ebookmeta.com/product/chess-explained-the-c3-sicilian-1st-
edition-sam-collins/

ebookmeta.com

Figures of Natality Reading the Political in the Age of


Goethe 1st Edition Joseph D. O’Neil

https://ebookmeta.com/product/figures-of-natality-reading-the-
political-in-the-age-of-goethe-1st-edition-joseph-d-oneil/

ebookmeta.com
Advances in Organic Farming Agronomic Soil Management
Practices 1st Edition Vijay Singh Meena (Editor)

https://ebookmeta.com/product/advances-in-organic-farming-agronomic-
soil-management-practices-1st-edition-vijay-singh-meena-editor/

ebookmeta.com

Forensic Science The Basics 4th Edition Mirakovits

https://ebookmeta.com/product/forensic-science-the-basics-4th-edition-
mirakovits/

ebookmeta.com

Mozart and the Mediation of Childhood 1st Edition Adeline


Mueller

https://ebookmeta.com/product/mozart-and-the-mediation-of-
childhood-1st-edition-adeline-mueller/

ebookmeta.com

An Introduction to Partial Differential Equations Zhilin


Li Larry Norris

https://ebookmeta.com/product/an-introduction-to-partial-differential-
equations-zhilin-li-larry-norris/

ebookmeta.com

Incredible Comic Book Women The Kick Ass Guide to Drawing


Hot Babes 1st Edition Tom Nguyen

https://ebookmeta.com/product/incredible-comic-book-women-the-kick-
ass-guide-to-drawing-hot-babes-1st-edition-tom-nguyen/

ebookmeta.com
Teaching Outside the Box Five Approaches to Opening the
Bible with Youth 1st Edition Andrew Zirschky

https://ebookmeta.com/product/teaching-outside-the-box-five-
approaches-to-opening-the-bible-with-youth-1st-edition-andrew-
zirschky/
ebookmeta.com
Introduction to
Microcontroller
Programming for
Power Electronics
Control Applications
Introduction to
Microcontroller
Programming for
Power Electronics
Control Applications
Coding with MATLAB® and
Simulink®

Mattia Rossi
Nicola Toscani
Marco Mauri
Francesco Castelli Dezza
MATLAB® is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks
does not warrant the accuracy of the text or exercises in this book. This book’s use or discussion of
MATLAB® software or related products does not constitute endorsement or sponsorship by The
MathWorks of a particular pedagogical approach or particular use of the MATLAB® software.

First edition published 2022


by CRC Press
6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742

and by CRC Press


2 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN

© 2022 Taylor & Francis Group, LLC

CRC Press is an imprint of Taylor & Francis Group, LLC

Reasonable efforts have been made to publish reliable data and information, but the author and
publisher cannot assume responsibility for the validity of all materials or the consequences of their use.
The authors and publishers have attempted to trace the copyright holders of all material reproduced in
this publication and apologize to copyright holders if permission to publish in this form has not been
obtained. If any copyright material has not been acknowledged please write and let us know so we may
rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced,
transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or
hereafter invented, including photocopying, microfilming, and recording, or in any information
storage or retrieval system, without written permission from the publishers.

For permission to photocopy or use material electronically from this work, access www.copyright.com
or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923,
978-750-8400. For works that are not available on CCC please contact mpkbookspermissions@tandf.
co.uk

Trademark notice: Product or corporate names may be trademarks or registered trademarks, and are
used only for identification and explanation without intent to infringe.
Library of Congress Cataloging‑in‑Publication Data

ISBN: 978-0-367-70985-3 (hbk)


ISBN: 978-1-032-05303-5 (pbk)
ISBN: 978-1-003-19693-8 (ebk)
eBook + ISBN: 978-1-032-05465-0

DOI: 10.1201/9781003196938

Typeset in LM Roman
by KnowledgeWorks Global Ltd.

eResources are available for this title at www.routledge.com/9780367709853


a Daniela
Contents

Foreword xiii

Preface xvii

Acknowledgments xix

Biographies xxi

1 Advances in Firmware Design for


Power Electronics Control Platforms 1
1.1 Embedded Control System . . . . . . . . . . . . . . . . . . . 1
1.2 Selecting a Development Board . . . . . . . . . . . . . . . . . 3
1.2.1 Key elements of a microcontroller . . . . . . . . . . . . 4
1.2.2 Programming microcontrollers . . . . . . . . . . . . . 5
1.3 The C2000™ Family of MCU from Texas Instruments™ . . . 7
1.4 Scheme of a Power Electronics Control Problem . . . . . . . 9

I Embedded Development:
Hardware Kits and Coding 13
2 Automatic Code Generation through MATLAB® 15
2.1 Model-Based Design and Rapid Prototyping . . . . . . . . . 16
2.2 Workflow for Automatic Code Generation . . . . . . . . . . . 18
2.3 Generate Code for C2000™ Microcontrollers . . . . . . . . . 22
2.4 TI C2000™ Processors Block-set . . . . . . . . . . . . . . . . 24

3 Texas Instruments™ Development Kit 27


3.1 TI C2000™ LaunchPad™ : F28069M Piccolo . . . . . . . . . 27
3.1.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.1.2 Pin muxing . . . . . . . . . . . . . . . . . . . . . . . . 30
3.1.3 Power connectivity . . . . . . . . . . . . . . . . . . . . 32
3.1.4 Serial connectivity . . . . . . . . . . . . . . . . . . . . 33
3.1.5 Boot options . . . . . . . . . . . . . . . . . . . . . . . 33
3.2 TI BOOSTXL-DRV8301 BoosterPack . . . . . . . . . . . . 34
3.2.1 BoosterPack PWM signals . . . . . . . . . . . . . . . . 35
3.2.2 BoosterPack GPIO signals . . . . . . . . . . . . . . . . 36
3.2.3 DC bus and phase voltage sense . . . . . . . . . . . . 37

vii
viii Contents

3.2.4 Low-side shunt-based current sense . . . . . . . . . . . 37

4 Software Installation 39
4.1 TI Support Packages:
Code Composer™ Studio and ControlSUITE™ . . . . . . . . 39
4.2 MATLAB® Support Package:
Embedded Coder for Texas Instruments C2000 Processors . 41
4.3 Installation Procedure . . . . . . . . . . . . . . . . . . . . . . 41

II Review of Control Theory: Closing the Loop 47


Introduction 49

5 Designing a Closed-Loop Control System 51


5.1 Dynamical Systems . . . . . . . . . . . . . . . . . . . . . . . 52
5.1.1 Mathematical laws . . . . . . . . . . . . . . . . . . . . 52
5.1.2 Dynamical systems in electrical applications . . . . . . 54
5.2 Design a PI Controller in Continuous-Time Domain . . . . . 54
5.2.1 Serial/parallel form . . . . . . . . . . . . . . . . . . . . 55
5.2.2 Characterization of the closed-loop dynamics F (s) . . 55
5.3 Derive a PI Controller in Discrete-Time Domain . . . . . . . 60
5.3.1 General properties of the discretization process . . . . 60
5.3.2 Characterization of the closed-loop dynamics F (z) . . 62

6 Design Example: PI-Based Current Control of an RL Load 65


6.1 Simulink® Simulation . . . . . . . . . . . . . . . . . . . . . . 67
6.1.1 Use of standard blocks (continuous/discrete) . . . . . 71
6.1.2 Use of Simscape™ (specialized power systems) . . . . 73
6.1.3 Controller performances . . . . . . . . . . . . . . . . . 74
6.2 Derive an Anti-Windup PI Controller Scheme . . . . . . . . 77
6.3 Design Summary . . . . . . . . . . . . . . . . . . . . . . . . . 82

7 Manipulate the Variables Format: Data Types 85


7.1 Fixed Point vs Floating Point Representation . . . . . . . . . 85
7.2 Single vs Double Precision . . . . . . . . . . . . . . . . . . . 88
7.3 Use of Scaling in Fixed Point Representation . . . . . . . . 91
7.4 Converting from Decimal Representation to Single Format . 93
7.5 Processing the Data: Implementation Hints . . . . . . . . . . 95

III Real-Time Control in Power Electronics:


Peripherals Settings 97
Introduction 99
Contents ix

8 Basic Settings:
Serial Communication COM and Hardware Target 101
8.1 Virtual Serial Communication through COM port . . . . . . 101

9 Simulink® Configuration 105


9.1 Simulink® Environments: Firmware vs Testing . . . . . . . . 107
9.1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . 107
9.1.2 Execution in Simulink® . . . . . . . . . . . . . . . . . 108
9.2 MCUs and Real-Time Control with Simulink® . . . . . . . . 109

10 Serial Communication Interface (SCI) Peripheral 111


10.1 Hardware Details . . . . . . . . . . . . . . . . . . . . . . . . 112
10.2 Firmware Environment:
Send and Receive Data through Serial Communication . . . 113
10.2.1 C2806x SCI receive . . . . . . . . . . . . . . . . . . . . 113
10.2.2 C2806x SCI transmit . . . . . . . . . . . . . . . . . . . 116
10.3 Testing Environment:
Send/Receive Data through Serial Communication . . . . . . 117
10.3.1 Serial configuration . . . . . . . . . . . . . . . . . . . . 117
10.3.2 Serial send . . . . . . . . . . . . . . . . . . . . . . . . 118
10.3.3 Serial receive . . . . . . . . . . . . . . . . . . . . . . . 119
10.4 Time Variable Settings (Sample Rates) . . . . . . . . . . . . 120
10.5 Examples on Serial Communication . . . . . . . . . . . . . . 122

11 GPIO Peripheral—Digital Input/Output 131


11.1 Hardware Details . . . . . . . . . . . . . . . . . . . . . . . . 131
11.2 Firmware Environment: GPIO Peripherals . . . . . . . . . . 133
11.2.1 C2806x GPIO digital input (GPIO DI) . . . . . . . . 133
11.2.2 C2806x digital output (GPIO DO) . . . . . . . . . . . 134
11.3 Examples with GPIO blocks . . . . . . . . . . . . . . . . . . 135

12 Analog to Digital Converter Peripheral 149


12.1 Operating Principle . . . . . . . . . . . . . . . . . . . . . . . 149
12.1.1 Sample & hold . . . . . . . . . . . . . . . . . . . . . . 150
12.1.2 Analog to digital converter . . . . . . . . . . . . . . . 150
12.2 Hardware Details . . . . . . . . . . . . . . . . . . . . . . . . 151
12.2.1 Difference between acquisition window
and sample time . . . . . . . . . . . . . . . . . . . . . 153
12.3 Firmware Environment: ADC Peripheral . . . . . . . . . . . 153
12.3.1 C2806x ADC . . . . . . . . . . . . . . . . . . . . . . . 153
12.4 Example with ADC block . . . . . . . . . . . . . . . . . . . . 155
12.5 Synchronization between ADC modules . . . . . . . . . . . . 160
x Contents

13 Pulse Width Modulator Peripheral 163


13.1 Operating Principle . . . . . . . . . . . . . . . . . . . . . . . 164
13.2 Hardware Details . . . . . . . . . . . . . . . . . . . . . . . . 166
13.2.1 ePWM sub-modules . . . . . . . . . . . . . . . . . . . 169
13.3 Generation of PWM signals . . . . . . . . . . . . . . . . . . . 171
13.3.1 Counting modes . . . . . . . . . . . . . . . . . . . . . 172
13.3.2 ePWMxA and ePWMxB sub-modules . . . . . . . . . 174
13.3.3 Setting dead bands . . . . . . . . . . . . . . . . . . . . 175
13.4 Firmware Environment: ePWM Peripheral . . . . . . . . . . 178
13.4.1 C2806x ePWM . . . . . . . . . . . . . . . . . . . . . . 178
13.5 Example with ePWM block . . . . . . . . . . . . . . . . . . . 186
13.6 DAC Peripheral—Filtered PWM . . . . . . . . . . . . . . . . 191
13.7 Examples with DAC Peripherals . . . . . . . . . . . . . . . . 192
13.8 Synchronization between Multiple ePWM Modules . . . . . . 197
13.9 Synchronization between ADC and ePWM Modules:
Average Measurements . . . . . . . . . . . . . . . . . . . . . 202
13.10Events Execution within Sample Time . . . . . . . . . . . . 204

14 Encoder Peripheral 207


14.1 Operating Principle of Incremental Encoders . . . . . . . . . 207
14.2 Hardware Details . . . . . . . . . . . . . . . . . . . . . . . . 209
14.3 Optical Rotary Encoder LPD3806 . . . . . . . . . . . . . . . 210
14.4 Speed Computation . . . . . . . . . . . . . . . . . . . . . . . 211
14.5 Firmware Environment: eQEP Peripheral . . . . . . . . . . . 213
14.5.1 C2806x eQEP . . . . . . . . . . . . . . . . . . . . . . . 213
14.6 Example with eQEP block . . . . . . . . . . . . . . . . . . . 215

IV Real-Time Control in Power Electronics:


Applications 219
15 Open Loop Control of a Permanent Magnet DC Motor 221
15.1 Required Hardware . . . . . . . . . . . . . . . . . . . . . . . 221
15.2 Linear Model of a PMDC Motor . . . . . . . . . . . . . . . . 222
15.3 System Simulations . . . . . . . . . . . . . . . . . . . . . . . 226
15.4 Half-Bridge Configuration . . . . . . . . . . . . . . . . . . . . 227
15.4.1 Control implementation . . . . . . . . . . . . . . . . . 231
15.5 Full-Bridge Configuration . . . . . . . . . . . . . . . . . . . . 234
15.5.1 Modulation strategies . . . . . . . . . . . . . . . . . . 235
15.5.2 Unipolar voltage switching . . . . . . . . . . . . . . . 236
15.5.3 Bipolar voltage switching . . . . . . . . . . . . . . . . 241
15.5.4 Control implementation . . . . . . . . . . . . . . . . . 246

16 Low-Side Shunt Current Sensing 251


16.1 Sensor Characterization: Theoretical Approach . . . . . . . . 252
16.2 Locked Rotor Test . . . . . . . . . . . . . . . . . . . . . . . . 254
16.3 Sensor Characterization: Experimental Approach . . . . . . . 260
Contents xi

17 Current Control of an RL Load 267


17.1 Required Hardware . . . . . . . . . . . . . . . . . . . . . . . 267
17.2 Linear Average Model and Controller Design . . . . . . . . . 269
17.3 System Simulations . . . . . . . . . . . . . . . . . . . . . . . 271
17.3.1 Detailed modeling of the actuation variables . . . . . . 271
17.4 Half-Bridge Configuration . . . . . . . . . . . . . . . . . . . . 273
17.4.1 Control implementation . . . . . . . . . . . . . . . . . 280
17.5 Variation of Load Parameters . . . . . . . . . . . . . . . . . 288
17.5.1 Effects on the transient response . . . . . . . . . . . . 288
17.5.2 Parameters estimation . . . . . . . . . . . . . . . . . . 290

18 Voltage Control of an RLC load 293


18.1 Required Hardware . . . . . . . . . . . . . . . . . . . . . . . 293
18.2 Guidelines for the Hardware Design of a RLC Load . . . . . 296
18.3 General State-Space Average Modeling Method . . . . . . . . 300
18.3.1 Linear average model and controller design . . . . . . 303
18.4 System Simulations . . . . . . . . . . . . . . . . . . . . . . . 306
18.5 Half-Bridge Configuration . . . . . . . . . . . . . . . . . . . . 306
18.5.1 Control implementation . . . . . . . . . . . . . . . . . 314
18.6 Variations of LC Filter Parameters . . . . . . . . . . . . . . 322

19 Cascade Speed Control of a Permanent Magnet DC Motor 325


19.1 Required Hardware . . . . . . . . . . . . . . . . . . . . . . . 327
19.2 Linear Model of a PMDC Motor . . . . . . . . . . . . . . . . 328
19.3 Cascade Control Architecture and Design . . . . . . . . . . . 330
19.4 System Simulations . . . . . . . . . . . . . . . . . . . . . . . 333
19.5 Full-Bridge Configuration . . . . . . . . . . . . . . . . . . . . 334
19.5.1 Model reference adaptive system (MRAS) observer . . 344
19.6 Single Motor Configuration . . . . . . . . . . . . . . . . . . . 347
19.6.1 Parameter identification . . . . . . . . . . . . . . . . . 348
19.6.2 Control implementation . . . . . . . . . . . . . . . . . 350
19.7 Back-to-Back (B2B) Configuration . . . . . . . . . . . . . . . 361
19.7.1 Parameter identification . . . . . . . . . . . . . . . . . 363
19.7.2 Control implementation . . . . . . . . . . . . . . . . . 364

V Real-Time Control in Power Electronics:


Load Emulation 371
20 Debugging Tools and Firmware Profiling 373
20.1 Processor-in-the-loop with Simulink® . . . . . . . . . . . . . 373
20.1.1 PMDC motor control implementation through PIL . . 375
20.2 External Mode Execution with Simulink® . . . . . . . . . . . 380
20.2.1 Simulink® setup for external mode execution . . . . . 381
xii Contents

21 Electric Propulsion Case Studies 385


21.1 Urban Tramway . . . . . . . . . . . . . . . . . . . . . . . . . 385
21.2 Electric Racing Car . . . . . . . . . . . . . . . . . . . . . . . 390

A Appendix A: Basics of C 401


A.1 Operations between numbers . . . . . . . . . . . . . . . . . . 401
A.1.1 Sum and differences . . . . . . . . . . . . . . . . . . . 401
A.1.2 Shift operation . . . . . . . . . . . . . . . . . . . . . . 401
A.1.3 Multiplication . . . . . . . . . . . . . . . . . . . . . . . 402
A.1.4 Division . . . . . . . . . . . . . . . . . . . . . . . . . . 402
A.2 Structure of a C program . . . . . . . . . . . . . . . . . . . 403

B Appendix B: Custom Expansion Boards and Hardware Kits 405

Bibliography 423
Index 427
Foreword

The new book Introduction to Microcontroller Programming for Power Elec-


tronics Control Applications contains the fundamental subjects of the interdis-
ciplinary field of power electronic based systems, which draws knowledge from
circuit and control theory, (digital) signal processing for embedded implemen-
tation, electrical machines/drives, and power semiconductor devices. Written
for students and practicing engineers, this book introduces the analysis and de-
sign of motor control systems and their implementation on microcontrollers.
The requirements and capabilities of the latter influence the structure and
design choice of the closed-loop control scheme, a subject particularly rele-
vant for laboratory activities both at university and industry level. This book
presents state-of-the-art techniques to implement modulation schemes and
control algorithms in a commercial microcontroller (MCU) suitable for rapid
prototyping approach, and hint for designing analog circuits, such as low-
voltage converter, output filters/load. MATLAB/Simulink® is introduced and
used to solve example problems.
The book presents a concise workflow for the reader by using a specific
embedded target, which is not a limiting factor for the validity of the sug-
gested approach. The latter can be extended even to different boards. It is
valuable to every graduate student, serving as a textbook for classes (looking
to create teamwork) and as a starting point for more advanced studies, for
industry professionals, researchers, and academics willing to study the broad
field of power electronics. The contents of the book are easy to read and pre-
sented in an interesting way with good illustrations and solid background on
the underlying theory. Solved problems (built-in files) are presented to help
the readers.

Introduction to Microcontroller Programming for Power Electronics Control


Applications is unique in the synthesis of the main characteristics of electri-
cal drive behavior and in their link to the main implementation aspect into
modern MCU, trying to fill the gap between system/circuit design, control
techniques, and digital signal processing. The authors are power electronics
and drives specialists from the Electrical Machines, Drives and Power Elec-
tronics Research Group of Politecnico di Milano, Italy. They collected in the
book the several years of teaching and subjects of the laboratory activities for

xiii
xiv Foreword

the M.Sc. in Automation and Control Engineering and Electrical Engineering


at the same university, with the collaboration and contribution of industrial
partner. As industrial partners, we retain this book a great achievement of
the last four years collaboration with the authors.

Angelo Strati — Field Application Engineer Italy


Domenico Santoro — Field Application Engineer Italy
. Giuseppe Ballarin — Team Leader FAE Italy
Würth Elektronik Group
angelo.strati@we-online.com

Most people go about their day blissfully unaware of the electric motors that
are spinning the world around us. We wake up staring upwards at a ceiling
fan, silently rotating in a circle. We jump into our car and rely on up to
40 motors—pumps, fans, locks, and lifts—to get us to our destination. We
power up our laptop computers and hear the soft whine of fans working to
keep the electronics cool. Motors are everywhere because they are one of the
main ways that an electronic circuit can interact with the real world, i.e. a
power electronic-based system. They are “lectromechanical, turning analog
and digital signals into real and visible mechanical motion. It is estimated
that electric motors consume 45 percent of the total worldwide electricity—
this is a stunning statistic! As we look to reducing energy consumption and
enabling a greener future, electric motors present a huge potential for efficiency
improvements.
Few engineering students are aware of the impact of electric motors on
the world around them, and even less are versed in the design and control of
motor systems. This is a problem! We need engineers growing in competency
in this field to create better and more efficient motor drive systems.
Motor drive and control is an incredibly multidisciplinary field. Real-time
digital processing is implemented in microcontrollers to be the “brain” behind
the motor system; controlling speed, power, and efficiency from the digital
domain. A wealth of analog components from power management (voltage
regulators & gate drivers) and signal chain (amplifiers & sensors) interface
the microcontroller to the motor through a power converter while providing
sensing, safe operation, and support for the system. Texas Instruments has
over 25 years of experience in the field of real-time control and also provides

Texas Instruments Incorporated (Nasdaq: TXN) is a global semiconductor company


that designs, manufactures, tests and sells analog and embedded processing chips for mar-
kets such as industrial, automotive, personal electronics, communications equipment and
enterprise systems. Our passion to create a better world by making electronics more afford-
able through semiconductors is alive today, as each generation of innovation builds upon
the last to make our technology smaller, more efficient, more reliable and more affordable—
making it possible for semiconductors to go into electronics everywhere. We think of this
as Engineering Progress. It is what we do and have been doing for decades. Learn more at
www.ti.com.
Foreword xv

a comprehensive analog portfolio covering every block of the motor drive and
control system.
This book presents very practical and important lessons to engineers and
engineering students alike on the topics of motor drive and control, covering
not only general concepts but details on how to create a motor drive system.
It provides an excellent resource to encourage the next generation of engineers
to grow and develop skills in the area of electric motors and power electronics,
introducing them the tools they need to make an impact on the world.
Politecnico di Milano is an outstanding academic partner, and the focus
of the Electrical Machines, Drives and Power Electronics Research Group on
cutting-edge power electronic-based technologies helps shape quality engineer-
ing minds. We wish the best of success to this publication and to the continued
collaboration between industry and academia.

Olivier Monnier — Marketing Manager, C2000 Real-Time MCU


Matt Hein — Applications Manager, Brushless-DC Motor Drives
. Antonio Faggio — Field Application Engineer
Texas Instruments Inc.
a-faggio@ti.com

Can you write the 100 million lines of code that are needed to build an average
modern car? The answer is pretty obvious: of course you can, it’s just a matter
of time. And how would you compare the complexity of this problem to writing
the 4501 lines of assembly code needed to build the first version of UNIX in
1971? While both tasks appear to be at a similar level of dauntlessness, the half
century separating them has witnessed the emergence of high-level languages
that enable programmers to address highly complex problems on their own
while reusing the legacy of their peers.
At MathWorks Inc., we relentlessly work on providing the best high-level
programming tools to automate the implementation of your ideas into embed-
ded systems. Simulink allows you to design and simulate complex algorithms
that you can translate into thousands of lines of embedded code with a click
of a button via our code generation technology.
The book Introduction to Microcontroller Programming for Power Elec-
tronics Control Applications will teach you how to use these modern techniques
to create control algorithms for systems involving complex physics. The re-
markable work of Mattia Rossi, Nicola Toscani, Marco Mauri and Francesco
Castelli Dezza from Politecnico di Milano, Italy, clearly explains deep concepts
to the reader in the field of embedded programming for power electronics ap-
plications using Model-Based Design.

The copyrighted material included in this book is reprinted with permission of The
MathWorks, Inc.
xvi Foreword

While the shift to digital is now largely dominating the industry of mo-
tor control, this revolution is just starting for power conversion applications.
The material in this book provides state of art techniques to train the many
engineers that the world needs tomorrow in a field that is at the core of the
indispensable transition to clean energy.
In recent conversations with Mattia and Nicola, while they politely thanked
us for our help, it was clear to us that the quality and the amount of effort
in this book deserved much more thanking from our side. With this foreword,
we extend all our gratitude to this outstanding contribution to accelerating
the pace of engineering and science, our core mission.

Antonin Ancelle — Embedded Targets Development Manager


John Kluza — Embedded Systems Partner Manager
Tom Erkkinen — Code Generation Marketing Manager
.
Brian McKay — Embedded Systems Partner Manager
MathWorks Inc.
aancelle@mathworks.com

www.we-online.com www.ti.com www.mathworks.com


Preface

Power electronics-based systems are the key enabling technology to meet most
of the future sustainable challenges from grid to motor applications.
Standard textbooks and courses about power electronics and electrical ma-
chines deal with analysis in continuous-time, averaged modeling of switched-
mode power converters, and continuous-time control theory. Nevertheless, real
control algorithms and management functions around power converters are
implemented digitally, thus, extending the field of fundamentals studies to
discrete-time modeling and digital control concepts specific to power electron-
ics. The necessary background is achieved by combining specific textbooks
and courses from both power electronics and digital control theory. However,
students who approach the design of digitally controlled power converters for
the first time may not fully understand and successfully practice for a targeted
problem due to such fragmented references.
In this book, we attempt to fill this gap by treating the fundamental as-
pects of digital control implementation for power electronics based systems
in a systematic and rigorous manner. Our objectives are to put the reader
in the position to understand, analyze, model, design, and implement digital
feedback loops around power converters, from system-level transfer function
formulations to understand which coding tool may be used when working
with microcontroller (MCU or µC) platforms. In particular, the latter be-
longs to Texas Instruments™ C2000™ family, which is specifically designed
for real-time closed loop control such as power supplies, industrial drives,
and solar inverters applications. The Simulink® environment is able to au-
tomatically generate ANSI/ISO C/C++ code tailored for specific embedded
targets through a model-based workflow. Given the settings which enable a
background usage of the Code Composer™ Studio IDE, a Simulink® scheme
can be directly compiled and executed on C2000™ MCUs. Such automated
build and execution procedure speed up the control algorithms implementa-
tion, thus, the code generation of software interfaces and MCU peripherals
(e.g. ADC, digital I/O, PWM), which can be tested with execution profiling.
This makes the reader working in a rapid prototyping manner.
This book is oriented to graduate students of electrical and automation
and control engineering pursuing a curriculum in power electronics and drives.
Moreover, it aims to be a reference for engineers and researchers who seek to
expand on the expertize in design-oriented knowledge for the aforementioned
applications. It is assumed that the reader is well acquainted with funda-
mentals of electrical machines and power converters, along with associated

xvii
xviii Preface

continuous-time modeling and control techniques. Familiarity with sampled-


data, discrete-time system analysis and embedded design topics is helpful but
not absolutely essential since the scope of the book is to provide a basic knowl-
edge even to whom is approaching these topics for the first time. Key concepts
are developed from scratches, including a brief review of control theory and
detailed description of the hardware and test bench used. Either custom ex-
pansion boards and assembled kits are open to users community. Project files
can be shared and/or pre-assembled boards/kit can be directly shipped.
There is no standard notation to cover all of the topics covered in this
book. We tried to use the most familiar notation from the literature whenever
possible to help the reader’s understanding through the chapters.
Acknowledgments

Most of the projects shown in this book have been funded by the Department
of Mechanical Engineering of Politecnico di Milano, Italy, with the particular
contribution of its Laboratory of Electrical Drives and Power Electronics.
Special thanks goes to the university rector Prof. Ferrucio Resta and the
department director Prof. Marco Bocciolone for their support to this initiative.
We are grateful to our graduate students Marco Gerosa, Matteo Scandella,
Andrea Polastri, Matteo Sposito, and Luca Grittini for the precious work
in supporting the hardware development, the boards testing and the many
suggestions they made. We also thank all the Ph.D. students and researchers
who contributed to this book. In particular, Dr. Khaled ElShawarby and Dr.
Alberto Bolzoni, who were supporting the project from day zero.

This book is the final outcome of a collaboration between Politecnico di


Milano, Italy, Würth Elektronik™ Group Texas Instruments™ Inc. and
MathWorks® Inc. . The authors are grateful to them for their support, help
and vision. In particular, Tristan De Cande for his encouragement to tight
the collaboration between university and company; Antonio Faggio and the
US C2000™ product line of Texas Instruments™ Inc. for their commitment to
invest in young generation growing at the university; Angelo Strati, Giuseppe
Ballarin, Domenico Santoro, Andrea De Gruttola from Würth Elektronik™
Group for helping in components selection and boards design; Antonin
Ancelle, John Kluza and their teams from MathWorks® Inc. for their help
on embedded development. Moreover, we thank also MathWorks® Inc. for let-
ting us being part of their Book Program.

The authors would like to specially thank Prof. Petros Karamanakos from
Tampere University, Finland, and Prof. Ralph Kennel from Technical Univer-
sity Munich, Germany, for their guidance, long discussions and availability to
share their high expertize in this field.

We are grateful to Nora Konopka and CRC Press LLC from Taylor and Fran-
cis Group for publishing this book. Special thanks goes to Prachi Mishra for
her guidance and support.

Finally, we acknowledge the inspiration, patience, and support of our fami-


lies during the preparation of this book, who allowed us to work during long
nights, weekends, and holidays. The book is dedicated to Daniela.

xix
Biographies

Mattia Rossi is a Research Assistant at Politecnico di


Milano, Italy. He received the B.Sc. and M.Sc. degrees in
Automation and Control Engineering from Politecnico di
Milano, Italy, in 2013 and 2015, respectively. In 2015, he
was at the ABB MV Drives, Switzerland, working on en-
hanced motor control design to reduce mechanical vibrations
in motor-load couplings. Since 2016, he is a Ph.D. student
in Electrical Engineering at Politecnico di Milano, Italy, in
collaboration with Tampere University, Finland. In 2019, he
was a visiting Ph.D. student at the Technical University of
Munich, Germany. His main research activities cover model predictive control
(MPC) algorithms for multilevel medium voltage power electronic-based sys-
tems and their embedded implementation, aiming to improve power conversion
efficiency and system components reliability. He received the Best Student Pa-
per Award at the 2019 IEEE International Symposium on Predictive Control
of Electrical Drives and Power Electronics, and the Jorma Luomi Student Fo-
rum Award at the 2016 International Conference on Electrical Machines.
Email: mattia.rossi@polimi.it

Nicola Toscani received the Bachelor (B.Sc.), Master of


Science (M.Sc.), and Doctor of Philosophy (Ph.D.) degrees
in Electrical Engineering from the Politecnico di Milano,
Milan, Italy, in 2013, 2015, and 2019, respectively. He is
currently working as a Postdoctoral Research Fellow in the
Department of Mechanical Engineering of Politecnico di Mi-
lano. His last research activities deal with the development
and the control of electrical machines for high-performance
vehicles and wireless power transfer. His research inter-
ests also include modeling strategies for Electromagnetic
Compatibility problems, Power Electronics and Electrical Drives. Email:
nicola.toscani@polimi.it

xxi
xxii Biographies

Marco Mauri is an Assistant Professor in Electrical Ma-


chines and Drives at Politecnico di Milano, Italy. He received
the Master of Science (M.Sc.) and Doctor of Philosophy
(Ph.D.) degrees in Electrical Engineering from Politecnico
di Milano in 1998 and 2002. His research interests mainly
include the control of electrical machines and modeling prin-
ciple of electrical drives and electromagnetic effects. He is a
member of the IEEE Power Electronics and Industrial Elec-
tronics societies Email: marco.mauri@polimi.it

Francesco Castelli Dezza is a Full Professor in Electri-


cal Machines and Drives at Politecnico di Milano, Italy.
He received the Master of Science (M.Sc.) and Doctor of
Philosophy (Ph.D.) degrees in electrical engineering from
the Politecnico di Milano, Milano, Italy, in 1986 and 1990,
respectively. He is currently the head of the Electrical Ma-
chines, Drives and Power Electronics research group of Po-
litecnico di Milano, Italy, which is mainly located at the De-
partment of Mechanical Engineering of the same university.
His research interests include studies on dynamic behavior of
electrical machines, electrical drives control and design, and power electronics
for energy flow management. He is a member of the IEEE Power Electronics
and Industrial Electronics societies. Email: francesco.castellidezza@polimi.it
1
Advances in Firmware Design for Power
Electronics Control Platforms

The rising complexity and tighter requirements of power electronics-based sys-


tems lead to a great complexity of digital control algorithms, which has to be
tested in many working conditions, i.e., looking for reliability. Hence, firmware
design and testing routines have become increasingly time-consuming. To
speed up the proof of concepts and to improve firmware quality assurance, the
simulation analysis is combined with several automatic code generation proce-
dures to achieve rapid prototyping. Such approach is aimed to test the control
algorithm and the related generated code on real hardware through mini-
mal modifications. This approach also helps to identify coding and platform-
specific configuration errors, as well as to get rid of them. In particular, this
book refers to microcontrollers (MCU or µC).
In this first, introductory chapter, basics of embedded systems and corre-
sponding coding approaches are presented in detail.

1.1 Embedded Control System


Everyone who encounter these book subjects for the first time may have a
very fundamental question: what is an embedded system?
To provide a clear answer, it is necessary to underline the major difference
between a microprocessor and a microcontroller first.
A microprocessor is the computational intelligence of complex systems,
i.e., the central processing unit (CPU), which is optimized to do logical-
mathematical computations. It usually has mainly on-board communica-
tions peripherals to interact with the rest of the system. However, in many
fields, including power electronics-based systems, there is the need for com-
municating with rather complex peripherals like Analog-to-Digital Conver-
sion (ADC) channels, Digital-to-Analog Conversion (DAC) modules, Pulse-
Width-Modulation (PWM) peripheral, and Inter Integrated Circuit (I2C)
communication.
A microcontroller (MCU) is designed to include such peripherals. Hence,
a MCU is a device built around a microprocessor (or CPU), where the

DOI: 10.1201/9781003196938-1 1
2 Advances in Firmware Design for Power Electronics Control Platforms

Standard microprocessor Microcontroller


(PCs) (Power electronics)
• High computational power • “Low” computational power
• Several communication peripheral • Communication, actuation and
sensing (measurements) peripherals
• General usage (e.g., software sim- • Target usage: optimizing perfor-
ulations, document editing) mances and costs

number of peripherals as well as their type and accuracy/resolution are related


to the final market price other than the specific task they have to carry out.
Figure 1.1 shows an example of architecture of MCU board. Note that, MCU
refers to microprocessor for which the computational power is significantly
lower compared to those used inside a personal computer. This is the reason
why most of the MCUs for the industrial markets are able to manage a re-
duced number of computations even if they drive high-speed/high-resolution
peripherals.
Therefore, an embedded system can be generally defined as a control plat-
form based on a programmable logic (i.e., microprocessor), where the control
algorithm and the peripheral interfaces are dedicated to specific tasks/func-
tions or a group of them. All the application requirements, e.g., from ADC
resolution to modulator dead time, are given from the beginning. This allows
every user to choose the best trade-off between computational power, type of
peripherals, and unitary cost, optimizing its design. The algorithm is executed
in real-time, generally without using an on-board operating systems (OS). In-
deed a custom (light) OS might be needed just for the most demanding cases.
Nowadays, the modern definition of embedded system mainly refers to mi-
crocontrollers. Nevertheless, even a single microprocessor which is specialized

CPU
A/D
CONVERTER RAM

PROGRAM
CLOCK
MEMORY
MCU

Figure 1.1 Example of the architecture of a MCU board [11].


Selecting a Development Board 3

Figure 1.2 Examples of power electronic-based applications [8].

in certain class of computations, or even custom designed for the applica-


tion at hand, may be considered as an embedded system. This is the case
of digital signal processors (DSPs), which are out of the scope of this book.
The wide-ranging insertion of power electronics in many applications with
different requirements still creates market for microcontrollers. Some of such
applications are reported in Figure 1.2. As an example, the MCU usage in the
automotive field is grown about +11% from 2006 to 2015. The popularity of
MCUs depends on their ability to work with floating point variables (i.e., to
include a floating point unit) as well as their benefit from mass production.
Nevertheless, some applications require cost-effective devices,1 thus, working
with integer variables (e.g., 8–16 bit), targeting low cost MCUs. Furthermore,
in order to extend the potential market of control platforms, today microcon-
trollers can be interfaced with different peripheral on the same pins, which
can be chosen by setting different values on the corresponding registers. Thus,
that allows to have more peripheral channels than pins.

1.2 Selecting a Development Board


Power electronics-based systems like power management and motor drive are
going on with their fast evolution toward high-performance and high-efficiency
solutions. Likewise, the demand for digital control algorithms managing the
electronic component operations and the overall system has been rising, and
embedded systems have been increasing in complexity reaching fast execution
times. Therefore, it has become a standard engineering practice to test the
control algorithm through real-time simulations and to verify its feasibility
based on the hardware at disposal. This is the reason why in both research
centers and academia development board must be updated according to the
new emerging platforms on the market.
The selection of the development board represents the very first
task of a project. In particular, development boards are designed to be
efficient, portable, and sensored according to a specific applications field.

1 From the customer’s point of view the “best” microcontroller is the one which matches

all the application requirements at the lowest price.


4 Advances in Firmware Design for Power Electronics Control Platforms

Since this book focuses on electrical power conversion case studies, from
now on the text refers to MCU platforms targeted to power electronics-based
applications. Even if this last statement reduces the candidate list, there still
are several suitable solutions available on the market which share a common
goal of being compact and versatile. Since the definition of a criterion to cat-
egorize each board would not be practical (i.e., there might be even deep
technology differences), it is recommended to follow a system-level approach
like the one presented here:
1. Consider all the components and peripherals that are necessary to
run all of the required features. If the board lacks any of them, it is
important to identify some supported expansions to include them.
2. Consider the supported programming languages and the level of
competence of the final user. Moreover, investigate if any automatic
code generation procedure is available as well as the quality of the
documentation at disposal for the adopted board. Indeed, commu-
nity and support are factors of great importance since they are the
primary resources when designing a project.
3. Evaluate costs versus adopted components for the considered spe-
cific application: is it worth paying for them?

1.2.1 Key elements of a microcontroller


The main features of microcontroller boards that set their performances are
reported below:

• CPU and clock speed: these two values affect the overall performance of
the board. Namely, how fast it can perform computations. It should be noted
that clock speed comparisons between CPUs coming from different families
may not lead to meaningful considerations. Other factors, such as instruction
cycles, instruction sets, and pipeline depth, also affect MCU performances.
• RAM: the size of this memory affects the number of tasks that can be run
simultaneously. It also impacts how fast data can be processed, as swapping
it from RAM to nonvolatile storage incurs large performance overheads.
• Graphical processing unit (GPU): it allows development board to run
video output (e.g., VGA/HDMI). High-performance GPUs are needed while
processing video/images with the development board.
• Data memory: it affects the size of programs, operating systems, and gen-
erated/downloaded data that can be stored on development boards.
• General purpose input/output pins: these pins are used to connect
external components to the development board in use. Hence, more pins
typically means more possible simultaneous connections. These pins are
usually assigned specific functionalities by the manufacturer being compli-
ant with some standards, such as integrated circuit (I2C), serial peripheral
Selecting a Development Board 5

interface (SPI), and universal asynchronous receiver/transmitter (UART).


These standards facilitate interoperability with third-party devices such as
displays or sensors.
• Analog-in pins: these pins are necessary for any data acquisition from
sensors and they are classified through the resolution and sampling rate of
the peripheral to which they are connected. In particular, resolution refers
to the number of discrete levels to which the input signal is quantized, while
sampling rate is the number of data points that can be obtained in a reference
time interval. High resolution is required for accurate measurements, while
high sampling rates are needed for the acquisition of fast changing signals.
• Pulse width modulator: pulse width modulation is a kind of digital signal
that is ideal for mimicking analog signals. Such signals are generated through
modulators which vary the duty cycle of square waves depending on the
desired output.
• Power supply and consumption: both of them can play a major role in
design choices. For portable products, the runtime requirements and power
demand of the board/associated components must be considered when se-
lecting an energy source. For example, a development board serving as a
data logger in a remote location must run uninterrupted for months, while
another one working as a mobile personal computer only needs to run for sev-
eral hours before recharging. Power consumption can be difficult to quantify
as many boards have varying modes of operation, allowing some of them
to work in very low power consumption modes. When considering power
consumption, the designer must take the following factors into account: re-
quired computational power, maximum run time without recharging, and
the cost/size of the energy source. The size of power sources is easier to
determine since it depends on the rated values of the adopted board

1.2.2 Programming microcontrollers


The development environment of boards affects how the designer interacts
with the hardware. The support for multiple operating systems, languages,
and integrated development environments creates a rich programming frame-
work and more appealing development board as well.
Depending on the specific application, all the onboard peripherals as well
as the main algorithm features have to be correctly set while programming
the MCU for executing required tasks.
Across the years, different coding approaches have been developed:

1. Low-level, based on machine code (e.g., Assembler language);


2. Intermediate-level, based on a combination of C-code (to define
algorithm features and peripheral settings) and the usage of an In-
tegrated Development Environment (IDE, e.g., Code Composer™
6 Advances in Firmware Design for Power Electronics Control Platforms

Studio from Texas Instruments™ ) to compile, link, debug, and down-


load the script on target;
3. High-level, based on a combination of objective-oriented languages
(e.g., Simulink® , to define algorithm features and peripherals set-
tings) and the usage of specific target toolbox to generate C-code,
compile, link, debug and download the algorithm into platform.
C code is considered as the universal language for microcontroller program-
ming, with C++ following closely behind. In addition, more and more boards
have custom IDEs associated with them, providing pre-configured device sup-
port and libraries, aimed at offering an all-around user-friendly workspace.
More versatile IDEs (i.e., those not designed for a specific development board)
allow users to explore alternative programming languages.
Each of the previously mentioned approaches has advantages and draw-
backs according to the end-user type. Some of the main differences between
low and high level coding are listed here in the following:
• Platform Dependencies
Low-level programming languages are platform-dependent, which means
that programs are written in such way they can run on the one hardware
configuration only. Instead, high-level programming languages are platform-
independent, that means programs written in such way can run on different
hardware configurations.
Remark: platform-independent does not mean operating system-
independent. Indeed, hardware configuration may change, but OS (if
present) should be the same for every new setup.
• Speed
Low-level language programs are faster than those written in high-level lan-
guage since they do not need to convert any algorithm in code executable on
the hardware. In addition, low-level languages have less syntax, functions,
keywords, and class libraries compared to other coding approaches.
• Easy Programming and Flexibility
Low-level languages are not as easy and user-friendly to manage as high-
level ones. Indeed, there are only two low-level programming languages,
which are Binary and Assembly. Binary language foresees codes made by
zeros and ones only, whereas Assembly requires some symbols knows as
mnemonics which are difficult to type. On the other hand, high-level lan-
guage programs are easy to write, read, modify, and understand. Moreover,
high-level languages have huge libraries with a rich set of functions, allowing
the development of algorithms for several applications with low effort.
• Performance
Since low-level language programs are faster than any other, their perfor-
mance are for sure better than those of high-level ones.
The C2000™ Family of MCU from Texas Instruments™ 7

• Translation
Programs written in Binary code does not need any translation as this lan-
guage is a machine code already. Namely, the hardware is capable of un-
derstanding them without any translation. Instead, Assembly codes need
an Assembler to translate programs to their equivalent counterpart in Ma-
chine Code. High-level languages are always translated by compilers or in-
terpreters. Some of them required both compilers and interpreters to get the
Object/Binary file.

• Support
Low-level languages have less support than high-level ones. There may be
lower number of communities for low-level languages than for high-level ones.

This book focuses on high-level programming languages which are user-


friendly both for students and for everyone who is approaching microcontroller
programming for the first time. In particular, coding/programming through
Simulink® is proposed in the following chapters.

1.3 The C2000™ Family of MCU from Texas


Instruments™
Texas Instruments™ (TI) offers free software development tools for
LaunchPad™ boards, such as Code Composer™ Studio (IDE) and Energia2 .
In addition, TI allows free use (limited size) of cloud-based development tools.
All these tools accept C/C++ code for programming.

Texas Instruments™ has a wide range of embedded processors from very


low-cost, limited performance up to high-cost, very high performance. Its main
product families are:

• MSP43x™ ultra-low-power microcontroller family;


• C2000™ microcontroller family;

• ARM-based microcontroller family;


• C5000™ low-power signal-processing DSPs;
• C6000™ high-perfomance signal-processing DSPs.

Among them, the C2000™ microcontroller family (also known as the


TMS320C2000™ family) is a product line aimed at high-performance control

2 Energia is a rapid prototyping platform based on Arduino IDE.


Exploring the Variety of Random
Documents with Different Content
“You would pass for the owner of rubies if you were rich enough
to back up the hypothesis.”
He twisted my stone around in his fingers; then he pointed to the
case under his hand, and set out a tray of diamonds.
He selected a table diamond as large as my false one and set
above a platinum band. I could not have told the difference.
My diamond was worth four hundred dollars. Bartoldi said there
was not a stone in the tray under five thousand dollars.
I stepped back to look at them from a little distance, about the
distance one would observe a diamond on a woman’s hand at dinner
across the table. I could not see any difference between the two
stones. They could have been interchanged, and they would have
fooled me at the distance. But they didn’t fool Bartoldi.
“Not much alike,” he said; “your stone has a sleek look.”
I did not see that. I told him I didn’t see it.
I knew that aspect of artificial stones, that appearance as if they
were pressed instead of cut. But it was the aspect of artificial stones
of a lower order than the one I had shown to Bartoldi. This one was
cut, and it looked crisp to me, very nearly as crisp as the best one.
But there is where the trained eye comes in. Walker knew it was
false, and Bartoldi knew it instantly. He could see the stratifications
with his eye.
I could see them with a good lens, but I could not see the sleek
look, and I moved toward the tray on the counter to get a close
view. I did not move directly ahead; I moved to one side—and I
discovered two persons who had come into the shop behind me.
I took up my diamond, and stood out of the way at once. I had
no wish to delay a customer. I was only idling with a laboratory
diamond, and Bartoldi had to sell jewels to keep his shop going. I
could not take up his time unless he happened to be at leisure.
The two persons who had come in at once attracted my attention.
They would have attracted the attention of anybody, even if there
had been nothing to follow. If one had chanced to observe them,
one would have stopped and considered them anywhere.
One would have been forced to think about them. They would
have stimulated one’s curiosity. No one could have passed those two
persons without undertaking to formulate some explanation; and to
me there was something more than their mere appearance.
In my mind there was a vague impression that I had seen them in
some other place. I could not at the moment remember the place; it
was what psychologists call subconscious, I suppose. At any rate it
did not crystallize into a memory. But it remained as a sort of
atmosphere behind the vivid impression they made on me.
The two persons were an old man and a girl. The two words go
together, but the two persons did not go together in any sense. The
girl was not past sixteen, and the man was past seventy. That would
be all right, an old man and his granddaughter, you would say.
But it was not all right. That was just exactly the impression that
was so cryingly conspicuous. It was not all right!
The man was very well dressed; everything about him was of the
best quality, and distinguished—perhaps just a little too
distinguished, a little too vivid. When one thought about it, one saw
that he was dressed somewhat for a younger part. There was a bit
of color, a suggestion of youth that the man did not have.
He was an old man, but he was a vigorous old man, and he had
the air and manner of wealth about him. I can’t precisely point out
these indicatory signs, but they were easily to be marked, and they
are not often successfully assumed. I suppose a clever actor could
do it. Walker used to say that the best actors were not on the stage;
they were in Joliet.
Now, that is what the man looked like—one of the idle rich, grown
old in an atmosphere of luxury. He ought to have had, as I figured
him up, a town house, a country estate, a yacht, and very nearly
every vice! His eyes, his bad mouth and his fat ears were good
evidential signs. I thought I knew the type!
The girl filled me with a sort of wonder. She wore a little cheap
hand-me-down dress that must have come from a village shop, and
it looked as though she had slept in it. She had slept in it!
The sort of crumpled-up appearance of that cheap material could
not be mistaken. She wore a straw hat lined with vivid color and
loaded with soiled artificial flowers. Her shoes were run down a bit.
She was generally soiled, as she would have been if she had traveled
in a day coach and slept in her clothes—and that is precisely what
she had done.
But all this could not obscure the fact that she was pretty, in a
sort of way. She had a pliant figure, and the charms that go along
with youth. Sleeping in one’s clothes, and the grime of a journey
can’t obscure that. She was young, and she had what youth has.
Now you understand why I said that the two together puzzled me.
Either alone would not attract a glance, and certainly not a line of
speculation. But the two together, as I have insisted, called upon you
for an explanation.
They puzzled me but they did not puzzle Bartoldi. I suppose he
understood it quicker than I. I understood it pretty quickly, just as
you have, no doubt, understood it all along, and as Bartoldi
understood it at a glance.
They came up to the glass counter, and the man asked to see a
diamond ring.
The girl did not look up. She did not say anything. She seemed to
wish to get as far as possible under the soiled hat.
Bartoldi set out some trays beside the one already on the table.
The old man moved a little to one side and the girl came quite close
to the glass counter. She bent her head down over the stones as
though she wished to see the rings and at the same time keep under
cover of the soiled hat.
She did not say a word. But she knew precisely what she wanted,
for she suddenly put out her hand and picked up the table diamond
that had lain beside my artificial stone on the glass case. She slipped
the stone on her finger and stepped back as though to be hidden a
little by the old man.
I got a surprise.
“Gad,” I said to myself, “big wages! Will he stand for it?”
Well, he did stand for it. He was a royal old sport; I will say that
for him.
Bartoldi said the price was five thousand dollars, and the old boy
never turned an eyelash. He made a careless gesture. I don’t think
he even O.K.’d the thing with a word.
He took a flat leather case out of his pocket, got out a draft,
asked Bartoldi for a pen, or rather indicated the wish for a pen with
a fiddling of his fingers, and when he got it, indorsed the draft. Then
he showed Bartoldi a letter that was in the envelope that had
contained the draft.
I followed them to the door. There was a taxicab waiting; they got
in and went up the Avenue.
That type of man ought to have a house somewhere on the
Avenue; it was August; the house would be closed; I began to put
things together.
I was standing there when Walker came up. I hailed him.
“Walker,” I said, “you got here a moment too late. You see that
taxicab?”
He made a little whimsical gesture.
“I see everything,” he said, “that the devil puts out to annoy me;
what’s in the taxicab?”
“There’s a case in it,” I said, “for the District Court of the United
States, on the criminal side, or I’m a poor detective.”
“All detectives are poor,” said Walker. “If they were rich, they
would have a town house, a country place and a string of hunters.”
“Well,” I said, “that’s what the old boy in the taxicab has got; and
he’s got something else that the United States doesn’t allow him to
take across a state line.”
Walker looked at me queerly. He put the tip of his finger to his
forehead.
“Touch of the heat?”
“Look here,” I said, “isn’t this sort of thing just as much in your
line of duty as trying to prevent the crooked cashier from boring
from within? Isn’t the United States by a fairly recent statute,
helping virtue to evade the dragon?”
Walker’s face wrinkled into a twisted smile.
“It’s helping the clever fille de joie to levy a little blackmail on the
side.”
“Wrong dope, in this instance,” I said.
I began to describe to him the incident and the two persons. I
described them carefully, minutely, and he listened without a word
and without a motion. He stood perfectly still, there in the hot street
before Bartoldi’s mammoth shop.
But his manner had changed. He had now, I noted from the very
impassive aspect of the man, a deep, a profound, a moving interest
in this affair. He cursed softly as though he chopped the words with
his teeth.
“Ten minutes too late!” he said. “Where did they go?”
Walker was motionless for a moment, his head down, his eyes
narrowed in a profound reflection.
I interrupted him with a repetition of his words.
“Ten minutes too late!” I said. “You are two minutes too late. The
taxicab has hardly disappeared in the traffic yonder.”
I pointed up the Avenue. Walker did not look up.
“I was thinking of Bartoldi,” he said. “I am ten minutes too late for
Bartoldi.”
“That’s right,” I said. “Bartoldi could have told you who this man
was. He must have known him.”
“Oh, no,” said Walker. “Bartoldi didn’t know him.”
I was astonished.
“Surely Bartoldi knew him,” I said.
Walker’s voice became a sort of drawl.
“Surely he did not know him. Bartoldi would not have been a
party to this man’s criminal adventures.”
I laughed.
“What does Bartoldi care about criminal adventures? He’s a dealer
in jewels.”
“He will care about this criminal adventure,” said Walker.
Then he looked suddenly at me.
“Where do you think they went?”
I told him what I thought. This type of person would have a
house on the Avenue; it would be closed in August.
Walker shook his head.
“I think I know where they have gone,” he said.
Again I looked at him in astonishment.
“Then you know who this man is?”
Walker replied with an abrupt query:
“Did you see the inside of his hand—the right hand? That was the
thing to see.”
“How about the girl?” I replied, for Walker’s indirections were
putting me on my mettle. “Her hand will be the thing to see; it’s got
Bartoldi’s diamond on it.”
He looked up rather vaguely.
“I am puzzled about the girl; I do not understand what the girl
has to do with it.”
I laughed.
“Bartoldi understood,” I said.
“Bartoldi!”
Walker seemed to bounce out of his reflection.
“The devil! We’ve got to get back his diamond.”
He darted suddenly out to the traffic of the Avenue, hailed a
taxicab and beckoned me to get in with him.
I got in and we went up Fifth Avenue. We were held in a jam of
vehicles a block or two farther on.
“And so,” I said, “you think the girl is a nice little country cousin,
an esteemed relative—esteemed to the tune of a five-thousand-
dollar diamond?”
Walker was fingering his face in reflection.
“Nonsense!” he said. “The girl’s no relation to him.”
“Then why the five-thousand-dollar diamond?”
“That’s what I would like to know,” said Walker.
I laughed. The thing was too absurd.
“If the wage of a sin is a five-thousand-dollar diamond, there’s got
to be the sin to earn it. That old sport was not taking any chance on
getting the value of his money.”
“O. K.,” said Walker.
“Then you think he has been paid for it?” I said.
“Surely,” said Walker, “that man has been paid for it.”
The taxicab turned out of the Avenue presently when the jam of
vehicles was released, and stopped before the Grand Central Station.
Walker paused a moment when we got down.
“If I put the thing together correctly,” he said, “they will be here.
The girl came in for her diamond.... How she earned it puzzles me....
The man had to get through with it as quickly as he could.”
He made a little gesture.
“From the station to Bartoldi’s in a taxicab and back to the first
train out—that would be his plan—to hurry.”
He added: “It was a risk, a big risk. But he had to take it. He
couldn’t trust anybody; he had to do it himself.”
I looked at Walker with what I imagined was an ironical smile.
“Then he would not be guilty under the statute,” I said, “for he
only brought the little baggage in to buy her a diamond.”
Walker seemed in a sort of reflection.
“Oh, yes,” he said, “he is guilty.”
“Then you want him?” I asked.
Walker suddenly looked at me with his eyes wide.
“Surely,” he said.
“Then why don’t you hurry?” I demanded.
He looked at me with a leisurely interest.
“If he’s here,” he said, “he can’t get out. I’ve got three of the best
agents of the Department in there—sent them up when I started to
Bartoldi’s to meet you.”
“But how would they know him?” I asked.
“They would know him by a scar in his hand,” replied Walker.
“They ought to know him by a girl on his arm,” I said.
Walker’s voice became reflective.
“I wonder if she could be his granddaughter, after all!”
I laughed. That laugh was like the key to a memory. I at once
remembered where I had seen this man and the girl.
It was at the end of the path that follows the sea south at Bar
Harbor. There is a great house where the path ends. It was closed;
the shutters were up, and the grounds only casually kept; I
remembered it now. I had undertaken one afternoon to get through
from this sea-path to the village street, and had wandered into an
immense sunken garden. I was making no sound.
The grass and leaves had covered the paths; it was very still, and
presently I heard the murmur of voices. I wondered who could be
here, for as I have said, the place was closed, and I was discovering
that there was no way through to the village street. I went forward a
few steps, and beyond me, standing in an angle of the garden,
obscured by an immense flowering vine, were this old man and this
girl.
I remembered the scene perfectly, now that I had the key to it.
The old man was speaking in a low voice, as though he urged
something, offered something, and the girl was listening in the
attitude in which I had observed her this afternoon, her head down,
her arms hanging. I had gone out quietly; I remember the
explanation that presented itself. The old man must be the owner of
the place, and the girl a keeper’s daughter, perhaps. The memory
bore out my impression, the impression which I received to-day and
the impression which had evidently convinced Bartoldi.
I told it all to Walker, very carefully and in detail, as we went into
the great lobby and down to the train exits. Walker caught my arm
in his big hand.
“That explains it,” he commented.
Then he stopped abruptly.
“By the way,” he said, as though it had just occurred to him and
he had now leisure to think about it, “let me have a look at that
artificial diamond.”
I took the piece of tissue paper out of my waistcoat pocket and
handed it to him. He unfolded the paper, took the diamond out and
retained it in his hand. We crossed through the throngs of people
everywhere grouped about in the great station, to the exit indicating
the evening train to Bar Harbor. We entered the little group, and I
realized suddenly that we were close behind the old man and the
girl. They were facing toward the gate.
Suddenly Walker opened his hand and dropped my diamond to
the floor. It clattered at the feet of the girl, and Walker stooped
swiftly and picked it up.
“Your daughter,” he said, speaking to the old man, “has dropped
the setting out of her ring; permit me to return it.”
The man turned instantly like a trapped animal. For a moment
both of his hands went into the pockets of his coat, and for an
instant his face was uncertain, vague, deadly; then he put out his
hand for the diamond.
Walker gave it to him and turned to me.
“Perhaps,” he said, “we had better see if the trunks got on. We
have nearly ten minutes to wait.”
And he walked away toward the great stair leading to the
baggage room.
The girl did not move; she did not speak; she remained as she
had stood in Bartoldi’s shop, her head down, concealed as far as she
was able to conceal it, under the drooping hat loaded with soiled
roses. Walker was crossing toward the great stair in his long stride
and I hurrying in my astonishment to overtake him.
“The devil, man!” I cried when I came up. “Why did you give him
my diamond?”
“I wanted to see if there was a scar in his hand,” said Walker. “He
had it.”
“Then you know him?”
“Surely,” said Walker.
“Aren’t you going to arrest him?”
Walker had returned to his careless manner.
“No,” he said, “I am not going to arrest him. You saw his hands go
into his pockets. There would have been a lot of people killed if it
hadn’t been for your diamond. It’s lucky I thought of it; besides, I
had to see the inside of his hand.”
“But my diamond,” I said, “when will I get it?”
Walker continued in his leisurely drawl:
“You will get your diamond when Bartoldi gets his.”
“When will that be?” I insisted.
“Right now,” replied Walker.
Then he paused in his stride, took off his hat and extended it for a
moment above his head like a tired person who would relax from the
fatigue of travel.
Immediately three persons, two men and a woman between
them, carrying bags, coats and the usual articles of travel, came out
from the crowd pouring into the station from the street and crossed
hurriedly into the group waiting at the entrance for the Bar Harbor
train.
Then a dramatic thing happened.
I could see the old man clearly; he was watching Walker out of
the tail of his eye, and he kept his hands in his pockets, but he was
not watching the three persons who came into the group as though
seeking the train for which he was bound; and as they passed,
quicker than the eye, the man’s hands were seized, dragged out of
his pockets and snapped into handcuffs. The pistols gripped in his
hands were swept out; they fell to the floor.
“The devil!” I cried. “The old boy is the most dangerous Lothario I
ever saw.”
Walker replied in his leisurely drawl:
“He’s the most dangerous bank swindler you ever saw.”

The girl had been questioned, and the thing was now clear.
Walker explained it all on the way to Bartoldi’s in a taxicab. I had my
diamond in my pocket, and Walker had Bartoldi’s to exchange for the
forged draft. The old man was Vronsky, the most notorious forger in
the world. He had bribed this girl, the janitress of the Empire Bank
at Bar Harbor, to steal a book of blank drafts and some sheets of
stationery. It was easy to do; the book of blanks was lying on the
bookkeeper’s desk in the package as it had come from the printer,
and the stationery had never been locked up.
With the blanks bearing the secret water mark of the bank,
Vronsky was able to forge drafts on New York and place them,
establishing his identity by a letter from the bank officials on this
stationery, in which they said they were sending him the draft which
he intended to pay out, and giving its amount and number.
“It was a clever scheme,” Walker added. “The secret water mark
on the draft blanks would show that they were genuine—that’s what
convinced Bartoldi; and the forged letter would show the identity of
the man who undertook to place it. The forgery gave Vronsky no
trouble; the problem was how to get the blanks and letter paper.”
“And he got them with a diamond,” I said.
Walker’s drawl lengthened.
“Precisely as we got him.”
And so this adventure opened with a diamond and closed with the
arrest of one of the worst criminals in the world. What was it I wrote
in the opening paragraph of this case? Go back and read it.
CHAPTER VIII
The Expert Detective

Walker kept two dog-eared magazines in a pigeonhole of his desk,


with a story marked in each. He kept them, he said, to reduce
enthusiasm, as a doctor keeps a drug to reduce a fever. They were
handed, with the regularity of a habit, to two types of visitors who
annoyed him: those persons who volubly admired the professional
detective; and that other class who assured him that the inspired
amateur, as, for example, some local prosecutor in a criminal case,
could outwit the acutest counselors of darkness.
I include the two stories in their instructive order.

The State had completed its case.


The conviction of the prisoners seemed beyond question.
Incident by incident, the expert detective, Barkman, had coupled
up the circumstantial evidence until it seemed to link the prisoners
inevitably to the crime. He was a big man, with eyes blue like a
piece of crockery, a wide face and a cruel, irregular jaw. One felt
that no sentiment restrained him; that he would carry out any
undertaking to its desperate end.
He sat now in the witness chair. He was the last witness for the
State, and, now that the case was complete, he had been turned
over for cross-examination.
It was afternoon. A sheet of sunlight entering through open
windows lay on the court room. It was a court room of a little city in
the South; a city but newly awakened to industrial activities, and the
conduct of its administration of justice still adhered to older and
more deliberate forms.
The court room was crowded with people down to the very railing
that separated the attorneys’ tables from the crowd.
The judge, a tall man, with a long, mild, unhealthy face, sat on
the bench. To the right of him and a step below was the clerk. The
jury were in chairs along the wall to the left of the bench. And
between the bench and jurors sat the witness.
The prosecuting attorney was before his table, a little to the right
of the first step to the bench. There were law books on his table,
and two polka-dot handkerchiefs lying loosely on some papers. The
man was no longer concerned with these articles. He sat back from
the table, his fingers linked together, his face lifted as in some
reflection.
Farther to the right, in two chairs against the railing, were the
prisoners. One, a big old man with a splotched, dissipated face and
his hair cropped close to his skull. Folds of fat lay along the base of
his neck, partly concealed by a white silk handkerchief held in place
under his chin by a long old-fashioned garnet pin. His companion
was a little, thin, fox-faced man who moved nervously in his chair.
The most striking figure in the court room was the attorney for
the prisoners.
He sat between them, a chair’s width in advance, before his table.
There was nothing whatever on this table except an ink pot, two
pens and a big blotting sheet. There was also a thick pad of foolscap
paper provided for the convenience of the attorney in taking any
note of the testimony, but there was no word written on it.
The lawyer was a huge bulk of a man. He sat relaxed in his chair.
His thick, black hair was brushed smoothly. It was of an oily, glossy
blackness. His big, thick features were putty-colored, as though the
man’s skin had no vitality. His eyes were very nearly closed; his
mouth sagged open, the thick lips holding a cigar that was not
lighted.
Every detail of his dress was immaculate and arranged with
extreme care.
The man was perhaps sixty, but, in the big relaxed body and
heavy face, age was indefinite. He now took the cigar out of his
mouth and laid it down on the table. He moved like one coming out
of a dream.
He had not immediately taken charge of the witness when the
prosecutor had released him for examination. But now, finally, at the
judge’s words, “Proceed, Colonel,” he at last looked up.
“You are an expert detective, Mr. Barkman.”
The voice had a strange dwindling whine as though it came from
some cavernous depth in the man’s immense body.
The witness looked about with a vague smile. “Well, Colonel,” he
said, “I have had some experience.”
“You have had a great deal of experience. You were Chief of
Police, then you set up a detective agency. You have had a lot of
experience in criminal investigation. And you have usually been
right.”
This was generous treatment when the reverse was indicated.
The detective was not conspicuous for the confidence of the
community in a profession too often subject to cloud. His
employment in the bank affairs had followed from his intimate
association with Halloway, an association, as all knew, resulting from
the handling of a questionable matter in the banker’s private life.
The bank did not require a retained detective.
Was this man’s sinecure gratitude in the banker, or a sort of
blackmail? Here was material with which a reflection on the witness
could have been assembled. But the attorney chose rather to admit
the man’s superior mental acumen in criminal affairs.
The witness moved in his chair. “Well, Colonel,” he said, “I try to
be right.”
“And you have nearly always been right,” continued the attorney.
“In the Deal case you maintained that the decedent had not been
killed by a bullet fired from a cellar grating at a hundred yards along
the street east of the man’s window, and it was afterward shown
that the trajectory of a bullet fired from that point would have
crashed into an electric light midway of the distance. And in the
Littlewood case, you said the evidences of a struggle were
manufactured, because the slant of wood fibers in the broken
window sash showed that the pressure had been exerted from
within the room and not from without.”
The voice ascended into a lighter drawl with a facetious note in it.
“You have had a lot of experience, and you have had a lot of
work, but you have not got rich at it. You would like to be rich,
wouldn’t you?”
The witness laughed. “I suppose everybody would like to be rich,
Colonel.”
The attorney smiled, a big, loose, vacuous sort of smile.
“Old Bill,” he said, “here behind me, and Lyin’ Louie would like to
be rich, but they are more likely to be hanged.” He laughed again.
“You are not afraid of being hanged, Mr. Barkman?”
Everybody laughed. The eccentricities of this attorney were one of
the attractions of the court room. They were good-naturedly
overlooked by the officers of the court, who had been associated
with the man for a lifetime in an old-fashioned civilization, leisurely
and considerate.
The attorney made a gesture as of one putting by a pleasantry of
the moment.
“This was a very ingeniously constructed crime?”
The witness was now in an excellent humor. “I’d say it was,
Colonel,” he replied. “It was slick enough to fool me.”
“Ah!” The attorney continued. “I had forgotten that. It was your
theory in the beginning that the president of the Trader’s Bank, Mr.
Halloway, had accomplished the robbery himself, and, afterward,
dropped dead in his own house. He lay on the floor, when the body
was discovered, by the side of the library table. It was thought that
in falling his head had struck the heavy carved foot of the table,
causing the injury to the skull that resulted in death. The physicians
first called in were inclined to agree with that theory. The immense
strain of a criminal adventure might have caused the accident after
the man had returned to his house. Emotional cataclysms have been
known to bring on attacks of acute indigestion or the rupture of a
defective heart.”
“Sure, Colonel,” the witness assented, “that’s what the thing
looked like; and I was fooled about it; I admit it. There was no
evidence of a struggle in the room. It was only after Doctor North
said the man had been killed by a blow, probably with the poker,
that I got onto the right track.”
The attorney made a drawling assent.
“Yes,” he said, “that was a bad find.”
His voice went again into a strange laugh.
“It was mighty near a hangin’ find for Old Bill and Lyin’ Louie! You
got on better then, Mr. Barkman. You found two polka-dot
handkerchiefs that had been stuffed down into a vase in the library,
and then you found Old Bill and Lyin’ Louie. Now you are goin’ to
hang ’em, I reckon.”
There was a suppressed giggle in the court room. It was not
shared by the prisoners.
The big, old man of the close-cropped skull plucked the attorney
by the sleeve and spoke in an audible whisper.
“Looka here, Colonel,” he said, “I thought you was defendin’ us.”
The attorney replied, a higher note in his deep drawl.
“Yes,” he said, “that’s what I am doing. But you’ve got no sense,
Bill! You never had any sense. If you had had any sense you would
not have been in the pen-i-ten-tia-ry house. There was no reason for
you going to the pen-i-ten-tia-ry. Old Lansky tried to make a bank-
cracker out of you—I was in the cell with him on the night he was
hanged—he said you had no sense. He said you would never make
anything but a fence, and a damned poor fence ... that’s what he
said, Bill.”
He interrupted the long narrative by getting ponderously on his
feet. He reached out and took the two handkerchiefs from the table
of the prosecuting attorney and laid them down on his own.
Then he addressed the witness.
“Now, Mr. Barkman,” he said, “I’d like you to tell us precisely what
you think happened on the night of the twenty-seventh. I want you
to reconstruct this crime for us. I want you to show us just how Old
Bill and Lyin’ Louie went about this thing.”
The witness moved as though rearranging himself in his chair. He
shifted his shoulder a little to one side and he looked around toward
the jury.
“Well, Colonel,” he said, “I think I can tell you just exactly what
happened.”
He was not expecting to be interrupted. But he was interrupted by
a sort of explosive assent.
The big attorney was looking at him, resting his huge body on
both hands, on the table. The witness was for a moment
disconcerted, then he went on:
“It was like this,” he said, “as I figure it out. Everybody knows that
Old Bill was a bank-cracker.”
Again there was a sort of booming interruption.
“He was never a good bank-cracker,” the lawyer exploded; “he
was a poor bank-cracker. He was such a damn poor bank-cracker
that he got into the pen-i-ten-tia-ry house!”
The witness laughed.
“Anyway, Colonel,” he said, “when Louie drifted in here, the two of
them fixed up this game and they carried it out slick.”
Again the lawyer introduced an interruption.
“Now, that is just what I am anxious to know, Mr. Barkman. I am
anxious to know precisely what they did and how they did it. I want
to know, in detail, everything that happened that night.”
“Well,” replied the witness, “this is the way I figure it out, Colonel,
and I think it’s straight dope: these men fixed up their plan and
Louie hung around until he found that the bank president was alone
in his house. That was the night his family went to the Springs. It
was in the newspapers. Everybody knew it. Then about midnight
they went up to Mr. Halloway’s house.”
“And how did they get into the house?” inquired the lawyer.
“That was no trouble,” said the witness. “They rang the bell. They
wanted Mr. Halloway to come down just as he did come down, with
his dressing gown on, like he was found dead in the library.”
The attorney had changed his posture. He was idly fingering the
two polka-dot handkerchiefs.
The witness went on:
“When Mr. Halloway opened the door, one of these crooks
jammed a pistol against him. They shut the door and marched him
into the library. And there they told him what they were going to do.
They held him up, right there in the library, and forced him to give
them the combination to the bank safe.”
“And how were they to know,” inquired the attorney, “that the
combination which the banker gave them was the correct one?
Would not his impulse be—would not any one’s impulse be—to give
an incorrect combination of figures?”
The witness laughed.
“Old Bill would know the trick,” he said. “They would ask the
banker to give the combination. They would write it down as he
gave it; then they would wait a little while and ask him again, and if
he had made it up, he would not be able to remember. That’s an old
trick. It was done in the North Hampton bank robbery, where they
burned the cashier’s feet for lying.”
The big attorney swung around toward his clients.
“Did you ever hear of that, Bill?”
“No,” said the prisoner, “I never did.”
Again the attorney laughed that vague, futile laugh.
“I believe you, Bill,” he said, “although nobody else does—I’m paid
to believe you.”
He turned back to the witness.
“What happened then?”
The big prisoner with the folded white handkerchief for a cravat
was mumbling incoherently.
The attorney paid no attention.
He looked at the witness. “Go on, Mr. Barkman,” he said. “What
did they do next?”
“Well,” said the witness, “when they had got the correct
combination written down, they put a gun against Mr. Halloway and
made him go over to the telephone. They made him call up the
watchman at the bank and tell him just what he has sworn here Mr.
Halloway told him that night: that his child was sick and the doctor
wanted him to come right home. Mr. Halloway had to say just what
they told him to say, because there they stood with a gun against
him. They could hear every word he said. The bank watchman asked
him what he could do about leaving the bank, and they made Mr.
Halloway say to him over the telephone, to go ahead out to his
house at once and that he himself would drive over in his car and
stay in the bank until the watchman got back; then they hung up the
receiver.”
The lawyer put a query:
“How do you suppose they were standing while Mr. Halloway was
calling the bank?”
The witness got up.
“Mr. Halloway was of course facing the telephone and the man
with the gun was standing behind him with the muzzle jammed
against his back. That would be the way they would be standing.”
He was about to sit down, but the lawyer interrupted him:
“Just a minute.”
He turned to the prisoner sitting on his left.
“Louie,” he said, “I want you to go over to Mr. Barkman and show
us just how you were holding that pistol against the banker’s back
while he was talking over the telephone. We’ll say Mr. Barkman’s the
banker.”
Everybody in the court room was astonished at this slip of the
attorney.
It would appear that he, like every one else, was convinced of the
guilt of the prisoners, and that this conviction had thus
unconsciously appeared in his words.
The man seemed not to realize what he had said. But the prisoner
saw it at once.
“Colonel,” he objected, “how can I show him how it was done
when I didn’t do it?”
The attorney made an exasperated gesture.
“Oh, Louie,” he said, “you are such a liar that nobody believes
anything you say. Do what I tell you.”
Then he stooped over the prisoner.
“Just a moment, Judge,” he explained; “I have got to encourage
my client.”
He whispered something in the man’s ear.
The prisoner rose and went over to the witness; he took him by
the shoulders and turned him around toward the judge, so that his
back was to the jury. He moved him until he got him in precisely the
position which he wished and then he thrust his long forefinger in
the man’s back, with the other fingers doubled up.
“How’s that, Colonel?” he said.
“Well,” said the attorney, “what do you think about it, Louie? Do
you think it’s O.K.?”
“Sure,” said the prisoner.
Then he came back and sat down in the chair.
The whole court room was amused and astonished. It was as
good as a theater.
The attorney returned to his examination of the witness.
“Proceed, Mr. Barkman,” he said. “What did they do next? Did
they make Mr. Halloway go over to the bank? His car was seen there
and he was, himself, seen going in, by some persons passing at the
end of the street. He was alone. How did they make him go over
there alone, accomplish the robbery, and come back to his house?”
Again the witness smiled shrewdly.
“They didn’t make him do it,” he said. “Old Bill there, he’s about
the size of Mr. Halloway.”
He turned about to the jurors.
“Mr. Halloway was a man, as you all know, about as big as I am.
Old Bill put on the banker’s hat and his long light overcoat. The
runabout stood under the porte-cochère outside. He went out, got in
this car and drove it over to the bank. He had the banker’s key to
the door and he had the combination to the safe, so he went in,
opened the safe, picked out the money and brought it back with
him.”
The attorney suddenly interrupted.
“Now, there,” he said, “right there. Why did they take only big bills
and not smaller currency? There were twenty thousand dollars taken
in big bills—five-hundred and one-thousand-dollar bills. Why did they
take that and not the smaller currency?”
“I can explain that,” said the witness. “You see they had to hide
this money after they got it—they had to look out for that; they
might have to move pretty quickly. They could not trust anybody to
keep it for them and they were afraid to conceal it, so they would
have to carry it around with them. That’s the reason they took big
bills.”
“Ah,” said the attorney, “I understand it now. It puzzled me a lot. I
could not see what they meant by taking big bills and leaving the
rest of the money; but it’s clear now.”
He swung suddenly around to the prisoners. “Louie,” he said, “you
never told me that.”
The creature grinned, his face broken into a queer extended
smile.
But the big prisoner to the right showed evidence of no such
conciliatory mood.
He got up.
“Judge,” he said, “we’re bein’ double crossed. I paid the Colonel,
here, a hundred dollars in honest money to defend us, and just look
what he’s doin’ to us.”
Everybody laughed.
The lawyer turned about and spoke to the man as he might have
spoken to an impertinent child.
“Sit down, Bill,” he said. “Louie knows that I am making a proper
defense, don’t you, Louie?”
The little fox-faced man continued to grin. But he said nothing.
“Now, Bill,” the lawyer went on gently as to a child, “Louie’s got
some sense; not much. He learned how to open registered
envelopes, when he started in to be a mail clerk, by watching the
post-office inspectors rolling a pen handle under the flap; and he
learned to feel for money in the envelope before he opened it. The
post-office inspectors taught him that. Louie had sense enough to
learn it. He learned it well. He can tell the feel of a bill through the
thickest envelope that was ever mailed. But you are a fool, Bill;
Lansky told me that. Nobody but a fool, after he robbed the
Norristown bank, would have hidden the money in the loft of an
abandoned schoolhouse, with a trail of cinders leading from the
window up to the trap in the ceiling. Anybody but a fool would have
wiped his feet off before he climbed in the window.”
The whole court room was convulsed with laughter; even the
judge smiled.
Nothing could have been more of the essence of comedy than
these passages between the attorney and his client.
The big lawyer turned again to the witness. “Now, Mr. Barkman,”
he said, “what did they do when Bill got back with the money?”
“They finished the job,” replied the witness.
“Well,” said the attorney, “what did they do?”
“It is clear what they did,” replied the detective; “they killed Mr.
Halloway with the fire poker, then they hid the two handkerchiefs
they had over their faces when they came in, and then they got out
of town.”
The witness sat back in his chair as though he had finished with
his testimony.
The big attorney stood up. The whole aspect of the man, as by
the snap of a switch, had undergone a transformation. The huge
bulk of him was vital. His heavy slack face was firm.
“Mr. Barkman,” he said, “why did the men who killed Hiram
Halloway wear no masks on their faces?”
“They did wear masks on their faces—they’re on the table before
you.”
The lawyer did not look down at the articles before him. His voice
was now hard and accurate like the point of a steel tool.
“Take it as a hypothetical question then. Suppose they wore no
masks. What would that fact indicate?”
The attorney for the State rose.
“I object,” he said. “There must be evidence in the case tending
to support the assumed facts in a hypothetical question.”
“The evidence shall be presently indicated,” replied the lawyer.
The judge passed on the objection at once.
“The Colonel promises to point out the evidence later. He may go
on; the witness has been introduced as an expert.”
The lawyer again faced the man in the chair. He repeated his
question.
The witness seemed doubtful.
“I don’t know,” he said.
“You don’t know! Reflect, Mr. Barkman. Would it not mean that
the person or persons who accomplished this criminal act felt that
they were so well known to Hiram Halloway that no ordinary
disguise could conceal their identity?”
The witness did not immediately reply, and the lawyer went on:
“And is not this the reason why Hiram Halloway was killed?”
“Why he was killed!” repeated the man in the chair.
“Yes, precisely the reason. One must credit even a common thief
with some intelligence. No one uselessly adds the crime of murder to
a lesser crime. Masked assassins wholly unknown to the decedent
would have gagged and bound him. It would have answered their
purpose as well. But not the purpose of a known, unmasked
assassin. Safety for him lay only in the banker’s death.”
The attorney added:
“That death was so unavoidably necessary—to cover the identity
of the assassin—that the evidences of an accidental death were
arranged with elaborate care. Is it not true?”
The witness had been twisting his feet about; his face uncertain.
Now it took on a dogged look.
“It’s true that the thing was a slick job.”
The attorney took one step toward the witness. “Now, Mr.
Barkman,” he said, “can you tell me why assassins who had so
carefully staged this tragedy to appear accidental should leave
behind them two handkerchiefs, with eye-holes cut in them, thrust
carelessly into a vase on a table? They might be found, and that
discovery would, at once, negative the theory of accidental death.”
“They wanted to get rid of the masks.”
“But if they wore no masks? Is it not inconceivable that they
would have placed them there to jeopardize all that they had so
carefully planned?”
The witness was watching the attorney, the dogged look
deepening in his face.
“If they didn’t wear masks, of course they wouldn’t have put them
there—it would have been a fool thing.”
The attorney moved out closer to the witness. The point, as one
might say, of his voice seemed to sharpen.
“Now, Mr. Barkman, if these masks were not put into the vase on
the table by the assassins, then they were put there by somebody
else; and if they were not put there on the night of the robbery, they
were put there later; and if they were put there by some one later, it
was one who had access to the house later; and if they were put
there by one having access to the house after it was established the
banker did not die from a natural cause, then they were put there to
deceive.”
He paused, and his final sentence descended like a hammer:
“And the deception in presenting false evidence of two men would
consist in the fact that but one man had, in fact, accomplished the
crime.”
The prosecuting attorney was on his feet.
“Your honor,” he said, “this is all built up on the theory that the
assassins did not wear masks. There is no evidence to support such
a theory. The handkerchiefs that the assassins took off of their faces
and hid in the vase are here in the case for everybody to see.”
The attorney for the prisoners put out his hand and took up the
two polka-dot handkerchiefs which were lying on the table before
him.
“It is the cleverest criminal,” he said, “who always makes the most
striking blunder. The accomplished assassin of Lord William Russell
carried away the knife with which his victim was supposed to have
cut his own throat. When the human intelligence, set on murder,
undertakes to falsify the order of events, the absurdity of its error
increases with its cunning.”
He shook the two handkerchiefs out and stretched them in his
fingers.
“They are here for everybody to see,” he echoed, “and if
everybody will look, he will see that these two handkerchiefs were
never tied around the faces of assassins; he will see—everybody—
that, while these handkerchiefs have eye-holes cut in them, the
corners of them are as smooth and uncreased as though they had
been ironed; if they had been tied around the faces of assassins,
they would show the strain and the fold of the knot!”
He turned now toward the judge.
“Your Honor,” he said, “the elaborate ingenuity of this whole
criminal plan is utterly beyond the feeble intelligence of these
prisoners. It is the work of some competent person; some person
well known to the decedent; some person who knew a disguise to
be useless; some one who had access to the house and was able to
set up the evidence of a second theory after the first had failed—
such an one was the assassin of Hiram Halloway.”
There was absolute silence in the court room. The witness sat
gripping the arms of his chair, his face distended as with some
physical pressure.
The big attorney, at the end of his significant pause, added a final
sentence:
“And now, that we have found the money, we can name the
man!”
The prosecuting attorney, utterly astonished, put the question, the
answer to which the whole court room awaited:
“Found the money! Where?”
The big lawyer sat down in his chair; his huge body relaxed; his
face assumed its vague placidity and his voice descended into its old,
deep-seated, dwindling whine:
“It’s sewed up in the lining of Mr. Barkman’s coat. Lyin’ Louie felt it
when he posed him for the jury.”
CHAPTER IX
The “Mysterious Stranger” Defense

“Now, Ellen,” said the attorney, “I want you to tell us precisely


why you called to me when you ran out of the house—why you said,
‘Save me, Colonel.’”
“I was scared,” replied the witness. “I didn’t know what was going
to happen to me.”
“You thought the same thing that had happened to the lawyer, Mr.
Collander, might also happen to you.”
“I don’t know, Colonel. I was scared.”
It was the third day of the criminal trial. Colonel Armant had put
the prisoner on the stand in her own defense. It seemed a desperate
hazard. A woman remains an experiment as a witness. The old
experts about the court room were pretty nearly a unit against the
experiment in this case. The prisoner was too much of an enigma;
one of those little, faded, blonde women, with a placid, inscrutable
face—capable of everything or of nothing, as one chose to assume
it.
The big attorney went on.
“You did know that something had happened to Mr. Collander?”
“I heard the shots—yes, I knew something had happened to him.”
“Just a moment, on this feature,” continued the attorney. “You do
not agree with the chief of police about the number of shots fired;
you thought there were three shots; one, and then two together, or
almost together?”
The prosecuting attorney interrupted.
“If you are going to lead the witness, Colonel,” he said, “why don’t
you lead her to some purpose? Why don’t you lead her to say there
was only one shot?”
The huge counsel for the prisoner put out his hand toward the
speaker, in the gesture of one who brushes aside a disturbing fly, but
he did not otherwise move in his chair. His whole body was in
repose. He spoke without moving a muscle.
“Now, Ellen,” he said, “the prosecuting attorney makes it a point
against you that you were expecting something to happen. What do
you say about that? You don’t deny it, do you?”
“Well, Colonel,” replied the witness, “I thought something might
happen to Mr. Collander. I thought it all along.”
“Then you did expect it?”
“Yes,” replied the witness, “I suppose you could say I did expect
it.”
The attorney rose.
“That brings us to another point made against you.”
He took up a weapon lying on the table before him. It was a
thirty-two-caliber cylinder revolver of the usual type.
“You can identify this weapon?” the attorney asked.
“It is the revolver that Mr. Collander kept in his bedroom.”
“Now, Ellen,” said the attorney, “the State has introduced
testimony to show that you took this pistol to the gunsmith, Mr.
Parks, and had him clean it and load it for you. That was on
Tuesday, a week before Mr. Collander’s death. The prosecuting
attorney calls on me to explain that incident on some theory, if I
can, which will be inconsistent with his theory that you thereby
provided yourself with a weapon in order to kill Mr. Collander.” He
paused. “We are not concerned with anybody’s theory, Ellen, but
what is the truth about it?”
“I was afraid, Colonel, just as I have said. I thought there ought
to be a pistol in the house that would shoot.”
The attorney paused a moment as in reflection; then he went on.
“That’s the second point the State makes against you. There is
still another; let us get them all together so we can tell the jury
precisely what they mean. The prosecuting attorney has shown,
here, by a number of witnesses, that you sometimes threatened the
lawyer, Mr. Collander; that you have been known to quarrel with him,
and that you have more than once said you would kill him. Now,
isn’t that true?”
The witness hesitated a moment. She looked vaguely about the
court room; presently her eyes rested on the floor.
“Yes,” she said, “it’s all true; but I was not the only person who
wanted to kill him.” She hesitated. “What I said was talk—just talk;
the other people who wanted to kill him meant it.”
The big attorney lifted his body with a little gesture.
“The fact is, Ellen, that you were always fond of him.”
The witness continued to look down at the floor.
“Yes,” she said, “too fond of him, Colonel.”
The attorney seemed to draw his big body together. He stood up
before his table.
“Now,” he went on, “let us get all the bad features of this case
together. You say other persons wished this man’s death. What
makes you say that, Ellen?”
“Well, Colonel,” replied the witness, “that’s pretty hard for me to
answer. Everybody knows that Mr. Collander had a lot of enemies, a
lot of people didn’t like him; a lot of people who had just as much
reason to threaten to kill him as I had, and they must have meant it
when I didn’t mean it.”
“Ellen,” said the attorney, “let us try to be a little more precise
about this. You say that there were persons who wished to kill the
lawyer, Collander; that you thought he was in danger, and that you
had this weapon cleaned and loaded so he would have some means
of defending himself.”
The prosecuting attorney interrupted.
“Just a moment, Colonel,” he said. “The witness hasn’t said
anything of the sort.”
The attorney made an irrelevant gesture.
“Perhaps not entirely in those words,” he said, “but it is the
substance and intent of the answers. I shall permit her to reply for
herself. What do you say about that, Ellen?”
The witness answered at once.
“That’s it,” she said, “that’s exactly it. I thought Mr. Collander was
in danger of being killed, and I thought he ought to have a pistol
that was loaded and would shoot. That’s why I took it to Mr. Parks.”
The big attorney nodded in assent.
“Now, what made you think that the decedent was in danger of
his life? You must have had some reason for it?”
“Well,” said the witness, “people were always coming to see Mr.
Collander. I have often heard him in a quarrel with people who came
in to see him. His study opens out on the porch; they sometimes
came to the porch and knocked on the door.”
“They didn’t always knock on the door, did they?” inquired the
attorney. “Sometimes they called him?”
The witness looked at the lawyer as though she did not precisely
follow his question.
“Yes,” she said, “sometimes they called him.”
“And then they would be standing down on the ground,”
continued the attorney. “The porch before the door is narrow; that
would put them below Mr. Collander if he were standing in the door.”
“Yes, sir,” said the witness, “the ground is lower than the porch;
anybody standing on the ground would be below Mr. Collander.”
Again the prosecuting attorney interrupted.
“What’s that go to do with it?” he said. “Are you going to drag in
the ‘mysterious stranger’ defense?”
The big lawyer swung around on his feet.
“Your Honor,” he said, addressing the judge, “I object to this
expression. It is an unfair expression. It has no place in a judicial
trial of which the sole object is to arrive at the truth. The
prosecuting attorney has no right to undertake to prejudice the
prisoner before the jury. That is an ungenerous expression. If the
prisoner did not kill Mr. Collander, some one else did kill him, and if
we don’t know, precisely, who that other person was we cannot
dismiss him as mythical, as a ‘mysterious stranger,’ as though he
were a figment of the imagination.”
The judge did not reply. He was accustomed to these passages
between the attorneys, staged always for effect, and he took no part
in them if he could avoid it.
The prosecuting attorney replied with ill-concealed irony.
“If the prisoner did not kill him!” he echoed.
“Quite so,” replied the Colonel, “and for your benefit, sir, I will say
that I propose to show, in a moment, that she not only did not kill
him, but that she could not have killed him.”
The prosecuting attorney made a vague gesture in the air with his
extended fingers. The aspect of irony remained.
“Go to it,” he said.
“Now, Ellen,” continued the attorney, “what made you think there
was some one outside of the house on the ground below the porch
who called Mr. Collander to the door?”
The prosecuting attorney was on his feet before the sentence was
ended.
“Your Honor,” he said, “this thing is ridiculous. Colonel Armant has
started in at the end of this case to set up one of the old stock
defenses. Your Honor knows ’em; everybody knows ’em; they are
the last resort of the guilty; the ‘alibi’ and the ‘mysterious stranger.’
He could not use the alibi because everybody saw this woman on
the spot. Not even Colonel Armant with all his acuteness could get in
an alibi. As it happened, Robert McNagel, the chief of police, was out
at the engine house just below Collander’s residence. Colonel
Armant was there; they were sitting in the engine house when they
heard the shots. McNagel ran with the Colonel to Collander’s house;
they were the first persons on the ground. McNagel was there when
the woman ran out of the house and when she shouted, ‘Save me,
Colonel.’ He went after her and brought her back, so the alibi had to
be given up. The only thing left is the ‘mysterious stranger.’”
The prosecuting attorney laughed.
“Colonel Armant has to get something to make a defense out of.
We have shown that this woman had a motive for killing Collander. It
is the oldest motive in the world. She lived there as housekeeper. I
don’t say that other persons did not want to kill him. I have not

You might also like