Reader small image

You're reading from  Full Stack Web Development with Raspberry Pi 3

Product typeBook
Published inAug 2017
Reading LevelExpert
PublisherPackt
ISBN-139781788295895
Edition1st Edition
Languages
Right arrow
Author (1)
Soham Kamani
Soham Kamani
author image
Soham Kamani

Soham Kamani is a full-stack developer who has extensive experience in the JavaScript ecosystem. He works as a consultant, developing end-to-end web-based solutions for clients around the world. He is an open source enthusiast and an avid blogger. He has worked on many frameworks and technologies such as React, Angular, Node, Express, Sails, SQLite, Postgres, and MySQL, and he has worked on many projects in the IoT space using Arduino and Raspberry Pi systems.
Read more about Soham Kamani

Right arrow

Preface

Just a few decades back, the average computer was the size of an entire city block and could barely store 5 MB of data. Today, this amount of data is consumed by an average image upload, and the dimensions of the modern computer have reached a stage where we can hold one on the palm of our hands. Alongside the reduction in size, computers have also undergone a tremendous reduction in cost. Raspberry Pi is the flag bearer of portable and affordable computing, barely costing $30 and being small enough to be held in your hand.

The introduction of Raspberry Pi has opened the doors for applications that would not have been feasible otherwise, and that is precisely what you will learn from this book.

In the chapters to follow, you will learn how Raspberry Pi can be utilized to its full potential and act as a sensor interface, a web server, and a database and host all the components of a fully functioning web application. You will also learn how to utilize cloud-based APIs and data storage and combine this with the existing components developed on Raspberry Pi to make an application that can accessed by anyone with an internet connection.

What this book covers

Chapter 1, Getting Started on the Raspberry Pi , takes a brief look at Raspberry Pi, its OS, and how to get started using it

Chapter 2, Getting Up-and-Running with Web Development on the Raspberry Pi, covers a high-level overview of the project that we will build and the different components of its technology stack.

Chapter 3, Running a Node Server on the Pi, helps you get started with Node.js, its installation on the Pi, and how to get up and running with Node.js by running a web server on the Pi.

Chapter 4, Extracting Information from the GPIO Pins, introduces you to the DHT22 sensor and demonstrates how to get information about the temperature and humidity recorded from the sensor.

Chapter 5, Retrieving Sensor Readings from the Server, goes through how to make the sensor readings available to the node server that was made earlier. By the end of this chapter, you will know how to make sensor readings available through a REST API.

Chapter 6, Creating a Web Page to Display Sensor Data, gets you started with your UI development journey by developing a webpage that will make use of the API created in the previous chapter to display the data received from the sensor in a user-friendly webpage.

Chapter 7, Enhancing Our UI - Using Interactive Charts, covers how to make an even richer user interface through the use of charts. This will be achieved through the use of open source chart libraries

Chapter 8, SQLite - The Fast and Portable Database, covers the basic concepts of the SQLite database and teaches you how to install and run it on your Pi.

Chapter 9, Integrating SQLite into Our Application, explains how to upgrade our existing application built in the previous chapters by persisting our data.

Chapter 10, Making Our Application Real Time with Web Sockets, discusses how all this time, the only way for our HTML5 frontend to get data from the server was through polling and making requests at regular intervals. Web sockets allow us to establish a connection only once, after which the server can actually push data to the browser.

Chapter 11, Deploying Our Application to Firebase, reiterates that our entire application is currently hosted on the Raspberry Pi. This works, but is not very scalable. This chapter will go through how to host our UI and database on Google's Firebase cloud architecture.

Chapter 12, Using Firebase APIs to Update Our Application, covers how to update the database by calling Firebase's cloud APIs from Raspberry Pi so that the cloud hosted application can get a continuous feed of the readings on the Pi.

What you need for this book

The reader should have some basic knowledge and programming experience (in any programming language). An awareness of the basic concepts regarding HTML and JavaScript would be a plus point, but is not required, and of will be covered in brief in this book. The reader is also expected to have a base level understanding of electronic hardware (how to connect pins and wires).

To execute all the examples given in this book, you will need the following:

  • A Raspberry Pi board, which will be the device where all the code is executed
  • Monitor, keyboard, and mouse to interact with the Raspbian OS
  • Memory card for the Raspberry Pi
  • Personal computer (optional), although this book is designed such that the entire application can be built and executed on the Pi, having a computer handy can help a lot.

Who this book is for

This book is aimed at hobbyist, enthusiasts, and developers eager to develop embedded device-powered web applications. Prior programming experience with JavaScript, HTML5, and Node.js will be beneficial.

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, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Most of these files have no meaning to us except the INSTRUCTIONS-README.txt file."

A block of code is set as follows:

     app.get('/temperature', function(req, res) {
res.send('24 °C');
});

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

firebase --version

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: "In the Firebase console, go to the SERVICE ACCOUNTS section of your application settings."

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/Full-Stack-Web-Development-with-Raspberry-Pi-3/. 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
Full Stack Web Development with Raspberry Pi 3
Published in: Aug 2017Publisher: PacktISBN-13: 9781788295895
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
Soham Kamani

Soham Kamani is a full-stack developer who has extensive experience in the JavaScript ecosystem. He works as a consultant, developing end-to-end web-based solutions for clients around the world. He is an open source enthusiast and an avid blogger. He has worked on many frameworks and technologies such as React, Angular, Node, Express, Sails, SQLite, Postgres, and MySQL, and he has worked on many projects in the IoT space using Arduino and Raspberry Pi systems.
Read more about Soham Kamani