Reader small image

You're reading from  Wearable-Tech Projects with the Raspberry Pi Zero

Product typeBook
Published inJul 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781786468819
Edition1st Edition
Languages
Right arrow
Author (1)
Jon Witts
Jon Witts
author image
Jon Witts

Jon Witts has been working within the IT industry since 2002 and specifically within Educational IT since 2004. He was introduced to Linux back in 2001 through his collaboration with two German artists who were visiting the arts organisation he was then working with. Having studied Fine Arts and Educational Technology and sought to innovate with open and accessible digital technologies within his creative practice, Jon is happiest when deconstructing technology and finding its limits. Jon has embedded within his school the use of Raspberry Pi computers, as an integral part of the delivery of the school's Computer Science curriculum as well as to run various school clubs and projects. Jon is a Raspberry Pi Certified Educator and also helps to organise and run the Hull Raspberry Jam events. I would like to thank my wife, Sally and our three daughters for putting up with all the cables and compoents around the house, and not least for being so tolerant of the need to dodge the robots racing round the kitchen floor!
Read more about Jon Witts

Right arrow

Preface

Are you interested in wearable-tech and gadgets? Do you want to know more about how you can use the Raspberry Pi Zero computer? This book has a series of projects which will show you some of the possibilities with wearable-tech and the Pi Zero, guiding you through each one from start to finish.

The Raspberry Pi Zero is a revolutionary product, designed and manufactured in the United Kingdom by the Raspberry Pi Foundation. This tiny computer provides powerful features, in spite of being such a small size; it measures a mere 65 x 35 mm! One of the advantages of its tiny size is that it is ideal to be used in wearable-tech projects.

You will begin at the beginning (as all good journeys do!) and learn how to install the required software for your upcoming projects. You will also learn how to control electronic devices with the GPIOZero Python library. Next, you will be creating some stylish wearable-tech projects such as a motion-reactive LED cap and Tweet-activated LED T-shirt. Towards the end of the book, you will be creating some useful health and fitness wearable-tech projects; these will help you monitor your heart-rate, track your movements with GPS, and count your footsteps with your own pedometer.

By the end of the book, you will have created a range of wearable-tech projects and learned enough about your Raspberry Pi Zero that you should be able to adapt these projects further or come up with your own creations!

What this book covers

Chapter 1, About the Raspberry Pi. This chapter introduces the Raspberry Pi Zero computer that we will be using throughout the book; it explains how to get the required software installed and running. We will look at how we can connect to our Pi Zero over SSH from a remote computer so we can program it without having to attach a monitor, keyboard or mouse. We will then look at how we can control basic electronic devices using the Python GPIOZero library. Finally, we will wire up an 'off switch' to our Pi Zero, so that when it is running headless in our later projects, we can safely power it 'off'.

Chapter 2, Scrolling LED Badge. In this chapter we will make a scrolling LED badge that you can program to display any message across and can be worn while out and about. We will make use of the Scroll pHAT HD from Pimoroni and our Pi Zero to create your badge. We will also look at how we can incorporate a battery pack to make this a portable solution. We will use Python to program our Scroll pHAT HD to display whatever message we want. Finally, we will look at ensuring this program runs as soon as we turn on our Pi Zero.

Chapter 3, Sewable LEDs in Clothing. This chapter uses stitchable LEDs and conductive thread to transform an item of clothing into a sparkling LED piece of wearable-tech, controlled with a Pi Zero hidden in the item of clothing. We will incorporate a Pi Zero and battery into a hidden pocket in the garment and connect our stitchable LEDs to the Pis GPIO pins so that we can write a Python program to control the order and timings of the LEDs.

Chapter 4, A Motion-Reactive LED Cap. In this chapter we will make use of a Pimoroni Blinkt LED strip, an Adafruit Triple-Axis Accelerometer and a Pi Zero to create a cap with a super-bright strip of RGB LEDs across the front. This will change its colors and display pattern, based upon the direction and speed that the wearer moves.

Chapter 5, A Tweet activated LED T-shirt. This project shows us how to incorporate some LEDs into another item of clothing, a t-shirt or jumper, and again wire them back to a hidden Pi Zero and battery pack. With our Pi Zero connected to a Wi-Fi network, we will then write a program, which monitors Twitter and listens out for trigger phrases. Whenever these trigger phrases are detected, our LEDs will light up in the different patterns we have programmed them to.

Chapter 6, An LED Laptop bag. Here we will cut and resolder an Adafruit DotStar Strip into a matrix of super-bright, controllable RGB LEDs. We will then attach this matrix to the front of a laptop bag. Next, we will hide our Pi Zero and battery pack inside the pocket of the bag and write the Python program to control our RGB LED matrix.

Chapter 7, Create Your Own pedometer. In this chapter we will make use of an Adafruit Triple-Axis Accelerometer, a Pimoroni Scroll pHAT HD, and a Pi Zero to create our own pedometer. Once we have connected the accelerometer and Scroll pHAT HD to the Pi Zero, we will write the program, which reads the data from the accelerometer and converts it into steps taken. We will then complete our program to make it display the updating step count on the Scroll pHAT HD.

Chapter 8, Create Your Own Heart Rate Monitor. With this project, we will use a Pulse Sensor Amped to create our own heart rate monitor device. We will add a Pimoroni Enviro pHAT and a Scroll pHAT HD to enable us to read the sensor data and display an animation of a heart beating in time with ours. As well as this, the device will display our heart's current BPM on the Scroll pHAT HD.

Chapter 9, Create Your Own GPS Tracker. Our final chapter will see us create a portable GPS tracker for bikers, runners or walkers to use when out and about. The GPS tracker will log your GPS coordinates, including elevation and time. We will also configure the Pi to create a file in the correct format for you to import into Google Maps or Google Earth to plot the course you have taken.

What you will need

The required hardware for each project is mentioned right at the beginning of every chapter; all software that is used in these projects is Open Source and freely available from the Internet. You will need a Raspberry Pi Zero of course; the latest Pi Zero W is recommended, so that you can make use of the on-board Wi-Fi to access your computer remotely without the need for an additional USB Wi-Fi dongle.

You will also need access to various tools for the different projects in this book. Again, each chapter details what you will need; the essential 'shopping list' includes a soldering iron, wire strippers, and a set of crocodile-clip helping hands.

Who this book is for

Everyone.

While some prior knowledge of Python programming and use of the terminal on the Raspberry Pi would be advantageous, they are by no means necessary. Each chapter clearly sets the steps to be taken on your wearable-tech adventure. Chapter 1, About the Raspberry Pi, assumes no prior knowledge to get your Pi Zero and you up and running. The complexity of the electronic devices used progress incrementally as you work through the chapters; there are clear steps to follow and pictures to help you at every turn along the way.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, path names, dummy URLs, user input, and Twitter handles are shown as follows: "We start a while True: loop, which will continue until we stop the program." A block of code is set as follows:

 def adxlToRGB(axis):
axes = adxl345.getAxes(True)
absADXL = abs(axes[axis])
if (absADXL >= 1):
absADXL = 1
rgbADXL = int(255 * absADXL)
return rgbADXL

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

 def adxlToRGB(axis):
axes = adxl345.getAxes(True)
absADXL = abs(axes[axis])
if (absADXL >= 1):
absADXL = 1
rgbADXL = int(255 * absADXL)
return rgbADXL

Any command-line input or output is written as follows:

sudo nano /lib/systemd/system/wearableHat.service

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on the blue Select image button and browse to the Jessie Lite zip archive you just downloaded"

Warnings or important notes appear like this.
Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail feedback@packtpub.com, and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you. You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at: https://github.com/PacktPublishing/Wearable-Tech-Projects-with-the-Raspberry-Pi-Zero. We also have other code bundles from our rich catalog of books and videos available at: https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title. To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy. Please contact us at copyright@packtpub.com with a link to the suspected pirated material. We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at questions@packtpub.com, and we will do our best to address the problem.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Wearable-Tech Projects with the Raspberry Pi Zero
Published in: Jul 2017Publisher: PacktISBN-13: 9781786468819
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Jon Witts

Jon Witts has been working within the IT industry since 2002 and specifically within Educational IT since 2004. He was introduced to Linux back in 2001 through his collaboration with two German artists who were visiting the arts organisation he was then working with. Having studied Fine Arts and Educational Technology and sought to innovate with open and accessible digital technologies within his creative practice, Jon is happiest when deconstructing technology and finding its limits. Jon has embedded within his school the use of Raspberry Pi computers, as an integral part of the delivery of the school's Computer Science curriculum as well as to run various school clubs and projects. Jon is a Raspberry Pi Certified Educator and also helps to organise and run the Hull Raspberry Jam events. I would like to thank my wife, Sally and our three daughters for putting up with all the cables and compoents around the house, and not least for being so tolerant of the need to dodge the robots racing round the kitchen floor!
Read more about Jon Witts