background image

IOR

EF

RES

ET

RES

ET

7-15

V

SCL

SDA

ARE

F

GND

13

12

~11

~10

~9

8

7

~6

~5

4

~3

2

1

0

TX

RX

13

3.3V

5V

GND

GND

VIN

A0

A1

A2

A3

A4

A5

POW

ER

ANA

LOG

 IN

DIG

ITA

L (P

WM

~)

ON

ISP

TX

RX

LEARN. SHARE. HACK.

SIK GUIDE

Your guide to the SparkFun Inventor’s Kit for the SparkFun RedBoard

IOREF

RESET

RESET

7-15V

SCL

SCA

AREF GND 13

12

~11

~10 ~9 8

7

~6

~5 4

~3 2

1

0

TX

RX

13

3.3V

5V

GND

GND

VIN

A0

A1

A2

A3

A4

A5

POWER

ANALOG IN

DIGIT

AL (PWM~)

ON

ISP

TX

RX

ARD

UINO L

ANG

UAG

E D

EVEL

OPM

ENT P

LATF

ORM

Version 3.2

Содержание RedBoard

Страница 1: ...2 A 3 A 4 A 5 P O W E R A N A L O G I N D I G I T A L P W M O N I S P T X R X L E A R N S H A R E H A C K SIK GUIDE Your guide to the SparkFun Inventor s Kit for the SparkFun RedBoard I O R E F E S E...

Страница 2: ...its of the SparkFun Inventor s Kit for Educators At the center of this manual is one core philosophy that anyone can and should play around with electronics When you re done with this guide you ll hav...

Страница 3: ...ction 1 Getting Started RedBoard Breadboard Circuit 1 Your First Circuit Blinking a LED Circuit 3 RGB LED Circuit 4 Multiple LEDs Circuit 5 Push Buttons Circuit 6 Photo Resistor Circuit 7 Temperature...

Страница 4: ...uts like a blinking LED light or an electric motor That s where the term physical computing is born this board is capable of taking the world of electronics and relating it to the physical world in a...

Страница 5: ...e f g h c b a f e d h g Power Lacing High Tops Old Toy Email Notifer Bug Zapper Counter Re Programmed Traffic Light Auto Plant Watering Camera Time lapse operation Quadcopter Auto Coffee Maker RedBoar...

Страница 6: ...s With an internet capable computer open up your favorite browser and type in the following URL into the address bar Access the Internet Download the Arduino IDE Integrated Development Environment use...

Страница 7: ...l need to follow specific instructions Please go to www sparkfun com FTDI for specific instructions on how to install the FTDI drivers onto your RedBoard 2 3 I O R E F R E S E T R E S E T 7 1 5 V S C...

Страница 8: ...Arduino IDE software on your computer Poke around and get to know the interface We aren t going to code right away this is just an introduction This step is to set your IDE to identify your RedBoard O...

Страница 9: ...buttons opens up a new code window tab 3 Open This button will let you open up an existing sketch See Diagram Below 4 Save This saves the currently active sketch 5 Serial Monitor This will open a wind...

Страница 10: ...t disappears should be the RedBoard Reconnect the board and select that serial port Select the serial device of the RedBoard from the Tools Serial Port menu On the Mac this should be something with de...

Страница 11: ...Arduino s folder named examples WHAT S NEXT Read on to learn more about getting started with circuits Then you can start on your first circuit on page 17 Unzip the file SIK Guide Code It should be loa...

Страница 12: ...any other handful of hundreds of thousands of components Circuits are usually divided into three categories analog circuits digital circuits or mixed signal circuits In this guide you will explore all...

Страница 13: ...Page 11...

Страница 14: ...umper Wire x30 Push Button x4 x1 DC Motor x1 DC Motor x1 Potentiometer Light Emitting Diode x1 x5 x5 x5 x5 LED 5mm 330 Resistor x25 ACTUAL SIZE 10K Resistor x25 ACTUAL SIZE TMP36 x1 Temp Sensor FRONT...

Страница 15: ...f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27...

Страница 16: ...EF RESET RESET 7 15V SCL SDA AREF GND 13 12 11 10 9 8 7 6 5 4 3 2 1 0 TX RX 13 3 3V 5V GND GND VIN A0 A1 A2 A3 A4 A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK 1 2 8 6 9 7 3 4 5 10 Page...

Страница 17: ...igital Rx Tx These various pins can be used for inputs outputs power and ground See Diagram Below 6 LED Indicates RedBoard is ON This is a simple power indicator LED 7 Reset Button This is a way to ma...

Страница 18: ...5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 This line divides the board in half re...

Страница 19: ...r is running Vertical Connection Power and Ground Power bus See Diagram Below 1 Horizontal Connection a e f j See Diagram Below 2 How s it all connected View of the inside f g h i a b c d e 1 2 3 4 5...

Страница 20: ...W E R A N A L O G I N D I G I T A L P W M O N I S P T X R X L E A R N S H A R E H A C K Connect the USB cable CIRCUIT 1 Your First Circuit Your RedBoard runs on 5V This is the power that will be supp...

Страница 21: ...ight not seem like much but establishing this important baseline will give you a solid foundation as we work toward more complex experiments Blinking an LED 1 Each circuit begins with a brief descript...

Страница 22: ...4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 LED Make sure the short leg marked with at side goes into the negative position 330 Resistor The color banding sh...

Страница 23: ...in its vertical column on the Power bus Breadboard The white background represents a connection to a breadboard socket speci ed by a letter number coordinate such as e2 These coordinates are merely s...

Страница 24: ...Page Setup Print New Open Sketchbook Examples Close Save Save As Upload Upload Using Progammer Circuit 1 Circuit 2 Circuit 3 Circuit 4 Circuit 5 Circuit 6 Circuit 7 Circuit 8 Circuit 9 Circuit 10 Cir...

Страница 25: ...your code automatically I O R E F R E S E T R E S E T 7 1 5 V S C L S D A A R E F G N D 1 3 1 2 1 1 1 0 9 8 7 6 5 4 3 2 1 0 T X R X 1 3 3 3 V 5 V G N D G N D V I N A 0 A 1 A 2 A 3 A 4 A 5 P O W E R A...

Страница 26: ...Code to Note Real World Application Almost all modern flat screen televisions and monitors have LED indicator lights to show they are on or off Open Arduino IDE File Examples SIK Guide Circuit 1 What...

Страница 27: ...ed proportionate to the resistance between the middle pin and the ground pin In this circuit you ll learn how to use a potentiometer to control the brightness of an LED Potentiometer PARTS Wire 6 X CI...

Страница 28: ...4 A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Circuit 2 Potentiometer a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b...

Страница 29: ...o and from the outside world and can even do tricks like simulated dimming by blinking on and off really fast and serial communications transferring data to another device by encoding it as patterns o...

Страница 30: ...g pin 0 the row of pins beneath the power pins LEDNotLightingUp LEDs will only work in one direction Try taking it out and twisting it 180 degrees no need to worry installing it backward does no perma...

Страница 31: ...bright each diode is nearly any color is possible RGB LED PARTS CIRCUIT 3 3 Potentiometer 1 X Transistor P2N2222AG 1 X Wire 6 X 330 Resistor 3 X LED 1 X I O R E F R E S E T R E S E T 7 1 5 V S C L S...

Страница 32: ...LOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Circuit 3 RGB LED a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b c d e f g h i 1 2 3...

Страница 33: ...using something called PWM Pulse Width Modulation The pins on the RedBoard with next to them are PWM Analog out compatible The RedBoard is so fast that it can blink a pin on and off almost 1000 times...

Страница 34: ...r loop is used to step a number across a range and repeatedly runs code within the brackets Here the variable x starts a 0 ends at 767 and increases by one each time x for x 0 x 768 x The RedBoard is...

Страница 35: ...n you want to run a piece of code several times arrays used to make managing variables easier by grouping them together Multiple LEDs PARTS LED 8 X Wire 10 X 330 Resistor 8 X CIRCUIT 4 4 I O R E F R E...

Страница 36: ...4 A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Circuit 4 Multiple LEDs a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b...

Страница 37: ...Wire Jumper Wire Jumper Wire Jumper Wire 5V Jumper Wire LED 5mm c2 c3 e2 Pin 2 330 Resistor a15 330 Resistor a12 330 Resistor a9 330 Resistor 330 Resistor a6 a3 LED 5mm c23 c24 LED 5mm c20 c21 LED 5m...

Страница 38: ...E T R E S E T 7 1 5 V S C L S D A A R E F G N D 1 3 1 2 1 1 1 0 9 8 7 6 5 4 3 2 1 0 T X R X 1 3 3 3 V 5 V G N D G N D V I N A 0 A 1 A 2 A 3 A 4 A 5 P O W E R A N A L O G I N D I G I T A L P W M O N I...

Страница 39: ...ngly In this circuit you will also use a pull up resistor which keeps the voltage HIGH when you re not pressing the button Push Buttons PARTS Wire 7 X CIRCUIT 5 5 Push Button 2 X LED 1 X 330 Resistor...

Страница 40: ...A4 A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Page 38 Circuit 5 Push Buttons a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 2...

Страница 41: ...nt provides a set of logic operations that let you build complex if statements They include You can combine these functions to build complex if statements For example if mode heat temperature threshol...

Страница 42: ...ou Should See The digital pins can be used as inputs as well as outputs Before you do either you need to tell the RedBoard which direction you re going pinMode button2Pin INPUT Because we ve connected...

Страница 43: ...voltage when it is getting a lot of light and a low voltage when it is not Photo Resistor PARTS Wire 6 X CIRCUIT 6 6 LED 1 X 330 Resistor 1 X Photo Resistor 1 X 10K Resistor 1 X I O R E F R E S E T R...

Страница 44: ...F GND 13 12 11 10 9 8 7 6 5 4 3 2 1 0 TX RX 13 3 3V 5V GND GND VIN A0 A1 A2 A3 A4 A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Page 42 Circuit 6 Photo Resistor a b c d e f g h i 1 2 3...

Страница 45: ...a normal fixed resistor When you connect the top resistor to 5 volts and the bottom resistor to ground The voltage at the middle will be proportional to the bottom resistor relative to the total resis...

Страница 46: ...the smaller range using the map function lightLevel map lightLevel 0 1023 0 255 Because map could still return numbers outside the to range we ll also use a function called constrain that will clip n...

Страница 47: ...e Arduino IDE s serial monitor to display the temperature Temperature Sensor CIRCUIT 7 7 p 44 GND Ground RedBoard TMP36 Precision Temperature Sensor 5 volt GND 3 VCC 1 VOUT 2 PIN A0 PARTS Wire 5 X Tem...

Страница 48: ...A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Circuit 7 Temperature Sensor a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30...

Страница 49: ...open this first upload the program then click the button which looks like a magnifying glass in a square In order for the serial monitor to operate correctly it must be set to the same baud rate speed...

Страница 50: ...n 9600 Serial print will print everything on the same line Serial println will move to the next line By using both of these commands together you can create easy to read printouts of text and data Ser...

Страница 51: ...ions because they do one thing very well that motors cannot they can move to a position accurately By varying the pulse width of the output voltage to a servo you can move a servo to a specific positi...

Страница 52: ...4 A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Circuit 8 A Single Servo a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a...

Страница 53: ...f the standard libraries and information on using them But anyone can create a library and if you want to use a new sensor or output device chances are that someone out there has already written one t...

Страница 54: ...1 1 0 9 8 7 6 5 4 3 2 1 0 T X R X 1 3 3 3 V 5 V G N D G N D V I N A 0 A 1 A 2 A 3 A 4 A 5 P O W E R A N A L O G I N D I G I T A L P W M O N I S P TX RX I O R E F R E S E T R E S E T 7 1 5 V S C L S D...

Страница 55: ...stance gets it has a range from about 10K ohm to 35K ohm In this circuit we will use the amount of bend of the flex sensor to control the position of a servo Flex Sensor PARTS CIRCUIT 9 9 Potentiomete...

Страница 56: ...A4 A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b c d e f g h i 1 2 3 4...

Страница 57: ...final output but it s also incredibly useful for debugging Debugging your sketches using the Serial Monitor Component Image Reference i20 i24 Servo e1 e3 e2 e1 Jumper Wire i19 Jumper Wire h24 Jumper...

Страница 58: ...ircuit 9 What You Should See I O R E F R E S E T R E S E T 7 1 5 V S C L S D A A R E F G N D 1 3 1 2 1 1 1 0 9 8 7 6 5 4 3 2 1 0 T X R X 1 3 3 3 V 5 V G N D G N D V I N A 0 A 1 A 2 A 3 A 4 A 5 P O W E...

Страница 59: ...s circuit we ll get the soft pot up and running to control an RGB LED Soft Potentiometer PARTS CIRCUIT 10 10 Wire 9 X 330 Resistor 3 X LED 1 X Soft Potentiometer 1 X 330 Resistor 3 X 10K Resistor 1 X...

Страница 60: ...5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b c d e f g h i 1 2 3 4 5 6...

Страница 61: ...e1 1 5V 330 Resistor g4 e4 e7 e1 1 5V 330 Resistor g6 e6 e7 e1 1 5V 330 Resistor g7 e7 Jumper Wire 5V 5V Jumper Wire Pin 9 h4 Jumper Wire Pin 10 h6 Jumper Wire Pin 11 h7 e5 Jumper Wire j18 Jumper Wire...

Страница 62: ...es which overlap to mix and create new colors See the code for more information Even if you re not 100 clear how it works you can copy and paste this or any function into your own code and use it your...

Страница 63: ...es together you ve got music This circuit and sketch will play a classic tune We ll never let you down Piezo Buzzer PARTS Wire 3 X CIRCUIT 11 11 Piezo Buzzer 1 X I O R E F R E S E T R E S E T 7 1 5 V...

Страница 64: ...4 A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Circuit 11 Piezo Buzzer a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b...

Страница 65: ...ir types in the parentheses after the function name If your function is not using any parameters just use an empty parenthesis after the name If your function is returning a value from your function p...

Страница 66: ...X R X 1 3 3 3 V 5 V G N D G N D V I N A 0 A 1 A 2 A 3 A 4 A 5 P O W E R A N A L O G I N D I G I T A L P W M O N I S P TX RX I O R E F R E S E T R E S E T 7 1 5 V S C L S D A A R E F G N D 1 3 1 2 1 1...

Страница 67: ...this circuit is rated at 40V max and 200 milliamps max perfect for our toy motor When the motor is spinning and suddenly turned off the magnetic field inside it collapses generating a voltage spike T...

Страница 68: ...A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Circuit 12 Spinning a Motor a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a...

Страница 69: ...m This is one of the reasons we ve been promoting good programming habits Things like using constants for pin numbers and breaking your sketch into functions make it much easier to re use your code in...

Страница 70: ...1 0 T X R X 1 3 3 3 V 5 V G N D G N D V I N A 0 A 1 A 2 A 3 A 4 A 5 P O W E R A N A L O G I N D I G I T A L P W M O N I S P TX RX I O R E F R E S E T R E S E T 7 1 5 V S C L S D A A R E F G N D 1 3 1...

Страница 71: ...N2222AG 1 X Relay 1 X 1 X Diode 1N4148 Wire 14 X 330 Resistor 2 X LED 2 X When the relay is off the COM common pin will be connected to the NC Normally Closed pin When the relay is on the COM common p...

Страница 72: ...3 A4 A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Circuit 13 Relays a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b c...

Страница 73: ...istor g3 e3 e7 e1 1 5V 330 Resistor b14 Component Image Reference i13 Jumper Wire i13 e22 j5 Jumper Wire j7 j9 Jumper Wire i15 e19 Jumper Wire e15 e19 Jumper Wire e15 e19 Jumper Wire b14 e19 Jumper Wi...

Страница 74: ...stor which in turn energizes the relay s coil the relay s switch contacts are closed This connects the relay s COM pin to the NO Normally Open pin Whatever you ve connected using these pins will turn...

Страница 75: ...E S E T R E S E T 7 1 5 V S C L S D A A R E F G N D 1 3 1 2 1 1 1 0 9 8 7 6 5 4 3 2 1 0 T X R X 1 3 3 3 V 5 V G N D G N D V I N A 0 A 1 A 2 A 3 A 4 A 5 P O W E R A N A L O G I N D I G I T A L P W M O...

Страница 76: ...A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Circuit 14 Shift Register a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a...

Страница 77: ...D j21 c24 330 Resistor a3 GND j24 c24 330 Resistor IC e5 f5 e6 f6 e7 f7 e8 f8 e9 f9 e 1 0 f10 e 1 1 f11 e 1 2 f12 a3 GND Jumper Wire a3 GND Jumper Wire a3 GND Jumper Wire j5 a3 GND Jumper Wire j6 a14...

Страница 78: ...2 1 1 1 0 9 8 7 6 5 4 3 2 1 0 T X R X 1 3 3 3 V 5 V G N D G N D V I N A 0 A 1 A 2 A 3 A 4 A 5 P O W E R A N A L O G I N D I G I T A L P W M O N I S P TX RX I O R E F R E S E T R E S E T 7 1 5 V S C L...

Страница 79: ...ometer 1 X I O R E F R E S E T R E S E T 7 1 5 V S C L S D A A R E F G N D 1 3 1 2 1 1 1 0 9 8 7 6 5 4 3 2 1 0 T X R X 1 3 3 3 V 5 V G N D G N D V I N A 0 A 1 A 2 A 3 A 4 A 5 P O W E R A N A L O G I N...

Страница 80: ...6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29 30 a b c d...

Страница 81: ...e a3 GND Jumper Wire e6 a3 GND Jumper Wire f15 a3 GND Jumper Wire e7 f28 a3 GND Jumper Wire f16 a3 GND Jumper Wire e8 Jumper Wire Jumper Wire j10 Pin 2 f17 f18 Pin 3 f18 j10 5V GND Potentiometer b8 b7...

Страница 82: ...code tells your Arduino IDE to include the library for a simple LCD display Without it none of the commands will work so make sure you include it include LiquidCrystal h Code to Note Real World Appli...

Страница 83: ...SIK Simon Says PARTS CIRCUIT 16 16 Page 81 I O R E F R E S E T R E S E T 7 1 5 V S C L S D A A R E F G N D 1 3 1 2 1 1 1 0 9 8 7 6 5 4 3 2 1 0 T X R X 1 3 3 3 V 5 V G N D G N D V I N A 0 A 1 A 2 A 3 A...

Страница 84: ...A4 A5 POWER ANALOG IN DIGITAL PWM ON ISP TX RX LEARN SHARE HACK Page 82 Circuit 16 Simon Says a b c d e f g h i 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 24 25 26 27 28 29...

Страница 85: ...j10 Pin 13 d12 a3 Jumper Wire c7 Jumper Wire j10 Pin 2 c24 a3 Jumper Wire c22 Jumper Wire j10 Pin 9 c29 a3 Jumper Wire c27 Jumper Wire GND Page 83 LED 5mm j11 c3 LED 5mm j12 c3 LED 5mm j18 c3 LED 5mm...

Страница 86: ...guess the pattern will repeat this time adding another random LED The player is to follow the pattern for as long as possible with each successful guess resulting in an additional layer of complexity...

Страница 87: ...te has a wealth of tutorials to whet your appetite for more knowledge We also host a community of hackers engineers DIYers etc in our forums So log on to our website for more information about Arduino...

Страница 88: ...Board is licensed under the Creative Commons Attribution Share Alike 3 0 Unported License To view a copy of this license visit http creativecommons org by sa 3 0 Or write Creative Commons 171 Second S...

Отзывы: