The Wayback Machine - https://web.archive.org/web/20151129065250/https://www.packtpub.com/application-development/python-programming-arduino

Python Programming for Arduino

Develop practical Internet of Things prototypes and applications with Arduino and Python

Python Programming for Arduino

Starting
Pratik Desai

Develop practical Internet of Things prototypes and applications with Arduino and Python
$15.00
$49.99
RRP $29.99
RRP $49.99
eBook
Print + eBook
$12.99 p/month

Get Access

Get Unlimited Access to every Packt eBook and Video course

Enjoy full and instant access to over 3000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

+ Collection
Free Sample

Book Details

ISBN 139781783285938
Paperback400 pages

About This Book

  • Transform your hardware ideas into real-world applications using Arduino and Python
  • Design and develop hardware prototypes, interactive user interfaces, and cloud-connected applications for your projects
  • Explore and expand examples to enrich your connected device’s applications with this step-by-step guide

Who This Book Is For

This is the book for you if you are a student, hobbyist, developer, or designer with little or no programming and hardware prototyping experience, and you want to develop IoT applications.

If you are a software developer or a hardware designer and want to create connected devices applications, then this book will help you get started.

Table of Contents

Chapter 1: Getting Started with Python and Arduino
Introduction to Python
Installing Python and Setuptools
The fundamentals of Python programming
Python operators and built-in types
Introduction to Arduino
Getting started with the Arduino IDE
Introduction to Arduino programming
Summary
Chapter 2: Working with the Firmata Protocol and the pySerial Library
Connecting the Arduino board
Introducing the Firmata protocol
Getting started with pySerial
Bridging pySerial and Firmata
Summary
Chapter 3: The First Project – Motion-triggered LEDs
Motion-triggered LEDs – the project description
The project goal
Method 1 – using a standalone Arduino sketch
Method 2 – using Python and Firmata
Summary
Chapter 4: Diving into Python-Arduino Prototyping
Prototyping
Working with pyFirmata methods
Prototyping templates using Firmata
Prototyping with the I2C protocol
Summary
Chapter 5: Working with the Python GUI
Learning Tkinter for GUI design
Your first Python GUI program
The Button() widget – interfacing GUI with Arduino and LEDs
The Entry() widget – providing manual user inputs
The Scale() widget – adjusting the brightness of an LED
The Grid geometry manager
The Checkbutton() widget – selecting LEDs
The Label() widget – monitoring I/O pins
Remaking your first Python-Arduino project with a GUI
Summary
Chapter 6: Storing and Plotting Arduino Data
Working with files in Python
Using CSV files to store data
Storing Arduino data in a CSV file
Getting started with matplotlib
Plotting random numbers using matplotlib
Plotting data from a CSV file
Plotting real-time Arduino data
Integrating plots in the Tkinter window
Summary
Chapter 7: The Midterm Project – a Portable DIY Thermostat
Thermostat – the project description
Stage 1 – prototyping the thermostat
Stage 2 – using a Raspberry Pi for the deployable thermostat
Summary
Chapter 8: Introduction to Arduino Networking
Arduino and the computer networking
Developing web applications using Python
RESTful web applications with Arduino and Python
MQTT – A lightweight messaging protocol
Getting started with MQTT on Arduino and Python
Summary
Chapter 9: Arduino and the Internet of Things
Getting started with the IoT
The IoT cloud platforms
Developing cloud applications using Python and Xively
Your own cloud platform for the IoT
Summary
Chapter 10: The Final Project – a Remote Home Monitoring System
The design methodology for IoT projects
Project overview
Stage 1 – a monitoring station using Arduino
Stage 2 – a control center using Python and the Raspberry Pi
Stage 3 – a web application using Xively, Python, and Amazon cloud service
Testing and troubleshooting
Extending your remote home monitoring system
Summary
Chapter 11: Tweet-a-PowerStrip
Project overview
Stage 1 – a smart power strip with Arduino and relays
Stage 2 – the Python code to process tweets
Testing and troubleshooting
Extending the project with additional features
Summary

What You Will Learn

  • Design and develop your own hardware prototypes using Arduino
  • Interface Arduino to a computer using the Firmata protocol and Python
  • Acquire hands-on experience in developing applications for a variety of popular sensors
  • Develop graphical user interfaces to control your components and plots to visualize sensor data
  • Access your Arduino prototype from the Internet
  • Implement messaging protocols for Arduino communication
  • Connect your hardware project to cloud-based services
  • Create advanced Internet of Things applications through projects in the book

In Detail

The future belongs to applications and services that involve connected devices, requiring physical components to communicate with web-level applications. Arduino combined with the popular open source software platform Python can be used to develop the next level of advanced Internet of Things (IoT) projects with graphical user interfaces and Internet-connected applications.

Starting with designing hardware prototypes using Arduino, this book will then show you everything you need to know to be able to develop complex cloud applications. You will delve into domain-specific topics with incremental complexity, ending with real-world projects. You will quickly learn to develop user interfaces, plots, remote access, messaging protocols, and cloud connectivity. Each successive topic, accompanied by plenty of examples, will help you develop your cutting-edge hardware applications.

Authors

Table of Contents

Chapter 1: Getting Started with Python and Arduino
Introduction to Python
Installing Python and Setuptools
The fundamentals of Python programming
Python operators and built-in types
Introduction to Arduino
Getting started with the Arduino IDE
Introduction to Arduino programming
Summary
Chapter 2: Working with the Firmata Protocol and the pySerial Library
Connecting the Arduino board
Introducing the Firmata protocol
Getting started with pySerial
Bridging pySerial and Firmata
Summary
Chapter 3: The First Project – Motion-triggered LEDs
Motion-triggered LEDs – the project description
The project goal
Method 1 – using a standalone Arduino sketch
Method 2 – using Python and Firmata
Summary
Chapter 4: Diving into Python-Arduino Prototyping
Prototyping
Working with pyFirmata methods
Prototyping templates using Firmata
Prototyping with the I2C protocol
Summary
Chapter 5: Working with the Python GUI
Learning Tkinter for GUI design
Your first Python GUI program
The Button() widget – interfacing GUI with Arduino and LEDs
The Entry() widget – providing manual user inputs
The Scale() widget – adjusting the brightness of an LED
The Grid geometry manager
The Checkbutton() widget – selecting LEDs
The Label() widget – monitoring I/O pins
Remaking your first Python-Arduino project with a GUI
Summary
Chapter 6: Storing and Plotting Arduino Data
Working with files in Python
Using CSV files to store data
Storing Arduino data in a CSV file
Getting started with matplotlib
Plotting random numbers using matplotlib
Plotting data from a CSV file
Plotting real-time Arduino data
Integrating plots in the Tkinter window
Summary
Chapter 7: The Midterm Project – a Portable DIY Thermostat
Thermostat – the project description
Stage 1 – prototyping the thermostat
Stage 2 – using a Raspberry Pi for the deployable thermostat
Summary
Chapter 8: Introduction to Arduino Networking
Arduino and the computer networking
Developing web applications using Python
RESTful web applications with Arduino and Python
MQTT – A lightweight messaging protocol
Getting started with MQTT on Arduino and Python
Summary
Chapter 9: Arduino and the Internet of Things
Getting started with the IoT
The IoT cloud platforms
Developing cloud applications using Python and Xively
Your own cloud platform for the IoT
Summary
Chapter 10: The Final Project – a Remote Home Monitoring System
The design methodology for IoT projects
Project overview
Stage 1 – a monitoring station using Arduino
Stage 2 – a control center using Python and the Raspberry Pi
Stage 3 – a web application using Xively, Python, and Amazon cloud service
Testing and troubleshooting
Extending your remote home monitoring system
Summary
Chapter 11: Tweet-a-PowerStrip
Project overview
Stage 1 – a smart power strip with Arduino and relays
Stage 2 – the Python code to process tweets
Testing and troubleshooting
Extending the project with additional features
Summary

Book Details

ISBN 139781783285938
Paperback400 pages
Read More