Leanpub Header

Skip to main content

Raspberry Pi: Measure, Record, Explore.

Measure the world, record the data and display it graphically.

Ever wanted to know more about the real world by measuring it? This book is aimed at getting you started measuring and recording information and presenting it graphically on a web page. You can download this book for FREE or I'm happy to take a donation to encourage further development of this and other books.

The author is letting you choose the price you pay for this book!

Pick Your Price...
PDF
EPUB
WEB
7,393
Readers
342
Pages
About

About

About the Book

Getting the real world to meet the digital one...

'Raspberry Pi: Measure, Record, Explore' is a book written to help those who want to get started interfacing computers with the physical world and turning recorded information into visual data.

Is this book an official Raspberry Pi product?

Nope. The Raspberry Pi Foundation is not involved in the production of the book. However, any and all readers should regard raspberrypi.org as the starting point for information on using and enjoying the fantastic products they are producing. They really are awesome and deserving of the success that is the Raspberry Pi.

Is this book for you?

It's not written for experts. It's put together as a guide to get you started if you're unsure about how to make the first move. It reads more like a story as it leads the reader through the basics of using a Raspberry Pi, connecting sensors, recording information into a MySQL database and presenting that data on a web page using d3.js.

Why was Raspberry Pi: Measure, Record, Explore written?

Because in the process of learning things, it's a great way to remember them if you write them down :-).

As a result, learning how to do cool stuff with a Raspberry Pi means that I'm accumulating ways to help me out when the going gets tricky. Making a book out of the information is a no-brainer since that way more people benifit from the process.

So here we are! A collection of tips and tricks for measuring, recording and exploring information written by a noob for people who might consider that they're in the same situation :-).

What's in the book?

I've captured the appropriate code and added in illustrations of what's going on so that you will get more traction at the start of your learning process.

Hang on, there's code?

The code examples that are used in the book are available to download (still free!).

The awesome that is Open Source.

Please consider this an opportunity for you to contribute back to the Open Source community that makes products like the Raspberry Pi possible. If you find something that can be improved about the book or think there's something that can be added, just let me know!

The book has plenty of information in it, but I've tried to pitch it in sections so that if you find something interesting, you can read parts in isolation. I have a little bit more additional material that I want to add, so I'm hoping that publishing using Leanpub will allow readers to get easy notification of when updates and improvements are made.

Download the whole book just to try it out!

I'm making the book available for free because I think it's a great way to give something back to the community as a whole, but if you find some value in the book, please consider contributing 99 cents when you download it so that Leanpub gets something for hosting the book and providing such an awesome service (50 cents is their flat cut of any book sales and 99 cents is the minimum (apart from $0) that they will allow for a sale).

(Don't be put off by the button at the top saying 'Buy the ebook now'. Once you click on it, you can select any price you want including $0!)

Enjoy.

So I hope you get something out of the book, please excuse the sometimes light-hearted conversational manner in which I approach the topic and enjoy measuring, recording and exploring the world in digital!

Share this book

Categories

Price

Pick Your Price...

Minimum price

Free!

$0.99

You pay

$0.00

Author earns

$0.00
$

All prices are in US $. You can pay in US $ or in your local currency when you check out.

EU customers: prices exclude VAT, which is added during checkout.

...Or Buy With Credits!

Number of credits (Minimum 0)

0
The author will earn $0.00 from your purchase!
You can get credits monthly with a Reader Membership

Author

About the Author

Malcolm Maclean

I have a passion for knowledge and I realise that part of the responsibility of gathering knowledge is being able to advance the state of the human condition in some way.

My aims in writing these books are to play with software, achieve personal goals and try something new for fun. It also helps that I think Open Source, technology, the visual representation of data and information rock in serious ways.

The books that I write are a mechanism to support my own learning, so the way I explain things is focused on trying to impart understanding in a simple but functional way.

I'm totally in awe of the Open Source community that has made this type of work possible. If you feel that you would like to support continued development of this content, feel free to donate when you download.

If you're looking for a hard copy version of any of these publications, they will be available through Amazon (not all will be available sorry).

Contents

Table of Contents

Introduction

  1. Welcome!
  2. What are we trying to do?
  3. Measure
  4. Record
  5. Explore
  6. Security
  7. Who is this book for?
  8. What tools / equipment will we use?
  9. Raspberry Pi
  10. MySQL
  11. Apache Web Server
  12. PHP
  13. Python
  14. JavaScript
  15. d3.js
  16. Sensors
  17. Where can I get more information?
  18. raspberrypi.org
  19. Google+
  20. reddit
  21. Google Groups
  22. Raspberry Pi Stack Exchange
  23. adafruit

Setting up the Raspberry Pi

  1. Hardware
  2. The Raspberry Pi
  3. Case
  4. SD Card
  5. Keyboard / Mouse
  6. Video
  7. Network
  8. Power supply
  9. Operating System
  10. Welcome to Raspbian
  11. Sourcing and Setting Up
  12. Downloading
  13. Writing Raspbian to the SD Card
  14. Installing Raspbian
  15. Software Updates
  16. GUI Desktop
  17. Static IP Address
  18. The Netmask
  19. Distinguish Dynamic from Static
  20. Setting a Static IP Address on the Raspberry Pi.
  21. Default Gateway
  22. Edit the interfaces file
  23. Remote access
  24. Remote access via TightVNC
  25. The Client-Server model
  26. Setting up the Client (Windows)
  27. Setting up the Server (Raspberry Pi)
  28. Copying and Pasting between Windows and the Raspberry Pi
  29. Starting TightVNC at boot on the Pi.
  30. Remote access via SSH
  31. Setting up the Server (Raspberry Pi)
  32. Installing SSH on the Raspberry Pi.
  33. Setting up the Client (Windows)
  34. Setting up a WiFi Network Connection
  35. Web Server and PHP
  36. Tweak permissions for easier web file editing
  37. Database
  38. MySQL
  39. phpMyAdmin
  40. Allow access to the database remotely
  41. Create users for the database
  42. Create a database
  43. Backup the Configured SD Card
  44. Exploring data with a simple line graph
  45. The full code
  46. PHP
  47. The code
  48. HTML
  49. CSS
  50. JavaScript and d3.js
  51. Setting up the margins and the graph area.
  52. Getting the Data
  53. Formatting the Date / Time.
  54. Does Time Matter?
  55. Setting Scales Domains and Ranges
  56. Scales, Ranges and the Ah Ha!” moment.
  57. Setting up the Axes
  58. Adding data to the line function
  59. Adding the SVG area.
  60. Actually Drawing Something!
  61. Wrap Up

Single Temperature Measurement

  1. Measure
  2. Hardware required
  3. Connect
  4. Test
  5. Record
  6. Database preparation
  7. Why did we choose those particular settings for our table?
  8. Record the temperature values
  9. Code Explanation
  10. Explore
  11. The Code
  12. Different MySQL Selection Options

Multiple Temperature Measurements

  1. Measure
  2. Hardware required
  3. Connect
  4. Test
  5. Record
  6. Database preparation
  7. Why did we choose those particular settings for our table?
  8. Record the temperature values
  9. Code Explanation
  10. Recording data on a regular basis with cron
  11. Explore
  12. The Code
  13. PHP
  14. JavaScript

System Information Measurement

  1. Measure
  2. Hardware required
  3. Measured Parameters
  4. System Load
  5. Memory Used
  6. Disk Used
  7. Raspberry Pi Temperature
  8. Record
  9. Database preparation
  10. Why did we choose those particular settings for our table?
  11. Record the system information values
  12. Code Explanation
  13. load
  14. ram
  15. disk
  16. temperature
  17. Main program
  18. Recording data on a regular basis with cron
  19. Explore
  20. The Bullet Graph
  21. The Code
  22. HTML / JavaScript
  23. PHP

Basic GPIO Input Sensors

  1. The Hall Effect
  2. Measure
  3. Hardware required
  4. The KY003 Hall Effect Sensor
  5. Connect
  6. Test
  7. Record
  8. Database preparation
  9. Why did we choose those particular settings for our table?
  10. Record the events
  11. Code Explanation
  12. Start the code automatically at boot
  13. Explore
  14. The Code
  15. PHP
  16. CSS (Styles)
  17. JavaScript

Pressure and Temperature measurement with the BMP180

  1. Measure
  2. Hardware required
  3. The BMP180 Sensor
  4. Connect
  5. Test
  6. Record
  7. Database preparation
  8. Why did we choose those particular settings for our table?
  9. Record the readings
  10. Code Explanation
  11. Recording data on a regular basis with cron
  12. Explore
  13. The Code
  14. PHP
  15. CSS (Styles)
  16. JavaScript
  17. Bibliography

Connecting Analog Sensors to the Raspberry Pi

  1. Analog and Digital
  2. Analog
  3. Digital
  4. Analog to Digital Conversion (ADC)
  5. The Sensor
  6. Data Visualization
  7. Measure
  8. Hardware required
  9. The ADS1015 Analog to Digital Converter
  10. The Light Dependant Resistor (LDR or Photoresistor) Sensor
  11. Connect
  12. Test
  13. Record
  14. Database preparation
  15. Why did we choose those particular settings for our table?
  16. Record the readings
  17. Code Explanation
  18. Recording data on a regular basis with cron
  19. Explore
  20. The Code
  21. PHP
  22. CSS (Styles)
  23. JavaScript
  24. Bibliography

Web Scraping

  1. OK, so what is web scraping?
  2. Measure
  3. Hardware required
  4. Software required
  5. Let the scraping begin
  6. Record
  7. Database preparation
  8. Why did we choose those particular settings for our table?
  9. Record the reader numbers
  10. Code Explanation
  11. Recording data on a regular basis with cron
  12. Explore
  13. The Code
  14. Description
  15. Nesting the data
  16. Wrangle the data
  17. Cheating with the domain
  18. data vs datum
  19. Setting up the clipPaths
  20. Clipping and adding the areas
  21. Draw the lines and the axes
  22. Adding a bit more to our difference chart.
  23. Add a Y axis label
  24. Add a title
  25. Adding the legend
  26. Link the areas
  27. The final result

Raspberry Pi Tips and Tricks

  1. Changing the default keyboard layout
  2. Changing the default local time
  3. Access the Pi with a ‘name’ or an IP address
  4. Transfer files easily to / from the Pi
  5. Bonus: Edit Files on the Pi from your Desktop Editor
  6. Turn the activity light on or off
  7. Cut to the chase and just do it
  8. The explanation of how it works

Hardware

  1. Raspberry Pi A+
  2. USB Port
  3. Video Out
  4. USB Power Input Jack
  5. MicroSD Flash Memory Card Slot
  6. Stereo and Composite Video Output
  7. 40 Pin Header
  8. Raspberry Pi B+
  9. USB Ports
  10. Video Out
  11. Ethernet Network Connection
  12. USB Power Input Jack
  13. MicroSD Flash Memory Card Slot
  14. Stereo and Composite Video Output
  15. 40 Pin Header
  16. Raspberry Pi B
  17. USB Ports
  18. HDMI Video Out
  19. Composite Video Out
  20. Ethernet Network Connection
  21. USB Power Input Jack
  22. SD Flash Memory Card Slot
  23. Audio Output
  24. 26 Pin Header
  25. Cases
  26. Multicomp MC-RP002-CLR
  27. Side views.
  28. Fitting the Raspberry Pi
  29. DIY Open Multi-stack Pi
  30. Sensors
  31. DS18B20 Programmable Resolution 1-Wire Digital Thermometer
  32. Accessories
  33. VGA to HDMI Adapter
  34. In-line switch for USB power supply
  35. Multiple Outlet USB Power Supply

Linux Command Glossary

  1. apt-get
  2. apt-get update
  3. apt-get upgrade
  4. apt-get install
  5. cat
  6. cd
  7. chmod
  8. chown
  9. crontab
  10. ifconfig
  11. ls
  12. modprobe
  13. sudo
  14. usermod

Appendices

  1. Raspberry Pi Quick Set-up
  2. Download Raspbian Image
  3. Writing Raspbian to the SD Card
  4. Installing Raspbian
  5. Software Updates
  6. Static IP Address
  7. Remote access via TightVNC
  8. On Windows
  9. On the Raspberry Pi.
  10. Starting TightVNC at boot.
  11. Copying and Pasting between Windows and the Raspberry Pi via TightVNC
  12. Remote access via SSH
  13. Setting up the Server (Raspberry Pi)
  14. Setting up the Client (Windows)
  15. Setting up a WiFi Network Connection
  16. Web Server and PHP
  17. Adjust permissions for web files
  18. Database
  19. phpMyAdmin
  20. Allow remote database access
  21. Add users to the database
  22. Create a database
  23. Understanding JavaScript Object Notation (JSON)

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub