Third, extended and revised edition with AVR Playground and Elektor Uno R4
Arduino boards have become hugely successful. They are simple to use and inexpensive. This book will not only familiarize you with the world of Arduino but it will also teach you how to program microcontrollers in general. In this book theory is put into practice on an Arduino board using the Arduino programming environment.
Some hardware is developed too: a multi-purpose shield to build some of the experiments from the first 10 chapters on; the AVR Playground, a real Arduino-based microcontroller development board for comfortable application development, and the Elektor Uno R4, an Arduino Uno R3 on steroids.
The author, an Elektor Expert, provides the reader with the basic theoretical knowledge necessary to program any microcontroller: inputs and outputs (analog and digital), interrupts, communication busses (RS-232, SPI, I²C, 1-wire, SMBus, etc.), timers, and much more. The programs and sketches presented in the book show how to use various common electronic components: matrix keyboards, displays (LED, alphanumeric and graphic color LCD), motors, sensors (temperature, pressure, humidity, sound, light, and infrared), rotary encoders, piezo buzzers, pushbuttons, relays, etc. This book will be your first book about microcontrollers with a happy ending!
This book is for you if you are a beginner in microcontrollers, an Arduino user (hobbyist, tinkerer, artist, etc.) wishing to deepen your knowledge,an Electronics Graduate under Undergraduate student or a teacher looking for ideas.
Thanks to Arduino the implementation of the presented concepts is simple and fun. Some of the proposed projects are very original:
Money Game
Misophone (a musical fork)
Car GPS Scrambler
Weather Station
DCF77 Decoder
Illegal Time Transmitter
Infrared Remote Manipulator
Annoying Sound Generator
Italian Horn Alarm
Overheating Detector
PID Controller
Data Logger
SVG File Oscilloscope
6-Channel Voltmeter
All projects and code examples in this book have been tried and tested on an Arduino Uno board. They should also work with the Arduino Mega and every other compatible board that exposes the Arduino shield extension connectors.
Please note
For this book, the author has designed a versatile printed circuit board that can be stacked on an Arduino board. The assembly can be used not only to try out many of the projects presented in this book but also allows for new exercises that in turn provide the opportunity to discover new techniques. Also available is a kit of parts including the PCB and all components. With this kit you can build most of the circuits described in the book and more.
Datasheets Active Components Used (.PDF file):
ATmega328 (Arduino Uno)
ATmega2560 (Arduino Mega 2560)
BC547 (bipolar transistor, chapters 7, 8, 9)
BD139 (bipolar power transistor, chapter 10)
BS170 (N-MOS transistor, chapter 8)
DCF77 (receiver module, chapter 9)
DS18B20 (temperature sensor, chapter 10)
DS18S20 (temperature sensor, chapter 10)
HP03S (pressure sensor, chapter 8)
IRF630 (N-MOS power transistor, chapter 7)
IRF9630 (P-MOS power transistor, chapter 7)
LMC6464 (quad op-amp, chapter 7)
MLX90614 (infrared sensor, chapter 10)
SHT11 (humidity sensor, chapter 8)
TS922 (dual op-amp, chapter 9)
TSOP34836 (infrared receiver, chapter 9)
TSOP1736 (infrared receiver, chapter 9)
MPX4115 (analogue pressure sensor, chapter 11)
MCCOG21605B6W-SPTLYI (I²C LCD, chapter 12)
SST25VF016B (SPI EEPROM, chapter 13)
About the author
Clemens Valens, born in the Netherlands, lives in France since 1997. Manager at Elektor Labs and Webmaster of ElektorLabs, in love with electronics, he develops microcontroller systems for fun, and sometimes for his employer too. Polyglot—he is fluent in C, C++, PASCAL, BASIC and several assembler dialects—Clemens spends most of his time on his computer while his wife, their two children and two cats try to attract his attention (only the cats succeed). Visit the author’s website: www.polyvalens.com.Authentic testimony of Hervé M., one of the first readers of the book:'I almost cried with joy when this book made me understand things in only three sentences that seemed previously completely impenetrable.'
Third, extended and revised edition with AVR Playground and Elektor Uno R4
Arduino boards have become hugely successful. They are simple to use and inexpensive. This book will not only familiarize you with the world of Arduino but it will also teach you how to program microcontrollers in general. In this book theory is put into practice on an Arduino board using the Arduino programming environment.
Some hardware is developed too: a multi-purpose shield to build some of the experiments from the first 10 chapters on; the AVR Playground, a real Arduino-based microcontroller development board for comfortable application development, and the Elektor Uno R4, an Arduino Uno R3 on steroids.
The author, an Elektor Expert, provides the reader with the basic theoretical knowledge necessary to program any microcontroller: inputs and outputs (analog and digital), interrupts, communication busses (RS-232, SPI, I²C, 1-wire, SMBus, etc.), timers, and much more. The programs and sketches presented in the book show how to use various common electronic components: matrix keyboards, displays (LED, alphanumeric and graphic color LCD), motors, sensors (temperature, pressure, humidity, sound, light, and infrared), rotary encoders, piezo buzzers, pushbuttons, relays, etc. This book will be your first book about microcontrollers with a happy ending!
This book is for you if you are a beginner in microcontrollers, an Arduino user (hobbyist, tinkerer, artist, etc.) wishing to deepen your knowledge,an Electronics Graduate under Undergraduate student or a teacher looking for ideas.
Thanks to Arduino the implementation of the presented concepts is simple and fun. Some of the proposed projects are very original:
Money Game
Misophone (a musical fork)
Car GPS Scrambler
Weather Station
DCF77 Decoder
Illegal Time Transmitter
Infrared Remote Manipulator
Annoying Sound Generator
Italian Horn Alarm
Overheating Detector
PID Controller
Data Logger
SVG File Oscilloscope
6-Channel Voltmeter
All projects and code examples in this book have been tried and tested on an Arduino Uno board. They should also work with the Arduino Mega and every other compatible board that exposes the Arduino shield extension connectors.
Datasheets Active Components Used (.PDF file):
ATmega328 (Arduino Uno)
ATmega2560 (Arduino Mega 2560)
BC547 (bipolar transistor, chapters 7, 8, 9)
BD139 (bipolar power transistor, chapter 10)
BS170 (N-MOS transistor, chapter 8)
DCF77 (receiver module, chapter 9)
DS18B20 (temperature sensor, chapter 10)
DS18S20 (temperature sensor, chapter 10)
HP03S (pressure sensor, chapter 8)
IRF630 (N-MOS power transistor, chapter 7)
IRF9630 (P-MOS power transistor, chapter 7)
LMC6464 (quad op-amp, chapter 7)
MLX90614 (infrared sensor, chapter 10)
SHT11 (humidity sensor, chapter 8)
TS922 (dual op-amp, chapter 9)
TSOP34836 (infrared receiver, chapter 9)
TSOP1736 (infrared receiver, chapter 9)
MPX4115 (analogue pressure sensor, chapter 11)
MCCOG21605B6W-SPTLYI (I²C LCD, chapter 12)
SST25VF016B (SPI EEPROM, chapter 13)
About the author:
Clemens Valens, born in the Netherlands, lives in France since 1997. Manager at Elektor Labs and Webmaster of ElektorLabs, in love with electronics, he develops microcontroller systems for fun, and sometimes for his employer too. Polyglot—he is fluent in C, C++, PASCAL, BASIC and several assembler dialects—Clemens spends most of his time on his computer while his wife, their two children and two cats try to attract his attention (only the cats succeed). Visit the author’s website: www.polyvalens.com.
Authentic testimony of Hervé M., one of the first readers of the book:'I almost cried with joy when this book made me understand things in only three sentences that seemed previously completely impenetrable.'
32 new Projects, Practical Examples and Exercises with the Elektor Arduino Nano MCCAB Training Board
Electronics and microcontroller technology offer the opportunity to be creative. This practical microcontroller course provides you with the chance to bring your own Arduino projects and experience such moments of success. Ideally, everything works as you imagined when you switch it on for the first time. In practice, however, things rarely work as expected. At that point, you need knowledge to efficiently search for and find the reason for the malfunction.
In this book for advanced users, we delve deep into the world of microcontrollers and the Arduino IDE to learn new procedures and details, enabling you to successfully tackle and solve even more challenging situations.
With this book, the author gives the reader the necessary tools to create projects independently and also to be able to find errors quickly. Instead of just offering ready-made solutions, he explains the background, the hardware used, and any tools required. He sets tasks in which the reader contributes their own creativity and writes the Arduino sketch themselves.
If you don’t have a good idea and get stuck, there is, of course, a suggested solution for every project and every task, along with the corresponding software, which is commented on and explained in detail in the book.
This practical course will teach you more about the inner workings of the Arduino Nano and its microcontroller. You will get to know hardware modules that you can use to realize new and interesting projects. You will familiarize yourself with software methods such as ‘state machines,’ which can often be used to solve problems more easily and clearly.
The numerous practical projects and exercise sketches are once again realized on the Arduino Nano MCCAB Training Board, which you may already be familiar with from the course book ‘Microcontrollers Hands-on Course for Arduino Starters’, and which contains all the hardware peripherals and operating elements we need for the input/output operations of our sketches.
Readers who do not yet own the Arduino Nano MCCAB Training Board can purchase the required hardware separately, or alternatively, build it on a breadboard.
Programming and Projects for the Minima and WiFi
Based on the low-cost 8-bit ATmega328P processor, the Arduino Uno R3 board is likely to score as the most popular Arduino family member so far, and this workhorse has been with us for many years. Recently, the new Arduino Uno R4 was released, based on a 48-MHz, 32-bit Cortex-M4 processor with a huge amount of SRAM and flash memory. Additionally, a higher-precision ADC and a new DAC are added to the design. The new board also supports the CAN Bus with an interface.
Two versions of the board are available: Uno R4 Minima, and Uno R4 WiFi. This book is about using these new boards to develop many different and interesting projects with just a handful of parts and external modules, which are available as a kit from Elektor. All projects described in the book have been fully tested on the Uno R4 Minima or the Uno R4 WiFi board, as appropriate.
The project topics include the reading, control, and driving of many components and modules in the kit as well as on the relevant Uno R4 board, including
LEDs
7-segment displays (using timer interrupts)
LCDs
Sensors
RFID Reader
4×4 Keypad
Real-time clock (RTC)
Joystick
8×8 LED matrix
Motors
DAC (Digital-to-analog converter)
LED matrix
WiFi connectivity
Serial UART
CAN bus
Infrared controller and receiver
Simulators
… all in creative and educational ways with the project operation and associated software explained in great detail.
Projects with Thonny-IDE, uPyCraft-IDE, and ESP32The 'Python' programming language has enjoyed an enormous upswing in recent years. Not least, various single-board systems such as the Raspberry Pi have contributed to its popularity. But Python has also found widespread use in other fields, such as artificial intelligence (AI) or machine learning (ML). It is obvious, therefore, to use Python or the 'MicroPython' variant for use in SoCs (Systems on Chip) as well.Powerful controllers such as the ESP32 from Espressif Systems offer excellent performance as well as Wi-Fi and Bluetooth functionality at an affordable price. With these features, the Maker scene has been taken by storm. Compared to other controllers, the ESP32 has a significantly larger flash and SRAM memory, as well as a much higher CPU speed. Due to these characteristics, the chip is not only suitable for classic C applications, but also for programming with MicroPython.This book introduces the application of modern one-chip systems. In addition to the technical background, the focus is on MicroPython itself. After the introduction to the language, the programming skills learned are immediately put into practice. The individual projects are suitable for use in the laboratory as well as for everyday applications. So, in addition to the actual learning effect, the focus is also on the joy of building complete and useful devices. By using laboratory breadboards, circuits of all kinds can be realized with little effort, turning the testing and debugging of the 100% homebrew projects into an instructive pleasure.The various applications, such as weather stations, digital voltmeters, ultrasound range finders, RFID card readers or function generators, make the projects presented ideally suited for practical courses or subject and study work in the natural sciences, or in science and technology classes.
Celebrating the Arduino Uno with a miniaturized limited edition
The world's favorite development board has gone mini. Everything in this version of the Arduino Uno is unique. Black and gold, finishing, elegant design and packaging, all delivered to the highest standard. A little jewel to celebrate the Arduino community and what we’ve been doing together for all these years.
Each item is unique and numbered on the PCB, and includes a hand-signed letter from the founders. It’s a limited edition, so get while it’s in stock!
For serious Arduino Uno lovers
Arduino Uno Mini Limited Edition is a collector’s item for serious Arduino Lovers: hobbyists, students, makers, reimaginers, dreamers, hopers, fans, engineers, designers, questioners, cake-makers, problem-solvers, puzzlers, gamers, debaters, developers, entrepreneurs, architects, future-shapers, musicians, scientists... 10 million projects based on (official) Uno boards that have contributed to this incredible story.
Specifications
The Arduino Uno Mini Limited Edition is a microcontroller board based on the ATmega328P. It has 14 digital inputs/outputs (six of which can be used as PWM outputs), six analog inputs, a 16 MHz ceramic resonator, a USB-C connector, and a reset button. Contains everything needed to support the microcontroller. Simply connect it to a computer with a USB cable, use a power adapter, or connect a battery to get started.
Microcontroller
ATmega328P
USB connector
USB-C
Built-in LED Pins
13
Digital I/O Pins
14
Analog Input Pins
6
PWM Pins
6
UART
Yes
I²C
Yes
SPI
Yes
Circuit operating voltage
5 V
Input Voltage (limit)
6-12 V
Battery connector
None
DC current per I/O Pin
20 mA
DC current for 3.3 V Pin
50 mA
Main processor
ATmega328P (16 MHz)
USB-serial processor
ATmega16U2 (16 MHz)
Memory ATmega328P
2 KB SRAM, 32 KB Flash, 1 KB EEPROM
Weight
8.05 g
Dimensions
26.70 x 34.20 mm
Downloads
Datasheet
Programming and Projects for the Minima and WiFi
Based on the low-cost 8-bit ATmega328P processor, the Arduino Uno R3 board is likely to score as the most popular Arduino family member so far, and this workhorse has been with us for many years. Recently, the new Arduino Uno R4 was released, based on a 48-MHz, 32-bit Cortex-M4 processor with a huge amount of SRAM and flash memory. Additionally, a higher-precision ADC and a new DAC are added to the design. The new board also supports the CAN Bus with an interface.
Two versions of the board are available: Uno R4 Minima, and Uno R4 WiFi. This book is about using these new boards to develop many different and interesting projects with just a handful of parts and external modules, which are available as a kit from Elektor. All projects described in the book have been fully tested on the Uno R4 Minima or the Uno R4 WiFi board, as appropriate.
The project topics include the reading, control, and driving of many components and modules in the kit as well as on the relevant Uno R4 board, including
LEDs
7-segment displays (using timer interrupts)
LCDs
Sensors
RFID Reader
4×4 Keypad
Real-time clock (RTC)
Joystick
8×8 LED matrix
Motors
DAC (Digital-to-analog converter)
LED matrix
WiFi connectivity
Serial UART
CAN bus
Infrared controller and receiver
Simulators
… all in creative and educational ways with the project operation and associated software explained in great detail.
The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328 (Arduino Nano 3.x). It has more or less the same functionality of the Arduino Duemilanove but in a different package. It lacks only a DC power jack and works with a Mini-B USB cable instead of a standard one.
Specifications
Microcontroller
ATmega328
Operating Voltage (logic level)
5 V
Input Voltage (recommended)
7-12 V
Input Voltage (limits)
6-20 V
Digital I/O Pins
14 (of which 6 provide PWM output)
Analog Input Pins
8
DC Current per I/O Pin
40 mA
Flash Memory
16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by bootloader
SRAM
1 KB (ATmega168) or 2 KB (ATmega328)
EEPROM
512 bytes (ATmega168) or 1 KB (ATmega328)
Clock Speed
16 MHz
Dimensions
0.73 x 1.70' (18 x 45 mm)
Power
The Arduino Nano can be powered via the Mini-B USB connection, 6-20 V unregulated external power supply (pin 30), or 5 V regulated external power supply (pin 27). The power source is automatically selected to the highest voltage source.
Memory
The ATmega168 has 16 KB of flash memory for storing code (of which 2 KB is used for the bootloader), 1 KB of SRAM and 512 bytes of EEPROM
The ATmega328 has 32 KB of flash memory for storing code, (also with 2 KB used for the bootloader), 2 KB of SRAM and 1 KB of EEPROM.
Input and Output
Each of the 14 digital pins on the Nano can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 V.
Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms.
Communication
The Arduino Nano has a number of facilities for communicating with a computer, another Arduino, or other microcontrollers.
The ATmega168 and ATmega328 provide UART TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An FTDI FT232RL on the board channels this serial communication over USB and the FTDI drivers (included with the Arduino software) provide a virtual com port to software on the computer.
The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the Arduino board. The RX and TX LEDs on the board will flash when data is being transmitted via the FTDI chip and USB connection to the computer (but not for serial communication on pins 0 and 1).
A SoftwareSerial library allows for serial communication on any of the Nano's digital pins.
Programming
The Arduino Nano can be programmed with the Arduino software (download).
The ATmega168 or ATmega328 on the Arduino Nano comes with a bootloader that allows you to upload new code to it without the use of an external hardware programmer. It communicates using the original STK500 protocol (reference, C header files).
You can also bypass the bootloader and program the microcontroller through the ICSP (In-Circuit Serial Programming) header using Arduino ISP or similar; see these instructions for details.
Automatic (Software) Reset
Rather than requiring a physical press of the reset button before an upload, the Arduino Nano is designed in a way that allows it to be reset by software running on a connected computer.
One of the hardware flow control lines (DTR) of theFT232RL is connected to the reset line of the ATmega168 or ATmega328 via a 100 nF capacitor. When this line is asserted (taken low), the reset line drops long enough to reset the chip.
The Arduino software uses this capability to allow you to upload code by simply pressing the upload button in the Arduino environment. This means that the bootloader can have a shorter timeout, as the lowering of DTR can be well-coordinated with the start of the upload.
Arduino Uno is an open-source microcontroller board based on the ATmega328P. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. You can tinker with your Uno without worring too much about doing something wrong, worst case scenario you can replace the chip for a few dollars and start over again.
'Uno' means one in Italian and was chosen to mark the release of Arduino Software (IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference versions of Arduino, now evolved to newer releases. The Uno board is the first in a series of USB Arduino boards, and the reference model for the Arduino platform; for an extensive list of current, past or outdated boards see the Arduino index of boards.
Specifications
Microcontroller
ATmega328P
Operating Voltage
5 V
Input Voltage (recommended)
7-12 V
Input Voltage (limit)
6-20 V
Digital I/O Pins
14 (of which 6 provide PWM output)
PWM Digital I/O Pins
6
Analog Input Pins
6
DC Current per I/O Pin
20 mA
DC Current for 3.3 V Pin
50 mA
Flash Memory
32 KB (ATmega328P) of which 0.5 KB used by bootloader
SRAM
2 KB (ATmega328P)
EEPROM
1 KB (ATmega328P)
Clock Speed
16 MHz
LED_BUILTIN
13
Dimensions
68.6 x 53.4 mm
Weight
25 g
Architecture, Programming and Applications
The MSP430 is a popular family of microcontrollers from Texas Instruments. In this book we will work with the smallest type, which is the powerful MSP430G2553. We will look at the capabilities of this microcontroller in detail, as it is well-suited for self-made projects because it is available in a P-DIP20 package.
We will take a closer look at the microcontroller and then build, step by step, some interesting applications, including a 'Hello World' blinking LED and a nice clock application, which can calculate the day of the week based on the date.
You also will learn how to create code for the MSP microcontroller in assembler. In addition to that, we will work with the MSP-Arduino IDE, which makes it quite easy to create fast applications without special in-depth knowledge of the microcontrollers.
All the code used in the book is available for download from the Elektor website.
In this book the author presents all essential aspects of microcontroller programming, without overloading the reader with unnecessary or quasi-relevant bits of information. Having read the book, you should be able to understand as well as program, 8-bit microcontrollers.The introduction to microcontroller programming is worked out using microcontrollers from the PIC series. Not exactly state-of-the-art with just 8 bits, the PIC micro has the advantage of being easy to comprehend. It is offered in a DIP enclosure, widely available and not overly complex. The entire datasheet of the PIC micro is shorter by decades than the description of the architecture outlining the processor section of an advanced microcontroller. Simplicity has its advantages here. Having mastered the fundamental operation of a microcontroller, you can easily enter into the realms of advanced softcores later.Having placed assembly code as the executive programming language in the foreground in the first part of the book, the author reaches a deeper level with ‘C’ in the second part. Cheerfully alongside the official subject matter, the book presents tips & tricks, interesting measurement technology, practical aspects of microcontroller programming, as well as hands-on options for easier working, debugging and faultfinding.
Elektor GREEN and GOLD members can download their digital edition here.
Not a member yet? Click here.
Arduino Portenta Machine Control and Arduino Portenta H7A CAN-to-MQTT Gateway Demo Project
Unboxing the Elektor LCR Meter with David Cuartielles
MicroPython Enters the World of Arduino
Connected Projects, SimplifiedDive Into the Arduino Cloud
Introduction to TinyMLBig Is Not Always Better
Arduino K-Way
Writing Arduino Sketches Just Got Better
Get to Know Arduino
Getting Started with the Portenta X8Manage Software Securely with Containers
Build, Deploy, and Maintain Scalable, Secure ApplicationsWith Arduino Portenta X8 Featuring NXP’s i.MX 8M Mini Applications Processor and EdgeLock SE050 Secure Element
How I Automated My HomeArduino CEO Fabio Violante Shares Solutions
Altair 8800 SimulatorHardware Simulation of a Vintage Computer
MS-DOS on the Portenta H7Run Old-School Software on Contemporary Hardware
Grow It YourselfA Digitally Controlled, Single-Box Solution for Indoor Farming
Save the Planet With Home Automation?MQTT on the Arduino Nano RP2040 Connect
Go Professional with Arduino Pro
Smart Ovens Take a Leap Into the Future
Tagvance Builds Safer Construction Sites with Arduino
Santagostino Breathes Easywith Remote Monitoring that Leverages AI for Predictive Maintenance
Security Flies High with RIoT Secure’s MKR-Based Solution
Open-Source Brings a New Generation of Water Management to the World
SensoDetect Deforestation with Sound Analysis
The Mozzi Arduino Library for Sound SynthesisInsights from Tim Barrass
The New Portenta X8 (with Linux!) and Max Carrier Redefine What’s Possible
How Using Arduino Helps Students Build Future Skills
Must-Haves for Your Electronics Workspace
The Importance of Robotics in Education
Dependable IoT Based Upon LoRa
Unboxing the Portenta Machine Control
8-Bit Gaming with Arduboy
Reducing Water Usage at Horseback Riding TracksAn IoT to Constantly Monitor Soil Humidity and Temperature Levels
The Panettone ProjectA sourdough starter management and maintenance system
Supporting Arduino Resellers
Space Invaders with Arduino
Art with ArduinoInspiring Insights from Artists and Designers
Arduino Product Catalogue
The Future of Arduino