Arduino Workshop
()
About this ebook
Dive into the exciting world of electronics and programming with "Arduino Workshop"! This hands-on guide is perfect for beginners and enthusiasts alike, offering a practical approach to learning Arduino and building innovative projects.
What you'll find in this book:
Introduction to Arduino: Start with the basics, understanding what Arduino is and how it works, including an overview of hardware and software components.
Step-by-Step Projects: Explore a variety of engaging projects that teach you how to use sensors, actuators, and other components to create interactive systems.
Hands-On Learning: Each chapter includes hands-on exercises that reinforce key concepts, ensuring you gain practical experience as you learn.
Programming Essentials: Learn the fundamentals of Arduino programming, including syntax, functions, and libraries, with clear explanations and examples.
Troubleshooting Tips: Navigate common challenges with troubleshooting advice to help you overcome obstacles and improve your problem-solving skills.
Creativity and Innovation: Discover how to apply your knowledge to create your own unique projects, from simple gadgets to more complex systems.
With easy-to-follow instructions and plenty of illustrations, "Arduino Workshop" is your essential guide to mastering Arduino and unleashing your creativity. Whether you're a hobbyist, educator, or aspiring engineer, this book will inspire you to explore the limitless possibilities of technology.
Read more from Abraham Black
Project Management for Engineering, Business and Technology Rating: 0 out of 5 stars0 ratingsC++/CLI :The Visual C++ Language for NET Rating: 0 out of 5 stars0 ratings
Related to Arduino Workshop
Related ebooks
Mastering Networking Basics From Novice To Pro Rating: 0 out of 5 stars0 ratingsClassic Car Electrics: Enthusiast’s Restoration Manual Rating: 0 out of 5 stars0 ratingsHands-on ESP32 with Arduino IDE: Unleash the power of IoT with ESP32 and build exciting projects with this practical guide Rating: 0 out of 5 stars0 ratingsAutoCAD Electrical 2025 Black Book Rating: 0 out of 5 stars0 ratingsThe Great Puncture Rip Off Rating: 0 out of 5 stars0 ratings3D Printer Troubleshooting Handbook Rating: 0 out of 5 stars0 ratingsAutodesk Fusion 360 PCB Black Book (V 2.0.18719) Rating: 0 out of 5 stars0 ratingsCreality Ender 3 and Creality Slicer Tutorial for 3D printers and tips and tricks. Rating: 3 out of 5 stars3/5The Maker's Field Guide: The Art & Science of Making Anything Imaginable Rating: 0 out of 5 stars0 ratingsCATIA V5-6R2022 for Designers, 20th Edition Rating: 0 out of 5 stars0 ratingsArduino Projects with Tinkercad | Part 2: Design & program advanced Arduino-based electronics projects with Tinkercad Rating: 0 out of 5 stars0 ratingsA Tinkerer's Guide to CNC Basics: Master the fundamentals of CNC machining, G-Code, 2D Laser machining and fabrication techniques Rating: 0 out of 5 stars0 ratingsCar Buyers' How-To Handbook Rating: 0 out of 5 stars0 ratingsEmerging Actuator Technologies: A Micromechatronic Approach Rating: 0 out of 5 stars0 ratingsMechatronics Second Edition Rating: 0 out of 5 stars0 ratingsSensor fusion Standard Requirements Rating: 0 out of 5 stars0 ratingsRapid Prototyping A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsTinkercad | Step by Step: Learn how to easily create 3D objects (CAD), design electronic circuits and program with Tinkercad Rating: 0 out of 5 stars0 ratings3D Printing for Beginners Rating: 0 out of 5 stars0 ratingsM5Stack Electronic Blueprints: A practical approach for building interactive electronic controllers and IoT devices Rating: 0 out of 5 stars0 ratingsThe Weir Group: The History of a Scottish Engineering Legend Rating: 0 out of 5 stars0 ratingsTeaching Basic Engineering mechanics for optimum student involvement Rating: 0 out of 5 stars0 ratingsElectronics Manufacturing Service A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsHow to Diagnose and Fix Everything Electronic, Third Edition Rating: 0 out of 5 stars0 ratingsARDUINO PROGRAMMING FOR BEGINNERS: Tips and Tricks for the Efficient Use of Arduino Programming Rating: 0 out of 5 stars0 ratingsAdvanced AutoCAD 2024: A Problem-Solving Approach, 3D and Advanced, 27th Edition Rating: 0 out of 5 stars0 ratingsANSYS Workbench 2023 R2: A Tutorial Approach, 6th Edition Rating: 0 out of 5 stars0 ratingsArduino meets MATLAB: Interfacing, Programs and Simulink Rating: 0 out of 5 stars0 ratings3D Printing Software A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratings
Intelligence (AI) & Semantics For You
Algorithms to Live By: The Computer Science of Human Decisions Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 4 out of 5 stars4/5The Secrets of ChatGPT Prompt Engineering for Non-Developers Rating: 5 out of 5 stars5/5ChatGPT For Dummies Rating: 4 out of 5 stars4/5TensorFlow in 1 Day: Make your own Neural Network Rating: 4 out of 5 stars4/5Deep Utopia: Life and Meaning in a Solved World Rating: 0 out of 5 stars0 ratingsOur Final Invention: Artificial Intelligence and the End of the Human Era Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Artificial Intelligence: A Guide for Thinking Humans Rating: 4 out of 5 stars4/5Summary of Super-Intelligence From Nick Bostrom Rating: 4 out of 5 stars4/5Prompt Engineering ; The Future Of Language Generation Rating: 3 out of 5 stars3/5The Alignment Problem: How Can Machines Learn Human Values? Rating: 4 out of 5 stars4/5Coding with AI For Dummies Rating: 0 out of 5 stars0 ratingsMidjourney Mastery - The Ultimate Handbook of Prompts Rating: 5 out of 5 stars5/5101 Midjourney Prompt Secrets Rating: 3 out of 5 stars3/5AI Investing For Dummies Rating: 0 out of 5 stars0 ratingsThe ChatGPT Revolution: How to Simplify Your Work and Life Admin with AI Rating: 0 out of 5 stars0 ratingsThe Business Case for AI: A Leader's Guide to AI Strategies, Best Practices & Real-World Applications Rating: 0 out of 5 stars0 ratingsHow To Become A Data Scientist With ChatGPT: A Beginner's Guide to ChatGPT-Assisted Programming Rating: 4 out of 5 stars4/5Thinking in Algorithms: Strategic Thinking Skills, #2 Rating: 4 out of 5 stars4/5Deep Learning with Python Rating: 5 out of 5 stars5/5Killer ChatGPT Prompts: Harness the Power of AI for Success and Profit Rating: 2 out of 5 stars2/5The Instant AI Agency: How to Cash 6 & 7 Figure Checks in the New Digital Gold Rush Without Being A Tech Nerd Rating: 0 out of 5 stars0 ratings
Reviews for Arduino Workshop
0 ratings0 reviews
Book preview
Arduino Workshop - abraham black
Arduino Workshop
Abraham Black
B R I e f C O nte nt S
Acknowledgments.....................................................xix
Chapter 1: Getting Started................................................1
Chapter 2: Exploring the Arduino Board and the IDE.............................19
Chapter 3: First Steps...................................................33
Chapter 4: Building Blocks...............................................55
Chapter 5: Working with Functions.........................................95
Chapter 6: Numbers, Variables, and Arithmetic................................111
Chapter 7: Liquid Crystal Displays.........................................147
Chapter 8: Expanding Your Arduino........................................161
Chapter 9: Numeric Keypads.............................................187
Chapter 10: Accepting User Input with Touchscreens...........................195
Chapter 11: Meet the Arduino Family.......................................207
Chapter 12: Motors and Movement........................................225
Chapter 13: Using GPS with Your Arduino...................................257
Chapter 14: Wireless Data..............................................271
Chapter 15: Infrared Remote Control.......................................285
Chapter 16: Reading RFID Tags..........................................295
Chapter 17: Data Buses................................................307
Chapter 18: Real-time Clocks............................................321
Chapter 19: The Internet................................................337
Chapter 20: Cellular Communications......................................349
Index..............................................................365
viii Brief Contents
Abraham Black
C On t e n t S I n D e t A I l
ACKNOWLEDGMENTS xix
1
GETTING STARTED 1
The Possibilities Are Endless.......................................2
Strength in Numbers.............................................6
Parts and Accessories............................................6
Required Software..............................................7
Mac OS X..............................................7
Windows XP and Later.....................................11
Ubuntu Linux 9.04 and Later.................................15
Safety......................................................18
Looking Ahead................................................18
2
EXPLORING THE ARDUINO BOARD AND THE IDE 19
The Arduino Board.............................................19
Taking a Look Around the IDE......................................25
The Command Area......................................25
The Text Area..........................................26
The Message Window Area.................................26
Creating Your First Sketch in the IDE.................................27
Comments.............................................27
The Setup Function.......................................28
Controlling the Hardware...................................28
The Loop Function.......................................28
Verifying Your Sketch.....................................30
Uploading and Running Your Sketch............................31
Modifying Your Sketch.....................................31
Looking Ahead................................................31
3
FIRST STEPS 33
Planning Your Projects...........................................34
About Electricity...............................................34
Current...............................................34
Voltage...............................................35
Power................................................35
Electronic Components..........................................35
The Resistor...........................................35
The Light-Emitting Diode...................................39
The Solderless Breadboard..................................41
Project #1: Creating a Blinking LED Wave............................43
The Algorithm..........................................43
The Hardware..........................................43
The Sketch............................................43
The Schematic..........................................44
Running the Sketch.......................................45
Using Variables...............................................45
Project #2: Repeating with for Loops................................46
Varying LED Brightness with Pulse-Width Modulation.......................47
Project #3: Demonstrating PWM...................................49
More Electric Components........................................49
The Transistor..........................................50
The Rectifier Diode.......................................50
The Relay.............................................51
Higher-Voltage Circuits..........................................52
Looking Ahead................................................53
4
BUILDING BLOCKS 55
Using Schematic Diagrams........................................56
Identifying Components....................................56
Wires in Schematics......................................58
Dissecting a Schematic....................................59
The Capacitor................................................60
Measuring the Capacity of a Capacitor..........................60
Reading Capacitor Values..................................61
Types of Capacitors......................................61
Digital Inputs.................................................63
Project #4: Demonstrating a Digital Input.............................65
The Algorithm..........................................65
The Hardware..........................................65
The Schematic..........................................65
The Sketch............................................69
Modifying Your Sketch.....................................70
Understanding the Sketch...................................70
Creating Constants with #define...............................70
Reading Digital Input Pins...................................70
Making Decisions with if....................................71
Making More Decisions with if-then-else.........................71
Boolean Variables..............................................72
Comparison Operators.....................................72
Making Two or More Comparisons.............................73
Project #5: Controlling Traffic.....................................74
The Goal..............................................74
The Algorithm..........................................74
The Hardware..........................................75
The Schematic..........................................75
The Sketch............................................76
Running the Sketch.......................................79
Analog vs. Digital Signals.........................................79
Project #6: Creating a Single-Cell Battery Tester........................80
The Goal..............................................81
The Algorithm..........................................81
The Hardware..........................................81
x Contents in Detail
The Schematic..........................................81
The Sketch............................................82
Doing Arithmetic with an Arduino....................................83
Float Variables..........................................84
Comparison Operators for Calculations..........................84
Improving Analog Measurement Precision with a Reference Voltage.............84
Using an External Reference Voltage...........................85
Using the Internal Reference Voltage...........................86
The Variable Resistor...........................................86
Piezoelectric Buzzers...........................................87
Piezo Schematic.........................................88
Project #7: Trying Out a Piezo Buzzer...............................88
Project #8: Creating a Quick-Read Thermometer........................90
The Goal..............................................90
The Hardware..........................................90
The Schematic..........................................91
The Sketch............................................91
Hacking the Sketch.......................................93
Looking Ahead................................................93
5
WORKING WITH FUNCTIONS 95
Project #9: Creating a Function to Repeat an Action.....................96
Project #10: Creating a Function to Set the Number of Blinks...............97
Creating a Function to Return a Value.................................98
Project #11: Creating a Quick-Read Thermometer That Blinks the Temperature..98
The Hardware..........................................99
The Schematic..........................................99
The Sketch...........................................100
Displaying Data from the Arduino in the Serial Monitor.....................101
The Serial Monitor.......................................102
Project #12: Displaying the Temperature in the Serial Monitor.............103
Debugging with the Serial Monitor............................105
Making Decisions with while Statements..............................105
do-while.............................................105
Sending Data from the Serial Monitor to the Arduino.......................106
Project #13: Multiplying a Number by Two...........................106
long Variables...............................................107
Project #14: Using long Variables.................................107
Looking Ahead...............................................109
6
NUMBERS, VARIABLES, AND ARITHMETIC 111
Generating Random Numbers.....................................112
Using Ambient Current to Generate a Random Number..............112
Project #15: Creating an Electronic Die.............................113
The Hardware.........................................114
The Schematic.........................................114
The Sketch...........................................115
Modifying the Sketch.....................................116
Abraham Black
A Quick Course in Binary........................................116
Byte Variables.........................................117
Increasing Digital Outputs with Shift Registers...........................118
Project #16: Creating an LED Binary Number Display...................119
The Hardware.........................................119
Connecting the 74HC595..................................119
The Sketch...........................................121
Project #17: Making a Binary Quiz Game............................122
The Algorithm..........................................122
The Sketch...........................................122
Arrays.....................................................124
Defining an Array.......................................124
Referring to Values in an Array..............................125
Writing to and Reading from Arrays............................125
Seven-Segment LED Displays.....................................126
Controlling the LED......................................127
Project #18: Creating a Single-Digit Display..........................129
The Hardware.........................................129
The Schematic.........................................129
The Sketch...........................................130
Displaying Double Digits...................................131
Project #19: Controlling Two Seven-Segment LED Display Modules.........131
The Hardware.........................................131
The Schematic.........................................132
Modulo..............................................133
Project #20: Creating a Digital Thermometer..........................134
The Hardware.........................................134
The Sketch...........................................134
LED Matrix Display Modules......................................135
The LED Matrix Schematic.................................136
Making the Connections...................................137
Bitwise Arithmetic.............................................139
The Bitwise AND Operator.................................139
The Bitwise OR Operator..................................139
The Bitwise XOR Operator.................................140
The Bitwise NOT Operator.................................140
Bitshift Left and Right.....................................140
Project #21: Creating an LED Matrix................................141
Project #22: Creating Images on an LED Matrix........................142
Project #23: Displaying an Image on an LED Matrix.....................144
Project #24: Animating an LED Matrix..............................145
The Sketch...........................................145
Looking Ahead...............................................146
7
LIQUID CRYSTAL DISPLAYS 147
Character LCD Modules.........................................148
Using a Character LCD in a Sketch............................149
Displaying Text.........................................150
Displaying Variables or Numbers.............................151
Project #25: Defining Custom Characters............................152
Graphic LCD Modules..........................................153
Connecting the Graphic LCD................................154
Using the LCD.........................................155
Controlling the Display....................................155
Project #26: Seeing the Text Functions in Action.......................155
Creating More Complex Display Effects.........................156
Project #27: Creating a Temperature History Monitor....................157
The Algorithm..........................................158
The Hardware.........................................158
The Sketch...........................................158
The Result............................................160
Modifying the Sketch.....................................160
Looking Ahead...............................................160
8
EXPANDING YOUR ARDUINO 161
Shields....................................................162
ProtoShields................................................164
Project #28: Creating a Custom Shield with Eight LEDs..................165
The Hardware.........................................165
The Schematic.........................................165
The Layout of the ProtoShield Board...........................166
The Design...........................................166
Soldering the Components.................................167
Modifying the Custom Shield................................169
Expanding Sketches with Libraries..................................169
Importing a Shield’s Libraries................................169
MicroSD Memory Cards.........................................173
Testing Your MicroSD Card.................................174
Project #29: Writing Data to the Memory Card.........................175
Project #30: Creating a Temperature-Logging Device....................177
The Hardware.........................................177
The Sketch...........................................177
Timing Applications with millis() and micros()...........................179
Project #31: Creating a Stopwatch.................................181
The Hardware.........................................181
The Schematic.........................................181
The Sketch...........................................182
Interrupts...................................................184
Interrupt Modes........................................184
Configuring Interrupts.....................................185
Activating or Deactivating Interrupts...........................185
Project #32: Using Interrupts....................................185
The Sketch...........................................185
Looking Ahead...............................................186
9
NUMERIC KEYPADS 187
Using a Numeric Keypad........................................187
Wiring a Keypad........................................188
Programming for the Keypad................................189
Testing the Sketch......................................189
Making Decisions with switch-case..................................190
Project #33: Creating a Keypad-Controlled Lock.......................190
The Sketch...........................................191
How It Works..........................................192
Testing the Sketch......................................193
Looking Ahead...............................................193
10
ACCEPTING USER INPUT WITH TOUCHSCREENS 195
Touchscreens...............................................195
Connecting the Touchscreen................................196
Project #34: Addressing Areas on the Touchscreen....................197
The Hardware.........................................197
The Sketch...........................................197
Testing the Sketch......................................198
Mapping the Touchscreen.................................199
Project #35: Creating a Two-Zone On/Off Touch Switch..................200
The Sketch...........................................200
How It Works..........................................202
Testing the Sketch......................................202
Project #36: Creating a Three-Zone Touch Switch......................202
The Touchscreen Map....................................203
The Sketch...........................................203
How It Works..........................................205
Looking Ahead...............................................205
11
MEET THE ARDUINO FAMILY 207
Project #37: Creating Your Own Breadboard Arduino...................208
The Hardware.........................................208
The Schematic.........................................211
Running a Test Sketch....................................214
The Many Arduino Boards.......................................217
Arduino Uno..........................................219
Freetronics Eleven......................................219
The Freeduino.........................................220
The Boarduino.........................................220
The Arduino Nano.......................................221
The Arduino LilyPad.....................................221
The Arduino Mega 2560...................................222
The Freetronics EtherMega................................222
The Arduino Due.......................................223
Looking Ahead...............................................224
Abraham Black
12
MOTORS AND MOVEMENT 225
Making Small Motions with Servos..................................225
Selecting a Servo.......................................226
Connecting a Servo......................................227
Putting a Servo to Work...................................227
Project #38: Building an Analog Thermometer........................228
The Hardware.........................................228
The Schematic.........................................229
The Sketch...........................................229
Using Electric Motors...........................................231
The TIP120 Darlington Transistor.............................231
Project #39: Controlling the Motor.................................232
The Hardware.........................................232
The Schematic.........................................233
The Sketch...........................................234
Project #40: Building and Controlling a Tank Robot.....................235
The Hardware.........................................235
The Schematic.........................................238
The Sketch...........................................240
Sensing Collisions............................................243
Project #41: Detecting Tank Bot Collisions with a Microswitch.............243
The Schematic.........................................243
The Sketch...........................................244
Infrared Distance Sensors.......................................246
Wiring It Up...........................................247
Testing the IR Distance Sensor..............................247
Project #42: Detecting Tank Bot Collisions with IR Distance Sensor.........249
Ultrasonic Distance Sensors......................................251
Connecting the Ultrasonic Sensor............................252
Using the Ultrasonic Sensor................................252
Testing the Ultrasonic Distance Sensor.........................252
Project #43: Detecting Tank Bot Collisions with an Ultrasonic Distance Sensor.254
The Sketch...........................................254
Looking Ahead...............................................256
13
USING GPS WITH YOUR ARDUINO 257
What Is GPS?...............................................258
Testing the GPS Shield.........................................259
Project #44: Creating a Simple GPS Receiver.........................261
The Hardware.........................................261
The Sketch...........................................261
Displaying the Position on the LCD............................262
Project #45: Creating an Accurate GPS-based Clock....................263
The Hardware.........................................263
The Sketch...........................................264
Project #46: Recording the Position of a Moving Object over Time..........265
The Hardware.........................................265
The Sketch...........................................266
Displaying Locations on a Map...............................268
Looking Ahead...............................................269
14
WIRELESS DATA 271
Using Low-cost Wireless Modules..................................271
Project #47: Creating a Wireless Remote Control......................272
The Hardware for the Transmitter Circuit........................273
The Transmitter Schematic.................................273
The Hardware for the Receiver Circuit..........................274
The Receiver Schematic...................................274
The Transmitter Sketch...................................275
The Receiver Sketch.....................................276
Using XBee Wireless Data Modules for Greater Range and Faster Speed........277
Project #48: Transmitting Data with an XBee..........................279
The Sketch...........................................279
Setting Up the Computer to Receive Data.......................279
Project #49: Building a Remote Control Thermometer...................281
The Hardware.........................................281
The Layout...........................................281
The Sketch...........................................282
Operation............................................283
Looking Ahead...............................................284
15
INFRARED REMOTE CONTROL 285
What Is Infrared?.............................................285
Setting Up for Infrared..........................................286
The IR Receiver........................................286
The Remote Control.....................................287
A Test Sketch..........................................287
Testing the Setup.......................................288
Project #50: Creating an IR Remote Control Arduino....................289
The Hardware.........................................289
The Sketch...........................................289
Expanding the Sketch....................................290
Project #51: Creating an IR Remote Control Tank......................291
The Hardware.........................................291
The Sketch...........................................291
Looking Ahead...............................................293
16
READING RFID TAGS 295
Inside RFID Devices...........................................296
Testing the Hardware...........................................297
The Schematic.........................................297
Testing the Schematic....................................297
Project #52: Creating a Simple RFID Control System....................299
The Sketch...........................................299
How It Works..........................................300
Storing Data in the Arduino’s Built-in EEPROM..........................301
Reading and Writing to the EEPROM..........................302
Project #53: Creating an RFID Control with Last Action
Memory..........303
The Sketch...........................................303
How It Works..........................................306
Looking Ahead...............................................306
17
DATA BUSES 307
The I²C Bus.................................................308
Project #54: Using an External EEPROM............................309
The Hardware.........................................309
The Schematic.........................................310
The Sketch...........................................311
The Result............................................312
Project #55: Using a Port Expander IC..............................313
The Hardware.........................................313
The Schematic.........................................313
The Sketch...........................................314
The SPI Bus.................................................315
Pin Connections........................................316
Implementing the SPI.....................................316
Sending Data to an SPI Device..............................317
Project #56: Using a Digital Rheostat...............................318
The Hardware.........................................318
The Schematic.........................................318
The Sketch...........................................319
Looking Ahead...............................................320
18
REAL-TIME CLOCKS 321
Connecting the RTC Module......................................322
Project #57: Adding and Displaying Time and Date with an RTC............322
The Hardware.........................................322
The Sketch...........................................323
How It Works..........................................325
Project #58: Creating a Simple Digital Clock..........................326
The Hardware.........................................326
The Sketch...........................................327
How It Works and Results..................................330
Project #59: Creating an RFID Time-Clock System......................330
The Hardware.........................................331
The Sketch...........................................331
How It Works..........................................335
Looking Ahead...............................................336
Abraham Black
19
THE INTERNET 337
What You’ll Need.............................................337
Project #60: Building a Remote-Monitoring Station.....................339
The Hardware.........................................339
The Sketch...........................................339
Troubleshooting........................................341
How It Works..........................................342
Project #61: Creating an Arduino Tweeter...........................343
The Hardware.........................................343
The Sketch...........................................343
Controlling Your Arduino from the Web...............................344
Project #62: Setting Up a Remote Control for Your Arduino...............345
The Hardware.........................................345
The Sketch...........................................346
Controlling Your Arduino Remotely............................347
Looking Ahead...............................................348
20
CELLULAR COMMUNICATIONS 349
The Hardware...............................................350
Preparing the Power Shield................................351
Hardware Configuration and Testing...........................352
Changing the Operating Frequency...........................354
Project #63: Building an Arduino Dialer.............................356
The Hardware.........................................356
The Schematic.........................................356
The Sketch...........................................357
How It Works..........................................358
Project #64: Building an Arduino Texter.............................358
The Sketch...........................................359
How It Works..........................................359
Project #65: Setting Up an SMS Remote Control.......................360
The Hardware.........................................360
The Schematic.........................................361
The Sketch...........................................361
How It Works..........................................363
Looking Ahead...............................................364
INDEX 365
1
G e t t InG S t A R t e D
Have you ever looked at some gadget and wondered how it really worked? Maybe it was a remote control boat, the system that controls an elevator, a vending machine, or an electronic toy? Or have you wanted
to create your own robot or electronic signals for a model railroad, or per- haps you’d like to capture and analyze weather data over time? Where and how do you start?
The Arduino board (shown in Figure 1-1) can help you find some of the answers to the mysteries of electronics in a hands-on way. The original creation of Massimo Banzi and David Cuartielles, the Arduino system offers an inexpensive way to build interactive projects, such as remote-controlled robots, GPS tracking systems, and electronic games.
The Arduino project has grown exponentially since its introduction in 2005. It’s now a thriving industry, supported by a community of people
united with the common bond of creating something new. You’ll find both individuals and groups, ranging from interest groups and clubs to local hackerspaces and educational institutions, all interested in toying with
the Arduino.
Figure 1-1: The Arduino board
To get a sense of the variety of Arduino projects in the wild, you can simply search the Internet. You’ll find a list of groups offering introductory programs and courses with like-minded, creative people.
The Possibilities Are Endless
A quick scan through this book will show you that you can use the Arduino to do something as simple as blinking a small light, or even something more complicated, such as interacting with a cellular phone—and many different things in between.
For example, have a look at Philip Lindsay’s device, shown in Figure 1-2.
It can receive text messages from cellular phones and display them on a large sign for use in dance halls. This device uses an Arduino board and a cellular phone shield to receive text messages from other phones (similar to Project 65). The text message is sent to a pair of large, inexpensive dot- matrix displays for everyone to see.
Figure 1-2: SMS (short message service) text marquee
You can purchase large display boards that are easy to interface with an Arduino, so you don’t have to make your own display from scratch. (For more information, visit http://www.labradoc.com/i/follower/ p/project-sms-text-scroller.)
How about creating a unique marriage proposal? Tyler Cooper wanted an original way to propose to his girlfriend, so he built what he calls a reverse geocache box
—a small box that contained an engagement ring, as shown in Figure 1-3. When the box was taken to a certain area (measured by the internal GPS), it unlocked to reveal a romantic message and the ring. You can easily reproduce this device using an Arduino board, a GPS receiver, and an LCD module (as used in Chapter 13), with a small servo motor that acts as a latch to keep the box closed until it’s in the correct location. The code required to create this is quite simple—something you could create in a few hours. The most time-consuming part is choosing the appropriate box in which to enclose the system. (For more information, visit http://learn.adafruit.com/reverse-geocache-engagement-box/.)
Figure 1-3: Marriage proposal via Arduino
Here’s another example. Kurt Schulz was interested in monitoring the battery charge level of his moped. However, after realizing how simple it is to work with Arduino, his project morphed into what he calls the Scooterputer
: a complete moped management system. The Scooterputer can measure the battery voltage, plus it can display the speed, distance traveled, tilt angle, temperature, time, date, GPS position, and more. It also contains a cellular phone shield that can be controlled remotely, allow- ing remote tracking of the moped and engine shutdown in case it’s stolen. The entire system can be controlled with a small touchscreen, shown in
Abraham Black
––––––––
Figure 1-4. Each feature can be considered a simple building block, and anyone could create a similar system in a couple of weekends. (See http:// www.janspace.com/b2evolution/arduino.php/2010/06/26/scooterputer/.)
Figure 1-4: The Scooterputer display (courtesy of Kurt Schulz)
Then there’s John Sarik, who enjoys the popular Sudoku math puzzles; he also likes working with Nixie numeric display tubes. With those two drivers in mind, John created a huge 81-digit Sudoku game computer!
The user can play a full 9-by-9 game, with the Arduino in control of the digits and checking for valid entries. Although this project might be consid- ered a more advanced type, it is certainly achievable and the electronics are not complex. The device is quite large and looks great mounted on a wall, as shown in Figure 1-5. (See http://trashbearlabs.wordpress.com/2010/07/09/ nixie-sudoku/.)
The team at Oomlout even used the Arduino to create a TwypeWriter. They fitted an Arduino board with an Ethernet shield interface connected to the Internet, which searches Twitter for particular keywords. When a keyword is found, the tweet is sent to an electric typewriter for printing. The Arduino board is connected to the typewriter’s keyboard circuit, which allows it to emulate a real person typing, as shown in Figure 1-6. (See http://oomlout.co.uk/blog/twitter-monitoring-typewritter-twypwriter/.)
These are only a few random examples of what is possible using an Arduino. You can create your own projects without much difficulty—and after you’ve worked through this book, they are certainly not out of your reach.
Figure 1-5: Nixie tube Sudoku
Figure 1-6: The TwypeWriter
Strength in Numbers
The Arduino platform increases in popularity every day. If you’re more of a social learner and enjoy class-oriented situations, search the Web for Cult of Arduino
to see what people are making and to find Arduino-related groups. Members of Arduino groups introduce the world of Arduino from an artist’s perspective. Many group members work to create a small Arduino- compatible board at the same time. These groups can be a lot of fun, intro- duce you to interesting people, and let you share your Arduino knowledge with others.
Parts and Accessories
As with any other electronic device, the Arduino is available from many retailers that offer a range of products and accessories. When you’re shopping, be sure to purchase the original Arduino, not a knock-off, or you run the risk of receiving faulty or poorly performing goods; why risk your project with an inferior board that could end up costing you
more in the long run? For a list of Arduino suppliers, visit http://arduino
.cc/en/Main/Buy/.
Here’s a list of current suppliers (in alphabetical order) that I recom- mend for your purchases of Arduino-related parts and accessories:
Adafruit Industries (http://www.adafruit.com/)
DigiKey (http://www.digikey.com/)
Jameco Electronics (http://www.jameco.com/)
Little Bird Electronics (http://www.littlebirdelectronics.com/)
Newark (http://www.newark.com/)
nicegear (http://www.nicegear.co.nz/)
Oomlout (http://www.oomlout.co.uk/)
RadioShack (http://www.radioshack.com/)
RS Components (http://www.rs-components.com/)
SparkFun Electronics (http://www.sparkfun.com/)
As you’ll see in this book, I use several Arduino-compatible products from Freetronics (http://www.freetronics.com/). However, you will find that all the required parts are quite common and easily available from various resellers.
But don’t go shopping yet. Take the time to read the first few chapters to get an idea of what you’ll need so that you won’t waste money buying unnecessary things immediately.
Abraham Black
Required Software
You should be able to program your Arduino with just about any computer using a piece of software called an integrated development environment (IDE). To run this software, your computer should have one of the following oper- ating systems installed:
Mac OS X or higher
Windows XP 32- or 64-bit, or higher
Linux 32- or 64-bit (Ubuntu or similar)
Now is a good time to download and install the IDE, so jump to the heading that matches your operating system and follow the instructions. Make sure you have or buy the matching USB cable for your Arduino from the supplier as well. Even if you don’t have your Arduino board yet, you can still download and explore the IDE. Because the IDE version number can change quite rapidly, the number in this book may not match the current version, but the instructions should still work.
n Ote Unfortunately, as this book went to press, there were issues with Windows 8 instal- lations. If you have Windows 8, visit the Arduino Forum at http://arduino.cc/ forum/index.php/topic,94651.15.html for guidance and discussion.
Mac OS X
In this section, you’ll find instructions for downloading and configuring the Arduino IDE in Mac OS X.
Installing the IDE
To install the IDE on your Mac, follow these instructions:
Using a web browser such as Safari, visit the software download page located at http://arduino.cc/en/Main/Software/, as shown in Figure 1-7.
Figure 1-7: The IDE download page in Safari
Click the Mac OS X link. The file will start downloading, and it will appear in the Downloads window shown in Figure 1-8.
Figure 1-8: File download is complete.
Once it’s finished downloading, double-click the file to start the instal- lation process. You will then be presented with the window shown in Figure 1-9.
Figure 1-9: Your new Arduino IDE folder
––––––––
n Ote The third file icon shown in Figure 1-9 needs to be installed only if you have an Arduino board older than the current Uno.
Drag the Arduino icon over the Applications folder and release the mouse button. A temporary status window will appear as the file is copied.
Now connect your Arduino to your Mac with the USB cable. After a moment, the dialog shown in Figure 1-10 will appear.
Figure 1-10: A new Arduino board is detected. Your dialog may read Uno instead of Eleven.
Click Network Preferences..., and then click Apply in the Network box. You can ignore the not configured
status message.
Setting Up the IDE
Once you have downloaded the IDE, use the following instructions to open and configure the IDE:
Open the Applications folder in Finder (shown in Figure 1-11) and double-click the Arduino icon.
Figure 1-11: Your Applications folder
A window may appear warning you about opening a web app. If it does, click Open to continue. You will then be presented with the IDE, as shown in Figure 1-12.
Abraham Black
Figure 1-12: The IDE in Mac OS X
You’re almost there—just two more things to do before your Arduino IDE is ready to use. First, you need to tell the IDE which type of socket the Arduino is connected to. Select ToolsSerial Port and select the
/dev/tty.usbmodem1d11 option, as shown in Figure 1-13.
Figure 1-13: Selecting the USB port
The final step is to tell the IDE which Arduino board you have connected. This is crucial, since Arduino boards do differ. For example, if you have the most common board, the Uno, then select ToolsBoardArduino Uno, as shown in Figure 1-14. The differences in Arduino boards are explained in more detail in Chapter 11.
Now your hardware and software are ready to work for you. Next, move on to Safety
on page 18.
Figure 1-14: Selecting the correct Arduino board
––––––––
Windows XP and Later
In this section, you’ll find instructions for downloading the IDE, installing drivers, and configuring the IDE in Windows.
Installing the IDE
To install the Arduino IDE for Windows, follow these instructions:
Using a web browser such as Firefox, visit the software download page located at http://arduino.cc/en/Main/Software/, as shown in Figure 1-15.
Figure 1-15: The IDE download page in Windows Firefox
Click the Windows link, and the dialog shown in Figure 1-16 will appear. Select Open with Windows Explorer, and then click OK. The file will start to download, as shown in Figure 1-17.
Figure 1-16: Downloading the file
Figure 1-17: Firefox shows the progress of your download.
Once the download is complete, double-click the file, and the window shown in Figure 1-18 will appear.
Figure 1-18: The IDE package
Abraham Black
––––––––
Copy the folder named arduino-0022 (or something similar) to the loca- tion where you store your applications. Once the copying is finished, locate the folder and open it to reveal the Arduino application icon, as shown in Figure 1-19. You may wish to copy the icon and place a short- cut on the desktop for easier access in the future.
Figure 1-19: Your IDE folder with the Arduino application icon selected
––––––––
Installing Drivers
The next task is to install the drivers for your Arduino board’s USB interface.
Connect your Arduino to your PC with the USB cable. After a few moments an error message will be displayed, which will say something like Device driver software not successfully installed.
Just close that dialog or balloon.
Navigate to the Windows Control Panel. Open the Device Manager