Skip to main content
main-content

Über dieses Buch

Extend the range of your Arduino skills, incorporate the new developments in both hardware and software, and understand how the electronic applications function in everyday life. This project-based book extends the Arduino Uno starter kits and increases knowledge of microcontrollers in electronic applications.
Learn how to build complex Arduino projects, break them down into smaller ones, and then enhance them, thereby broadening your understanding of each topic.You'll use the Arduino Uno in a range of applications such as a blinking LED, route mapping with a mobile GPS system, and uploading information to the internet.
You'll also apply the Arduino Uno to sensors, collecting and displaying information, Bluetooth and wireless communications, digital image captures, route tracking with GPS, controlling motors, color and sound, building robots, and internet access. With Arduino Applied, prior knowledge of electronics is not required, as each topic is described and illustrated with examples using the Arduino Uno.
What You’ll Learn
Set up the Arduino Uno and its programming environment
Understand the application of electronics in every day systems
Build projects with a microcontroller and readily available electronic components

Who This Book Is For
Readers with an Arduino starter-kit and little-to-no programming experience and those interested in "how electronic appliances work."

Inhaltsverzeichnis

Frontmatter

Chapter 1. Introduction

Abstract
The Arduino Uno provides the framework to learn about electronics, and to understand and build electronic devices. The Arduino Uno can monitor an environment with sensors, drive LED message boards, generate sound and light patterns, take and display digital photos, communicate by Bluetooth or wirelessly with other electronic devices, communicate by Wi-Fi to the Internet, and record data on the route, speed, and altitude of a trip with GPS.
Neil Cameron

Chapter 2. Switches

Abstract
Switches are used to turn devices on or off, such as a room light or an electrical appliance, and when sending a signal, such as pressing a particular key on a keyboard. Switches can also be used to control devices; a device is on when the switch is initially pressed or while the switch is pressed. The metal contacts of switches can bounce when the switch is pressed, which could repeatedly turn a device on and off again. Switch bouncing can be controlled using software or by hardware, which is called debouncing a switch.
Neil Cameron

Chapter 3. Sensors

Abstract
Sensors can be connected to the Arduino to measure aspects of the environment with sensor information displayed on the serial monitor or on the serial plotter. The Arduino can perform an instruction depending on the sensor signal being above or below a given threshold, such as turning on a light when a room is dark. This chapter describes several sensors with accompanying sketches to demonstrate uses of the sensors. In subsequent chapters, projects include one or more sensors, so it is useful to have all the sensors described in one chapter.
Neil Cameron

Chapter 4. Liquid Crystal Display

Abstract
The liquid crystal display (LCD) screen displays output from the Arduino, so that the Arduino does not need to be connected to a computer screen or laptop. A 16×4 LCD with a HD44780 controller is used in the chapter, which can display four rows of 16 characters per row, with each character defined by an 8×5–pixel array. LCDs have different sizes such as 16×2, 16×4, 20×2, and 20×4.
Neil Cameron

Chapter 5. 7-Segment LED Display

Abstract
Numbers and characters displayed on electronic devices use modules of seven LEDs with an eighth LED for the decimal point. Conventions for labelling the LEDs are a, b, … g or A, B, … G, with the decimal point denoted P or DP. There are 10 pins on the 7-segment display with pins 1 to 5 corresponding to LEDs e, d, common, c, and P with pins 6 to 10 mapping to LEDs b, a, common, f, and g. The two common pins, 3 and 8, are connected to a common cathode or common anode (see Figure 5-1).
Neil Cameron

Chapter 6. 4-Digit 7-Segment Display

Abstract
The 4-digit 7-segment display is an extension of the 1-digit 7-segment display discussed in Chapter 5. As with the 1-digit 7-segment display, there are seven LED segments on the 4-digit display, labelled a, b,g and P or DP. There are an additional four pins controlling the 4-digit displays. The pin layout on the 4-digit 7-segment display is illustrated in Figure 6-1 and the order of the digits from the left-hand side is 1, 2, 3, and 4. The 4-digit 7-segment display has a common cathode and a digit display is on when the digit pin state is LOW, which is equivalent to the common pin connected to ground for the 1-digit 7-segment display.
Neil Cameron

Chapter 7. 8×8 Dot Matrix Display

Abstract
The 8×8 dot matrix consists of 64 LEDs with 16 pins corresponding to eight columns of anodes and eight rows of cathodes. The label on one side of a 8×8 dot matrix display usually indicates the side containing pins 1 to 8 (left to right) with the other side containing pins 9 to 16 (right to left), as shown in Figure 7-1.
Neil Cameron

Chapter 8. Servo and Stepper Motors

Abstract
Servo and stepper motors are used in a variety of applications, such as robotics, tracking systems, and positioning devices. Servo motors are used for fast movement to a given angle, while the stepper motors moves at a controlled speed in either continuous rotation or to a specific position. The servo motor has a feedback mechanism to determine location in contrast to the stepper motor that is moved incrementally. Servo motors are included in projects in Chapters 13, 22, and 24 with the stepper motor used in Chapter 9.
Neil Cameron

Chapter 9. Rotary Encoder

Abstract
A rotary encoder is used to finely control an output, such as the rotation of a motor, the cursor position on a screen or simply the brightness of an LED. Rotary encoders are used as control switches, such as on audio equipment. The rotary encoder has 20 positions, but the rotor can be continuously rotated either forward or backward to increase or decrease a control variable.
Neil Cameron

Chapter 10. Infrared Sensor

Abstract
Infrared (IR) remote controls operate devices, such as domestic appliances and office machinery, wirelessly by transmitting a signal consisting of pulses of infrared light. When a remote control button is pressed, the infrared sensor receives a signal, which is decoded to implement the appropriate action corresponding to the remote control button. For example, if the “power on” button signal has binary representation B011101, the pulsed infrared signal would be as shown in Figure 10-1. The infrared wavelength is not visible to the human eye, but a remote control signal can be observed when viewed through the camera of a mobile phone.
Neil Cameron

Chapter 11. Radio Frequency Identification

Abstract
Radio frequency identification, RFID, uses electromagnetic fields to transfer data wirelessly. Common uses of RFID are entry passes to secure sites, library book logging, or tracking component parts in a production process. Passive RFID tags consist only of an antenna and a microchip, whose shadow can be seen by holding an RFID card up to a light. Passive RFID tags are powered by the RFID reader’s electromagnetic field to receive messages from the RFID reader and transmit messages to the RFID reader.
Neil Cameron

Chapter 12. SD Card Module

Abstract
SD (Secure Digital) cards can be used for data storage and data logging. Examples include data storage on digital cameras or mobile phones and data logging to record information from sensors. Micro SD cards can store 2GB of data and should be formatted as FAT32 (File Allocation Table) format. The micro SD card operates at 3.3V, so only micro SD card modules with a 5V to 3.3V voltage level shifter chip and a 3.3V voltage regulator can be connected to the Arduino 5V supply.
Neil Cameron

Chapter 13. Screen Displays

Abstract
Displaying information on the serial monitor has limitations on mobility with the Arduino connected to a computer screen, and the LCD screen displays only 16×4 characters and does not display images.
Neil Cameron

Chapter 14. Sensing Colors

Abstract
A color can be defined as a combination of red, green, and blue components, as shown in Figure 14-1. One byte or 8 bits is used to store each of the red, green, and blue values with 28 = 256 possible values for each of the red (R), green (G), and blue (B) components of the compound color. For example, magenta has a (255, 0, 255) RGB format.
Neil Cameron

Chapter 15. Camera

Abstract
The Arduino can support a camera, such as the OV7670 module, and display images on an ST7735 TFT LCD screen (see Figure 15-1) with a frame transfer rate of 10 frames per second (fps). The resolutions of the OV7670 camera and ST7735 TFT LCD screen are 640×480 and 160×128 pixels, respectively.
Neil Cameron

Chapter 16. Bluetooth Communication

Abstract
Bluetooth is a wireless technology for short distance communication between devices with short wavelength radio waves and operating at 2.4GHz. Bluetooth is used for hands-free car phones, streaming audio to headphones, data transfer, and communication between devices. The HC-05 Bluetooth module mounted on a breakout board is recommended, as the module itself does not have connecting pins. The HC-05 module communicates by Bluetooth Serial Port Profile (SPP) with a coverage distance of up to 10m.
Neil Cameron

Chapter 17. Wireless Communication

Abstract
While Bluetooth communication is used between devices less than 10m apart, communication over longer distances is possible using wireless transceiver modules. The greater distance between wireless transceiver modules or between a wireless transceiver module and the Arduino enables access to remote sensors and control of remote devices. The nRF24L01 radio transceiver module operates at 2.4GHz, the same frequency as Bluetooth, with 126 available channels and baud rates of 250kbps, 1Mbps, and 2Mbps. The lower baud rate may be more suitable for longer distances.
Neil Cameron

Chapter 18. Build Arduino

Abstract
In this chapter, we’ll review the ATmega328P-PU 8-bit microcontroller. It has three types of memory: 32kB ISP (in-system programming) flash memory where sketches are stored, 1kB EEPROM (electrically erasable programmable read-only memory) for long-term data storage and 2kB SRAM (static random-access memory) for storing variables when a sketch is running. Information in flash memory and EEPROM is retained when power to the microcontroller is removed.
Neil Cameron

Chapter 19. Global Navigation Satellite System

Abstract
Longitude, latitude, and altitude can be determined from the global navigation satellite system (GNSS) using radio signals transmitted by line-of-sight satellites. GNSS includes the American GPS, Russian GLONASS, European Union Galileo, Chinese BeiDou, Japanese Quasi-Zenith, and satellite-based augmentation satellite systems. The u-blox NEO-7M module used in this chapter can receive signals from the GPS and GLONASS systems.
Neil Cameron

Chapter 20. Interrupts and Timed Events

Abstract
Interrupts allow the microcontroller to respond to an external signal, such as the change in state of a device, while performing another task. An interrupt pauses the sketch and implements the interrupt service routine (ISR), then the sketch continues from the point that it was interrupted.
Neil Cameron

Chapter 21. Power Saving

Abstract
The power demands on the Arduino are the ATmega328P microcontroller, the ATmega16U2 microcontroller controlling the USB-to-serial interface, the 3.3V and 5V voltage regulators, and the three LEDs: power-on, transmit (TX), and receive (RX). There are several power-down options, but they only apply to the ATmega328P microcontroller.
Neil Cameron

Chapter 22. Sound and Square Waves

Abstract
Sound is the vibration of air particles. If the vibration is continuous and regular, then the sound can be described by its frequency, as the number of waves per second, quantified in Hertz (Hz). For the time interval in Figure 22-1, the blue sound wave has two complete cycles, while the red sound wave has four complete cycles, so double the frequency and half the wavelength of the blue sound wave. For electromagnetic and sound waves, wavelength is the speed of light and sound, respectively, divided by the frequency.
Neil Cameron

Chapter 23. DC Motors

Abstract
The DC (direct current) motor has many applications in robotics, portable power tools, and electric vehicles. DC motors are driven by the force generated in a magnetic field. Passing a current through an electromagnet, which is a coil of wire wrapped around a metallic rod, generates a magnetic field and reversing the current changes the polarity of the electromagnet. Given that same-pole magnets repel and dissimilar-pole magnets attract, then mounting two electromagnets on a rotor enclosed within a permanent magnet and alternating the current through the electromagnets turns the rotor as the magnets sequentially attract and repel.
Neil Cameron

Chapter 24. Robot Car

Abstract
Building a robot car combines devices outlined in several chapters, with DC motors in Chapter 23, a servo motor in Chapter 8, an ultrasonic distance sensor in Chapter 3, an OLED display in Chapter 13, and an RGB LED in Chapter 14. The obstacle-avoiding robot car detects the distance to surrounding objects in front of the robot car, and if the distance is below a threshold, the robot car stops and scans left and right to determine the direction away from the nearest obstacle. An RGB LED indicates the direction of the turn. The distances from the robot car are shown on the OLED display (see Figure 24-1).
Neil Cameron

Chapter 25. Wi-Fi Communication

Abstract
Wi-Fi technology allows communication between a device and a wireless local area network (WLAN). Devices such as personal computers and printers, digital cameras and mobile phones can connect to a Wi-Fi access point over a distance of 20m indoors with greater distances outdoors. Like Bluetooth (see Chapter 16) and wireless (see Chapter 17) communication, Wi-Fi operates at 2.4GHz.
Neil Cameron

Backmatter

Weitere Informationen

Premium Partner

    Bildnachweise