List of Figures

Chapter 1. Hello Arduino

Figure 1.1. Board layout and pins of the Arduino Uno

Figure 1.2. The Arduino Mega pins and layout; note the additional input-output pins and the extra serial ports compared to the Arduino Uno.

Figure 1.3. The LilyPad Arduino is suitable for sewing onto fabric, and there’s a range of sewable accessories available.

Figure 1.4. LED inserted between pin 13 and GND. Note that the shorter leg is connected to GND.

Figure 1.5. In this example, the Duemilanove has been selected, but you can see there’s quite a list to choose from.

Figure 1.6. Select the correct serial board from the list.

Figure 1.7. Click the upload button to upload the sketch to the Arduino.

Figure 1.8. A typical sketch with the buttons and areas of the screen labeled

Figure 1.9. The serial monitor showing the output from an Arduino printing out an ASCII table

Figure 1.10. The code editor reports an error we’ve introduced into the code. The code checker indicates which line it thinks the error is on, as well as what it expected.

Chapter 2. Digital input and output

Figure 2.1. The components required to complete this tutorial

Figure 2.2. Breadboard layout: the sockets in the top and bottom two rows are connected horizontally; the other sockets are connected vertically with a break in the center of the breadboard.

Figure 2.3. Schematic diagram showing Arduino connected to five LEDs

Figure 2.4. Making connections to the first LED with a currentlimiting resistor and pin 12 of the Arduino

Figure 2.5. Connections of the five resistors to pins 8 through 12 on the Arduino

Figure 2.6. The completed circuit with power being provided by the USB connection

Figure 2.7. Schematic of an Arduino connected to five LEDs controlled by a push button

Figure 2.8. Connecting the push button to the breadboard

Figure 2.9. The completed circuit connected to the USB for power

Figure 2.10. Schematic of Arduino with a push button and seven LEDs: two of them are used as start/stop indicators.

Figure 2.11. Completed connections with two additional LEDs for stop and start

Figure 2.12. Final circuit running the reactometer

Figure 2.13. Serial monitor displaying reaction times

Chapter 3. Simple projects: input and output

Figure 3.1. A selection of potentiometers

Figure 3.2. Schematic symbols for a potentiometer: U.S. (left), International (center), Fritzing (right)

Figure 3.3. A circuit diagram showing the potentiometer connected to the Arduino

Figure 3.4. The potentiometer connected to the Arduino

Figure 3.5. Output displayed as the potentiometer is rotated

Figure 3.6. A typical piezoelectric transducer used in some musical cards and as sensors on drum kits

Figure 3.7. When a piezoelectric transducer is distorted, it produces an electric charge; alternately squeezing and releasing the transducer will produce a varying voltage.

Figure 3.8. When varying voltage is applied to a piezoelectric transducer, the transducer’s shape distorts.

Figure 3.9. A piezoelectric transducer attached to analog input A0. The zener diode protects the Arduino from the high voltages produced by the transducer when it’s struck.

Figure 3.10. The completed circuit connected to the Arduino. Note the orientation of the zener diode and the polarity of the piezoelectric transducer.

Figure 3.11. The serial monitor showing the results of squeezing or tapping the piezoelectric transducer

Figure 3.12. Output from hitting the piezoelectric transducer with varying degrees of force

Figure 3.13. A speaker has been added to the circuit, with which you’ll output a tone.

Figure 3.14. Connections with the addition of the speaker

Figure 3.15. Circuit diagram for pentatonic keyboard

Figure 3.16. The pentatonic keyboard fully assembled

Chapter 4. Extending Arduino

Figure 4.1. The microSD shield from SparkFun Electronics

Figure 4.2. The contributed libraries available to a sketch after installation

Figure 4.3. A motor shield from adafruit.com

Figure 4.4. The official Arduino Ethernet shield

Figure 4.5. The WiFly shield from SparkFun

Figure 4.6. A prototyping shield from adafruit.com

Chapter 5. Arduino in motion

Figure 5.1. A DC motor complete with gearbox from solarbotics.com

Figure 5.2. The elements of an SPDT relay

Figure 5.3. A NPN 2N2222 transistor in a TO-92 plastic package

Figure 5.4. A 2N2222 NPN transistor with legs connected to a TO-92 plastic package on the left and a TO-18 metal package on the right

Figure 5.5. Schematic symbol for an NPN transistor showing the base, collector, and emitter

Figure 5.6. Schematic diagram for switching a motor on and off with a transistor and a relay

Figure 5.7. Pinouts of DPDT relay

Figure 5.8. Completed circuit controlling a motor with a relay

Figure 5.9. Using a potentiometer to control the speed of a motor

Figure 5.10. Output from an Arduino using the analogWrite function

Figure 5.11. An H-bridge made up of four switches to control the direction of a motor

Figure 5.12. Pinouts of the L293D dual H driver

Figure 5.13. Circuit diagram showing connections between the motor, the L293D, and the Arduino

Figure 5.14. DC motor control using an L293D integrated circuit

Figure 5.15. A stepper motor purchased from eBay

Figure 5.16. Label on the back of a stepper motor

Figure 5.17. Measuring the resistance between two stepper motor wires

Figure 5.18. Resistance measured from coils of a unipolar stepper motor

Figure 5.19. A surplus bipolar stepper motor pulled from an old printer

Figure 5.20. Label on reverse of bipolar stepper motor

Figure 5.21. A schematic diagram using an L293D to drive a bipolar stepper motor

Figure 5.22. Circuit connections between the L293D and the unipolar stepper motor

Figure 5.23. A typical small servomotor

Figure 5.24. Relationship between pulse width and servo angle

Figure 5.25. Section of single-row header 0.1-inch pitch to connect servomotor to breadboard

Figure 5.26. Connections between servomotor and Arduino

Figure 5.27. An outrunner (top) and an inrunner (bottom) brushless motor

Figure 5.28. Brushless motor controlled by an Arduino

Figure 5.29. Components supplied in the Adafruit Industries motor control shield kit

Figure 5.30. The fully-assembled motor controller shield

Chapter 6. Object detection

Figure 6.1. How ultrasonic waves are transmitted and received by a distance sensor

Figure 6.2. The Devantech SRF05, an ultrasonic sensor

Figure 6.3. The Parallax Ping, an ultrasonic sensor

Figure 6.4. Connecting the Parallax Ping to the Arduino

Figure 6.5. Connecting the Devantech SRF05 to the Arduino

Figure 6.6. The Sharp GP2D12 IR Ranger

Figure 6.7. Distance to voltage output from the GP2D12

Figure 6.8. Connecting the GP2D12 to the Arduino

Figure 6.9. The Parallax PIR sensor

Figure 6.10. Connecting the Parallax PIR sensor to the Arduino

Chapter 7. LCD displays

Figure 7.1. The connections between a Hitachi HD44780-based LCD display and the Arduino

Figure 7.2. Power and contrast wiring for the Hitachi HD44780 parallel LCD

Figure 7.3. Completing the wiring for the Hitachi HD44780 parallel LCD

Figure 7.4. Circuit diagram for a weather station using the SparkFun (or compatible) serial LCD, and the DS18B20 one-wire digital temperature sensor

Figure 7.5. Pin layout for the DS18B20 temperature sensor

Figure 7.6. Completed wiring for a DS18B20-based LCD weather station

Figure 7.7. Circuit diagram for the KS0108 GLCD with pinout A connected to the Arduino Mega

Chapter 8. Communications

Figure 8.1. Overview of Arduino web server communication

Figure 8.2. Simple button-tweeting circuit

Figure 8.3. Screenshot of a Twitter button tweet

Figure 8.4. Overview of pins used by Wifi Shield.

Figure 8.5. Connecting the ADXL335 analog accelerometer to the Arduino

Figure 8.6. Screenshot showing how your computer’s Bluetooth chip acts as a serial device

Figure 8.7. ArduinoBT, a Bluetoothenabled Arduino board

Figure 8.8. Connecting the SparkFun BlueSMiRF Silver to an Arduino

Figure 8.9. SPI communication channels

Figure 8.10. Four LEDs controlled by the AD5206 digital potentiometer

Figure 8.11. Main Cosm user interface

Figure 8.12. Creating a new Cosm feed to log sensor data

Chapter 9. Game on

Figure 9.1. Wii Nunchuk

Figure 9.2. A self-balancing motorized skateboard built by John Dingley, UK

Figure 9.3. Angular rotation of three-axis accelerometer

Figure 9.4. Range of motion of Nunchuk joystick

Figure 9.5. Nunchuk end connector

Figure 9.6. WiiChuck designed by Tod E. Kurt

Figure 9.7. NunChucky breakout board from Solarbotics

Figure 9.8. Typical output from Nunchuk to serial monitor

Figure 9.9. Xbox 360 game controller

Figure 9.10. Version 2.0 of the USB Host Shield from circuitsathome.com

Figure 9.11. Select the USB_desc example sketch

Figure 9.12. Device descriptor and configuration descriptor

Figure 9.13. Description of interface 00 for the Xbox controller

Figure 9.14. Xbox controller connected to USB Host Shield and Arduino

Figure 9.15. Typical output from the Xbox controller

Chapter 10. Integrating the Arduino with iOS

Figure 10.1. The Redpark Product Development serial cable for use with older iOS devices

Figure 10.2. Pinout of male RS232 DB-9 connector

Figure 10.3. P4B TTL to RS232 adapter

Figure 10.4. P4B TTL to RS232 adapter connected to the Arduino

Figure 10.5. Select Single View Application

Figure 10.6. Complete the project details.

Figure 10.7. MainStoryboard_iPhone.storyboard view

Figure 10.8. Switch object dragged onto the viewer with its state set to Off

Figure 10.9. Name the outlet toggleSwitch.

Figure 10.10. Create an action and name it toggleLED.

Figure 10.11. Import the Redpark serial SDK files.

Figure 10.12. Add the external accessory framework to the project.

Figure 10.13. Declaring support for the Redpark serial cable

Figure 10.14. iPhone connected to Arduino, switching LED on and off

Figure 10.15. Adding a Slider control to the iPhone storyboard

Figure 10.16. Add the Tag value 13 to the Switch.

Figure 10.17. Add the moveSlider outlet.

Figure 10.18. Add the brightnessLED action.

Figure 10.19. LED connected to pin 9 on the Arduino

Figure 10.20. Complete setup: iPhone controlling LED’s brightness

Figure 10.21. Labels added to the view

Figure 10.22. Adding the distance outlet

Figure 10.23. GP2D12 infrared sensor added to circuit

Figure 10.24. The completed circuit with GP2D12 sensor connected to Arduino and iPhone

Figure 10.25. The complete IOSArduino app running on an iPhone

Chapter 11. Making wearables

Figure 11.1. The pins of the LilyPad

Figure 11.2. Connecting the SparkFun FTDI breakout board to the LilyPad for programming

Figure 11.3. The LilyPad Simple

Figure 11.4. LilyPad Temperature Sensor and LilyPad Vibe Board from SparkFun Electronics

Figure 11.5. Two different LilyPad power boards: the AAA Battery Holder, and the LiPo Holder, which allows you to connect a lithium polymer battery

Figure 11.6. Conductive ribbon

Figure 11.7. Flex sensor

Figure 11.8. Connecting the LilyPad, LEDs, and flex sensors

Figure 11.9. Sewing the components into the jacket

Figure 11.10. Creating a simple soft button

Figure 11.11. Connecting the buttons and speaker to the LilyPad Arduino

Figure 11.12. The Arduino Pro Mini

Figure 11.13. The tiny QRE1113 IR-reflectance sensor

Figure 11.14. A Bluetooth Mate Silver transmitter

Figure 11.15. The HMC5883L magnetic compass

Figure 11.16. The SparkFun 7-segment serial display

Chapter 12. Adding shields

Figure 12.1. The Adafruit motor shield—the first motor shield we will be using in this chapter. Image from http://www.adafruit.com/products/81.

Figure 12.2. The connections for listing 12.1

Figure 12.3. Connecting a servomotor to the motor shield

Figure 12.4. A project board, sometimes called a perfboard (source: SparkFun)

Figure 12.5. The pins for the 74HC4050

Figure 12.6. An SD card holder that can be soldered into a project board

Figure 12.7. The various connections for an SD card

Figure 12.8. Connecting the 74HC4050 to the Arduino and SD card holder

Figure 12.9. The two types of header pins: standard female header on the left, and Arduino offset header on the right

Figure 12.10. You can drill additional 0.8 mm holes into the perfboard if you don’t have prebent pins or don’t want to bend them yourself.

Figure 12.11. The SD card shield is ready to be connected to the Arduino board.

Figure 12.12. Connecting the level shifter to the SD card holder

Chapter 13. Software integration

Figure 13.1. The Lynx Pan and Tilt kit

Figure 13.2. Connecting the servomotors to the Arduino

Figure 13.3. Connecting the LEDs to create your Arduino equalizer

Figure 13.4. Selecting the StandardFirmata program

Figure 13.5. A Pd patch

Figure 13.6. The comport object

Figure 13.7. Connecting the comport to the devices object

Figure 13.8. Connecting potentiometers for the mixer

Figure 13.9. The Pd patch in the Pd IDE

Figure 13.10. Connecting the temperature sensors to the Arduino

Appendix A. Installing the Arduino IDE

Figure A.1. Extracting/copying the Arduino IDE and drivers to your local hard drive on Windows 7

Figure A.2. Setting driver location search path for Arduino Uno driver installation on Windows 7

Figure A.3. Setting driver location for FTDI-based Arduino boards (such as the Duemilanove, Nano, and Diecimila) on Windows 7

Figure A.4. Select the type of Arduino board

Figure A.5. Select your serial port

Figure A.6. Using the Synaptic Package Manager to install dependencies for Linux

Figure A.7. Marking OpenJDK for installation

Figure A.8. Libraries to be installed for OpenJDK

Appendix B. Coding primer

Figure B.1. Additional functionality is added to the language by using libraries.

Figure B.2. Typical variables, considered as though they are held in named buckets

Figure B.3. The scope of variables varA, varB, and varC

Figure B.4. A simple task: upon entering a room, if it is dark, turn on the light.

Figure B.5. A for loop header showing initialization, test, and increment or decrement

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset