I wrote an Arduino programming book for people who really want to know what is going on -- the Arduino library does it's best to hide the internals. I'm selling this book either printed or Kindle ebook on Amazon here or on your nearest Amazon site if you are not in the US. In the US the price is $19.99 for the Kindle version and $24.99 for the printed version.
Here is the preface of the book, which gives a good idea about its aim:
Have you ever wondered what really goes on inside the microcontroller on the Arduino Uno board? Do you wonder what more it can do beyond the Arduino library functions provided? The author taught college microcontroller courses for 20 years. Starting with industrial microcontroller boards and ending up with boards that students bought (at $150 each) he rejected using a $22 Arduino board in class. Why? Because it was designed to hide the operation of the microcontroller rather than reveal it!
Let's be upfront with what this book is not:
- It is not an education in basic electronics. You really need a basic understanding of electronic circuits. You won't find out here how lights, motors, sensors, switches, or logic gates function.
- It is not an education in programming. You need some embedded C or C++ programming experience. If you have already written "sketches" for the Arduino, not just copy them from a book, you know enough to benefit from reading this book. If you have general knowledge of C or C++ you will be in great shape!
- It is not for people perfectly happy with the functionality of the Arduino. There is no question that the Arduino library makes programming simpler.
- It is of little use for users of Arduino boards not based on the Microchip Technology (formerly Atmel) AVR series of microcontrollers and will require more research to be used with boards other than the Arduino Uno, Nano, or Mega. The Arduino software library hides the differences of the individual microcontrollers and board layouts.
When you start reading this book you are assumed to already have an Arduino Uno or Nano (or equivalent clone), the Arduino IDE installed, and are able to write, load, and run sketches. This book is also useful for the Arduino Mega with the ATmega2560 microcontroller. Some example programs will not work on the Mega board without modification.
So then, what is this book about?
- It takes the features, usually expressed as function calls in the Arduino Library, and shows how they can be accessed directly in the AVR ATmega328P microcontroller.
- It shows how to access the features that are hidden by the Arduino Library to keep things simple.
- It discusses how to best utilize the memory on the microcontroller, and shows how to use the AVR function library to access program ROM and EEPROM for data.
- There is full coverage of interrupts -- how to set them up and how to use them. Using interrupts will usually increase the overall efficiency of the design, allowing more complex applications to be implemented.
- All peripheral interfaces are discussed -- two-wire (TWI/I2C), SPI, USART, ADC, Analog Comparator, timer/counters and the basic Digital I/O.
With this knowledge you can improve performance markedly, allowing larger, more sophisticated applications to be implemented. And because all microcontrollers are similar, you will be able to quickly adapt to other microcontrollers you will come across either as a hobbyist or on the job.
There are over 80 example programs. These can be downloaded from the author's website. In most cases only excerpts are in the book to keep the size down.
A few other things to get out of the way:
- Arduino is being silly introducing new terminology. "Sketches" will be called "programs" in the remainder of this book, whenever possible.
- The "Arduino Programming Language" is just C++. The compiler is just the standard GCC compiler that targets the AVR microcontroller.
- The Arduino IDE does some "funny business" and the Arduino library supplies some non-standard functions where standard functions would suffice. These red flags that would make your programs less portable to other platforms will be covered.
- Programs that run on the microcontroller are called "firmware" programs. However as far as this book is concerned, there is no real distinction between "firmware" and "software" so it will be called "software".
- The author will occasionally use the pronoun "I" when talking about his personal preferences or experiences.
Let's get started!
Here is the Table of Contents:
The Many Faces of Arduino
The Arduino Uno Board
The Arduino IDE
File Locations
The Arduino Library
AVR Basics
Arduino Uno to ATmega328 "Rosetta Stone"
Harvard Architecture
Lock and Fuse Bits
Accessing I/O Device Registers
EEPROM
Differences in the Arduino MEGA 2560
Loading Programs
Using the Arduino Bootloader
Using a Programmer
Variables and Constants
Data types
Using program memory for constants
Strings or strings?
Digital I/O Pins
Arduino's digitalRead and digitalWrite
The AVR Underpinnings
An Improvement Without Cost
Pulsing A Pin
Special Considerations
Introduction to Interrupts
What is an Interrupt?
Finite State Machines
Simple Multitasking and Execution Blocking
A Basic Multitasking Example
Watchdog Timer
Volatile Variables, Atomic References, and Reentrancy
External Interrupts and attachInterrupt()
The Versatile Timer/Counters
Introduction to Timer/Counters
Arduino Time Measurement
Timer Interrupt and State Machines
The Stepper Motor
Arduino Square Wave Generation - tone()
Generating Square Waves
Arduino PWM Generation - analogWrite()
PWM Generation -- Analog Output, LEDs, Motors, Relays
Input Capture and pulseIn()
Use as a Counter
Other Timer/Counter Topics
Analog Input
Arduino's analogRead()
Using the AVR Analog to Digital Converter
Analog Comparator
Differences in the Arduino Nano and Mega
SPI
Serial Peripheral Interfacing
SPI Example Project
Arduino's Approach
Using the AVR Hardware
Bidirectional SPI Example
Microcontroller as SPI Slave
Two Wire Interface AKA I2C
TWI Basics
The ZS-042
The Arduino Wire Library
Using twi.c
Rolling Your Own
Microcontroller as TWI Slave
One Wire Interface
The One Wire Protocol
One Wire without Interrupts
Interrupt Driven One Wire
USART
USART Functionality
Using the Arduino Serial functions
The AVR USART interface
Buffered UART Operation
STDIO
Line Buffering
Additional Examples
Keypads
Ultrasonic Distance Sensors
Rotary Encoders
LCD Displays
Multiple Relays
Multiple Servos
Multiple Stepper Motors
Waveform Measuring Instrument
Power Saving
References
Index of Example Programs
Tom Almy webmaster9@almy.us |
Last Modified 8/2019 |
Return to my HOME PAGE |