Programmers probably all have a bit of a maker dream. While others’ youth is filled with confusion, we are obsessed with code, indifferent to love… While others think the world is vast and want to explore, we perhaps find the world of 0s and 1s more mysterious. Speaking of the mysterious hobbies of programmers, tinkering at home with boards must be one of them!
First, let’s take a look at a wave of tools for homebodies from Zhihu—
@Lightning Law Tesla A DEBUG artifact
@Missy Tetris
@Ah Gu Music box, poke its eyes to make sounds, blow its butt to make sounds, give it water to make sounds, tilt it to make sounds, drop it to make sounds, together it becomes a percussion instrument.
@Yu Ziqi A micro quad Multiwii firmware, suitable for indoor flying
(The above images and works are from Zhihu users; for more details, you can click the link to view and message the author https://www.zhihu.com/question/29441922)
A very small box contains a circuit board, a plug-in power supply, several LED lights, some resistors, jumper wires, and a solderless breadboard. Once you open the box, you can use the items inside to create anything you want. This is not Pandora’s box, nor is it the small box containing the Internet from IT maniacs; it is a box of creativity. Moreover, anyone can achieve the maker’s dream for about $15. So, what’s in the box? The answer is an Arduino board.
Since its launch in 2005, Arduino has become one of the most successful open-source hardware projects in the world(some may disagree). After the Arduino team made their designs public, many countries, including Italy, Brazil, China, the Netherlands, India, and the United States, began producing development boards based on this design. Anyone can buy a fully functional Arduino-compatible development board for about $15. People can freely download and use the completely free Arduino development environment.
Next, let’s delve into today’s protagonist—Arduino.
Arduino is a convenient and flexible open-source electronic prototyping platform that includes hardware (various models of Arduino boards) and software (Arduino IDE), developed by a European team in the winter of 2005. Its members include Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, David Mellis, and Nicholas Zambetti.
It is built on an open-source simple I/O interface board and has a development environment similar to Java and C language called Processing/Wiring.It consists of two main parts: the hardware part is an Arduino circuit board used for circuit connections; the other is the Arduino IDE, the programming development environment on your computer. By writing program code in the IDE and uploading it to the Arduino circuit board, the program will tell the Arduino circuit board what to do.
Arduino can sense the environment through various sensors and respond to and affect the environment by controlling lights, motors, and other devices. The microcontroller on the board can be programmed using the Arduino programming language, compiled into binary files, and burned into the microcontroller. Programming for Arduino is done through the Arduino programming language (based on Wiring) and the Arduino development environment (based on Processing). Projects based on Arduino can include only Arduino or both Arduino and other software running on a PC, communicating between them (such as Flash, Processing, MaxMSP) to achieve functionality.
Tables 1-2 to 1-5 display several common Arduino development boards, including old and new versions, but do not include all types of Arduino, as new development boards and updates to existing boards are released regularly. Figure 1-1 shows the diversity of various Arduino development boards in shape and application.
In terms of size, Arduino is not very big, with the baseline board size of approximately 2.1 in × 2.7 in (53.3 mm × 68.6 mm), generally equipped with physical pins to support expansion boards. Figure 1-1 displays two types of Arduino development boards, with a ruler for size comparison. Figure 1-2 shows a Nano development board installed on a solderless breadboard.
Figure 1-1: Relative size of Arduino development boards
Figure 1-2: Arduino Nano installed on a solderless breadboard
Table 1-2: Arduino development board baseline layout
Table 1-3: Layout of Arduino Mega development board
Table 1-4: Arduino small development board
Table 1-5: Arduino special edition
In addition to various development boards designed or recognized by Arduino.cc, there are many devices that are compatible with Arduino in hardware or software. These devices are compatible with Arduino because they integrate the Arduino Bootloader (or a similar Bootloader). We can select suitable and mutually compatible Arduino development boards from the drop-down list in the Arduino IDE and write programs for them in the Arduino IDE.
Hardware Compatible Devices
For Arduino hardware compatible devices, the arrangement of various I/O pins is the same as existing Arduino boards. Generally, on hardware-compatible development boards, we can also use various expansion boards and plug-in modules made for official Arduino development boards.
In most cases, hardware-compatible development boards look very similar to Arduino development boards, but they do not have the official Arduino logo and silkscreen graphics. Other hardware-compatible products may look completely different from standard Arduino development boards, but they adopt the same arrangement layout to provide pin sockets, allowing users to use standard Arduino expansion boards on them. Some hardware-compatible products are equipped with additional connectors, such as the SainSmart Uno, which has extra connectors for supporting I/O functions. Table 1-6 lists several common Arduino clone boards and compatible boards. Additionally, there are many development boards compatible with Arduino, and those listed in the table give you a general idea.
Table 1-6: Arduino hardware-compatible devices (Please note that Diavolino is a kit that requires user assembly.)
Software Compatible Devices
In addition to hardware-compatible devices, there are many Arduino software-compatible development boards available. These development boards use Arduino’s Bootloader and development environment, but their physical sizes differ from Arduino. Software-compatible devices can be programmed using Arduino development tools but may adopt different I/O pin arrangements or use some other types of connectors to replace the pin sockets of old Arduino development boards. For custom circuit boards based on AVR microcontrollers embedded in larger devices or systems, if the microcontroller has the Arduino Bootloader installed, we also classify them as software-compatible devices.
The core of Arduino is the processor and pre-installed Bootloader. From this definition, the simplest Arduino is just a basic ATmega AVR IC with the Arduino firmware, capable of working with solderless breadboards and the Arduino development environment. You can purchase AVR MCU ICs with pre-loaded Bootloader code from various sources, or you can create them yourself.
Interestingly, some official Arduino development boards are not hardware-compatible based on whether they use standard I/O connector layouts, such as Mini, Micro, Nano, LilyPad, and Esplora. They cannot be used directly with common expansion boards but are still Arduino development boards and are supported by Arduino IDE.
Boarduino, launched by Adafruit Industries, is an example of an Arduino software-compatible device designed to be installed on standard solderless breadboards, resembling a full-size 40-pin IC. Boarduino is available in two versions, DC version and USB version. The DC version does not have an onboard USB chip, requiring an external USB adapter for programming. Another example of a software-compatible development board is the Dragonfly board produced by Circuit Monkey, which uses standard Molex connectors instead of the commonly used pins and sockets of Arduino. Dragonfly is mainly used in high-vibration environments, such as drones (UAVs) and robots.
Raspduino is designed to be installed on Raspberry Pi boards, functionally equivalent to an Arduino Leonardo. This combination is roughly equivalent to Arduino Yún, but not entirely the same. Each setup has its pros and cons, and Table 1-7 lists several common Arduino software-compatible development boards.
Table 1-7: Arduino software-compatible devices
The above are just a small portion of the various available software-compatible development boards. Since AVR microcontrollers can be easily integrated into electronic designs, they are widely seen in numerous applications. With the help of Arduino Bootloader firmware, programming devices becomes very simple, and the design is filled with endless possibilities.
-
Real-world Monitoring
-
Automated Weather Stations
-
Lightning Detectors
-
Solar Panel Sun Tracking Systems
-
Background Radiation Monitoring
-
Wildlife Automatic Detection Devices
-
Home or Commercial Security Systems
-
Small-scale Control
-
Small Robots
-
Rocket Models
-
Airplane Models
-
Quadcopter UAVs
-
Simple CNC for making small machine tools
-
Small Automation Control
-
Automated Greenhouses
-
Automated Aquariums
-
Laboratory Shuttle Robots
-
Precision Temperature Control Boxes
-
Automated Electronic Testing Systems
-
Art Performances
-
Dynamic Light Control
-
Dynamic Sound Control
-
Moving Structures
-
Audience Interactive Works
After seeing this introduction to Arduino and the works at the beginning of this article, are your hands itching? Or did you buy a board but didn’t know how to play with it? Today, Xiao Lu has organized the content for everyone from our new book “Arduino Technical Guide”.The author has been in contact with Arduino since the early 1980s—it aims to inspire creativity.
It is aimed at those who love to tinker, regardless of whether you have a technical background. However, programmers and other technical guys are probably Arduino’s number one fans! So I sincerely introduce this book to everyone:
John M. Hughes
Embedded systems engineer with over 30 years of experience in electronics, embedded systems and software, aerospace systems, and scientific application development. He was responsible for developing surface imaging software for the Phoenix Mars Lander. His team also developed a new type of synthetic heterodyne laser interferometer for calibrating the position control of the Webb Space Telescope. He is also the author of “Must-read for Electronic Engineers: Components and Techniques”, which systematically introduces electronics, hardware, components, tools, and techniques for enthusiasts and makers without an electronics background.
Chapter 1 briefly introduces the history of various Arduino development boards; it also introduces the AVR microcontroller used in Arduino development boards and discusses the differences between Arduino software-compatible products and hardware-compatible products.
Chapter 2 focuses on Atmel AVR microcontrollers, outlining how a truly complex device is composed. Of course, only the most important parts are quickly reviewed here, including timer logic, analog comparators, analog inputs, SPI interfaces, and other major subsystems on the chip.
Chapter 3 further explains various AVR microcontrollers used on Arduino development boards, including ATmega168/328, ATmega1280/2560, and ATmega32U4. This chapter builds on the content of Chapter 2, adding more low-level details, such as internal architecture, electrical characteristics, chip pin layout, etc.
Chapter 4 discusses the physical characteristics and interface functions of various Arduino development boards, including USB interface types, printed circuit board (PCB) sizes, and pin layout diagrams of development boards.
Chapter 5 discusses the Arduino programming environment, which is what truly sets it apart. This chapter also introduces the definition of Arduino programs and how to write Arduino programs using C and C++ languages; it also introduces Arduino BootLoader and main() functions, explaining how to download Arduino source code. By reading these source codes, you can understand the underlying workings hidden beneath the surface.
Chapter 6 introduces the AVR-GCC toolchain and the techniques for programming Arduino development boards without using the Arduino IDE. It also involves content related to “makefiles” and briefly introduces assembly language programming. Finally, it discusses various tools for uploading code to AVR.
Chapter 7 focuses on the various standard libraries included with the Arduino IDE. The Arduino IDE itself provides a large number of standard libraries and continues to add more. If you want to know if there is a ready-made library module for a specific sensor or operation, this chapter is a good starting point.
Chapter 8 introduces various expansion boards suitable for Arduino, including various common types, such as flash, prototype, input/output, Ethernet, Bluetooth, ZigBee, servo control, stepper motor control, LED display, LCD display, etc. This chapter also includes content on using multiple expansion boards and provides many tips and tricks to help you maximize the potential of expansion boards.
Chapter 9 introduces some additional components that can be used with Arduino development boards, including various sensors, relay modules, keypads, and other devices that are not specific to Arduino but work well with it. In addition, it provides pin layouts and circuit diagrams for many electronic components discussed.
Chapter 10 specifically introduces how to make your own expansion boards, as it is sometimes not easy to find expansion boards that meet our needs. Additionally, it discusses how to use AVR microcontrollers without Arduino-type circuit boards and still be able to use the Arduino IDE.
Chapters 11-13 introduce several electronic design projects, through which you can further understand the functions of AVR microcontrollers and Arduino expansion boards. These electronic projects also demonstrate how to apply Arduino in various situations, rather than just showing how to make circuit boards or devices. Of course, if you are willing, you can completely make these electronic projects yourself and use them as a starting point for your own projects. Each example project includes principles of operation, circuit diagrams, detailed component lists, PCB layout designs (if needed), and an overview of the software required for operation.
Chapter 11 discusses how to make a basic signal generator, which is often used to test electronic circuits. Through this signal generator, you can produce pulses with various duty cycles, output a series of pulses in response to trigger pulse inputs, generate sine waves, and create programmable pulse patterns.
Chapter 12 explains how to design and make a smart thermostat, which is suitable for use with home HVAC (heating, ventilation, and air conditioning) systems. After studying this chapter, you won’t need to buy a ready-made thermostat, as you can completely make one yourself and have it work entirely according to your design. In this chapter, I will teach you how to integrate temperature sensors (which include multiple temperature and humidity sensors), how to use the HVAC system’s fan to create a comfortable environment, and how to avoid costs incurred by running compressors or lighting heaters.
Chapter 13 will teach you how to make an automatic model rocket launcher, which comes with a programmable sequencer and automatic system detection function. Even if you don’t have a model rocket, I recommend that you seriously learn some of the techniques used in this project, as these techniques can be applied in various control processes that have strict requirements on execution order, such as production lines in factories and automated material handling equipment in laboratories.
Table of Contents
Chapter 1: The Arduino Family 1
1.1 Arduino History 1
1.2 Arduino Device Types 2
1.3 Arduino Physical Display 3
1.4 Arduino Compatible Devices 6
1.5 Arduino Naming Conventions 8
1.6 Purposes that can be achieved with Arduino 9
1.7 More Information 11
Chapter 2: AVR Microcontrollers 12
2.1 Background 12
2.2 Internal Architecture 13
2.3 Internal Memory 16
2.4 Peripheral Functions 16
2.5 Analog Comparators 19
2.6 Analog to Digital Converters 20
2.7 Serial I/O 21
2.8 Interrupts 24
2.9 Watchdog Timers 26
2.10 Electrical Characteristics 26
2.11 More Information 27
Chapter 3: AVR Microcontrollers for Arduino 28
3.1 ATmega168/328 29
3.2 ATmega1280/ATmega2560 35
3.3 ATmega32U4 44
3.4 Fuse Bits 53
3.5 More Information 55
Chapter 4: Arduino Technical Details 56
4.1 Arduino Features and Functions 56
4.2 Arduino USB Interfaces 57
4.3 Arduino Physical Size 59
4.4 Arduino Pin Layout 66
4.5 More Information 78
Chapter 5: Programming Arduino and AVR Microcontrollers 79
5.1 Microcontroller Cross Compilation 80
5.2 BootLoader 81
5.3 Arduino IDE Environment 83
5.4 Cross Compilation with Arduino IDE 86
5.5 Libraries 98
5.6 Arduino Source Code 103
Chapter 6: Programming without Arduino IDE 105
6.1 IDE Replacement Options 105
6.2 AVR Toolchain 108
6.3 Building C or C++ Programs from Scratch 118
6.4 AVR Assembly Language 120
6.5 Uploading Executable Code to AVR 126
6.6 Summary 133
Chapter 7: Arduino Libraries 134
7.1 Library Components 134
7.2 Third-party Libraries 179
Chapter 8: Expansion Boards 182
8.1 Electrical Characteristics of Expansion Boards 183
8.2 Physical Characteristics of Expansion Boards 184
8.3 Stacking Expansion Boards 186
8.4 Common Arduino Expansion Boards 186
8.5 Uncommon Arduino Expansion Boards 230
8.6 Resources 231
Chapter 9: Modules and I/O Components 233
9.1 Modules 234
9.2 Grove Modules 260
9.3 Introduction to Sensors and Modules 261
9.4 Sensors 262
9.5 Communication 279
9.6 Output Devices and Components 281
9.7 User Input 288
9.8 User Output 289
9.9 Support Functions 291
9.10 Connections 294
9.11 Supplier Resources 297
9.12 Summary 297
Chapter 10: Making Your Own Components 299
10.1 Preparation 301
10.2 Making Expansion Boards 305
10.3 Making GreenShield Expansion Boards 309
10.4 Making Arduino-Compatible PCBs 334
10.5 Switchinator 335
10.6 Resources 356
Chapter 11: Project: Programmable Signal Generator 358
11.1 Project Goals 360
11.2 Definition and Planning 360
11.3 Design 362
11.4 Prototyping 366
11.5 Software 370
11.6 Final Assembly 382
11.7 Final Testing and Conclusion 386
11.8 Cost Reduction 387
11.9 Cost Breakdown 388
11.10 Resources 389
Chapter 12: Project: Smart Thermostat 390
12.1 Background 390
12.2 Project Goals 395
12.3 Definition and Planning 395
12.4 Design 396
12.5 Prototype 406
12.6 Software 410
12.7 Final Version 413
12.8 Cost Breakdown 417
12.9 Next Steps 417
12.10 Resources 418
Chapter 13: Model Rocket Launcher: Design Study 419
13.1 Overview 419
13.2 Design Cycle 420
13.3 Goals 421
13.4 Selecting and Defining Functional Requirements 423
13.5 Initial Design 426
13.6 Prototype 432
13.7 Final Design 433
13.8 Cost Analysis 443
Scan to Buy on JD
Welfare Time
We are giving away 5 free books this time. For those who have played with Arduino, tell us what you have made with it? Or what technical implementation difficulties have you encountered while using it?
For those who haven’t used it, what made you learn about Arduino? Or what ideas do you want to implement with Arduino?
We welcome everyone to speak freely, and 5 selected comments will receive the free books, deadline December 27, 2017.
PS: Merry Christmas!
Click 【Read Original】 to see more electronic and electrical books