184 30 Arduino Projects for the Evil Genius Other Code Description Farnell RS Other 48 102-406 49 Miniature push switch 1448152 455-132 Local store 50 2.1-mm Power plug 1200147 489-021A Local store 51 9V battery clip 1650667 238-151 52 Regulated 15V 1.5A power supply 1354828 220-4276 Local store 53 3-way screw terminal 1641933 206-8648 54 Perf board 1172145 115-6031 eBay, 55 4 x 3 keypad 1182232 668-9551 Sparkfun 56 0.1-inch header strip 1097954 277-9584 Local store 57 0.1-inch socket strip 1218869 — 58 Rotary encoder with push switch 1520815 532-6408 Local store LCD module (HD44780 controller) 1137380 Local store 59 628-4535 Local store 60 Miniature 8 ⍀ loudspeaker 1300022 — Salvage 61 Electret microphone 1736563 499-6595 eBay 62 5V relay 9913734 234-238 63 12V 1A power supply 1279478 668-8842 Local store 64 12V computer cooling fan 1755867 238-9721 Local store 65 6V motor 599128 — 66 9g servo motor — 533-2217 Supermarket 67 5V solenoid (< 100 mA) 9687920 511-7670 Salvaged Piezotransducer 1675548 phone 68 (without driver electronics) — charger Piezobuzzer 1192513 Local store 69 (integrated electronics) 289-7884 70 Miniature reed switch 1435590 71 7 x 5 inch picture frame 234-222 5V power supply 1297470 — 72 Breadboard 4692597 Local stores like RS and Maplins allow you to see components before you buy, and are good for components like power supplies and computer fans, which will usually be cheaper than the big professional suppliers.
Appendix ■ Components and Supplies 185 Starter Kit of Components ■ Resistors: 0.5W metal film, 100 ⍀, 270 ⍀, 1 K⍀, 10 K⍀, 100 K⍀ It’s good to have a bit of a stock of common components. The following list gives some ■ 5-mm red LEDs components that you are likely to find yourself using over and over again. ■ Transistors: BC548, BD139
This page intentionally left blank
Index References to figures are in italics. ! command, 123 oscillator, 20 power connections, 16–18 A power supply, 16 Reset switch, 20 allOff function, 138 serial programming connector, 20 amplification, 36 USB interface chip, 20 analog inputs, 18 breadboards, 11–13 analog meters, 177 Brevig, Alexander, 64 analog output from digital inputs, 112 buying components, 175 Arduino Diecimila board C powering up, 1 selecting, 6, 7 C language, 21 suppliers, 182 arithmetic, 23–24 Arduino Duemilanove board, 2 arrays, 30–32 powering up, 1 bumpy case, 21–22 selecting, 6, 7 conditional statements, 24–25 suppliers, 182 constants, 23 Arduino Lilypad, 20 data types, 23, 24 suppliers, 182 example, 21–23 Arduino Mega, 20 functions, 22 Arduino Playground, 179 integers, 22 Arduino Protoshield, 37, 38–40 logical expressions, 25 arrays, 30–32 logical operators, 25 ATmega168, 20 loops, 23, 29–30 ATmega328, 19–20 parameters, 23 autoranging meters, 177 semicolon, 22 Strings, 24 B variables, 22, 23 back EMF, 126, 150 capacitors, 108 bipolar transistors, 90–91 suppliers, 182 Blink program, 1 circuits modifying, 8–11 circuit symbols, 171 board components, 16 schematic diagrams, 169–171 analog inputs, 18 clones, 182 digital connections, 18–19 code, 8 microcontrollers, 19–20 187
188 30 Arduino Projects for the Evil Genius collector-feedback bias, 121 Found New Hardware Wizard, 3, 4 common anodes, 91–92 functions, 22 component box, 175 components G buying, 175 getEncoderTurn function, 69 starter kit, 185 GND, 17 suppliers, 181–184 computer-controlled fan (Project 23), 132–133 lines in schematic diagrams, 169 conditional statements, 24–25 configuring the Arduino environment, 6, 7 H constants, 23 continuity test, 178–179 H-bridge controllers, 134 countdown timer (Project 30), 163–168 high-brightness Morse code translator (Project 4), current, measuring, 178 35–38 D making a shield for, 38–40 high-powered strobe light (Project 8), 52–55 DAC, 111 hunting, 127–130 data types, 23, 24 hypnotizer (Project 24), 134–138 datasheets, 171 hysteresis, 130 decade counter, 96 dice, 55–59, 91–95 I Diecimila. See Arduino Diecimila board digital connections, 18–19 ideas for projects, 179–180 digital inputs and outputs, 41 infrared remote (Project 28), 153–158 inputs, 15 analog output from digital inputs, 112 digital meters, 177 analog, 18 digital-to-analog converters, 111 digital, 41 disk images, 5 installing software, 1–2 downloading project software, 6–8 on LINUX, 5–6 Duemilanove. See Arduino Duemilanove board on Mac OS X, 4–5 on Windows, 2–4 E integers, 22 EEPROM, 20, 78, 82, 153 K electromotive force, 126 EMF, 126 keypad security code (Project 10), 61–67 EPROM, 15 Evil Genius countdown timer (Project 30), L 163–168 lasers, servo-controlled laser (Project 25), Extraction Wizard, 2–3 138–143 F LCD displays, 101–102 LCD thermostat (Project 22), 125–131 FETs, 48, 96 LDRs, 72 MOSFETs, 135–136 leaky integration, 75 LED array (Project 16), 95–101 field effect transistors, 48, 96 LED dice (Project 9), 55–59 flashing LED (Project 1), 8–11 ledPin, 21, 22 Flashing LED (Project 1), breadboard, 12 LEDs 1W Luxeon, 35 adding an external LED, 10–11
Index 189 flashing LED (Project 1), 8–11 metal oxide semiconductor field effect transistors, high-brightness Morse code translator (Project 4), 135–136 35–40 microcontrollers, 15, 19–20 high-powered strobe light (Project 8), 52–55 model traffic signal (Project 5), 41–44 LED array (Project 16), 95–101 model traffic signal using a rotary encoder LED dice (Project 9), 55–59 model traffic signal (Project 5), 41–44 (Project 11), 68–72 Morse code S.O.S. flasher (Project 2), 27–31 modules, 174–175 Morse code translator (Project 3), 31–35 Morse code letters, 32 S.A.D. light (Project 7), 47–52 Morse code S.O.S. flasher (Project 2), 27–29 seven-segment LED double dice (Project 15), Morse code translator (high-brightness—Project 4), 91–95 35–38 seven-segment LEDs, 89–91 making a shield for, 38–40 strobe light (Project 6), 44–47 Morse code translator (Project 3), 31–35 libraries, installing into Arduino software, 64, 65, MOSFETs, 135–136 multicolor light display (Project 14), 85–89 154–155, 161 multimeter, 177–179 lie detector (Project 26), 145–148 light harp (Project 20), 117–120 O light-dependent resistors, 72 lights Ohm’s Law, 17–18 OmniGraffle, 171 LED array (Project 16), 95–101 operators, 25 multicolor light display (Project 14), 85–89 seven-segment LED double dice (Project 15), marketing operator, 123 oscillator, 20 91–95 oscilloscope (Project 18), 107–111 strobe light (high-powered—Project 8), 52–55 oscilloscopes, 179 strobe light (Project 6), 44–46 outputs, 15 USB message board (Project 17), 102–105 Lilypad. See Arduino Lilypad analog output from digital inputs, 112 Lilypad clock (Project 29), 159–162 digital, 41 LINUX, installing software on, 5–6 logical expressions, 25 P logical operators, 25 loops, 23, 29–30 parameters, 23 PCBs. See Protoshield circuit boards M perf board, 48 Mac OS X, installing software on, 4–5 layout, 50 magnetic door lock (Project 27), 148–153 photoresistors, 72 mains electricity, 110, 125 phototransistors, 72, 73–74 mains hum, 110 piezobuzzers, 146–147 marketing operator, 123 playNote function, 113–116 measuring current, 178 pliers, 176 measuring resistance, 179 PNP transistors, 92 measuring temperature, 77 power measuring voltage, 177–178 memory, 15, 19–20 computer-controlled fan (Project 23), 132–133 message board, 102–105 hypnotizer (Project 24), 134–138 LCD thermostat (Project 22), 125–131 servo-controlled laser (Project 25), 138–143 power connections, 16–18
190 30 Arduino Projects for the Evil Genius power jumper, 1 random number generation, 55 power supply, 16 randomSeed function, 55 pre-processor directives, 78 reed switches, 159 programs, 8 Reset button, 1 projects Reset connector, 16–17 Reset switch, 20 computer-controlled fan, 132–133 resistance measurement, 179 Evil Genius countdown timer, 163–168 resistors, 10, 172 flashing LED, 8–11 high-brightness Morse code translator, 35–38 color codes, 172 high-powered strobe light, 52–55 light-dependent resistors, 72 hypnotizer, 134–138 suppliers, 182 ideas, 179–180 values, 19 infrared remote, 153–158 variable resistors, 45, 46, 47, 147 keypad security code, 61–67 rotary encoders, 67, 68 LCD thermostat, 125–131 Ruby language, installing, 109–110 LED array, 95–101 LED dice, 55–59 S lie detector, 145–148 light harp, 117–120 S.A.D. light (Project 7), 47–52 Lilypad clock, 159–162 schematic diagrams, 169–171 magnetic door lock, 148–153 model traffic signal, 41–44 See also individual projects model traffic signal using a rotary encoder, semiconductors, suppliers, 183 sensors 68–72 Morse code S.O.S. flasher, 27–29 keypad security code (Project 10), 61–67 Morse code translator, 31–35 model traffic signal using a rotary encoder multicolor light display, 85–89 oscilloscope, 107–111 (Project 11), 68–72 pulse rate monitor, 73–77 pulse rate monitor (Project 12), 73–77 S.A.D. light, 47–52 USB temperature logger (Project 13), 77–83 servo-controlled laser, 138–143 Serial Monitor, 34–35, 75 seven-segment LED double dice, 91–95 serial port, settings, 6, 7 strobe light, 44–47 serial programming connector, 20 tune player, 112–116 servo motors, 138 USB message board, 102–105 servo-controlled laser (Project 25), 138–143 USB temperature logger, 77–83 seven-segment LED double dice (Project 15), 91–95 VU meter, 120–124 seven-segment LEDs, 89–91 Protoshield circuit boards, 39 See also LEDs pulse rate monitor (Project 12), 73–77 shields, 38–40, 47, 142, 174–175 Pulse Width Modulation, 48 Shirriff, Ken, 154 PWM, 48 sine waves, 111 sketches, 8 R snips, 176 software R-2R resistor ladder, 111, 112 Blink sketch, 8–9 RAM, 15 downloading project software, 6–8 random function, 55 installing, 3–6 soldering, 176–177 solenoid, 148–150, 153
Index 191 sound transistors, 173–174 generation, 111–112 bipolar transistors, 90–91 light harp (Project 20), 117–120 datasheet, 174 oscilloscope (Project 18), 107–111 FETs, 48, 96 tune player (Project 19), 112–116 MOSFETs, 135–136 VU meter (Project 21), 120–124 NPN bipolar transistor, 36 PNP transistors, 92 square waves, 111 used in this book, 173 Stanley, Mark, 64 starter kit of components, 185 Transistor-Transistor Logic, 16 Strings, 24 TTL, 16 strobe light (high-powered—Project 8), 52–55 tune player (Project 19), 112–116 strobe light (Project 6), 44–46 U making a shield for, 47 suppliers, 181–184 updates, 3 USB drivers, installing, 3–4 T USB interface chip, 20 USB lead, type A-to-type B, 1 temperature USB message board (Project 17), 102–105 LCD thermostat, 125–131 USB temperature logger (Project 13), 77–83 measuring, 77 temperature logger, 77–83 V Theremin, 117 variable resistors, 45, 46, 47, 147 thermistors, 77 variables, 22, 23 voltage, measuring, 177–178 USB temperature logger (Project 13), voltage regulator, 16 77–83 VU meter (Project 21), 120–124 thermostat, 125–131 W timer, 163–168 tools, 175 web color chart, 87 website, 2 component box, 175 Windows, installing software on, 2–4 multimeter, 177–179 wire stripper, 176 oscilloscopes, 179 snips and pliers, 176 soldering, 176–177
Search
Read the Text Version
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208