Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Raspberry Pi Sensors

You're reading from   Raspberry Pi Sensors Integrate sensors into your Raspberry Pi projects and let your powerful microcomputer interact with the physical world

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781784393618
Length 192 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Rushi Gajjar Rushi Gajjar
Author Profile Icon Rushi Gajjar
Rushi Gajjar
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Meeting Your Buddy – the Raspberry Pi FREE CHAPTER 2. Meeting the World of Electronics 3. Measuring Distance Using Ultrasonic Sensors 4. Monitoring the Atmosphere Using Sensors 5. Using an ADC to Interface any Analog Sensor with the Raspberry Pi 6. Uploading Data Online – Spreadsheets, Mobile, and E-mails 7. Creating an Image Sensor Using a Camera and OpenCV A. Shopping List Index

Preface

Raspberry Pi is a single-board, credit-card-sized, computer packed with many opportunities to explore and invent. It is really amazing to see kids start coding Python from scratch, and build a bird box that streams live video on the Internet to check whether a bird has got its meal. I remember that when I was a kid, I used to play with Lego toys attached to DC motors and batteries, which was engaging. At that time, I could not imagine the logic that went into coding, and did not get any chance to code my projects and control the movement of those Lego blocks using a mobile phone. But I am lucky enough now to get an opportunity to explain such projects and provide a launchpad for young creators who really have a passion to create something and change the world around us.

The world is moving towards a new era. Technology is revolutionizing daily needs and habits and making them available on a simple interface, which gave me motivation to write a book on Raspberry Pi sensors. It's a world of creativity, and the I believe that creativity comes when you start understanding and appreciating the fundamentals and start applying logic to it. A lot of information and projects on Raspberry Pi are floating on various webpages, and one wishes to achieve as much as he/she can. I feel that the information on webpages is often observed as incomplete. It gives us a quick start to build projects but does not explain what is behind them.

It is known that without actually diving too deep into electronic devices and communication protocols, you can start coding on Raspberry Pi and craft amazing projects. I have colleagues around me who often need to code and wire the sensors on the Raspberry Pi platform for their experiments. They can develop Python code on artificial neural networks in a short span of time, but when it comes to wiring something, they look around. I believe that a basic understanding of electronics is a plus for such prodigies out there, who want to develop code on such platforms. In the opposite scenario, hardware developers can wire sensors, ensures proper voltage levels on device pins, but when it is time to code, they need help.

The most interesting thing that I find with the Raspberry Pi is that I can still play with the hardware components and soldering iron, and code my hardware to make it live. This book provides a kick start for such creators, who really want to know how things work together, and want a direction for starting projects on sensor interfacing and the Internet of Things with Raspberry Pi. There is tremendous growth in technology when we look towards the connected array of everything around us.

Internet of Things opens up a new world for collecting data and analyzing it for better user experience. A lot of data from the array of sensors has been generated from several different sensor nodes. In this context, the Raspberry Pi provides us with the opportunity to start with simple projects, such as uploading data to the Internet from a developed sensor station, as described in the chapters of this book. This will be your first step to building an Internet of Things project. Another interesting thing is that with the rise of Raspberry Pi 2 model B, developers have got enough processing power to perform computation-intensive algorithms on the Raspberry Pi. Therefore, image processing has been included in one of the chapters. It would have been very difficult to try to explain image processing to beginners, but I have at least tried to offer a simple start for readers so that they begin image processing on their own.

This book explores five different projects, any of which can be a startup for different ways of building electronics projects. The approach I have followed while preparing the projects is quite interesting. This is the methodology I often follow to develop complex hardware designs. Although I do not rely on breadboards (as I am more into high-speed circuit designs), small project prototypes, some of which are covered in this book, can easily be wired on breadboards. The first approach should be to purchase the best hardware components (preferably through hole for breadboard testing), on which you can rely when the code is not working or not giving the proper results. Prepare a block diagram and consider each issue that may occur during hardware and firmware design. Second, read datasheets of components used and ensure every single entity meets the design requirements. Thirdly, wire the components to the breadboard and check it thoroughly. Finally, when the hardware is built robustly, write the code (or firmware), and rewrite it to make it more perfect. Remove the unnecessary variables and unreachable code or loops, handle interrupts, define the sleep time and watchdogs of a processor, and manage proper memory segments to avoid crashes. However, this book has followed mostly simple code that does not go that deep into managing embedded programming. Installing useful coding libraries on the Raspberry Pi takes care of the faults often created by a programmer. Just call a function and it does all the embedded calls in the background. Thanks to the developers of the Raspberry Pi libraries, with which we build more robust code (whether knowingly or unknowingly). When you prepare a sample of code, I advise you to break it down into pieces.

You may face some difficulty when building the project for getting data from temperature, humidity and light sensors. First, get it done for temperature and humidity, and then code for the light sensor. Whenever both pieces of code give you the desired values, recode them. Then you can combine them by managing the function calls.

When writing the chapters, I have followed a common theme across the book: first the setup, then the purpose of the project, and finally describing the hardware with complete details. In some of the chapters, the software has been divided into components, and then they have been merged so as to avoid monotony for you. I apologize to you for being lengthy in the theory portion in some parts of this book, but I am sure that you will love to read and learn a lot from it, and you can get the most out of it.

Any questions, improvements, and suggestions are welcome, and should probably take place in the GitHub issues for the book at https://github.com/rushigajjar/raspberrypisensors so that everybody can take part. Besides that, anybody can contact me on LinkedIn at https://in.linkedin.com/in/rushigajjar, and send messages regarding their interesting projects and startups. I would really love to hear about it. Or you can send tweets by sharing temperature and luminance values at @rushigajjar once you get your air conditioner and lights automated!

lock icon The rest of the chapter is locked
Next Section arrow right
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.
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 $19.99/month. Cancel anytime