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

[Ebooks PDF] download Science and Engineering Projects Using the Arduino and Raspberry Pi: Explore STEM Concepts with Microcomputers 1st Edition Paul Bradt full chapters

Science

Uploaded by

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

[Ebooks PDF] download Science and Engineering Projects Using the Arduino and Raspberry Pi: Explore STEM Concepts with Microcomputers 1st Edition Paul Bradt full chapters

Science

Uploaded by

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

Experience Seamless Full Ebook Downloads for Every Genre at textbookfull.

com

Science and Engineering Projects Using the Arduino


and Raspberry Pi: Explore STEM Concepts with
Microcomputers 1st Edition Paul Bradt

https://textbookfull.com/product/science-and-engineering-
projects-using-the-arduino-and-raspberry-pi-explore-stem-
concepts-with-microcomputers-1st-edition-paul-bradt-2/

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Science and Engineering Projects Using the Arduino and


Raspberry Pi: Explore STEM Concepts with Microcomputers
1st Edition Paul Bradt
https://textbookfull.com/product/science-and-engineering-projects-
using-the-arduino-and-raspberry-pi-explore-stem-concepts-with-
microcomputers-1st-edition-paul-bradt-2/
textboxfull.com

Beginning Robotics with Raspberry Pi and Arduino: Using


Python and OpenCV Jeff Cicolani

https://textbookfull.com/product/beginning-robotics-with-raspberry-pi-
and-arduino-using-python-and-opencv-jeff-cicolani/

textboxfull.com

Beginning Robotics with Raspberry Pi and Arduino: Using


Python and OpenCV 2nd Edition Jeff Cicolani

https://textbookfull.com/product/beginning-robotics-with-raspberry-pi-
and-arduino-using-python-and-opencv-2nd-edition-jeff-cicolani/

textboxfull.com

Beginning Robotics with Raspberry Pi and Arduino: Using


Python and OpenCV 2nd Edition Jeff Cicolani

https://textbookfull.com/product/beginning-robotics-with-raspberry-pi-
and-arduino-using-python-and-opencv-2nd-edition-jeff-cicolani-2/

textboxfull.com
Internet of Things with Raspberry Pi and Arduino 1st
Edition Rajesh Singh (Author)

https://textbookfull.com/product/internet-of-things-with-raspberry-pi-
and-arduino-1st-edition-rajesh-singh-author/

textboxfull.com

Action movement light and sound with Arduino and Raspberry


Pi First Edition Monk

https://textbookfull.com/product/action-movement-light-and-sound-with-
arduino-and-raspberry-pi-first-edition-monk/

textboxfull.com

Internet Of things With Raspberry Pi And Arduino First


Edition. Edition Rajesh Singh

https://textbookfull.com/product/internet-of-things-with-raspberry-pi-
and-arduino-first-edition-edition-rajesh-singh/

textboxfull.com

Raspberry Pi Home Automation with Arduino 2nd Edition


Andrew K. Dennis

https://textbookfull.com/product/raspberry-pi-home-automation-with-
arduino-2nd-edition-andrew-k-dennis/

textboxfull.com

Hacking Electronics: Learning Electronics with Arduino and


Raspberry Pi, 2nd Edition Simon Monk

https://textbookfull.com/product/hacking-electronics-learning-
electronics-with-arduino-and-raspberry-pi-2nd-edition-simon-monk/

textboxfull.com
Paul Bradt and David Bradt

Science and Engineering Projects Using


the Arduino and Raspberry Pi
Explore STEM Concepts with Microcomputers
Paul Bradt
Houston, TX, USA

David Bradt
Houston, USA

Any source code or other supplementary material referenced by the


author in this book is available to readers on GitHub via the book’s
product page, located at www.​apress.​com/​978-1-4842-5810-1. For
more detailed information, please visit http://​www.​apress.​com/​
source-code.

ISBN 978-1-4842-5810-1 e-ISBN 978-1-4842-5811-8


https://doi.org/10.1007/978-1-4842-5811-8

Apress standard
© Paul Bradt and David Bradt 2020

This work is subject to copyright. All rights are reserved by the


Publisher, whether the whole or part of the material is concerned,
specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other
physical way, and transmission or information storage and retrieval,
electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed.

The use of general descriptive names, registered names, trademarks,


service marks, etc. in this publication does not imply, even in the
absence of a specific statement, that such names are exempt from the
relevant protective laws and regulations and therefore free for general
use.
The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.

Distributed to the book trade worldwide by Springer Science+Business


Media New York, 233 Spring Street, 6th Floor, New York, NY 10013.
Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-
ny@springer-sbm.com, or visit www.springeronline.com. Apress Media,
LLC is a California LLC and the sole member (owner) is Springer
Science + Business Media Finance Inc (SSBM Finance Inc). SSBM
Finance Inc is a Delaware corporation.
The authors dedicate this book to all of the Science, Technology,
Engineering, Math (STEM) teachers who guide and shape the paths of
many young minds (including ours) to question, learn, and utilize new
technology to solve problems. Without these unsung heroes, the world
would not have powerful cell phones, highly reliable cars, the Internet,
and many other amazing things we routinely take for granted.
Introduction
The authors’ journey developing this book started in 2013 when they
discovered the Arduino microcontroller. It is interesting how something
big really starts with one step as they found the Arduino incredibly
powerful. Users are able to program it with computer code, and then it
executes its instructions for as long as it has power. The authors started
evaluating various applications of the Arduino around the house and in
their hobby endeavors. In 2017, they started experimenting with the
Raspberry Pi minicomputer which enables users to take projects to a
whole new level with a low-cost computer that interfaces with sensors.
Since a Raspberry Pi is very affordable, a real computer can now be
dedicated to operating a system permanently. While requiring some
technical steps to set up, both of these tools can be used to gather data,
automate tasks, and provide a lot of fun. The authors found it very
satisfying to watch a device do several tasks, especially when they set it
up. This book chronicles some science and engineering projects the
authors developed over the past few years and provides helpful hints,
along with a few things to avoid.
There are two primary areas of focus or goals of this book. The first
goal is to help the reader explore the Arduino and Raspberry Pi. The
second goal is exploring science and engineering in interesting and fun
ways.
The projects and concepts in this book are meant to accomplish the
first goal by providing information to get an Arduino or Raspberry Pi
system set up, running, and ready to capture data. The text provides
enough detail for users with average assembly or electrical skills to
complete them. Additionally, the goals of learning are to gain
knowledge and skills. When the reader engages in a project that
requires them to try new things, it reinforces how they learn and gain
confidence and encourages them to try even more complex tools and
techniques.
The second goal is exploring concepts of STEM (Science,
Technology, Engineering, Mathematics) and working through examples
to demonstrate basic scientific and engineering concepts. Finally, the
authors provide some detail on the mathematics needed to understand
and explain the science demonstrated.
Science and engineering provide critical skill sets for the modern
world that can be used in everyday life. People use these skills to
develop the technology that the modern world relies on. This book can
establish these skill sets for a fruitful and rewarding career.
The authors hope this book inspires the reader to expand and
explore their own STEM projects by including a wide range from
beginner to advanced. From these examples, the reader can learn many
techniques, tools, and technologies and apply them beyond the ones
listed here; but first, the authors introduce STEM.

What Is STEM?
STEM (Science, Technology, Engineering, Mathematics) is a program
based on educating students in science, technology, engineering, and
mathematics in an integrated, interdisciplinary approach to learning.
School systems today strive to improve education in STEM. This goal
is an area where educators can use outside help developing and
improving students’ knowledge when they actively contribute, design,
and build hands-on projects. In many ways, the young mind is excited
and motivated building projects. They develop an in-depth
understanding of what is required and how it works. The authors
believe this is the best way to learn and remember these concepts,
which results in a solid STEM foundation for students.
A question not often understood is how the scientific method is
different from an engineering approach. Understanding the difference
between science and engineering can be seen in the original Star Trek
series. Mr. Spock was the science officer, and Montgomery Scott (Scotty)
was the chief engineer. Their jobs and how they approached new
scenarios or problems really provide a great explanation about the
differences and similarities between science and engineering. Let’s
examine some examples.
Mr. Spock used the term fascinating when describing a new event or
phenomenon. The role of science is to expand knowledge and
investigate new events. This fascination with new and unique areas is
key for a scientist. Scotty, the engineer, on the other hand always had to
fix the warp engines, the transporter, or some other critical system. The
normal role of an engineer is to develop and implement solutions to
problems. In one of the episodes, Scotty indicated he would rather read
his engineering journals to learn about how others solved problems
than go on shore leave!

Science
Researchers use the scientific method as a tool to understand questions
in their area of interest. Based on the information they have initially,
they develop a hypothesis and then methods to test the validity of the
hypothesis. When sufficient test data are gathered and analyzed, the
researcher either accepts or rejects the hypothesis. In many cases,
positive or negative results point to the next step or direction of
exploration and contribute to the general body of scientific and
engineering knowledge.

Engineering
The primary goal of engineering is to evaluate alternatives and choose
the optimal solution to minimize or eliminate specific problems or
issues. Solutions are not necessarily new, but may be repurposed
concepts applied to different problem areas. Other aspects of
engineering include planning the work, selecting components to meet
requirements, and following through on managing and completing a
project. Often projects or systems fail because the planning, scheduling,
and logistics of activities are not adequately engineered for an optimum
solution. These skills are important and necessary in any job.
Science and engineering use many of the same tools and techniques,
but it is important to understand the distinction between scientific
experimentation and the engineering process of developing optimal
solutions. For one thing, they both use the language of mathematics to
describe percentages, results, probability, and other physical
parameters. However, science’s goal is to expand knowledge which is
different than engineering’s goal of selecting an optimum solution and
proceeding with solving the problem. One other difference is a scientific
test often gains new knowledge, whereas an engineering test often
demonstrates how a system performs a function. In many ways, they
are synergistic as science often provides new tools and ideas for
engineers to use to solve problems.
In the authors’ minds, the roots of some key technological
advancements that exist now can be traced back 50 years to the
original Star Trek TV show. For example, in the show, they used
tricorders to gather data about aliens, equipment failures, medical
problems, and a host of other out of this world challenges. They had
communicators that allowed them to contact crewmembers all over
alien worlds. Finally, they had the replicators that allowed them to
produce any type of food they desired. Today we don’t have tricorders,
but we do have some examples that 50 years ago would have been
amazing. Today there are personal computers, cell phones, 3D printing,
and incredible sensors based on the early transistors of the 1960s. The
Arduino and the Raspberry Pi, two examples of new technology, can be
built into devices similar to the incredibly versatile Star Trek tricorders.
Both Mr. Spock and Scotty realized they needed each other (science
and engineering) to accomplish the goals of exploration and keep the
Enterprise flying safely through space. In today’s complex world,
integrating science and engineering is key to researching problems and
developing solutions.
In the following chapters, the authors will demonstrate all of the
components of STEM needed to research scientific questions, use new
technology (Arduino and Raspberry Pi), employ engineering
techniques, and use mathematics to quantify the scientific data. As Star
Trek boldly went forth to explore new worlds, the authors hope the
students of today do the same!
Acknowledgments
This book would not be possible without the authors’ gaining early
technical insight regarding the Raspberry Pi and Arduino from others.
Jared Brank and Dennis Pate provided a lot of basic information, key
insights, and Arduino hardware early in the process. The authors thank
the following individuals who listened to them on many occasions and
provided help, insight, and inspiration with their own experiences with
the Raspberry Pi and other projects: Jeff Dunehew, Todd Franke, and
Fitz Walker. Additionally, significant assistance with 3D printing was
provided by Mitch Long and David Thoerig.
Producing this book would not have been possible without the
excellent help and guidance regarding scope and early editorial reviews
by Joanna Opaskar and Ed Weisblatt. The authors also utilized many
ideas from Andrew Bradt and Laura Brank’s science fair experience.
Most important was the support and advice from Andrea Bradt.
Table of Contents
Chapter 1:​Key Technology Tools
Arduino Basics
Arduino Setup
Ports and Interfaces
Lessons Learned About the Arduino
Raspberry Pi Basics
Raspberry Pi Setup
Lessons Learned About the Raspberry Pi
Basic Electronics Definitions
Summary
Chapter 2:​Data Logging Basics
Data Logging with the Arduino
Data Logging with the Raspberry Pi
Summary
Chapter 3:​Physics and Mathematics Basics
Temperature
Force
Pressure
Basic Concept of Algebra
Statistical Concepts
Direct Compared to Inferred Measurements
Summary
Chapter 4:​Simple Science and Engineering Projects
Buoyancy of Air
Arduino Buoyancy of Air Version
Raspberry Pi Buoyancy of Air Version
Buoyancy Recap
Demonstrating Pressure
Pressure/​Force Recap
Capturing Counts
Counts Recap
Summary
Chapter 5:​Advanced Physics and Mathematics for Science and
Engineering
Basics Terms of Calculus
How Heat Transfer Works
Conduction Heat Transfer
Convection Heat Transfer
Radiation Heat Transfer
All Three Heat Transfer Mechanisms Work Together!
Mass
Velocity and Acceleration
Inertia
Momentum
Friction
More Advanced Aspects of Calculus
Summary
Chapter 6:​Time/​Condition-Dependent Projects
Conduction Heat Transfer Through an Aluminum Rod
Ensure Consistency in Temperature Sensor Readings
Aluminum Rod Conduction Heat Transfer Recap
Conduction Heat Transfer Through a Window
Window Conduction Heat Transfer Recap
Convection Heat Transfer
Convection Heat Transfer Recap
Zero Gravity Demonstration
Zero Gravity Recap
Measuring Frictional Force Projects
Arduino Frictional Force Project
Operational Schematic
Arduino Frictional Force Recap
Raspberry Pi Frictional Force Project
Raspberry Pi Frictional Force Recap
Acceleration Projects
Acceleration Direct to Computer
Acceleration with Computer Recap
Acceleration Measurement Without a Computer
Acceleration Without Computer Recap
Summary
Chapter 7:​Light and Imaging Projects
Radiation Heat Transfer
Analysis of Heat Transfer
Radiation Heat Transfer Recap
Astrophotography​with the Raspberry Pi Camera
Assembling the Meade ETX-60AT and Raspberry Pi
Astrophotography​Meade ETX-60AT Setup Recap
Assembling the 4 1/​2-Inch Reflector Telescope and the
Raspberry Pi
Components Needed to Assemble the Raspberry Pi 3
Mounting System to the 4 1/​2-Inch Telescope
Reflector Telescope Setup Recap
Basic Raspistill Previewing an Image with the Terminal
Command Line
Using Raspistill to Capture an Image
More Advanced Raspistill Input Without a Keyboard
Raspistill Image Capture Recap
Astrophotography​Raspberry Pi Python GUI
Initiating the GUI
PI_​SN003 Raspberry PI GUI Recap
Assembling the Raspberry Pi and Touchscreen in the Case
Raspberry Pi, Touchscreen, and Case
Modification of the Case and Assembly
Components and Assembly of the Raspberry Pi Case Recap
Camera Modifications, Camera Case, and Power Cables
Camera Modifications
Building the Camera Case
Final Assembly of the Camera in the Case
Power Cord Combination
Camera, Camera Case, and Power Cord Assembly Recap
Building the Shelf for the Meade ETX-60AT
Shelf Components and Assembly Recap
Helpful Hints Using the Telescope and Raspberry Pi
Lessons Learned Recap
Example Images and Enhancing Them Using a Video Capture
GUI
Example Images Taken with the Upgraded Meade ETX-60AT
Astrophotography​System
Recap of Example Images and Enhancement Techniques
Summary
Appendix:​Reference Material
Soldering Safety
General Shop Safety
Manufacturing Techniques
Soldering
Basic Arduino and Raspberry Pi Python Commands
3D Printing
Computer-Aided Design Options
Project Management for Engineering
Decision Analysis for Engineering
Thermal Conductivity Coefficients
Coefficients of Friction
Astronomy Terms
Specifications of the Meade ETX-60AT
Setup, Updates, and Repairs
Helpful Books
Index
About the Authors
Paul Bradt
has a BS in Computer Science from the
University of Houston–Clear Lake. He
currently owns a small business and
writes books, develops code, and does IT
support work. He has experimented with
the Arduino and Raspberry Pi system
and believes them to be excellent tools
for developing an understanding of
electronic components and hardware
interaction in integrated systems. He
believes they are very useful as a
teaching aid in learning computer
programming, science, and engineering.
He likes to perform sophisticated
troubleshooting of computer problems
and has found that online resources can be a great help for novice users
to get their experiments operating quickly and effectively.

David Bradt
has a BS in Mechanical Engineering from New Mexico State University
with many years of experience in the aerospace industry and in the
petrochemical industry. He enjoys building and designing devices to
measure and control systems. He has found the Arduino and Raspberry
Pi to be incredibly powerful little devices that with a little bit of work
can do many different tasks. He is a big fan of Star Trek: The Original
Series and astronomy.
About the Technical Reviewer
Sri Manikanta Palakollu
is an undergraduate student pursuing his bachelor’s degree in
Computer Science and Engineering at SICET under JNTUH. He is a
founder of the OpenStack Developer Community in his college. He
started his journey as a competitive programmer. He always loves to
solve problems that are related to the data science field. His interests
include data science, app development, web development,
cybersecurity, and technical writing. He has published many articles on
data science, machine learning, programming, and cybersecurity in
publications like Hacker Noon, freeCodeCamp, Noteworthy, and DDI
through the Medium platform.
© Paul Bradt and David Bradt 2020
P. Bradt, D. Bradt, Science and Engineering Projects Using the Arduino and Raspberry Pi
https://doi.org/10.1007/978-1-4842-5811-8_1

1. Key Technology Tools


Paul Bradt1 and David Bradt2
(1) Houston, TX, USA
(2) Houston, USA

This chapter will highlight some of the basics about the Arduino and
the Raspberry Pi. It will help the reader get started if they are
unfamiliar with these powerful devices. It is amazing what these
devices can do and this chapter provides some basic aspects for getting
them set up to run.

Arduino Basics
The Arduino is a powerful microcontroller that is ready to program and
acts as an intermediary device between a personal computer and
various sensors. It is relatively new technology that is a great tool for
gaining insight into physical properties and other scientific parameters.
The Arduino board was first developed in Italy in 2004 as a tool to
help train students in programming. It is an open source tool and as
such has developed a large base of helpful web sites and user groups. It
represents a breakthrough as an easy-to-use, relatively inexpensive,
programmable interface between a computer and various sensors. The
software development package and all of the online resources help
make this an ideal data logging tool for science fair/college projects.
The Arduino, Adafruit, SparkFun, Hacktronics, and other web sites
are great places to start. There are also several introductory books to
help the researcher get started using this device. Getting started with
Arduino by Banzi is a very good beginner’s book on Arduino.
Other sources of information for the Arduino novice are maker
faires and user group activities.
There are several versions and sizes, but for the projects in this
book, the Arduino Uno and the Integrated Development Environment
(IDE) version 1.89 were utilized. Figure 1-1 shows an example of the
Arduino Uno. The authors recommend for the person unfamiliar with
Arduinos to use an official version and not a clone. The authors have
never experienced a problem with an official Arduino, but there are
many clones, and the authors have experienced problems with one of
them.

Figure 1-1 Arduino Uno

Arduino Setup
Setting up an Arduino is relatively straightforward; the reader should
follow these basic steps to get the device running:
1. The Arduino is connected to a computer via a USB connection to the
input port (see Figure 1-3).

2. Load code using the IDE (see Figure 1-2).

3. Open the serial monitor to get data.


These steps sound basic, and after the reader completes these steps
a few times, they will see how easy it is to connect and run an Arduino.
In many cases, the challenges occur with the code. If the reader is
copying code from a source, it is important to type it in exactly as it
looks. Even then there could be errors, but that is part of the adventure,
and it’s very rewarding when the code runs.

Figure 1-2 Arduino IDE

Ports and Interfaces


Figure 1-3 shows the main ports of the Arduino Uno.
Figure 1-3 Arduino Ports
There are five primary port groupings that are used to connect to
the Arduino:
Computer port: This is the primary port that is directly connected to
the computer. It is a micro-USB port that powers and enables the
user to upload the sketches or programs to the Arduino.
Battery power port: This port allows an Arduino to be unplugged
from a computer and use battery power to operate. A standard wall
power supply that provides 9–12 V DC can also be used.
Sensor power ports: These plug connections provide 3.3 V and 5 V
DC power. There is also a reset connection and input voltage
connection.
Analog device ports: These connections are for analog inputs.
Digital device ports: These are for digital inputs and outputs.
IDE (Integrated Development Environment): The IDE is the
program that is used to develop the code. It is the programming tool
that runs on a computer and has features to help the developer write
code. The IDE tool must be downloaded from the Arduino web site.
Sketch: The code that runs on an Arduino is called a sketch. Once the
code is developed in the IDE, it is uploaded to the Arduino.
Libraries: These are code modules that are installed on the Arduino
and called up by the program when needed. Libraries add a lot of
functionality and do not require any additional coding.
There are other components and hardware that can be used with
the Arduino:
Shields/breakout boards: These are add-on boards that are either
inserted into the standard Arduino board ports or connected via
wires.
Sensors: A sensor is a device that senses some type of data. It can be
used to directly measure a physical aspect, or it can be used with
some mathematics to infer a physical measurement.
Effectors: An effector imparts some change in the physical world
when activated. Motors, solenoids, and servos are some examples.
LCDs: Liquid Crystal Display can be used to show data.
LEDs: Light-Emitting Diodes or other incandescent lights can also
indicate an event has occurred.

Lessons Learned About the Arduino


The Arduino is relatively easy to use, but the authors found there are a
few key points that will help when using this powerful device:
Each Arduino attaches to a specific com port. The port may have to
be changed or selected in the tools tab under “port” to get the IDE to
recognize the Arduino.
If the code is being pasted into the IDE, do not copy from Microsoft
Word or another word processor. First, put it in a text editor such as
Notepad, Notepad++, or some other C/C++ IDE editor and then copy
it from there. Important note: Notepad and Notepad++ are not
development tools like the IDE. One other very important item of
note is when the code was transcribed into the book format some of
the code text that must be on one line may show up on two lines in
this book. The authors have tried their best to highlight the code that
should be on one line in the IDE by bolding it in the Listing. Please
contact the authors if there are questions at
contact@pdanalytic.com.
It is a good idea to test the devices with a basic program to be sure
they work, before moving to a more complex program.
If the final code is complex, get each piece of code working before
adding more modules. This way, it is easier to find the module where
the problem is located.
The authors recommend for long timing events or complex programs
to not use the “delay command,” because it locks the Arduino and
prevents it from doing anything else. Instead, use the “milli
command” that tracks time intervals between events and still allows
other actions to occur. The milli code might be a little more complex,
but it allows the Arduino to perform other functions simultaneously.
Using the delay command for short events or simple programs like
the ones in this book, such as a switch debounce, is recommended.
A feature built into the Arduino IDE is the “auto-format command.” It
can be found under the tools tab or using “Alt+T.” This command
helps identify missing items and also helps organize the code for
improved readability.
One more key aspect of Arduino coding is the “loop command.” There
are a few different types, but common ones such as “void loop” and
the “for command” perform several operations and then repeat them.
Check the wiring twice before applying power. It can be difficult to
see which port a wire is plugged into when there are several wires.
It is hard to know what code is on an Arduino. One easy way that
helps determine what is loaded on an Arduino is saving code with a
descriptive name, date, and even time information. This helps
programmers who may need to go back to a previous code version.
One other very helpful trick is to put the descriptive name of the code
on a piece of tape and stick it on top of the computer port. This helps
when working on, or programing, several different Arduinos.
One of the advantages of the Arduino is that once it is programmed, it
remembers the code. When a power source is plugged into the
battery power port, it will operate the Arduino. According to the
Arduino web site, any power source that can supply 9–12 V DC, 250
mA, or more will work. The plug must be 2.1 mm with the center pin
providing positive voltage and the exterior of the plug the negative
terminal. Some power supplies do not deliver enough current or do
not provide stable power. If an Arduino is behaving strangely, try a
different power supply.
Some programs need special ways to use and communicate with the
Arduino. To do this, the reader should understand these special
connection ports on the Arduino Uno: analog A5 is the SCL (Clock
port) and A4 is the SDA (Data port).

Raspberry Pi Basics
The Raspberry Pi 3 is a powerful minicomputer. This piece of
technology comes with a lot of features like any other modern
computer. It is an experimental/hobbyist device developed around
2011 in the United Kingdom to teach programming. For its low cost, it
has many capabilities and allows the user to configure it in many ways.
There are several models on the market. For this book, the authors
choose the Raspberry Pi 3 Model B V1.2 (Figures 1-4 and 1-5). There is
a new Raspberry Pi 4 that was recently released that has more features.
The authors researched the setup and use of the Raspberry Pi 4, and it
appears to be the same as the Raspberry Pi 3. We believe these projects
will work the same if you have a Raspberry Pi 4.

Figure 1-4 Raspberry Pi


Figure 1-5 Raspberry Pi Ports
Once the Raspberry Pi 3 is up and running, it is just like a normal
personal computer. It has a graphical user interface (GUI) similar to any
computer that enables you to open programs or files with the click of a
mouse. It uses a version of the Linux program for the operating system
(OS) called Debian , so it is a bit of a hobbyist machine and occasionally
may have an issue. There are a lot of online resources to find help.
The Raspberry Pi 3 has a 1.2 GHz 64-bit quad-core CPU, 1 GB RAM,
an integrated wireless connection, four USB ports, an Ethernet port,
and an HDMI connection. It is a truly powerful device for only ≈ $25.
The Raspberry Pi 4 has a 1.4 GHz 64-bit quad core CPU, options of 2, 4,
8 GB RAM and costs from $35 to 75. The Raspberry Pi 4 will run hotter
than the Pi 3 and it is recommended to have a cooling fan but it is faster.

Raspberry Pi Setup
These are the general steps to set up the Pi:
1. Insert the SD card.

2. Plug in the monitor.


3. Plug in the keyboard.

4. Plug in the mouse.

5. Start the system.

The authors recommend that the reader do all their programming


in versions of Python 3.X or later. The exception to this
recommendation is if the reader has legacy code that runs on an earlier
version like Python 2.7.X.
Some projects in this book require additional modules to run. The
“pip” command is typed into the terminal area to install code modules.
The reader should be aware that the pip command installs a module in
the base Python area, which may be specific to Python 2.7.3. If the
reader has upgraded to or is using a newer version of Python, they will
need to use pip3 or Python 3.
Operating the Raspberry Pi is much like a personal computer. It has
a GUI along with several programs such as a spreadsheet, word
processor, and other built-in items. Figure 1-6 provides an example of
the interface.
Figure 1-6 Raspberry Pi GUI with Spreadsheet
For the purposes of this book, the authors will focus primarily on
how to connect sensors to the Raspberry Pi and get data out of them.
There are many other uses for the Raspberry Pi that will not be covered
in this text.
Figure 1-7 shows the General-Purpose Input/Output or GPIO pins,
although it may not be easy to determine the pin number on the
Raspberry Pi. A ribbon cable is also shown that connects to a nice
interface board made by MCM. This interface board has pin numbers
and makes it a lot easier to connect sensors to the Raspberry Pi. More
about this in the next chapter.
Figure 1-7 GPIO Pins on the Raspberry Pi
The GPIO pins include several 5 V, 3.3 V, ground, and input/output
ports.
There are several special ports on the GPIO pins. These are very
important for the Raspberry Pi to communicate via Serial Peripheral
Interface (SPI) protocol with other devices like an analog to digital
converter (ADC). For the Raspberry Pi 3, pin 23 is the GPIO SPI clock
connection; this is also called GPIO11. The next two special connections
are pin numbers 19 and 21. Pin 19 is the data in connection termed
Master Out Slave In (MOSI), also called GPIO10. Pin 21 is the data out
connection termed Master In Slave Out (MISO), also called GPIO9. The
final connection is pin 24 and it is the chip enable (CE0) connection.
There are a lot of confusing descriptions and diagrams on the Internet
regarding these connections, but once the authors understood what
these four connections were used for, it started making sense.
Many resources are available online, and the following books were
helpful in explaining the Raspberry Pi and its features. Beginner’s Guide
to Raspberry Pi published by BDM Publications, Raspberry Pi: The
Complete Manual published by Image Publishing, Learn Raspberry Pi
Programming with Python published by Apress, and The Python Coding
Manual published by BDM Publications are good resources.
The following are some Raspberry Pi terms and definitions:
Another Random Scribd Document
with Unrelated Content
Europeans towards the race among whom they dwell. Not long ago
a notice might have been seen, “No Chinamen or dogs admitted.”
It may seem strange that the Chinese post-office is in the
foreign concession, but the reason is that it is under European
management together with the customs, which are under the same
roof. If you wish to send off a parcel to Europe, you must first take it
to the Customs House, where it has to be opened for examination. If
you happen to be a lady you are shown into a division marked
“Ladies only,” and the Chinese officials save you all further trouble:
they do your parcel up with a dexterity which makes you envious,
and seal it according to regulation; and it is all accomplished with a
swiftness and courtesy that might well be copied at home.
One day we drove to the fine American college of St. John’s,
about five miles from the city. We passed along the Nanking Road,
where the most beautiful Chinese shops are. The façades are of
handsome carved gilt woodwork, with balconies in which there were
parties of men drinking tea. Unfortunately, these shops are gradually
being replaced by European shops with plate-glass windows, and
soon this part of the city will be quite spoilt. Gay carriages were
following the same direction as our own, the Bubbling Well Road,
and we were amused to see in one a party of Chinese girls evidently
returning from school, and with their little handmaiden hanging on
to the perch behind, where you would expect to see a boy in livery.
Inside the carriage was a mirror and a sort of dressing-table and a
flower-vase, as the custom is at Shanghai. On arrival at the college,
we were taken first to see the orphanage, where tiny little creatures
of about two or three years old came and solemnly bowed to us,
with folded hands. The two youngest members of the establishment
were babies, one of whom had been rescued from destruction. The
father and mother had both been born on unlucky days, and when
the baby girl had the same misfortune they utterly refused to have
anything to do with it. She was accordingly taken to St. John’s at
two days old, and has thriven capitally. We visited successively the
boys’ and girls’ schools, and finally were taken round the college by
the principal, Dr. Pott, to whom is mainly due the great success it
has achieved. There are about 120 scholars, all of whom have to
pass an entrance examination in English, and they pay what are
considered somewhat heavy fees, so that the bulk of the expense
has not got to be met from mission funds (American Episcopal). At
present the only two final schools of the college are theology and
medicine, but many of the students go on to America for further
college courses. We visited the dormitories, and were interested to
compare the boys’ belongings with those of English schoolboys. Each
boy has his own teapot, and can always get a supply of boiling
water. Many of them had musical instruments, some flowers, some
birds, some crickets. They are fond of having “cricket matches”—
that is to say, with live crickets. In winter the boys all bring hand-
warmers into class, and Nelson’s ink-bottles are the most approved
for this purpose.
As regards games, Dr. Pott said that it was with the utmost
difficulty that Chinese boys can be got to exert themselves; but they
are gradually getting keener, and the average of attainment is
steadily rising. On a board in the college they have a list of honours
won, and this keeps up the interest. In answer to a geography
examination question, “What are the five principal races?” the
answer was, “Fifty yards, hurdle race, &c.”! The college has a fine
library, alumni hall, chapel, and playing grounds, but the laboratory
leaves much to be desired. It is affiliated to an American university,
and has the highest reputation of any educational establishment in
China. Certainly, to judge by one of its students, who travelled with
us for six months as interpreter, it is worthy of the highest praise.
Since our visit a new hall has been added to it, and there will be
accommodation for another 100 students when the building is
completed. The cost is being largely defrayed by Chinese well-
wishers, £600 having been already contributed by them.
CHAPTER II
Shantung, the German Sphere of Influence

W
E left Shanghai by steamer on October 2nd, and reached
Tsingtao (the port of Kiaochow) at about 8 p.m. on the 3rd.
We were grateful to be allowed to stop on board for the
night, as our train started from a station close at hand at 7 a.m., and
we were saved the trouble of going to an hotel. The harbour is
picturesquely situated at the mouth of the bay, surrounded by hills
which have all received German names since the occupation. We
were up betimes, and rather disturbed by the non-appearance of the
Customs House official, without whose presence we could not go
ashore. However, he appeared in time to let us get to the little
wayside station, and we found other passengers waiting there,
seated on the line with their luggage in a haphazard way. The
Germans have not only got the concession known as Kiaochow, but
also thirty miles on each side of the railway line which they have
built from Tsingtao to Tsinan, the capital of the province, a distance
of about 250 miles, through the centre of the province. The port is
laid out just like a German town, and has hotels, statues, a post-
office, commercial buildings, and private houses. The place is a
fashionable summer resort, consequently the prices are high, and
have gone up at least 50 per cent. since the coming of the Germans,
who spend money lavishly.
The German Government has just decided to build a High School
for Chinese boys of the upper class, at a cost of £30,000.
The rail is the dearest and dirtiest I have ever seen. The officials
treat foreigners with indifference, and the Chinese with brutality—at
least, so we heard at every place at which we stayed, and from the
people who most appreciated the coming of the railway. One can
only hope that things may be improved later, and a better class of
officials put in charge of the line. There was but one train per day
going in each direction, and the journey from Tsingtao to Tsinan
takes about twelve hours. Occasional trains run on sections of the
line. Although money has been poured out like water to make the
German occupation a success, the object has so far not been
accomplished, perhaps owing to lack of harmony between the three
principal German officials in China—the Governor of Kiaochow, the
Ambassador, and the Commander of the Fleet. The bulk of the trade
on the line is still in Chinese hands, and the merchants have
succeeded in getting permission to build a branch line from the
treaty port, Chefoo, to Weihsien, which will be a great advantage to
them. Naturally the Germans, after spending so much on their port,
do not like to see trade diverted to another. They not only refuse to
build the line themselves, but have memorialised the Throne to
prevent the Chinese from being allowed to build one either:
however, their representations have failed.
The province of Shantung is considerably larger than England,
and is the most densely populated of any in China—557 persons to
the square mile. Although it is well cultivated and prosperous in
appearance, the partial failure of the crops has the immediate effect
of throwing 50,000 of the inhabitants into a state of beggary. When
this happens, the Government grants each beggar daily a bowl of
rice. It is hard to realise this state of affairs when you pass through
such a prosperous-looking country; the crops are wheat, different
kinds of millet, sorghum, maize, sweet potatoes, beans, peas, hemp,
and indigo. A large quantity of fruit is also grown—pears, apples,
apricots, peaches, cherries, grapes, persimmons, &c. Every now and
then you pass brilliant patches of vegetables of various sorts. A
villager’s plot of land usually contains all the requisites of life—cotton
(for clothes and bedding), wheat, potatoes, a fruit-tree, and last, but
not least in China, a castor-oil plant; a few fowls and pigs will give
him what most he loves in the way of food. I have known a Chinese
woman eat fifteen eggs at a sitting, and she was surprised at the fit
of indigestion which followed this meal! There is a curious specimen
of fowl cultivated in this province, called the Cottonwool fowl; it is
small, white and fluffy, looking just like a toy out of a cardboard box,
and is exclusively used as medicine, especially for the diseases of
women. Its flesh is dark, and the bones black; the chickens are the
sweetest-looking objects. In contrast, the pigs of this part are black
and hairy.
After leaving Tsingtao the train travelled slowly, stopping at
every station, and these stations are all alike except a few large
ones. There was a ticket office, and a row of five wooden-looking
Chinese policemen standing at attention and drawn up in line as
long as the train was in the station. They wear black sailor-hats, and
hold batons as if they were rifles. For all the world they look like toy
soldiers at 11¾d. per dozen, made in Germany. There are no
platforms on these stations, and passengers squat on the line
surrounded by their bedding, teapots, and birdcages. The Chinese
take to railway journeys like ducks to water, so the trains are well
filled. A woman may be seen approaching on her donkey, which
travels at about the same rate as the train, so she stands a good
chance of catching it even if she has started rather late. She is a
picturesque object sitting astride on the top of her bedding, attired
in a blue coat and pink trousers, tied in at the ankle with pea-green
ribbons over white socks; the finishing touch of the costume being
the coyest imaginable little pointed embroidered shoes.
A SUBURB OF WEIHSIEN

At Weihsien, which we reached after some five and a half hours’


travelling, we were met by a friend, and passing out of the station,
we found on the “cab-stand” a row of wheelbarrows waiting to take
passengers to the town, about half a mile distant. The country is
dotted with a good number of trees, mainly willows, poplars,
cypresses, and mulberries, above which tower the walls of the city.
We were carried in chairs, and were charmed with the view, as a
lovely clear stream flowed at the base of the walls, reflecting a deep
blue sky. Weihsien is an important business city, and its streets are
named after the trades plied in them, such as Forge Street, Gold
Street, and Silversmith Street. To us they appeared picturesque, but
some people might call them squalid, and it is certainly wisest to
look up, not down. We passed through the outskirts of the town to a
fine-looking mission station, mainly built and worked by American
Presbyterians who had recently coalesced with the English Baptists.
This mission station was completely destroyed by Boxers in 1900,
but now there is a fine group of buildings, including boys’ and girls’
schools, hospitals, a church, college buildings, and houses for
workers (who number about twenty), and the whole is enclosed
within a high wall. So far the teaching, even of Western science, has
been entirely carried on in Chinese, but the demand for the
knowledge of English is so pressing that it has recently been added
to the curriculum.
From Weihsien we went next day to Tsingchowfu by rail, a
journey of about two hours, and this is one of the great historical
centres of the Empire. Here, again, the railway station was at a little
distance from the town, and we found chairs waiting to convey us
thither. The town has an imposing position on the hill, with a stream
flowing round the greater part of it; consequently the walls look an
astonishing height from the outer side, at least twice as high as from
within, and the main entrance is across a bridge.
Within the gloomy north gate hangs a group of cages containing
magistrates’ boots, but it is probable that they were originally used
to hold something very different, namely, criminals’ heads. In Les
derniers Jours de Pékin, Pierre Loti describes those he saw just after
the siege, all with the queue hanging down between the bars.
There are many fields within the city, and if time had allowed I
should willingly have stayed several weeks sketching there. The
ruins of the palace belonging to the Ming dynasty are fast falling to
decay, and as, unfortunately, the Government does not take any
2
interest in the preservation of national relics, it is not unlikely that
they may entirely disappear one of these days.
Both here and at Weihsien we were struck with what we heard
of the village girls’ mission schools, showing the stability of character
and also the capacity of Chinese girls. When a village wishes to
establish a school, its inhabitants ask some mission to supply a
teacher, and they make themselves responsible for the rest. The girl
teacher is probably lodged in the home of the village elder, and he
makes arrangements for the schoolroom, &c., and acts as guardian
to the teacher. She organizes work, and has entire control as long as
she manages it properly. About twice a year a missionary goes to
inspect it and examine the scholars. We felt it would be interesting
to see one of these schools, so our hostess offered to arrange the
matter, and took us one day to the village of Wang Mu Chiang
Chwang, some ten miles distant, which she was intending to visit for
the purpose of inspection.
CHAPTER III
A Day in the Country (Shantung)

D
AYS in early October are perfect for visiting the country. The
thermometer stands at 70° to 80°. We set out one clear,
fresh morning at about eight o’clock. I went in a sedan-chair,
and the two others in a wheelbarrow—not such an uncomfortable
conveyance as might be supposed, except when the roads are very
rough. The occupants recline on each side of the wheel, and parallel
to it, in a padded seat with back rests and cushions, their feet
extended full length in front; the barrow is wheeled from behind,
and has a man harnessed like a beast in front. As this was a heavy
barrow there were two additional men pulling, one on each side of
it. The sedan-chair travelled quicker than the barrow, and had the
advantage of taking short cuts across the fields. It was carried by
four men, two in front and two behind; the front ones carried by
means of a pole, to which the shafts were suspended—which ran
parallel to them—while the carriers at the back were in the shafts
themselves. When the men wished to shift the weight from one
shoulder to the other, they supported the pole by means of an
upright one which they carry for the purpose. Owing to these
arrangements the chair can be equally well carried by three men as
by four, two in front and one behind, in which case the back carrier
is much farther from the chair than the front men.
I was soon well ahead, and did not witness the catastrophe that
happened to the barrow shortly after starting. Going round a corner
rather too fast, the barrow was upset, and one of my friends was
tipped out into the dust; but the other, on the upper side, managed
to hold on. Happily, no damage was done, as the fall was into a soft,
clean heap of dust. But it was not so pleasant a matter for another
friend to whom this happened when she was travelling the same
road earlier in the year. She was tipped over into a sea of mud, and
as she happened to be carrying a basket full of eggs, she suddenly
found herself in a “Yellow Sea.”
Leaving the city behind us, we passed through open country
where every one was still busy harvesting in the fields. Some fields
were already ploughed, in others green wheat stood a few inches
high; it would not be much higher before the snow came to cover it
for winter. Much of the foliage looked more like spring green than
autumn, and many of the villages lay embowered in trees—willows,
aspens, cryptomerias, the last-named always belonging to temples
or adjoining graves. The threshing-floors were filled with golden
grain being prepared for winter storage. Bean pods were being
broken up by means of stone rollers, worked by donkeys, blindfolded
with neat straw goggles. On one occasion I saw a donkey wearing a
pair of ornate blinkers, bright blue cotton with protuberant black
eyes surrounded by a white line. The Chinese love to decorate the
things in common use, and it is a perpetual joy to see the skill and
ingenuity expended on simple objects. After the bean pods have
been crushed the different parts of the plant are raked into separate
heaps on the threshing floor—bean, husk, stalk, and chaff—for every
particle is used in one way or other. If one were asked to state what
was the most striking feature of this great empire, I almost think it
would be this: the carefulness which prevents waste, the ingenuity
which finds a use for everything. Even the green weed covering the
ponds is used as fodder for pigs. When the fields look quite empty
after harvest, the women and girls gather together the few
remaining straws. Every inch of ground is cultivated, except the
endless mounds, the graves of countless generations.
The country was a scene of delightfully cheerful energy, whole
families working together; a tiny child lying naked, basking in the
sun, the women (despite their bound feet) as busy as the men.
Barrows passed along, groaning under loads so heavy that it needed
a friend to drag in front, while at the end of some five yards of
traces a donkey trotted along, waiting to give its assistance till it was
more urgently needed, as, for instance, going uphill or over difficult
ground. The reins were attached to each side of the barrow, and
could only be manipulated by a dexterous twist of the wrists.
Occasionally a man rode by on a pony, whose coming was heralded
by a tinkling of bells. As the country is covered with crops, not many
cattle are to be seen, and any there may be are mainly fed on bean
cakes. We were swiftly borne through village after village, and my
men only set me down for one ten minutes’ rest during the ten
miles, which we covered in two hours and forty minutes.
As we entered Wang Chia Chuang (Wang = family village), the
whole community, headed by the Wang family, turned out to meet
us, having been warned the day previous of our intended arrival,
and we were ceremoniously led to the Guest Chamber. On the
outside of the entrance to the house little strips of red or orange
paper were pasted up, and in the inner courtyards as well. On these
papers are sayings from the writings of Confucius, or other mottoes,
such as the following:
When you sit quietly, think of your own fault;
When you chat together, mention not another man’s.
In teaching children, good must be taught;
To win a reputation, study may be required.
Diligence and frugality are the principal thing in maintaining a house;
Humility and mildness are the boat for crossing this world.
Honesty keeps the family great;
Classics make the generation long.

These couplets are renewed at the beginning of the year, and


the village schoolmaster has a busy time writing them.
Tea was brought in, and not only the family and schoolgirls, but
also the neighbours came to see us, pouring out a flood of talk, of
which we understood nothing. Then we went into the schoolroom
across the courtyard, and found it and the girls as clean as soap and
water could make them. The certificated teacher was about twenty
years of age, and in this case happened to be Mr. Wang’s daughter.
Her room opened out of the schoolroom, and was a pattern of
neatness—it was ornamented with photos. Her salary is £3 per
annum. The curriculum of these village schools consists of the three
R’s, singing, drill, and sewing, and it is wonderful to see the
difference in the appearance of the girls after they have been a short
time under training, the awakened intelligence showing to a marked
degree. The more promising students get drafted on to the
boarding-schools for further training, with a view to their becoming
teachers. The largest of these schools only contain thirty scholars,
but they have two teachers for that number of scholars. An official
who happened to visit one of these schools was filled with
astonishment at the behaviour of the girls; as soon as he entered
they all stood up, and answered the questions he put to them with
modesty and clearness. He said how different this was from the
behaviour in the national schools for boys, and sent a large sum of
money (comparatively speaking) to be divided among the scholars,
as a mark of his appreciation. In the large towns Government
schools for girls are being started, but in the country there are only
mission ones. Dating from the new year (1909) school attendance is
compulsory for boys throughout the Empire, therefore the
Government is responsible for the establishment of the requisite
number of schools—at least one in every village. At first there was a
difficulty in starting village girls’ schools; now they are in great
demand, and sufficient teachers cannot be obtained.
A VILLAGE SCHOOL
After we had heard the children sing and had inspected their
writing and sewing, &c., we watched Mr. Wang doling out medicine
in a patriarchal way in the courtyard. Several people had taken the
opportunity of our visit for killing two birds with one stone, namely,
seeing foreigners and obtaining medicine. One of them showed us
her unbound feet with great pride, as she had just achieved the
process of unbinding, and she presented us with her old shoe, much
worn, but beautifully embroidered, in which she used to work in the
fields. The Chinese naturally have remarkably small feet, and in this
village most of them are unbound, as the majority are Christians, but
the feet are so tiny that in many cases it is difficult to believe that
they are not bound. The women wear white linen socks, and their
wide trousers are neatly fastened over them with different coloured
braids. Village life here looks eminently patriarchal. The sons do
most of the work, all living with their families under the same roof.
One of the daughters-in-law had a beautiful Madonna-like face, as
she sat nursing her baby, with other youngsters crowding round her
knees. No one could have failed to admire the saintly expression and
graceful pose. The two married daughters of the house were living
in a neighbouring camp with their husbands, who are Manchu
officers. All the prefectural towns have Manchu garrisons, but it
would not be possible for a foreigner to tell the difference between
Manchu and Chinese soldiers.
Our visit came to rather an abrupt close, as we were warned
that we must reach the city before sundown or the gates would be
closed. Mr. Wang brought in preserved pears and tomatoes strewn
with sugar, which are esteemed a great delicacy, and then we
started on our homeward way. Work in the fields was ended for the
day, but for many of the Chinese work is never ended. Until all the
grain is housed, watch must be kept by day and night. Small huts
are erected in the fields for this purpose, sometimes perched on tall
poles, from which a wide outlook can be kept over the country, or on
the threshing-floors adjoining the farms.
CHAPTER IV
Shantung Silk

T
HE next morning we pursued our railway journey as far as
Chowtsun, but we had great difficulty in getting tickets. Before
leaving Shanghai we inquired at the bank what sort of money
we should take for Shantung, and were told that notes would go
everywhere, so we accepted what the bank gave us. On the railway
they demurred at every place where we offered notes, and at
Chowtsun they absolutely refused to take them. In vain I
expostulated in German. The Chinaman pretended not to
understand. Nothing would induce him to say a word or give us
tickets, but he said in Chinese that he must have Mexican dollars.
Finally, we left the office, and when the train arrived we had our
luggage put in, and got in ourselves. The man came out of his office,
and looked surprised. He then poured forth a flood of German. I told
him that he would be reported for incivility at the station to which
we were going, and where we would pay for our tickets. He had
evidently imagined we should be intimidated and should produce the
dollars. Chowtsun is a charming place, and we found plenty of the
now fashionable Shantung silk to be bought there, but much finer in
quality than one sees in London shops. We were taken to look at it
in an inner room, and provided with tea. The merchant said that the
Shantung silk blouse which I was wearing was very poor quality, and
he showed us some lovely stuffs, all hand-woven. On the counter
were lying Manchester cotton goods, which are imported all over the
Empire. It is interesting to learn that Shantung has been noted for
its silks since 2640 b.c. In the Chinese classics of that date silk is
referred to as being made in the south-west of the province, where
3
the mulberries grow well. At the present time the silkworms are fed
on dwarf oak in the eastern part of the province, and pongée is
made from their silk; but all the finer silks come from the west. From
the time of Yu (who flourished b.c. 2640) there is continual reference
made in the classics to sericulture. A later writer says that in his time
it was forbidden to rear more than one breed of silkworms in a
season, because astrologers had discovered that horses and
silkworms belonged to the same constellation, and therefore must
be of the same origin. Later on, in a classical book of the Han
dynasty (b.c. 204), the ceremonies connected with it are described,
and how the Empress herself took part in it, none of her ladies being
allowed to wear jewelry when picking mulberry leaves to feed the
young insects, and “none dare indulge in indolence”; “lewd
conversation” was said to disturb the worms. From this time
onwards it appears that successive empresses had to take a
ceremonial part in the rearing of silkworms. Silk was the most
interesting product of the province to us, but the main interest of
the country to others lies in its mineral worth. The Germans have
got mining rights, and have carried a branch line of the railway down
to the coalfields at Poshan.
From Chowtsun we went on a barrow, through interesting
country, to the town of Tsowping to visit a friend, and as the roads
were good we quite enjoyed our four hours’ ride. Specially careful
barrow-men had been selected, so that we might run no risk, and
certainly this was desirable, as the path often lay along the edge of
steep banks. We found a good mission hospital up there, where we
heard astonishing stories of the recuperative powers of the Chinese.
The Scotch doctor said that when he told them to his friends at
home, one would remark, “I am not a bad liar myself, but I would
not dare to go so far as that.” My own experience at a hospital in
China makes me think that it is impossible to beat the reality, no
matter how exaggerated the story sounds!
From Tsowping we returned by barrow to Chowtsun, and thence
by rail to Tsinan, which boasts three railway stations.
The accompanying illustration gives an idea of what is worn by
officials. The self-complacent pose of a Chinese official’s feet is
eminently characteristic. Much has been written about character as
seen in the human hand, but I think a character study of feet might
still be written, even when the feet are disguised by boots or shoes.
OFFICIAL (COURT DRESS)
CHAPTER V
Tsinan

T
HE capital of Shantung is a large city, containing a population
of about 150,000 inhabitants. Tsinan is a city of real beauty,
owing to the fact that there are bubbling streams in all parts
of it, so that the trees grow well. The water is singularly bright and
sparkling, and looks attractive even in the dirtiest gutters. As it
comes bubbling up in every direction there is a radiance about it
which seems untarnishable. In the very centre of the town is a
temple, standing on a terrace with fine carved balustrades round it,
in front of which is a large pond full of this bubbling water, overhung
by willows—a typical Chinese picture. On the other side of the pond
is a busy market, whence crowds soon collected round us to watch
our sketching and photographing. They were quiet and polite, and it
was quite unnecessary for the policeman to come and keep them at
a distance. But then that manœuvre gave him the advantage of an
excellent view for himself! Everywhere we found a Chinese crowd of
spectators preferable to one composed of Europeans. The market
interested us greatly, having every kind of ware for sale, from rags
and silk scraps, out of which elegant shoes are made, to all sorts of
weird medicines, of which the emblem was a life-sized, double-
headed fowl, planted in the centre of the counter. Hard by the
medicine stalls was an enclosed space, where a woman was telling a
story to an interested crowd. The professional story-teller is quite an
institution here, as elsewhere in the East, but it is rarely that a
woman is seen in that capacity. In fact, women take but small part
in the business life of the country, and men do all the selling in
shops.
Not far from the market, but situated on the outskirts of the
town, is the University, a recent institution (1902), and built mainly
in European style; the professors’ houses being of two stories and
entirely un-Chinese. The entrance, however, is the usual native one
with carved and painted woodwork decorations; facing it, and
crossing a little bridge over an empty tank, was the guest-room,
supposed to be purely Chinese, but full of European lapses, in the
shape of lace curtains, wall-papers, European carpet, chairs, clock,
electric bells, and, most striking of all, a centre candelabra for the
electric light. There are lecture-rooms, libraries, museum, laboratory,
and dining-rooms, and thirty-two baths with hot and cold water laid
on; these are so popular that their use has had to be limited.
Amongst the institutions may be named a fife and drum band, and
the latest novelty is a brass band. The University is only open to the
students of the province of Shantung, and naturally the standard of
Western knowledge is still low; but there are professors of English,
German, French, and Japanese, though the respective numbers of
their classes are seven, five, five, two. At present Japanese is not so
popular as it used to be. Indeed, in the Imperial College in Kaifeng
the Educational Board has just cut out Japanese: whether this is an
exceptional case I cannot say.
The English section includes a study of European history
(Freeman’s) and political economy, but other subjects, such as
geography, are popular among students, to judge by their use of the
small English library. Curiously enough, the most popular book both
here and elsewhere is “Little Lord Fauntleroy.” Half the lectures are
devoted to Western knowledge and half to the Chinese classics, and
the course of study at present covers three years.
In connection with the scheme of education, and under the
same jurisdiction, are normal schools, secondary and primary
schools. One of the principal ones has an English headmaster, so
that there will soon be a set of students prepared to profit much
better by university training, and fitted to go to some European
university later. There are no fewer than fifteen schools and colleges,
with about two thousand five hundred students. Another interesting
feature of the education question is the opening of a girls’ school for
the daughters and wives of the officials. It was built three years ago
by two Chinese gentlemen, and they have an English teacher there.
The school was formally opened by the Literary Chancellor, and on
entering he saluted the girls deferentially, and gave them an
admirable address. In the south of China many ladies learn reading
in private, but in the north this is extremely rare, and so lately as
1902 there was not a single girls’ school in the Empire, except the
mission schools; now they are cropping up in all directions, and the
Government is taking an active interest in all their concerns. Possibly
it may be thought that it shows this in somewhat exaggerated
fashion, for a recent order has been issued from the Education
Department in Peking prohibiting the wearing of a long fringe of hair,
or “bang” as our American friends call it, in any of the girls’ schools
throughout the Empire. This fashion had become rather general last
year. It would have been of much more practical value if all scholars
had been forbidden to paint, as this is one of the most time-wasting
processes. At Tsinan the school hours have been obliged to be fixed
late because the scholars require some hours for the morning
toilette. In the girls’ schools they are now very anxious to learn
English, music, and drawing; “accomplishments” are more valued
than serious study. It is quite evident that there is no lack of ability
to learn, though the girls are called “wooden-heads” sometimes in
contempt. In the American Board School at Peking the girls gave an
admirable rendering of Wagner’s and Mendelssohn’s music in part-
singing. The piano is also very popular among the girls. Like the
boys, they have astonishing memories, and think nothing of reciting
a whole Gospel; it is even not ranked as a feat by the Chinese to
know the whole of the Bible by heart.
Tsinan is a most progressive town: it has a British postmaster,
who has organised, not to say revolutionised, the postal system of
the province. Letters now go to Peking in four days, and to Tientsin
in three and a half days; the runners carrying them reckoning to do
fifty or sixty miles at a stretch, with an average speed of three and a
half miles per hour. They receive about five shillings a week as
wages. Sir Robert Hart is responsible for the selection of
postmasters, and even in a remote place we found a very nice one
who could speak a little English. Sir Robert Hart was appointed head
of the Customs Department in 1862, and the Customs and Post-
Office form part of one system.
One of the prettiest places at Tsinan is the lake, the main
pleasure resort of the Chinese. After threading our way in chairs
through incredibly dirty and narrow lanes, filled with a jostling crowd
and traffic, often brought to a standstill by a hopeless-looking
impasse of rickshas, barrows, beasts, and chairs, we came to a
gateway, and stepped thereout straight on to the edge of the lake,
where boats, with graceful latticed-work windows, and a broad
couch to lie on in the front, awaited passengers. Tea was ready on
the table, and we set off along one of the water highways through
the tall reeds and beds of lotus. Gorgeous kingfishers darted to and
fro like a flash of light; tiny wild-ducks bobbed up out of the water,
and then scuttled into the reeds, as we slowly made our way to the
various points of interest. The lake has been chosen as a place for
putting up memorial monuments to distinguished people, and they
are certainly a singular contrast to ours. They stand like temples on
little islands, and to the uninitiated appear to be such, with their
tablets of incense and altars. For instance, there is a fairly recent
one erected in memory of a former Governor of Shantung. Above
the altar, and almost hidden by the inscribed tablet, is a life-size
seated figure of the Governor. The head is a photograph, and the
rest is a painting, but in the dim light it required close inspection to
ascertain this fact. Incense is offered before it by any one, and not
only by the members of his family, as in ancestral worship. Opposite
this building, and as part of the memorial, is an ornate theatre,
where plays are acted on public occasions. Another recent memorial
has been put up to Li Hung Chang, and it is extremely strange. It
includes a little summer-house and a rock-garden (without rock-
plants), a theatre, a house containing a tablet, altar, &c., and a
guest-house where distinguished visitors can be lodged. This last
building is two-storied, and quite European in style, perched on an
elevation with a well-built wall below it, surmounted by barbed wire.
Another little group of buildings had corrugated iron walls; on
another was a Taoist temple, where we found a travelling showman
who was exhibiting a popular cinematograph in the neighbourhood.
The Chinese frequent the lake for pleasure parties, and a good deal
of drinking goes on, not of tea only. A visit by moonlight is as
enchanting as anything that could be imagined. On one of the
islands we noticed the most fascinating of all the fascinating
birdcages we had yet seen. It was the usual round shape made in
bamboo, but the centre of the roof inside was a well-executed
portrait of the handsome, black talking bird which inhabited it. The
seed- and water-pots were of different colours and shapes, and
fastened in with tiny figures of men carved into wooden buttons. I
have never been in any country where there were so many caged
birds, and where they were so well looked after. Every cage has its
well-made night-cover, and often this is fastened down the side with
neat little buttons. We continually saw men carrying cages along the
streets, taking their birds for walks, as we do dogs. At one place we
saw a man take the cage to a stream, and after he had cleaned it
out with a sort of tooth-brush, he left it in the stream for the bird to
have its bath, after which he hung it up to dry, and whistled to the
bird. The fashion of carrying birds about is said to be for the purpose
of showing that the owner is a man of leisure; as this is now
creating a good deal of ridicule, the custom is likely to go out of
fashion.
One of the interesting sights of Tsinan, which is quite up to date,
is a large camp, lighted by electricity, about two miles outside the
city. It is built like rows of little cottages; the men are well drilled,
and have to attend lectures. We found them, when they acted as our
military escort through the province, very civil, and in every way
pleasant and obliging men. A party of them was brought by an
officer to visit the mission museum, and the men were much
interested in having the various kinds of natural history and
geological specimens, models of architecture, electrical machines,
steam-engines, &c., explained to them. Visitors are surprised to see
a model of an English cemetery, but it throws a new light on English
character when the Chinese receive an explanation of our views with
regard to the dead, and the care lavished on their last earthly
dwelling-place. Models are of great value when wisely used for
dispelling misconceptions, but we are often prevented by our insular
pride from taking the trouble to disabuse foreigners of false
impressions they may have conceived of us. One of the most
attractive models is a dredge worked by electricity, for the province
of Shantung suffers terribly from the inundations of the Yellow River,
and the means used to cope with this difficulty are wofully
inadequate.
This museum was originally started by Mr. Whitewright, of the
Baptist Mission at Tsingchowfu, where the prefectural examinations
used to take place, attracting to it 10,000 or more students from all
parts of the province. When the old examination system was
abolished the city of Tsingchowfu was no longer of importance from
this point of view, and it was decided to move the Institute to the
capital, Tsinan, a treaty port whose importance, on the other hand,
was rapidly increasing. The Mission obtained an excellent site, and
put up a lecture-hall to seat six hundred persons, reception-rooms
for men and for women, a reading-room, and the museum. The first
block of buildings was opened in 1905 by the Governor, and ever
since then the place has attracted an increasing number of visitors of
all kinds. In the second year of its existence there were 187,000
admittances; at the great annual religious festivals it is specially
crowded, as thousands of pilgrims pass through Tsinan on their way
to the sacred mountain, Tai Shan. From 8.30 a.m. till 6 p.m. preaching
goes on without intermission, a specially selected staff of native
preachers assisting the missionaries in this work; for the Chinese
prove themselves more able than Europeans to win converts to
Christianity.
Many of the students from the university and the schools
frequent the museum and lecture-hall, the walls of which are hung
with charts and diagrams calculated to give the thoughtful Chinaman
much food for reflection. After studying the comparative tables of
commerce, population, &c., a visitor is said to have exclaimed, “Why!
the only thing that China is ahead in is population!” Lectures on
history, science, and religion are given in the hall, and are largely
attended by university students on Sunday, as, in imitation of our
Western custom, they have no classes at the university that day.
One day a week the museum is open to ladies only, and we met
the wife of the retiring Governor of the province just leaving the
building after an exhaustive examination of its contents. She was
accompanied by a considerable retinue on horseback and in chairs,
not to mention a motley crowd composed of the rag-tag and bobtail
of the town, carrying absurd little flags.
It has now been decided to attach a medical school to the
Institute, as there is none in the province, and a church is also to be
built. The American Presbyterians and the English Baptists are
combining for this medical school. The former society has had
medical work here for the last twenty-eight years, and for many
years they have had a hospital and dispensary in the eastern suburb.
There is also a free dispensary in the city, a Government affair,
where the patient is at liberty to choose either Eastern or Western
treatment. The majority choose the latter, and are treated by a
German naval doctor; they are indebted for his services to the
German Government, who have lent him for this purpose. There are
already classes for medical students in connection with several of the
mission hospitals in the province, who will form an excellent nucleus
with which to start the new college. The importance of medical
mission work in China is great, not only for its own sake, but also for
the purpose of familiarising the Chinese in the most remote corners
of the Empire with the benefits of Western science and the goodwill
felt towards them by Europeans and Americans, of which this is the
practical demonstration. The two continents are about equally
represented, and there are over three hundred doctors scattered
throughout the Empire: their fame extends far beyond the limits of
the neighbourhoods where they happen to be residing. They are
training numbers of intelligent young Chinamen to carry on their
work, but the establishment of colleges to complete the training of
these students is now becoming increasingly necessary.
The work already achieved by medical missionaries in China is by
no means small or unimportant. They form an association, by means
of which the task of fixing the terminology of medical science has
already been accomplished. They have published a standard
dictionary in Chinese, as well as the latest American and English
text-books on this subject. The Chinese medical student, therefore,
is not entirely dependent on oral teaching, if he has no knowledge of
English. Another branch of this work is the organised labour of their
research committee. The geographical distribution of disease, the
various forms of it prevalent in different districts, and the methods of
treatment come under this heading. Men of undoubted ability and
with the highest medical qualifications are engaged in this work.
The Chinese Government has recognised the value of what has
been already done by its official sanction of the Union College at
Peking—the first attempt made in China to give a full medical
4
education. The late Dowager Empress contributed to its initial cost,
and the Government has pledged itself to grant degrees to the
students who have successfully passed its examinations. There are
about seventy to a hundred students in it at the present time.
This is a somewhat long digression, but I think it will not be
without interest to readers to have a general idea of the scope of
medical mission work in China at the present time.
There is an arsenal near Tsinan, where an English officer, who
had just been allowed to see over it, told us they seemed thoroughly
expert, and able to reproduce anything they tried. They were busy
making locks for a canal, and less than a hundred miles away we
passed another large arsenal where they were busy making
ammunition. The smoky chimneys were quite suggestive of home!
The most interesting feature of our stay at the capital was an
interview with the Governor of the province, to whom we had an
introduction. His Excellency Lord Wu is an intellectual-looking man,
but worn and bowed with age. He had granted us an audience one
afternoon, and on our arrival at his yamen (= official residence) we
were led through a circular doorway in the wall, into the gardens, in
which were little ponds and bridges, and an arbour made in the
shape of a boat. We waited the Governor’s coming in a summer-
house, a terrible European erection, furnished with a crimson and
“Reckitt’s blue” plush sofa and revolving chairs to match. On the
table were glasses and plates, with proverbs inscribed round them,
and cups of the type seen at a Sunday-school caterer’s. Cake,
champagne, and tea were set out on a parti-coloured table-cloth,
which was ornamented with a florid design in chain-stitch composed
of every colour of the rainbow. His Excellency soon made his
appearance, accompanied by an exquisite-looking interpreter who
spoke English well—better than he understood it, I fancy. For nearly
an hour he plied us with all sorts of questions as to my education
(he had been much exercised by F.R.S.G.S. on my Chinese visiting-
card), occupation, our past and future travels. He not only gave us
good advice with regard to our journey, but practical assistance—as
we afterwards discovered—by sending word to the magistrates on
our route through the province. An interested but somewhat ragged
audience watched us from the doorway, and the Governor’s personal
attendant played with his queue, but somehow nothing could disturb
the dignified impression of the old man. He had known Gordon, and
at the time of the Boxer troubles he had sent the missionaries safely
out of the province, in direct opposition to the orders he had
received from his Government. He is a strong, good man, and I
much regretted that our conversation had to be carried on through
an interpreter, for that process is paralysing to thought, not to
mention that one had grave doubts as to the accuracy of the
interpretation. The interview lasted about an hour, and was
terminated by His Excellency inviting us to drink champagne or tea,
after which he escorted us back through the garden to our chairs.
CHAPTER VI
The Sacred Shrine of Tai Shan

S
HANTUNG is the most interesting (historically) of all the
provinces in the Empire, and we determined to visit two
particularly sacred spots which were not far from the capital—
Tai Shan (one of the four sacred mountains of China) and Küfow, the
home of Confucius.
We started on a beautiful autumn morning, with quite an
imposing cortège. First came our mounted military escort, then
ourselves in two light mountain chairs, each carried by two men and
with two to relieve them. Next came the cart, with our interpreter (a
minute person clad in khaki, boasting the name of Fergus Summer—
though a Chinaman), the cook, some baggage, and the men’s
bedding. Finally a mule brought up the rear, carrying our baggage,
some one’s bedding, and our other servant perched cross-legged on
the top. It was a delightfully exhilarating day, and not less so the
thought that we were really beginning our adventures off the beaten
track, and had said good-bye to the railway for at least three weeks,
to try far pleasanter, if slower, means of transit. The chairs were light
frames with a hanging foot-rest, quite comfortable when padded
with our bedding, and with an awning fastened on light bamboo
rods above us. We were well manned, so we comforted ourselves as
to the fact of their carrying us between twenty and thirty miles a day
by remembering that they were only too pleased to get the job.
They were pleasant, cheery fellows, with fine mahogany-coloured
backs, and did not seem the least bit jaded at the end of the day’s
march. They go lightly clad, the most solid part of their clothing
being the pig-tail curled round their heads. The rest of their
garments were well ventilated, and sometimes seemed in danger of
falling to pieces altogether. Their food seemed most inadequate—a
chunk of bread, an onion (alas for the passenger who hates the
smell of an onion!), endless cups of tea at wayside restaurants, and
frequent whiffs of smoke from their tiny pipes. They are wonderfully
good-tempered, always ready for a laugh, and most attentive and
careful for one’s comfort.

MOUNTAIN CHAIR

The first day passed without any adventure, but was pleasantly
spent in charming scenery, and we passed a somewhat uneasy night
trying to accustom ourselves to our new beds (light camp mattresses
with an air pillow under the hips—an excellent arrangement) and
strange surroundings in an inn. It was an easy task to get up early
next day, and we started at 6 a.m., so as to do a four hours’ stage
before breakfast—fifteen miles. The country was full of interesting
sights: one hamlet we passed through seemed to have a monopoly
of whips; every shop was full of them and of nothing else. In
another plaited straw for hats was the only article for sale. Farther
on, we came to a district where each village had large bunches of
maize hanging in golden clusters from the trees, looking like fruit. As
we turned a corner into a deep gully we came into a bevy of
barrows in full sail—like a fleet of blue-sailed boats—bearing down
upon us. They were the only ones we saw, as there was not much
wind, but it was an unforgettable sight.
As we approached the city of Tai An we were met by a fine
soldier in red plush breeches, but the rest of his costume was not to
match! He had come six miles from the city to act as our escort, and
told us of a noted Buddhist temple that we must stop and visit.
There was an extraordinary seated gilt Buddha, with a broad grin on
his face, and another grave one standing, but there was nothing
particularly noteworthy, as far as we could see. The soldier told us
that preparations had been made for our entertainment at the inn,
but we had arranged to stay with a hospitable American lady, who
had lived out here for over fifty years, and as soon as we arrived she
sent to engage chairs to take us next day up the holy mountain.
Chinese books say that it has been the holy mountain of the East for
the last 4000 or 5000 years; it is certainly one of the most
frequented to-day, and at the usual times of pilgrimage (February
and March) as many as 10,000 will go up in a day. Most of the
pilgrims go up on foot, a few on their knees, and the wealthy ones
in chairs.
We started betimes in chairs—there is a special guild of chair-
bearers, and they are simply wonderful—they are called “climb-
mountain tigers,” and as soon as they saw my size they demanded
an extra man. I was quite willing to comply with the demand,
though they would not have suggested it to a Chinaman of twice my
bulk! It was a lovely morning, worthy even of such an expedition.
We were carried about two miles across the fields before we came to
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like