Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi John Allworkdownload
Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi John Allworkdownload
https://ebookmass.com/product/programming-voice-controlled-iot-
applications-with-alexa-and-raspberry-pi-john-allwork/
https://ebookmass.com/product/programming-the-raspberry-pi-third-
edition-getting-started-with-python-simon-monk/
https://ebookmass.com/product/hacking-electronics-learning-
electronics-with-arduino-and-raspberry-pi-2nd-edition-simon-monk/
https://ebookmass.com/product/raspberry-pi-electronics-projects-for-
the-evil-genius-1st-edition-norris/
https://ebookmass.com/product/arduino-and-raspberry-pi-sensor-
projects-for-the-evil-genius-1st-edition-chin/
Programming Kotlin Applications: Building Mobile and
Server-Side Applications With Kotlin Brett Mclaughlin
https://ebookmass.com/product/programming-kotlin-applications-
building-mobile-and-server-side-applications-with-kotlin-brett-
mclaughlin/
https://ebookmass.com/product/integration-of-mechanical-and-
manufacturing-engineering-with-iot-r-rajasekar/
https://ebookmass.com/product/beginning-programming-with-python-for-
dummies-3rd-edition-john-paul-mueller/
books
books books
Programming
# constants
and gained his MSc at UMIST.
”
T%H:%M:%S.00Z
skill and terminology such as utterances, intents, slots, and conversations After two years working for ICL as
m - % d
are explained. Debugging your code, saving user data between sessions, a design engineer, he returned to
UTC_FORMAT = “ % Y - %
a z o n . c o m / a u t h/o2/token”
m
https://api.a
S3 data storage and Dynamo DB database are discussed. UMIST where he graduated with a
PhD in ‘Design and Development of
Microprocessor Systems’.
TOKEN_URI = “
In-skill purchasing, enabling users to buy items for your skill as well as
s constants
certification and publication is outlined. Creating skills using AWS Lambda
# Token acces
He worked for several years in
and ASK CLI is covered, along with the Visual Studio code editor and technical support and as manager
n t i a l s . k e y [ ‘ CLIENT_ID’]
rede T’]
CLIENT_ID = c ‘CLIENT_SECRE
local debugging. Also covered is the process of designing skills for visual in electronics distribution, working
closely with Intel engineers and
e n t i a l s . k e y [
= cred
displays and interactive touch designs using Alexa Presentation Language.
CLIENT_SECRET
later designing Inmos Transputer
systems.
The second half of the book starts by creating a Raspberry Pi IoT “thing”
to control a robot from your Alexa device. This covers security issues and Having taught electronics at
s_to ken():
methods of sending and receiving MQTT messages between an Alexa Manchester Metropolitan University,
he retired in 2011 but retained
def get_acces
device and the Raspberry Pi.
his interest in electronics and
= {
token_params t_credentials
”,
programming. His other occupations
Creating a smart home device is described including forming a security consist of traveling, walking,
p e ” : “ c l i e n
profile, linking with Amazon, and writing a Lambda function that gets geocaching and spending time on “grant_ty a c t i ve_events”,
e x a : : p r o
“scope”: “al
triggered by an Alexa skill. Device discovery and on/off control is his allotment.
LIENT_ID,
demonstrated.
l i e n t _ i d ” : C
“c
Next, readers discover how to control a smart home Raspberry Pi display
n t _ s e c r e t ” : CLIENT_SECRET
from an Alexa skill using Simple Queue Service (SQS) messaging to “clie
switch the display on and off or change the color.
A node-RED design is discussed from the basic user interface right up to
}
configuring MQTT nodes. MQTT messages sent from a user are displayed Elektor International Media
on a Raspberry Pi. www.elektor.com
token_headers
= {
o n / j s o n ; c h a r set=UTF-8”
”: “applicati
A chapter discusses sending a proactive notification such as a weather “Content-Type
alert from a Raspberry Pi to an Alexa device. The book concludes by
}
explaining how to create Raspberry Pi as a stand-alone Alexa device.
I , h e a d e r s = t oken_headers
s
Dr John Allwork
ts.post(TOKEN
_UR
n s e = r e q u e
respo
● All rights reserved. No part of this book may be reproduced in any material form, including photocopying, or
storing in any medium by electronic means and whether or not transiently or incidentally to some other use of this
publication, without the written permission of the copyright holder except in accordance with the provisions of the
Copyright Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licencing Agency
Ltd., 90 Tottenham Court Road, London, England W1P 9HE. Applications for the copyright holder's permission to
reproduce any part of the publication should be addressed to the publishers.
● Declaration
The Author and Publisher have used their best efforts in ensuring the correctness of the information contained in
this book. They do not assume, and hereby disclaim, any liability to any party for any loss or damage caused by
errors or omissions in this book, whether such errors or omissions result from negligence, accident, or any other
cause.
All the programs given in the book are Copyright of the Author and Elektor International Media. These programs
may only be used for educational purposes. Written permission from the Author or Elektor must be obtained before
any of these programs can be used for commercial purposes.
● F irst edition
© Copyright 2023: Elektor International Media B.V.
Editor: Alina Neacsu
Prepress Production: Jack Jamar | Graphic Design, Maastricht
Elektor is part of EIM, the world's leading source of essential technical information and electronics products for pro
engineers, electronics designers, and the companies seeking to engage them. Each day, our international team develops
and delivers high-quality content - via a variety of media channels (including magazines, video, digital media, and social
media) in several languages - relating to electronics design and DIY electronics. www.elektormagazine.com
●4
Contents
Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
●5
Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi
●6
Contents
4.14 AMAZON.SearchQuery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.15 ASK SDK Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.16 Intent error logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.17 Language understanding NLU and Automatic speech recognition ASR . . . . . . . . 82
4.18 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
●7
Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi
●8
Contents
●9
Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi
● 10
Contents
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
● 11
Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi
Dr. John Allwork was born in 1950 in Kent, England and became interested in electronics
and engineering at school. He went to Sheffield University on their BEng Electrical and
Electronic Engineering course. There he developed an interest in computers and continu-
ed his education on an MSc course in Digital Electronics and Communication at UMIST.
After two years working for ICL as a design, commissioning and test Engineer he returned
to UMIST where he graduated with a Ph.D. in ‘Design and Development of Microprocessor
Systems’.
He worked for several years in technical support and as a manager in electronics distribu-
tion, working closely with Intel Application Engineers and followed this with design work
using the Inmos Transputer systems.
Having taught at Manchester Metropolitan University he retired in 2011 but has kept up
his interest in electronics and programming as well as his other occupation of travelling,
walking, geocaching and spending time on his allotment.
● 12
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Introduction
This book is aimed at anyone who wants to learn about programming for Alexa devices
and extending that to Smart Home devices and controlling hardware, in particular the
Raspberry Pi.
It covers Alexa programming concepts from the basic concepts of Alexa Voice service, the
interaction model and the skill code which runs on AWS (Amazon Web Services) Lambda.
It takes the reader through all stages of creating skills to certification and publishing,
including writing skills that involve in-skill purchasing. It discusses different ways of crea-
ting skills, then moves on to creating visual skills using APL (Alexa Presentation Langua-
ge) for screen-based Alexa devices.
The book then moves on to cover different ways of controlling hardware including the
Internet of Things and Smart Home devices. There are interfaces with the Raspberry Pi
using MQTT and SQS communication, displaying on the Pi using Node-RED and Python
code.
Although mostly based on Python, Node.js examples or links are also provided. The full
code is provided in a separate document.
Please note that Alexa skill development, the developer console and APL versions have
changed since writing this book, so please bear with the author if there are slight diffe-
rences.
I do not pretend to know all there is about Alexa and Raspberry Pi programming – they
seem to advance faster than I can follow! I have a background in hardware and software
design. I am sure that there are areas where some programmers may be offended by my
code and that there may be better ways to write it, but I have written and tried all the
examples and know they work. I hope the examples will spur you on to find solutions to
your own problems. Should you need more information then please try the online help
and the Raspberry Pi or Alexa forums: alexa.design/slack is particularly good. There are
plenty of programmers out there willing to help solve your problems, often extremely
quickly; certainly faster than I would get back to you!
I wish to thank my friends for encouraging me, especially Dr. Hugh Frost, Andy Marsh
and Dr. John Nichols; the Alexa staff: in particular Jeff Nunn, Jeff Blankenburg and Ryan J
Lowe; helpers on the alexa.design/slack group, including Andy Whitworth; subscribers of
my YouTube and GitHub channels who have made encouraging comments; and the many
anonymous people on the internet, forums, blogs and websites who have answered many
questions, not just my own – keep up the good work. Not least of all I would like to thank
my wife Penny, for supporting me throughout.
● 13
Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi
In 2017, Amazon released a combination of the Dot and Show, called the Echo Spot. In
the same year, the Echo Show was released and featured a slanted, 7-inch touchscreen,
camera and speaker. This later changed to a 10-inch screen (Echo Show 10), and more
recently, added a 360-rotating display.
The Echo Show 5 came in 2019, (2nd gen in 2021), as well as Echo Show 8 and an Echo
Show 15 in 2021 designed for wall mounting.
There are other devices too, including the Button, Flex, Input, Look and recently the Astro
robot.
Here are some of my devices (not including smart devices). From the top: Echo Show 8,
Fire TV stick, Echo Auto, my original Echo dot, and the Echo Spot.
● 14
Chapter 1 ● Alexa History and Devices
Even though many devices have a screen, you should always design for ‘voice first’.
The interaction model is what your users say and how they communicate with your skill.
AWS Lambda is a serverless, event-driven computing service that lets you run your code.
Lambda can be triggered by many AWS services and you only pay for what you use.
When a user interacts with an Echo device, AVS sends a request to the skill which is run-
ning on AWS Lambda. The skill replies with a response that is turned into a speech and/
or visual response back to the user.
1.2 Pricing
Although there are charges for AWS Lambda, the AWS Lambda free tier includes one
million free requests per month and 400,000 GB-seconds of compute time per month, as
well as 500 Mb storage. As you can see, this is more than enough for a beginner. For more
information, see https://aws.amazon.com/lambda/pricing/
For developers whose skills use more than this, Amazon provides Promotional Credits
which reward those who build cloud-hosted applications, software, or tools for sustaina-
bility-related work.
For FAQ see reference 1.
● 15
Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi
We’ll be concentrating on Custom skills. Blueprint pre-built skills are also available and
easy to develop but have reduced options for user experience. We’ll also study smart
home skills, of course.
1.5.2 Invocation
The ‘invocation’ is the phrase used to trigger your skill, e.g.: ‘Alexa, open Johns’ weather
skill’ or ‘Alexa, launch my cooking skill’.
1.5.3 Utterances
Utterances are the phrases that your user says to make a request. There can be many
ways to achieve the same result, e.g.: What’s the time? What’s the time now? What time
is it? – you will have to think of as many possible ways that your user can interact with
your skill. Nevertheless, Alexa will build your model and try to find similar utterances.
All the possible ways to do this can be difficult to describe (considering, for instance, how
many different ways and types of pizza someone might order), so Amazon has recently
announced Alexa Conversations to help with this. For more information, see reference 3.
● 16
Chapter 1 ● Alexa History and Devices
• Built-in Intents
- Standard built-in intents: These are provided by default by Amazon that every skill
must have, e.g.: AMAZON.StopIntent, AMAZON.CancelIntent, AMAZON.Fallback-
Intent, etc. and include: AMAZON.YesIntent, and AMAZON.NoIntent, intents for
screen control (e.g., scroll up/ down/ left / right) and media intents (pause, repeat,
resume), and also an AMAZON.SendToPhoneIntent. You can see these when you
add an intent, and select “Use an existing intent from Alexa’s built-in library”
- The Alexa Skills Kit also provides a library of specific built-in intents and includes
intents such as Actor intents, Books, Calendar, LocalBusiness, Music, TV, Series,
WeatherForecast, etc.
These intend to add functionality to your skill without you having to provide any sample
utterances. For example, the WeatherForecast includes a search action (What is), an ob-
ject (WeatherForecast), location (London) and date (tomorrow) .
We won’t cover them in this book, see:
https://developer.amazon.com/en-US/docs/alexa/custom-skills/built-in-intent-library.html
• Custom Intents
• A Launch request that runs when our skill is invoked (as a result of the user saying,
‘Alexa open …’ or ‘Alexa, launch ...’).
• An Intent request which contains the intent name and variables passed as slot values.
• A SessionEnded request, which occurs when the user exits the skill, or there is an
unmatched user’s response (although you may be able to trap this out with AMAZON.
FallbackIntent).
This information is all packaged and sent as a request (and returned as a response) as a
JSON file. We’ll look at the JSON code later.
1.5.5 Slots
A slot is a variable that contains information that is passed to an intent. The user might
say ‘What’s the time in London’. Here ‘London’ (or Paris or Rome) is passed as a slot
variable to the intent code.
● 17
Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi
Amazon provides built-in slot types, such as numbers, dates and times, as well as built-
in list types such as actors, colors, first names, etc. In the previous example, we could use
AMAZON.GB_CITY which provides recognition of over 15,000 UK and world-wide cities
used by UK speakers.
However, some of these slots are being deprecated (including AMAZON.GB_CITY in favour
of AMAZON.CITY), so check. The full list is covered at ‘List Slot Types:
https://developer.amazon.com/en-US/docs/alexa/custom-skills/slot-type-reference.html#list-slot-types
Developers can create custom slots for variables that are specific to their skill.
When we define our utterances, slots are shown in curly braces: {city}, e.g.:
Example:
Intent GetTimeIntent
Utterance What is the time in
Slot {city}
The GetTimeIntent will trigger a function in your skill (which you might sensibly call Get-
TimeIntentFunction).
Slots are used to pass data from your VUI (voice user interface) to your program. As an
example, we might have an Alexa skill that asks for your name.
● 18
Chapter 1 ● Alexa History and Devices
At this point, the slot data is lost unless you save it. You can save data in a temporary
folder but more often data is stored in session attributes, you will find out later.
1.5.7 Endpoints
The endpoint is where your code is hosted. You can choose an Amazon-hosted, AWS
Lambda ARN (Amazon Resource Name) site or host it yourself on an HTTPS site that you
manage.
If you choose an AWS site, it will give you an ID beginning arn:aws:lambda and look
like: arn:aws:lambda:<region>:function:<functionID>. You skill also has an ID looking
something like this: amzn1.ask.skill.a0093469-4a50-4428-82e6-abcde990fgh3.
1.5.8 Regions
If using an AWS-hosted site, you should host your code in a region near to your user.
We’ll see that there are lots of regions, but for some skills currently only North Virginia
is available.
If the shouldEndSession parameter is ‘true’ the skill terminates, otherwise, the session
remains open and expects the user to respond. If no user input occurs, a reprompt is
sent if included in the code. If the user still doesn’t respond (after about 8 seconds), the
session ends 4.
Skill connections and progressive responses may override these rules. For example, if
a skill has to get further information from another source, e.g., when your taxi will be
available, or pizza delivered.
● 19
Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi
The basic JSON request contains information on the active session, the context, the sys-
tem information on the application (ID), user, deviceID, and the request itself:
{
“version”: “1.0”,
“session”: {
( ..session parameters)
}
“context”: {
( ..information on the Alexa device)
}
“System”: {
…
“request”: {
“type”: “IntentRequest”,
“requestId”: “amzn1.echo-api.request.745d…9a”,
“locale”: “en-GB”,
“timestamp”: “2022-04-14T09:27:01Z”,
“intent”: {
“name”: “HelloWorldIntent”,
“confirmationStatus”: “NONE”
}
}
The reply JSON contains is the response speech and reprompt, as well as the state
of the EndSession and session attributes.
{
“body”: {
“version”: “1.0”,
“response”: {
“outputSpeech”: {
“type”: “SSML”,
“ssml”: “<speak>Welcome, you can say Hello or Help.</speak>”
},
“reprompt”: {
“outputSpeech”: {
“type”: “SSML”,
“ssml”: “<speak>Welcome, you can say Hello or Help.</speak>”
}
},
● 20
Chapter 1 ● Alexa History and Devices
“shouldEndSession”: false,
“type”: “_DEFAULT_RESPONSE”
},
“sessionAttributes”: {},
“userAgent”: “ask-python/1.11.0 Python/3.7.12”
}
}
The response can get more complicated if there is a dialog session occurring (i.e., if the
program hasn’t enough information to complete the intent request and has to ask for
more).
We’ll look at the information passed in the JSON request and response and how to extract
it in a later chapter.
The current categories are: At home, Kids recommended, Learning and knowledge, Fun
and Games, Storyteller, Greetings and Occasions, Communities and Organizations, and
Business 6. We won’t cover them here.
● 21
Programming Voice-controlled IoT Applications with Alexa and Raspberry Pi
1.10 Summary
We’ve seen how the Alexa devices have developed from the original voice-only device to
screen-based and robot devices, how the Alexa Voice service works and looked at termin-
ology – Invocation, Utterances, Intents and Slots. Finally, we looked at a skill session and
how data is passed and saved during a session and between sessions.
In the next chapter, we’ll see how to set up an Alexa account before moving on to our
first Alexa skill.
1.11 References:
1. https://aws.amazon.com/lambda/faqs/
2. https://developer.amazon.com/en-US/docs/alexa/ask-overviews/list-of-skills.html
3. https://www.youtube.com/watch?v=1nYfRvg976E
4. https://developer.amazon.com/en-US/docs/alexa/custom-skills/
manage-skill-session-and-session-attributes.html
5. https://www.json.org/json-en.html
6. https://blueprints.amazon.com
● 22
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Exploring the Variety of Random
Documents with Different Content
ceiling. But wasn't it a narrow shave!"
"That's what it was," answered Don, soberly. "I don't want another
like it."
"Nor I," added Bob, and Leander shook his head doubtfully.
"I wonder how it started," was Robert Menden's question. "Danny,
can you explain it?"
"Sure an' I can't, sur, savin' to say that I was sick, an' maybe I didn't
put the fire out very good, sur;" and Danny looked as if he had
committed the greatest crime on earth. The origin of the fire was
never fully explained, but probably Danny's view of it was correct.
The fire brought forth another lecture from old Jacob. "Ye can't be
too careful, nohow," he said. "Ye want to see to it thet not a spark is
allowed around. If the Dashaway had been burnt up, like as not
most of us would have lost our lives."
"I am sure we'll all be careful in the future," said Dick.
"You kin bet I'll be on me guard, so I will," broke in Danny. "Dat fire
most scared me into a fit, dat's wot it did."
The nights were now beautiful ones. A cloudless sky and millions of
stars twinkled down upon the polished deck of the Dashaway as she
bowled along before a steady breeze, which old Jacob declared was
"jest about right, any way o' lookin' at it." It was cool, too, for that
locality, and the balance of the trip promised to prove a most
delightful one.
Passing along the Great Bahama Bank to the south of the Andros
Islands, the course had been toward Acklin Island, on the southeast,
and then past Providence Island, straight onward to a course five or
six miles north of the upper coast of Hayti and Dominica.
"We might stop along the coast o' Dominica," observed old Jacob,
one day, as he surveyed the distant coast line with his long
telescope.
"I wouldn't stop unless it is necessary for stores," returned Robert
Menden. "Remember, we want to get to Porto Rico just as quickly as
possible."
"We have stores enough to last us to San Juan. I saw to thet afore
we pulled up anchor at St. Augustine."
"Then we'll go right straight through," decided Dick; and as he was
the owner of the Dashaway, that settled the matter.
But going right straight through was not such an easy matter as
anticipated. Early on the following day a heavy fog set in, and by
noon it was so thick that one could not see twenty feet ahead. At
once old Jacob ordered the jib taken in, also the topsail, while the
mainsail was closely reefed.
"This is one o' the wust places in the world fer a fog," was the
Yankee tar's comment. "Afore ye know it if we ain't careful we'll run
on a hidden bank. We must keep a strict watch, and keep the fog
horn blowing until the fog lifts." And this was done, one and another
taking his turn at the big horn until he was tired. Once, about seven
o'clock, they heard an answering horn, which seemed to come closer
and closer, but just as they felt they had good cause for alarm, the
sound began to recede, until it was lost in the distance.
"This is reg'lar smugglers' weather," said old Jacob. "They love it, for
they can land goods 'most anywhere, without the custom house
officials being the wiser."
"Did you ever run across any smugglers?" questioned Don, who
stood by.
"I did once—down on the coast o' Maine. They were bringin' in silk
from Chiny, and I helped the revenue officers collar, six o' 'em—
strappin' big fellers, too. Three o' the crowd were shot in the mix-up
and one o' 'em died in the hospital from his wounds. It was in that
muss that I got that," and the old sailor pointed to a long scar along
his neck.
"Excuse me, but I want nothing to do with smugglers," shuddered
Don. "They must be a bloodthirsty set."
"Some o' 'em are, lad—yet they ain't half so bad as the wreckers—
the chaps as sets up false lights along shore to lure a vessel to her
doom, so as they kin loot her. Those are the chaps as ought to be
hung, every mother's son on 'em!" and old Jacob shook his head
decidedly.
It was not until thirty hours had gone by that the fog began to lift,
raised by a gentle breeze which sent the Dashaway on her course as
lively as ever before.
"Off once more!" shouted Bob. "Hurrah!" and the others joined in
the cheer. It was calculated that two days more would bring them
within eight of Porto Rico, at a point near Manati, a city located
directly in the center of the northern coast, and but a few miles to
the westward of San Juan.
But once again their hopes were doomed to disappointment. The
wind lasted only until sunrise the next morning, then died out
utterly, leaving the sun to boil down on the deck with more
fierceness than it had shown for some time.
"Confound the luck!" growled Dick, as he gazed at the idle sails of
his craft. "I wonder how long this is going to last."
"Why not whistle for a breeze," suggested Bob, slyly. "I've heard that
will fetch it."
"All right, Bob, you whistle," replied Dick.
"I'll tell you what I'd like to do," said Don. "I'd like to take a swim
before we go ashore at San Juan."
"Hurrah! just the thing!" cried Leander, throwing up his cap. "We'll all
go in together!" And he rushed down to the cabin, to don his
bathing trunks. All of the other boys followed, even Danny taking
part.
CHAPTER X.
A SWIM NOT LIKELY TO BE FORGOTTEN.
"Dick!"
"Leander!"
"Oh, my side!"
"Oh, my leg!"
"Are you seriously hurt?"
"I—I don't know."
"I've had all the wind knocked out of me."
"Ditto with me. What a tumble to take!"
"What kind of a place is this?"
"A hole—a big, deep, dark hole. One of the caves, perhaps."
"Do you think it's a—a bear's den, or something like that?"
"No, I don't. I reckon it's just a common, everyday hole, or cave.
The question is, how are we going to get out?"
"To get out?"
"That's what I said."
"Climb out, of course."
"That's easy enough to say, but just look up and see how far we are
from the top."
They looked up. The hole was all of thirty-five or forty feet deep, and
from ten to fifteen feet across. The sides were of dirt and rocks,
covered here and there with wet moss.
Luckily they had landed on a pile of half-decayed leaves and tree
branches, otherwise they must have been seriously injured. The
rushes and some dirt had fallen all around them.
For a full minute neither spoke. During that time they examined the
walls of the hole.
"We've got to get out somehow," said Dick, at last. "But to climb
that wall seems impossible."
"Let us try it, anyway," returned Leander.
He found what he considered the best place, where several jagged
rocks projected, and by digging his hands into the soil succeeded in
pulling himself up a distance of eight or ten feet.
"Look out!"
As Dick uttered the cry he leaped back out of danger.
Down came several of the rocks, accompanied by a great mass of
dirt.
Leander followed, to roll over on his back on top of the pile.
"Great Cæsar!" gasped the fallen one. "I didn't think I was going to
pull down the whole wall over me."
"Don't try that again, or we may be buried alive," cautioned Dick.
"I don't think I will try it," was the rueful answer. "But, Dick, we
must get out."
"That's true."
"Let us yell for help."
"I don't believe anybody is within hearing distance."
"Never mind, we can try it."
Both raised their voices, not once, but half a dozen times. Then they
listened intently.
"Did you hear anything?" asked Dick.
"Not a sound."
Their faces fell. What were they to do next?
"If we only had a rope," sighed Leander.
"Or a long pole."
They walked around the flooring of the hole dismally. Then Dick
drew out his watch and his face brightened.
"The fifteen minutes are up. They'll be hunting for us presently."
He was right; the others of the expedition were both hunting and
calling, but nothing was seen or heard of them.
Led by old Jacob the party went through the orange grove, but came
up a goodly distance to the left of the hole in which the poor boys
were prisoners of nature.
Another quarter of an hour went by. To Dick and Leander it seemed
an age. Again they cried out, but the top of the hole being smaller
than the bottom, their voices were as muffled as though they were
prisoners in a huge bottle.
"This is truly a pickle," groaned Dick, as he threw himself on one of
the fallen rocks. "I must say, I'm stumped."
"So am I."
"I'm going to try throwing stones out of the hole," said Dick, after
another interval of silence. "Anything is better than doing nothing."
Both boys began to shy out all of the stones they could pick up.
"We're really making the hole deeper," observed Leander, when
suddenly the opening above them was darkened, and they saw a
negro boy looking down at them with eyes as big as saucers.
"Hullo, help us out!" cried Leander, eagerly; but at the sound of their
voices the negro boy took to his heels as fast as he could go.
"He's gone!"
"Perhaps he has gone for a rope."
"More than likely he was scared to death. He'll go home and say he
saw a ghost."
Another quarter of an hour went by. Then they heard footsteps
approaching, and two stalwart Caribs appeared. Behind them came
the little boy, trembling with fear.
"Hullo!" repeated Leander. "Help us out, will you?"
"Un Americano!" muttered one of the Caribs. "How you git down
dar?" he asked, in broken English.
"We fell through the rushes."
"Um—bad place dis to walk."
"So we have discovered. Will you kindly help us out?"
Both of the negroes nodded. Then they withdrew, to consult one
with another. Presently they came back.
"How much give if pull you out de hole?" demanded the one who
had previously spoken.
"Give?" came from both boys simultaneously.
"Ye—as, Americano rich boys, not so?"
"No, we are not rich," replied Dick in disgust. "But we'll pay you,
don't fear."
"How much give?"
"Oh, I don't know."
"We'll give you a dollar," added Leander. "Gosh, but they believe in
making money, don't they," he added, in a whisper.
"No take dollar," came from the Porto Rican. "Take ten dollar."
"Ten dollars!" gasped Dick, not so much over the amount of the
sum, but because of the "cheek" in asking it. "You don't want much,
do you?"
"We'll give two dollars—we can't pay any more," said Leander.
But at this the Caribs shook their woolly heads. They were bound to
make money out of the Americans' misfortune. Such a thing as
being generous never entered their heads.
"Ten dollar, or we go away again," said the one who could speak
broken English.
"We'll give you three dollars," said Dick.
"No, ten dollar."
To this the Caribs stuck, and at last the boys promised them the
amount.
"But you have got to pull us out first," said Leander.
Even to this the negroes demurred, and in the end it was agreed to
pay five dollars first, and the second five when they were safe.
Dick took some Spanish money and tied it in, a handkerchief, which
he threw up so that the largest of the Caribs could catch it. Then
one of the natives ran off to get a long rope.
Getting up out of the hole by the aid of the rope was comparatively
easy. As soon as the youths were on the top of the earth once more,
each of the natives caught a boy and held him.
"Now pay udder five dollars to Bumbum," grinned the leader of the
pair.
"Is your name Bumbum?" demanded Dick.
"Yes, señor."
"All right, Bumbum, here is the money, and let me say that I think
you about the meanest Porto Rican on the island."
"Bumbum must earn his living, señor."
"I don't call this earning a living. What do you do, as a general rule?
Lie about to squeeze strangers?"
At this the Carib's face darkened. "No insult me, or you be sorry!" he
cried, and made a movement as if to draw some weapon from his
bosom.
"Come, let us be going," cried Leander, in alarm.
"I'm ready," was Dick's reply, and they hurried off in one direction,
while Bumbum and his companion, accompanied by the negro boy,
stalked off in another. Soon the two parties were lost to sight of
each other; but that was not the last, by any means, that was seen
of the wily Caribs.
CHAPTER XIII.
THE WAYSIDE INN.
"Well, well, boys, where have ye been? We've been a-huntin' high
an' low fer ye!"
And so speaking, old Jacob rushed up to them, followed by all the
others.
Dick told their story, to which the remainder of the party listened
with close attention.
"It's lucky the Caribs came up," was Robert Menden's comment. "But
they made you pay dearly for their services."
"It was downright robbery!" burst out the old Yankee tar. "If I run
across 'em, I'll make 'em give up nine dollars o' the money, sure;
mark my words on't!"
"Well, I'm mighty glad we are out of it," said Leander. "I wouldn't
want to spend a night down in that hole for twice ten dollars."
"Nor I," added Dick. "Next time I'll be sure where I am stepping."
They continued on their way until five o'clock, when it began to rain.
"No use of getting wet," declared Robert Menden. "I move we seek
shelter for the night."
This was agreed to, and they hurried on to where there stood a sort
of wayside inn—a rambling, two-story affair, built of rough stone and
whitewashed.
A tall and not overly-pleasant looking Spaniard received them, and
soon Dick had arranged for supper, lodging and breakfast for the
entire party.
The wayside inn was almost deserted, only the proprietor, his wife
and a negro servant being present.
They were shown to two rooms in the second story—low
apartments, but well ventilated—and here their host left them,
stating that supper would be ready at seven o'clock.
The boys surveyed the apartments with interest. Each room was
perfectly square, with its floor covered with a rough matting of sea-
grass. The walls were bare, saving for one or two religious pictures
miserably executed. The beds were old-fashioned "four-posters,"
covered with straw ticks and plain white sheets, nothing more.
"They don't need blankets," observed old Jacob. "A man can keep
warm without half tryin'. Thet's why the windows ain't got no glass
in 'em, an' there ain't no stoves around."
The rain continued to come down steadily, so that they could not
roam about the place. After a general washing up, they went below,
to find their host, Jose Maguel, snoring lustily in an easy-chair in the
parlor.
"Half-past six," said Menden, looking at his watch. "I wonder what
they will give us for supper?"
"He promised us chicken," answered Dick. "But it ought to be
cooking by this time."
He walked through the dining-room and into the apartment that did
duty as a kitchen. Beyond, in the yard, the servant was stirring up a
small charcoal fire, built under a shelter of palm thatch, the sides
being open so that the smoke and heat might escape.
Presently a negro boy hove into view on the road. He carried in his
hand the body of a dead rooster. As he came closer, Dick saw that
the fowl had steel spurs attached to his legs.
"A dead gamecock," he muttered. "I'll wager there has been cock-
fighting somewhere, and Señor Maguel is going to dish us up the
defeated fowl."
Dick hurried back to the others and told them of what he had seen.
At once old Jacob grew indignant and rushed to the rear of the inn,
where the servant was in the act of decapitating the dead fowl with
an axe.
"We won't eat thet, consarn ye!" he cried, pointing his long, bony
finger at the fowl. "We want chicken—good barnyard fowls—an'
don't ye forgit it!"
The girl did not understand a word of what was said, but she
understood his actions and stepped back, dropping the gamecock as
she did so. At once old Jacob secured the fowl, and marched into
the inn with it, and up to where Jose Maguel still sat snoring in the
chair. A shake of the shoulder aroused the innkeeper, and he gazed
in bewilderment when the old Yankee tar held up the gamecock
before his nose.
"Do ye suppose civilized Americans air a-goin' to eat thet?" came
from old Jacob, wrathfully. "I'd jest as lief eat crow. We want real
chicken, killed fer the purpose o' eating, understand?"
"Un Americano no like dis?" queried Jose Maguel, mildly.
"No, we don't like it, not by a jugful. You give us real chicken."
"Dis chicken—good chicken."
"It's a slaughtered fowl from one o' yer cockfights," roared old
Jacob. "Like ez not, he's pizened from the other bird's cuts. Oh, I
know all on ye do nothing but look at cock-fighting day in an' day
out, much to yer discredit. We want good chicken, understand?"
"Yes. Señor shall have good chicken," growled the Spaniard; and
inwardly very angry, but not daring to show it before so many
strangers, he took the gamecock and passed into the kitchen with it.
"He'll make you eat it if he can," observed Leander. "He's mad clear
through, I can see that."
"I'm going to watch him, lad, until the meal is on the table," replied
old Jacob; and this he did, and made certain that they got a chicken
which was caught and killed for that purpose. Cock-fighting is a
national sport in Porto Rico, and it is a great trick to work off the
slain fowls on anybody who does not know the difference, the
natives rarely eating their fallen champions.
When supper was served it was by no means a bad meal, although
all of the party had eaten better. It consisted of chicken, rice cakes,
fried sweet potatoes, baked bananas, and bread and jelly, with
strong native coffee. As they ate, the host sat by, but said nothing to
them.
"We may as well retire early," observed Robert Menden. "We want to
reach the vicinity of the caves by to-morrow."
"Did you ask the landlord about the caves?" queried Don.
"I mentioned them in an off-hand way, but he said he knew nothing
about them." And this, let me add, is not strange, for it is but lately
that the caves have become known to the great majority of people.
"We don't want to let anybody suspect our mission here," put in
Bob. "They might follow and rob us, you know."
"Thet's it," added old Jacob. "As long as we know about where the
caves are, ye had better keep yer trap closed. I allers found thet it
paid not to talk too much in a strange country."
Robert Menden had his written description of the caves with him,
and before retiring, all hands pored over this, hoping by it to gain
some clew concerning the box with the initials, M. M. M.
The rain continued to come down, but it did not lightning and
thunder, and the gentle patter-patter on the roof acted as a lullaby
to the tired boys, everyone of whom went sound asleep in short
order. Then Robert Menden and old Jacob dropped off, and all
became quiet in the two rooms which the party occupied.
How long he slept Don did not know. But he awoke with a start and
sat up, not knowing what had aroused him.
The room was in semi-darkness, the smoky lamp being turned down
low. All of the others were sleeping soundly.
"Dick!" he cried softly, but there was no reply from his chum.
"Bob! Leander!" he continued after a long pause. Still no answer,
saving a long snore from Bob, as he turned over restlessly.
"It's mighty queer what woke me up," thought the boy. He usually
slept well.
He dropped back on the bed and tried to go to sleep again.
But the effort was a failure, and though he lay back with his eyes
tightly closed, he was as wide-awake as before.
Then, of a sudden, although he heard nothing, a peculiar sensation
stole over him, and he became convinced that some stranger was in
the apartment!
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
ebookmasss.com