Python for Microcontrollers: Getting Started with Micropython

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Publisher's Note: Products purchased from Third Party sellers are not guaranteed by the publisher for quality, authenticity, or access to any online entitlements included with the product. Program Your Own MicroPython projects with ease--no prior programming experience necessary! This DIY guide provides a practical introduction to microcontroller programming with MicroPython. Written by an experienced electronics hobbyist, Python for Microcontrollers: Getting Started with MicroPython features eight start-to-finish projects that clearly demonstrate each technique. You will learn how to use sensors, store data, control motors and other devices, and work with expansion boards. From there, you'll discover how to design, build, and program all kinds of entertaining and practical projects of your own. - Learn MicroPython and object-oriented programming basics - Explore the powerful features of the Pyboard, ESP8266, and WiPy - Interface with a PC and load files, programs, and modules - Work with the LEDs, timers, and converters - Control external devices using serial interfaces and PWM - Build and program a let ball detector using the 3-axis accelerometer - Install and program LCD and touchsensor expansion boards - Record and play sounds using the AMP audio board

Author(s): Donald Norris
Publisher: McGraw-Hill Education Tab
Year: 2016

Language: English
Pages: 288

Title Page
Copyright
Dedication
About the Author
Contents
Preface
Acknowledgments
1 Introduction
Introduction to MicroPython
Design Philosophy
Exploring MicroPython
Object-Oriented Programming and Some Python Basics
Object-Oriented Concepts
Modeling a Robot
Some Python Basics
The Robot Class
Child Classes
Using Interfaces
Integrated Robot Project Design and Test
Dynamic Binding
Using MicroPython with a Pyboard
Bare-Metal Approach
Summary
2 Introduction to the Pyboard
Pyboard Hardware
Generic Microcontroller Program Development
Interrupts
Controlling the Pyboard
Python Test Program
Blinking LEDs
PyBlink
PyBlink_MP
Hardware Interrupt Demonstration
Emergency Exception Buffer
Timers
Timer Interrupts
Other Pyboard Hardware
The ADC
The DAC
Summary
3 Interfaces, Files, and Libraries
Pulse Width Modulation
Bit-Serial Ports
UART Serial Protocol
I2C Serial Protocol
SPI Serial Protocol
Directory Structures
Importing a Module
Using a File for an Import
Importing a Module from a PYBFLASH Subdirectory
Using the SD Card for an Import
Boot Process
Error Reporting by the LEDs
Libraries
Standard Libraries
Customized Python Libraries
Pyboard-Specific Library and Classes
MicroPython Library
Summary
4 Let Ball Detector
Initial Design
Project Requirements
Prototype
The Accelerometer
Low-Level I2C Command Demonstration
Inclinometer
Hardware Design
Main Program
Experimenting on the Tennis Court
Turn On Visual and Optional Audio Alerts upon Let Ball Detection
Final Program
Summary
5 LCD and Touch-Sensor Board
LCD Board Specifications
Initial LCD Module Operations
LCD Graphics Demonstration
Using an External Command with the LCD Controller
Touch Controller
Capacitive Sensing
LCD Module Touch-Sensor Schematic and MPR121 Registers
MPR121 Driver Software
Initial Touch-Sensor Test
LEDs Controlled by Touch Pads
LCD and Touch-Sensor Demonstration
Using the LCD Module GPIO Pins
MPR121 PWM
Summary
6 The AMP Audio Skin
Assembling the AMP Board
AMP Board Circuits
Audio Input Circuit
Audio Output Circuit
Initial Test
Troubleshooting the Distortion
Playing MP3 Files
Audio Input Demonstration
Summary
7 An Autonomous Robotic Car
Building the Robot Car Platform
A Standard Analog Servo
CR Servo
Robotic Car Power Supply
Electrical and Wiring Instructions
Ping Sensor
Robot Car Software
CR Servo Control
Initial Test Run
Autonomous Mode
Obstacle Avoidance Demonstration
Summary
8 GPS with the Pyboard
Introduction
Brief GPS History
The Basics of How GPS Functions
The Ultimate GPS Receiver
Initial GPS Receiver Test
GPS Receiver UART Communication
NMEA Protocol
Latitude and Longitude Formats
Parsed GPS Message
MicroPython GPS Parser
Preparing GPS Sentences for Parsing
Summary
9 The ESP8266
The ESP8266 SMT ESP-12E Module
The ESP8266 HUZZAH Breakout Board
Key Hardware Technical ESP8266 Features
ESP8266 Software
Installing MicroPython on the HUZZAH ESP8266 Board
Exploring MicroPython Installed on the ESP8266 HUZZAH Board
Experiments
Analog-to-Digital Converter
1-Wire Temperature Sensor
NeoPixel Demonstration
APA102 Demonstration
webREPL
Summary
10 The WiPy
WiPy Specifications
Wi-Fi Modes
Station
Access Point
Direct
WiPy Expansion Board
Creating the Initial WiPy Network Connection
FTP Demonstration
FileZilla
Station Operation
Boot Process and Restoring the Filesystem
Restoring the Filesystem
Pymakr
Summary
11 Current and Future States of MicroPython
The MicroPython Language
Hardware Platforms
LoPy
LoRa Radio System
SiPy
Sigfox versus LoRa
Summary
Index