SlideShare una empresa de Scribd logo
1 de 32
Descargar para leer sin conexión
KEYES
What Arduino can do
Arduino can sense the environment by receiving
input from a variety of sensors and can affect its
surroundings by controlling lights, motors, and
other actuators. The microcontroller on the board
is programmed using the Arduino programming
language (based on Wiring) and the Arduino
development environment (based on Processing).
Arduino projects can be stand-alone or they can
communicate with software running on a computer
(e.g. Flash, Processing, MaxMSP).
OPEN SOURCE
Arduino
starter
kit book
About the kit
About open source hardware
About KEYES
Our Words
About arduino
Here is The Arduino Starter Kit! This kit walks you through the basics of using the Arduino in a hands-on way.
You'll learn through building several creative projects.
The kit includes a selection of the most common and useful electronic components with a book of 26 projects.
Starting the basics of electronics, to more complex projects,
the kit will help you control the physical world with sensor and actuators.
Open-source hardware consists of physical artifacts of technology designed and offered by the open design movement.
Both free and open-source software (FOSS) as well as open-source hardware is created by this open-source culture movement
and applies a like concept to avariety of components. The term usually means that information about the hardware is easily
discerned. Hardware design (i.e. Mechanical drawings, schematics, bills of material, PCB layout data, HDL source code and
integrated circuit layout data), in addition to the software that drives the hardware, are all released with the FOSS approach.
Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer.
It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for
writing software for the board.
Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety
of lights, motors, and other physical outputs. Arduino projects can be stand-alone, or they can be communicate with software
running on your computer (e.g. Flash, Processing, MaxMSP.) The boards can be assembled by hand or purchased
preassembled; the open-source IDE can be downloaded for free.
The Arduino programming language is an implementation of Wiring, a similar physical computing platform, which is based on
the Processing multimedia programming environment.
KEYES is China early development and production of open source hardware company,There are three major brand products,
FUNDUINO controller,
KEYES sensor,
ROBOTALE robot,
We continue to develop new products,
The open source world we work together。
KEYES
Kit list
Item list
Project list
Funduino UNO
*1
*4
ARDUINO HOLDER
bread board
*1
Funduino UNO
ARDU INO HOLD ER
bre ad bo ard
MCU Holder LED
RED 5PCS
GREEN 5PCS
YELLOW 5PCS
Resistance
220R10PCS
1KR 10PCS
10KR 10PCS
Jump wire
10mm 20pcs
Jump wire
20mm 10pcs
Dopont wire
Female 20mm 10pcs
Usb cable
Ds
1302
Cr20 32
+
+
Keyes
Gnd
Out
Vcc
OUT VCC GND
Sdr-
05vdc
Songle
Relay
Uln2003an
74hc595n
LM
35
Box
Breadboard Breadboard
400 hole 830hole
Battery box Key switch RGB LED
*1 *1
*1 *1
*1 *4 *1 *3 *1 *2
*1
*1 *2 *1 *2 *1 *1 *1 *1
*1
*1
*1
*1
*1
*1
Lm35
Sevro 1602 lcd
Tilt
Photocell Flame Buzzer
Infrared receiver Potentiometer 74hc595 Remote controller 7 segment display 7 segment display
Four
Clock
Tempe and humidity
Relay
Motor Stepping drive
dot matrix
*1 *1
Project-01 Hello world
Blink
T r af f i c Li ght
Loop
Pwm
Button
Responder
RGB led
Buzzer
Analog read
Photocell control buzzer
Photocell control light
Tilt
Frie
Temp
74hc595
7segment display
Four-7segment display
dot matrix
Sevro
I R Remot e
1602 LCD
Stepper motor
Relay
Temp & humidity
Clock
Basic building
Four in one
Project-02
Project-03
Project-04
Project-05
Project-06
Project-08
Project-07
Project-09
Project-10
Project-11
Project-12
Project-13
Project-14
Project-15
Project-16
Project-17
Project-18
Project-19
Project-20
Project-21
Project-22
Project-23
Project-24
Project-25
Project-26
Page 1
KEYES
K es
ey
-
+
-
+
-
+
-
+
ey
K es
-
+
-
+
-
+
-
+
*1
ARDUINO HOLDER
bread board
e
K yes
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
f
Are
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Language Reference
Structure
The setup() function is called when a sketch starts.Use it to initialize variables, pin modes, start using libraries,
etc. The setup function will only run once, after each powerup or reset of the Arduino board.
After creating a setup() function, which initializes and sets the initial values, the loop() function does
precisely what its name suggests, and loops consecutively, allowing yourprogram to change and
respond. Use it to actively control the Arduino board.
Control Structures
If
if, which is used in conjunction with a comparison operator, tests whether
a certain condition has been reached, such as an input being above a
certain number. The format for an if test is:
if (someVariable > 50){// do something here}
The program tests to see if someVariable is greater than 50. If it is, the
program takes a particular action. Put another way, if the statement in
parentheses is true, the statements inside the brackets are run. If not,
the program skips over the code.
if / else
if/else allows greater control over the flow of code than the basic if
statement, by allowing multiple tests to be grouped together. For example,
an analog input could be tested and one action taken if the input was less
than 500, and another action taken if the input was 500 or greater.
The code would look like this:
if (pinFiveInput < 500) {// action A } else { // action B}
else can proceed another if test, so that multiple, mutually exclusive tests
can be run at the same time.
For
The for statement is used to repeat a block of statements enclosed in
curly braces. An increment counter is usually used to increment and
terminate the loop. The for statement is useful for any repetitive
operation, and is often used in combination with arrays to operate on
collections of data/pins.
Constants
Data Types
Digital
Analog
Arduino programs can be divided in three main parts: structure,
values (variables and constants), and functions.
More of the grammar please to:http://arduino.cc/en/Reference/HomePage
Page 2
KEYES
HIGH
The meaning of HIGH (in reference to a pin) is somewhat different
depending on whether a pin is set to an INPUT or OUTPUT. When a pin
is configured as an INPUT with pinMode, and read with digitalRead,
the microcontroller will report HIGH if a voltage of 3 volts or more is
present at the pin.
LOW
The meaning of LOW also has a different meaning depending on whether
a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT
with pinMode, and read with digitalRead, the microcontroller will report
LOW if a voltage of 2 volts or less is present at the pin.
INPUT
Arduino (Atmega) pins configured as INPUT with pinMode() are said to be
in a high-impedance state. Pins configured as INPUT make extremely
small demands on the circuit that they are sampling, equivalent to a series
resistor of 100 Megohms in front of the pin. This makes them useful for
reading a sensor, but not powering an LED.
Int
On the Arduino Uno (and other ATMega based boards) an int stores a
16-bit (2-byte) value. This yields a range of -32,768 to 32,767 (minimum
value of -2^15 and a maximum value of (2^15) - 1).
On the Arduino Due, an int stores a 32-bit (4-byte) value. This yields a
range of -2,147,483,648 to 2,147,483,647 (minimum value of -2^31 and
a maximum value of (2^31) - 1).int's store negative numbers with a
technique called 2's complement math. The highest bit, sometimes
referred to as the "sign" bit, flags the number as a negative number.
The rest of the bits are inverted and 1 is added.
Char
A data type that takes up 1 byte of memory that stores a character value.
Character literals are written in single quotes, like this: 'A' (for multiple
characters - strings - use double quotes: "ABC").
Characters are stored as numbers however. You can see the specific
encoding in the ASCII chart. This means that it is possible to do arithmetic
on characters, in which the ASCII value of the character is used
(e.g. 'A' + 1 has the value 66, since the ASCII value of the capital letter A
is 65). See Serial.println reference for more on how characters are
translated to numbers.
Long
Long variables are extended size variables for number storage, and store
32 bits (4 bytes), from -2,147,483,648 to 2,147,483,647.
If doing math with integers, at least one of the numbers must be followed
by an L, forcing it to be a long. See the Integer Constants page for details.
Time
Millis()
Returns the number of milliseconds since the Arduino board began
running the current program. This number will overflow (go back to zero),
after approximately 50 days.
Micros()
Returns the number of microseconds since the Arduino board began
running the current program. This number will overflow (go back to zero),
after approximately 70 minutes. On 16 MHz Arduino boards
(e.g. Duemilanove and Nano), this function has a resolution of four
microseconds (i.e. the value returned is always a multiple of four).
On 8 MHz Arduino boards (e.g. the LilyPad), this function has a resolution
of eight microseconds.
Delay()
Pauses the program for the amount of time (in miliseconds) specified
as parameter. (There are 1000 milliseconds in a second.)
PinMode()
Configures the specified pin to behave either as an input or an output.
See the description of digital pins for details on the functionality of the pins.
As of Arduino 1.0.1, it is possible to enable the internal pullup resistors
with the mode INPUT_PULLUP. Additionally, the INPUT mode explicitly
disables the internal pullups.
DigitalWrite()
Write a HIGH or a LOW value to a digital pin.
If the pin has been configured as an OUTPUT with pinMode(), its voltage
will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for
HIGH, 0V (ground) for LOW.
If the pin is configured as an INPUT, writing a HIGH value with
digitalWrite() will enable an internal 20K pullup resistor (see the tutorial
on digital pins). Writing LOW will disable the pullup. The pullup resistor is
enough to light an LED dimly, so if LEDs appear to work, but very dimly,
this is a likely cause. The remedy is to set the pin to an output with the pinMode()
function.
DigitalRead()
Reads the value from a specified digital pin, either HIGH or LOW.
AnalogReference(type)
Configures the reference voltage used for analog input (i.e. the value used as the top of
the input range). The options are:
DEFAULT: the default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts
(on 3.3V Arduino boards)
INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or Atmega328
and 2.56 volts on the ATmega8 (not available on the Arduino Mega)
INTERNAL1V1: a built-in 1.1V reference (Arduino Mega only)
INTERNAL2V56: a built-in 2.56V reference (Arduino Mega only)
EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference.
AnalogRead()
Reads the value from the specified analog pin. The Arduino board
contains a 6 channel (8 channels on the Mini and Nano, 16 on the Mega),
10-bit analog to digital converter. This means that it will map input
voltages between 0 and 5 volts into integer values between 0 and 1023.
This yields a resolution between readings of: 5 volts / 1024 units or,
.0049 volts (4.9 mV) per unit. The input range and resolution can be
changed using analogReference().
AnalogWrite()
Writes an analog value (PWM wave) to a pin. Can be used to light a LED at
varying brightnesses or drive a motor at various speeds. After a call to
analogWrite(), the pin will generate a steady square wave of the specified
duty cycle until the next call to analogWrite() (or a call to digitalRead() or
digitalWrite() on the same pin). The frequency of the PWM signal on most
pins is approximately 490 Hz. On the Uno and similar boards, pins 5 and 6
have a frequency of approximately 980 Hz. Pins 3 and 11 on the Leonardo
also run at 980 Hz.
Setup() Loop()
Getting Started w/ Arduino on Windows
This document explains how to connect your Arduino board
to the computer and upload your first sketch.
1. Download the Arduino environment
2. Connect the board
3.Install the drivers
4. Launch the Arduino application
5. Open the blink example
6.Select your board
7. Select your serial port
8. Upload the program
Get the latest version from the download page.
Http://arduino.cc/en/Main/Software
When the download finishes, unzip the downloaded file.
Make sure to preserve the folder structure. Double-click the
folder to open it. There should be a few files and sub-folders
inside.
The Arduino Uno automatically draw power from either the
USB connection to the computer or an external power supply.
Connect the Arduino board to your computer using the USB
cable. The green power LED (labelled PWR) should go on.
Plug in your board and wait for Windows to begin it's driver
installation process. After a few moments, the process will fail,
despite its best efforts Click on the Start Menu, and open up the
Control Panel.While in the Control Panel, navigate to System
and Security. Next, click on System. Once the System window
is up, open the Device Manager.Look under Ports (COM & LPT).
You should see an open port named "Arduino UNO (COMxx)"
Right click on the "Arduino UNO (COmxx)" port and choose the
"Update Driver Software" option.Next, choose the "Browse my
computer for Driver software" option.
Finally, navigate to and select the driver file named "arduino.inf",
located in the "Drivers" folder of the Arduino Software download
(not the "FTDI USB Drivers" sub-directory). If you are using an old
version of the IDE (1.0.3 or older), choose the Uno's driver file
named "Arduino UNO.inf"
Windows will finish up the driver installation from there.
Double-click the Arduino application. (Note: if the Arduino
software loads in the wrong language, you can change it in
the preferences dialog. See the environment page for details.)
Open the example sketch: File > Examples > 1.Basics > Blink.
You'll need to select the entry in the Tools >
Board menu that corresponds to your Arduino.
Choose board>uno
Select the serial device of the Arduino board from the Tools |
Serial Port menu. This is likely to be COM3 or higher
(COM1 and COM2 are usually reserved for hardware
serial ports). To find out, you can disconnect your Arduino
board and re-open the menu; the entry that disappears
should be the Arduino board. Reconnect the board and
select that serial port.
Now, simply click the "Upload" button in the environment.
Wait a few seconds - you should see the RX and TX leds
on the board flashing. If the upload is successful, the
message "Done uploading." will appear in the status bar.
(Note: If you have an Arduino Mini, NG, or other board,
you'll need to physically present the reset button on the board
immediately before pressing the upload button.)
A few seconds after the upload finishes, you should see the
pin 13 (L) LED on the board start to blink (in orange). If it does
, congratulations! You've gotten Arduino up-and-running.
Page 3
KEYES
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Project -01
ABOUT THE PROJECT ITEM PHOTO
PARTS
Note
Connection Code
Hello world
First, only need a Arduino and a usb cablel,
Let Arduino say "Hello World!" ,
This is a Arduino and PC communication experiment,
This is an introductory experiment,
Hope can lead you into the world of Arduino.
Funduino UNO
*1 *1
Baud rate is 9600, here to set
same to software.
When the access specific
equipment
(such as: Bluetooth)
we have to agreement with
other equipment baud rate.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
ARDUINO HOLDER
bread board
*1 *1
Schematic Contact us
Not working?
you can contact us by
email or skybe,
email is szkeyes@126.com
our skybe is zuokejian,
Any questions please feel
free to contact us.
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
KEYES
Page 4
ARDUINO HOLDER
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Analog
ey
K es
-
+
-
+
-
+
-
+
//Arduino code:
************************************************
int val ; //define val
int ledpin=13; // define of digi tal interface 13
void setup()
{
Serial .begin (9600);
// set the baud rate is 9600.
pinMode (ledpin, OUTPUT);
// set 13 for the output port .
}
void loop()
{
val=Serial.read();//
//read the PC machine send instructionsor
//character of Arduino, and the instruction
//or character is assigned to val
if (val=='R' ) // to judge whether
//the instruction or character received is "R".
{
// if recei ved "R" character
digitalWrite (ledpin, HIGH);
// digi tal 13 LED on
delay (500);
digitalWrite (ledpin, LOW);
// digi tal 13 LED off
delay (500);
Serial .println ("HelloWorld!");
// display "Hel lo World!"
}
}
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
KEYES
Project -02
ABOUT THE PROJECT ITEM PHOTO
PARTS
Code
To build the circuit, attach a 220-ohm resistor to pin 13. Then attach the long leg of
an LED (the positive leg, called the anode) to the resistor.Attach the short leg
(the negative leg, called the cathode) to ground. Then plug your Arduino board into
your computer, start the Arduino program,and enter the code below.Most Arduino
boards already have an LED attached to pin 13 on the board itself. If you run this
example with no hardware attached, you should see that LED blink.
Blink
/*
Blink
Turns on an LED on for one second, then off for one second,
repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
***********************************************************************
int led = 13;
// the setup routine runs once when you press reset:
void setup()
{
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop()
{
digitalWrite(led, HIGH);
// turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW);
// turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1
Page 5
KEYES
Keyes
-
+
-
+
-
+
-
+
Connection
In between the on and the off, you want enough time for a person to seethe change, so the delay
() commands tell the Arduino to do nothing for 1000 milliseconds, or one second. When you use
the delay() command,nothing else happens for that amount of time. Once you've understood
the basic examples, check out the Blink Without Delay example to learn
how to create a delay while doing other things.
Schematic
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
220R
GND
ARDUINO HOLDER
bread board
eyes
K
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Analog
Contact us
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Project -03
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection
Code
Traffic Light
Traffic Light
We have completed a single LED control project,
Next we have to do a bit more complex traffic project,
In fact, smart friends can see that this project is the
Extending the single LED project into 3 color light,
We can realize our simulation of traffic project.
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *3 *4
The project we simulated traffic lights,Red, yellow, and green lights flashing
time of traffic lights need seemed really,
We can use the Arduino delay () function to control the
delay time.
220R
*3
Schematic
Contact us
GND
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
220R
220R
Page 6
KEYES
bread board
Keyes
-
+
-
+
-
+
-
+
ARDUINO HOLDER
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Analog
ey
K es
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
//arduino code :
**********************************************************************
int redled =10; // define digital interface 10
int yellowled =7; // define digital interface 7
int greenled =4; // define digital interface 4
void setup ()
{
pinMode (redled, OUTPUT); //define red light for the output
pinMode (yellowled, OUTPUT);//define yellow light for output
pinMode (greenled, OUTPUT); //define green light for output
}
void loop ()
{
digitalWrite (redled, HIGH); // red light on
delay (1000); // 1 second delay
digitalWrite (redled, LOW); // red light off
digitalWrite (yellowled, HIGH); // yellow light on
delay (200); // 0.2 second delay
digitalWrite (yellowled, LOW); // yellow light off
digitalWrite (greenled, HIGH); // green light on
delay (1000); // 1 second delay
digitalWrite (greenled, LOW); // green light off
}
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -04
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Loop
This example makes use of 6 LEDs connected to the pins 2 - 7 on the board using
220 Ohm resistors. The sketch makes the LEDs blink in a sequence, one by one
using only digitalWrite(pinNumber,HIGH/LOW) and delay(time).
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *6 *14
This example code
/*For Loop Iteration */
********************************************************************
int timer = 100; // The higher the number, the slower the timing.
void setup()
{
// use a for loop to initialize each pin as an output:
for (int thisPin = 2; thisPin < 8; thisPin++) {
pinMode(thisPin, OUTPUT);
}
}
void loop()
{
// loop from the lowest pin to the highest:
for (int thisPin = 2; thisPin < 8; thisPin++) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer);
// turn the pin off:
digitalWrite(thisPin, LOW);
}
// loop from the highest pin to the lowest:
for (int thisPin = 7; thisPin >= 2; thisPin--) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer);
// turn the pin off:
digitalWrite(thisPin, LOW);
}
}
Often you want to iterate over a series of pins and do
something to each one. For example, this example lights
up a series of LEDs attached to pins 2 through 7 of the Arduino.
220R
*6
Contact us
GND
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
220R
220R
220R
220R
220R
220R
Schematic
Page 7
KEYES
ARDUINO HOLDER
bread board
Keyes
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -05
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
PWM
Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means. Digital
control is used to create a square wave, a signal switched between on and off. This on-off pattern can
simulate voltages in between full on (5 Volts) and off (0 Volts) by changing the portion of the time the
signal spends on versus the time that the signal spends off. The duration of "on time" is called the pulse
width. To get varying analog values, you change, or modulate, that pulse width. If you repeat this on-off
pattern fast enough with an LED for example, the result is as if the signal is a steady voltage between
0 and 5v controlling the brightness of the LED.
In the graphic below, the green lines represent a regular time period. This duration or
periodis the inverse of the PWM frequency. In other words, with Arduino PWM frequency
at about500Hz, the green lines would measure 2 milliseconds each. A call to analogWrite
() is on a scale of 0 - 255, such that analogWrite(255) requests a 100% duty cycle (always
on), and analogWrite(127) is a 50% duty cycle (on half the time) for example.
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1
Arduino Code
/*The example shows how to fade an LED using the
analogWrite *
***********************************************************
int ledPin = 9; // LED connected to digital pin 9
void setup() {
// nothing happens in setup
}
void loop() {
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5)
{
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
220R
*1
Demonstrates the use of analog output (Pulse Width
Modulation (PWM)) to fade an LED. PWM is a technique
for getting an analog-like behavior from a digital output
by switching it off and on very fast.
Schematic
Contact us
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
220R
GND
Project -05
Page 8
KEYES
ARDUINO HOLDER
bread board
Key s
e
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
G
d
n
r
A
ef
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -06
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Button
Pushbuttons or switches connect two points in a circuit when you press them. This example turns on
the built-in LED on pin 13 when you press the button.
Connect three wires to the Arduino board. The first two, red and black, connect to the two long vertical
rows on the side of the breadboard to provide access to the 5 volt supply and ground. The third wire
goes from digital pin 2 to one leg of the pushbutton. That same leg of the button connects through a
pull-down resistor (here 10 KOhms) to ground. The other leg of the button connects to the 5 volt supply.
When the pushbutton is open (unpressed) there is no connection between the two legs of the
pushbutton, so the pin is connected to ground (through the pull-down resistor) and we read a LOW.
When the button is closed (pressed), it makes a connection between its two legs, connecting the pin
to 5 volts, so that we read a HIGH.
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 220R
*1 *6 *1
Arduino Code
/* Button*/
// constants won't change. They're used here to
// set pin numbers:
**********************************************************************
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop()
{
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}}
You can also wire this circuit the opposite way, with a pullup resistorkeeping the input HIGH,
and going LOW when the button is pressed.If so, the behavior of the sketch will be reversed,
with the LED normallyon and turning off when you press the button.
If you disconnect the digital i/o pin from everything, the LED may blink erratically. This is
because the input is "floating" - that is, it will randomly return either HIGH or LOW. That's
why you need a pull-up or pull-down resistor in the circuit.
Schematic
Contact us
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUI NO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
10K
LED
Page 9
KEYES
ARDUINO HOLDER
bread board
Keyes
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -07
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Responder
This project is from the button control the led project
but Add 3 buttons and 3 leds, occupy 6 digital I/O interface.
The principle same to button control the led.
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *3 220R
*3 *15 *3
Once you've got a pushbutton working, you often want to do some
action based on how many times the button is pushed. To do this, you
need to know when the button changes state from off to on, and count
how many times this change of state happens. This is called state
change detection or edge detection.
Schematic
Contact us
Page 10
KEYES
220R
220R
220R
10K 10K
10K
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
ARDUINO HOLDER
bread board
y
Ke es
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
f
Are
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
ey
K es
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
//Ardui no code:
**********************************************
int redled=10;
int yellowled=9;
int greenled=8;
int redpin=7;
int yellowpin=6;
int greenpin=5;
int red;
int yellow;
int green;
void setup ()
{
pinMode (redled, OUTPUT);
pinMode (yellowled, OUTPUT);
pinMode (greenled, OUTPUT);
pinMode (redpin, INPUT);
pinMode (yellowpin, INPUT);
pinMode (greenpin, INPUT);
}
void loop ()
{
red=digitalRead (redpin);
if ( red==LOW)
{digitalWrite (redled, LOW); }
else
{digitalWrite (redled, HIGH); }
yellow=digitalRead (yellowpin);
if ( yellow==LOW)
{digitalWrite (yellowled, LOW); }
else
{digitalWrite (yellowled, HIGH); }
green=digitalRead (greenpin);
if ( green==LOW)
{digitalWrite (greenled, LOW); }
else
{digitalWrite (greenled, HIGH); }
}
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -08
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Rgb led
RGB LED has 3 sets of output,Through ARDUINO programming,
To achieve R, G, B, a mixture of three colours,Achieve the full-color effect,
The RGB led has 3 output:
1 R, red output,
2 G, green output,
3 B, blue output.
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 220R
*3 *4
Contact us
Schematic
In this project, you will need to use 3 Pulse Width Modulation pins, PWM for short.
Pins that are not specified as PWM pins are digital pins, which can only turn on and off.
PWM pins can go from lets say 3.3 volts to five volts to 1.1 volts.
In my program Red = pin 11, Blue = pin 10, and Green = pin 9.
Page 11
KEYES
ARDUINO HOLDER
bread board
Keyes
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
220R
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
ey
K es
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
int red = 11; //this sets the red led pin
int green = 10; //this sets the green led pin
int blue = 9; //this sets the blue led pin
int redNow;
int blueNow;
int greenNow;
int redNew;
int blueNew;
int greenNew;
void setup()
{ //this sets the output pins
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
redNow = random(255);
blueNow = random(255);
greenNow = random(255);
redNew = redNow;
blueNew = blueNow;
greenNew = greenNow;
}
#define fade(x,y) if (x>y) x--; else if (x<y) x++;
void loop()
{
analogWrite(blue, blueNow);
analogWrite(red, redNow);
analogWrite(green, greenNow);
redNew = random(255);
blueNew = random(255);
greenNew = random(255);
// fade to new colors
while ((redNow != redNew) ||
(blueNow != blueNew) ||
(greenNow != greenNew))
{
fade(redNow,redNew)
fade(blueNow,blueNew)
fade(greenNow,greenNew)
analogWrite(blue, blueNow);
analogWrite(red, redNow);
analogWrite(green, greenNow);
delay(20);
}
}
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -09
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Buzzer
The calculation of the tones is made following the mathematical operation:
timeHigh = period / 2 = 1 / (2 * toneFrequency)
where the different tones are described as in the table:
note frequency period timeHigh
c 261 Hz 3830 1915
d 294 Hz 3400 1700
e 329 Hz 3038 1519
f 349 Hz 2864 1432
g 392 Hz 2550 1275
a 440 Hz 2272 1136
b 493 Hz 2028 1014
C 523 Hz 1912 956
This example uses a piezo speaker to play melodies. It sends a square wave of
the appropriate frequency to the piezo, generating the corresponding tone.
Piezos have polarity. Commercial devices are usually have a red (positive) and a
black (negative). Connect the red wire digital pin 9 and the black wire to ground.
Sometimes it is possible to acquire Piezo elements without a plastic housing,
then they will just look like a metallic disc.
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1
Arduino Code
*************************************************************************
int speakerPin = 9;
int length = 15; // the number of notes
char notes[] = "ccggaagffeeddc "; // a space represents a rest
int beats[] = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4 };
int tempo = 300;
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}
void playNote(char note, int duration) {
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };
// play the tone corresponding to the note name
for (int i = 0; i < 8; i++) {
if (names[i] == note) {
playTone(tones[i], duration);
}
}
}
void setup() {
pinMode(speakerPin, OUTPUT);
}
void loop() {
for (int i = 0; i < length; i++) {
if (notes[i] == ' ') {
delay(beats[i] * tempo); // rest
} else {
playNote(notes[i], beats[i] * tempo);
}
// pause between notes
delay(tempo / 2);
}
}
*1
Contact us
Schematic
Page 12
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
ARDUINO HOLDER
bread board
K yes
e
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -10
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Analog read
This example shows you how to read analog input from the physical world using a
potentiometer. A potentiometer is a simple mechanical device that provides a varying
amount of resistance when its shaft is turned. By passing voltage through a
potentiometer and into an analog input on your Arduino, it is possible to measure
the amount of resistance produced by a potentiometer (or pot for short) as an analog
value. In this example you will monitor the state of your potentiometer after
establishing serial communication between your Arduino and your computer.
arduino code:
/*AnalogReadSerial
Reads an analog input on pin 0,
prints the result to the serial monitor.
Attach the center pin of a potentiometer to pin A0,
and the outside pins to +5V and ground. */
// the setup routine runs once when you press reset:
**************************************************************
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
Funduino UNO
*1 ARDUINO HOLDER
bread board
*1
In the program below, the only thing that you do will in the setup function is to begin serial communications, at 9600 bits
of data per second, between your Arduino and your computer with the command:
Next, in the main loop of your code, you need to establish a variable to store the resistance value (which will be between
0 and 1023, perfectfor an int datatype) coming in from your potentiometer:
Finally, you need to print this information to your serial window as adecimal (DEC) value. You can do this with the
command Serial.println() in your last line of code:
Now, when you open your Serial Monitor in the Arduino development environment (by clicking the button directly to the
right of the "Upload" button in the header of the program), you should see a steady stream of numbers ranging from 0-1023,
correlating to the position of the pot.As you turn your potentiometer, these numbers will respond almost instantly.
Serial.begin(9600);
int sensorValue = analogRead(A0);
Serial.println(sensorValue, DEC)
Contact us
Schematic
Page 13
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
ARDUINO HOLDER
bread board
Keyes
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
f
Are
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
*1
*1 *1
ey
K es
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -11
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Photocells control buzzer
Photocells are sensors that allow you to detect light. They are small, inexpensive,
low-power, easy to use and don't wear out. For that reason they often appear in
toys, gadgets and appliances. They are often referred to as CdS cells (they are
made of Cadmium-Sulfide), light-dependent resistors (LDR), and photoresistors
This project will photosensitive resistor connected to the IO port.
There is no light, the normal sound, but the sound is extremely small.
If The light is stronger , the resistance is smaller, and the buzzer is louder.
Funduino UNO
*1 ARDUINO HOLDER
bread board
*1 *1 *1
*1 *1
A photocell's resistance changes as the face is exposed tomore light. When its
dark, the sensor looks like an large resistor up to 10MΩ, as the light level
increases, the resistance goes down. This graph indicates approximately
the resistance of the sensor at different light levels.Remember each photocell
will be a little different so use this as a guide only!
Contact us
Schematic
Page 14
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
//Ardui no code:
************************************************
void setup ()
{
pinMode (6, OUTPUT);
}
void loop ()
{
while (1)
{
char i, j;
while (1)
{
for (i =0; i<80; i++
)// a frequency voice
{
digitalWrite (6, HIGH);
delay (1);
digitalWrite (6, LOW);
delay (1);
}
for (i =0; i<100; i++) // another frequency voice
{
digitalWrite (6, HIGH);
delay (2);
digitalWrite (6, LOW);
delay (2);
}}}}
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
ARDUINO HOLDER
bread board
y
Ke es
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
n
G
d
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -12
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Light control led
This project we conducted a relatively simple experiment using a Photocells.
the Value with changes in the intensity of the incident light.
Light intensity, the Photocells decreases,
Weak incident light, the Photocells increases.
Usually Photocells for measuring light,
And a photoelectric conversion of the light control.
photovaristor can be widely used in various light control circuit,
Such as lighting control, regulation , can also be used for light control switch.
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 220R *1 *6
*1 10k *1
Photocells are basically a resistor that changes its resistive value (in ohms Ω) depending on
how much light is shining onto the squiggly face. They are very low cost, easy to get in many
sizes and specifications, but are very innacurate. Each photocell sensor will act a little
differently than the other, even if they are from the same batch.
The variations can be really large, 50% or higher! For this reason, they shouldn't be used to try
to determine precise light levels in lux or millicandela. Instead, you can expect to only be able
to determine basic light changes.
//arduino code:
*******************************************************
int potpin=A0; // define A0 is connected with the
//photosensitive resistor
int ledpin=11; // define 11 output PWM regulating
// LED brightness
int val=0; // define val
void setup ()
{
pinMode (ledpin, OUTPUT); // define io 11 output
Serial.begin (9600); // set the baud rate of 9600
}
void loop ()
{
val=analogRead (potpin); // analog read sensor
//values are assigned to val
Serial.println (val); // display the Val numerical variables
analogWrite (ledpin, val); // open LED and set the brightness
// (PWM output a maximum of 255)
delay (10); // 0.01 second delay
}
Contact us
Schematic
Page 15
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
220R
10k
ARDUINO HOLDER
bread board
K yes
e
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
d
Gn
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -13
Project -13
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Tilt
Contact us
Schematic
The tilt sensor is a component that can detect the tilting of an object. However it is only the
equivalent to a pushbutton activated through a different physical mechanism. This type of
sensor is the environmental-friendly version of a mercury-switch. It contains a metallic ball
inside that will commute the two pins of the device from on to off and viceversa if the sensor
reaches a certain angle.
The code example is exactly as the one we would use for a pushbutton but substituting this one
with the tilt sensor. We use a pull-up resistor (thus use active-low to activate the pins) and connect
the sensor to a digital input pin that we will read when needed.
Arduino code:
*****************************************************************
const int tiltPin = 2; // the number of the tilt pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int tiltState = 0; // variable for reading the tilt status
void setup()
{
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the tilt pin as an input:
pinMode(tiltPin, INPUT);
}
void loop()
{
// read the state of the tilt value:
tiltState = digitalRead(tiltPin);
// check if the tilt is Oblique.
// if it is, the tiltState is HIGH:
if (tiltState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1
While not as precise or flexible as a full accelerometer, tilt switches can detect
motion or orientation simply. Another benefit to them is that the big ones can
switch power on their own. Accelerometers, on the other hand, output digital
or analog voltage that must then be analyzed with extra circuitry.
Page 16
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
10k
10k
*1 *6
ARDUINO HOLDER
bread board
e s
K ye
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
d
Gn
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -14
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Fire alarm
Contact us
Schematic
The flame sensor's operating temperature is -25 degrees Celsius to 85 degrees Celsius,
in the course of the flame it should be noted that the probe distance from the flame should
not be too close inorder to avoid damage.
The Flame Sensor can be used to detect fire or other wavelength at 760 nm ~ 1100 nm light.
In the fire-fighting robot game, the flame plays an important role in the probe,
which can be used as the robot's eyes to find fire source or football. It can make use of
fire-fighting robots, soccer robots.
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1
*7
*1 10k *1
Page 17
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
10k
ARDUINO HOLDER
bread board
Keyes
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
r
A
ef
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
ey
K es
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Arduino code:
*****************************************************************
int flame=A5; // ANALOG A5 definition of flame
int Beep=8; // define the buzzer for digital Io8
int val=0; //DEFINE digital variables;
void setup ()
{
pinMode (Beep, OUTPUT); // define buzzer output
pinMode (flame, INPUT); // define flame sensor inpu
t
Serial.begin (9600); // set the baud rate to 9600
}
void loop ()
{
val=analogRead (flame); // reading flame value
Serial.println (val); // analog value, print it out
if (val>=600) // when the analog value is big than 600
{
digitalWrite (Beep, HIGH);
}
else
{
digitalWrite (Beep, LOW);
}}
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -15
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Lm35 TEMP
Contact us
Schematic
An analog temperature sensor is pretty easy to explain, its a chip that tells you what the ambient temperature is!
These sensors use a solid-state technique to determine the temperature. That is to say, they don't use mercury
(like old thermometers), bimetalic strips (like in some home thermometers or stoves), nor do they use thermistors
(temperature sensitive resistors). Instead, they use the fact as temperature increases, the voltage across a diode
increases at a known rate. (Technically, this is actually the voltage drop between the base and emitter - the Vbe - of
a transistor.) By precisely amplifying the voltage change, it is easy to generate an analog signal that is directly
proportional to temperature. There have been some improvements on the technique but, essentially that is how
temperature is measured.
Arduino code:
//lM35 Pin Variables
*************************************************************************
int sensorPin = 0;
//the analog pin the lm35's Vout (sense) pin is connected to
//the resolution is 10 mV / degree centigrade with a
//500 mV offset to allow for negative temperatures
/*
* setup() - this function runs once when you turn your Arduino on
* We initialize the serial connection with the computer
*/
void setup()
{
Serial.begin(9600); //Start the serial connection with the computer
//to view the result open the serial monitor
}
void loop() // run over and over again
{
//getting the voltage reading from the temperature sensor
int reading = analogRead(sensorPin);
// converting that reading to voltage, for 3.3v arduino use 3.3
float voltage = reading * 5.0;
voltage /= 1024.0;
// print out the voltage
Serial.print(voltage); Serial.println(" volts");
// now print out the temperature
float temperatureC = (voltage - 0.5) * 100 ;
//converting from 10 mv per degree wit 500 mV offset
//to degrees ((voltage - 500mV) times 100)
Serial.print(temperatureC); Serial.println(" degrees C");
// now convert to Fahrenheit
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
Serial.print(temperatureF); Serial.println(" degrees F");
delay(1000);
//waiting a second
}
These sensors have little chips in them and while they're not that delicate, they do need to be handled
properly. Be careful of static electricity when handling them and make sure the power supply is connected
up correctly and is between 2.7 and 5.5V DC - so don't try to use a 9V battery!
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 *3
LM
35
Page 18
KEYES
VCC
OUT
GND
VCC
GND
OUT
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
ARDUINO HOLDER
bread board
Ke es
y
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
d
Gn
A
f
re
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
LM
35
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -16
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
74HC595
Contact us
Schematic
At sometime or another you may run out of pins on your Arduino board and need to extend it with
shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as
an "8-bit serial-in, serial or parallel-out shift register with output latches; 3-state." In other words,
you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller
. You can link multiple registers together to extend your output even more.
Arduino code:
*****************************************************************
int data = 2;
int clock = 4;
int latch = 5;
int ledState = 0;
const int ON = HIGH;
const int OFF = LOW;
void setup()
{
pinMode(data, OUTPUT);
pinMode(clock, OUTPUT);
pinMode(latch, OUTPUT);
}
void loop()
{
int delayTime = 100;
for(int i = 0; i < 256; i++)
{
updateLEDs(i);
delay(delayTime);
}
}
void updateLEDs(int value)
{
digitalWrite(latch, LOW);
shiftOut(data, clock, MSBFIRST, value);
digitalWrite(latch, HIGH);
}
void updateLEDsLong(int value)
{
digitalWrite(latch, LOW);
for(int i = 0; i < 8; i++)
{
int bit = value & B10000000;
value = value << 1;
if(bit == 128){digitalWrite(data, HIGH);}
else{digitalWrite(data, LOW);}
digitalWrite(clock, HIGH);
delay(1);
digitalWrite(clock, LOW);
}
digitalWrite(latch, HIGH);
}
int bits[]={B00000001, B00000010, B00000100,
B00001000, B00010000, B00100000,
B01000000, B10000000};
int masks[] ={B11111110, B11111101, B11111011,
B11110111, B11101111, B11011111,
B10111111, B01111111};
void changeLED(int led, int state)
{
ledState = ledState & masks[led];
if(state == ON){ledState = ledState | bits[led];}
updateLEDs(ledState);
}
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *8 *20 220R
*8
74hc595n
*1
This set up makes all of the output pins active and addressable all the time.
The one flaw of this set up is that you end up with the lights turning on to their last state
or something arbitrary every time you first power up the circuit before the program starts
to run. You can get around this by controlling the MR and OE pins from your Arduino board
too, but this way will work and leave you with more open pins.
Page 19
KEYES
Q7
MR
SHCP
STCP
OE
DS
O
VCC
GND
7
1
6
5
4
3
2
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
220R
220R
220R
220R
220R
220R
220R
220R
ARDUINO HOLDER
bread board
es
Key
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
n
G
d
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
7
4
h
c
5
9
5
n
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -17
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection
Code
Digital tube
Contact us
Schematic
The seven segment display is a pretty simple device.
It is actually 8 LEDs (the decimal point is the 8th).
It can be arranged so that different combinations can be
used to make numerical digits.
This tutorial will show you how to wire one up and drive
it with an Arduino.
7 Segment LED is also composed of light emitting diode
So when we use it.
Also want to connect a current limiting resistor,
Otherwise to burn the light emitting diode.
Funduino UNO
*1 *1
ARD UIN O HOL DER
bread board
*1 *1 *1 *20 220R
*8
Page 20
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
ARDUINO HOLDER
bread board
es
Key
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
n
G
d
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
int a = 7 ;// IO7 connect a
int b = 6 ;// IO66 connected to b
int c = 5 ;// IO5 connection c
int d = 11 ;// IO11 connection d
int e = 10 ;// IO10 connection e
int f = 8 ;// IO8 connection f
int g = 9 ;// IO9 connection g
int dp = 4 ;// IO4 connection dp
void digital_1 (void) // display number 1
{
unsigned char j;
digitalWrite (c, HIGH) ;// to the digital interface 5-pin high, light c
digitalWrite (b, HIGH) ;// lit b segment
for (j = 7; j <= 11; j++) // off remaining segments
digitalWrite (j, LOW);
digitalWrite (dp, LOW) ;// turn off decimal point DP segment
}
void digital_2 (void) // display the number 2
{
unsigned char j;
digitalWrite (b, HIGH);
digitalWrite (a, HIGH);
for (j = 9; j <= 11; j++)
digitalWrite (j, HIGH);
digitalWrite (dp, LOW);
digitalWrite (c, LOW);
digitalWrite (f, LOW);
}
void digital_3 (void) // display the number 3
{
unsigned char j;
digitalWrite (g, HIGH);
digitalWrite (d, LOW);
for (j = 5; j <= 7; j++)
digitalWrite (j, HIGH);
digitalWrite (dp, LOW);
digitalWrite (f, LOW);
digitalWrite (e, HIGH);
}
void digital_4 (void) // display the number 4
{
digitalWrite (c, HIGH);
digitalWrite (b, HIGH);
digitalWrite (f, HIGH);
digitalWrite (g, HIGH);
digitalWrite (dp, LOW);
digitalWrite (a, LOW);
digitalWrite (e, LOW);
digitalWrite (d, LOW);
}
void digital_5 (void) // display the number 5
{
unsigned char j;
for (j = 7; j <= 9; j++)
digitalWrite (j, HIGH);
digitalWrite (c, HIGH);
digitalWrite (d, LOW);
digitalWrite (dp, LOW);
digitalWrite (b, LOW);
digitalWrite (e, HIGH);
}
void digital_6 (void) // display the number 6
{
unsigned char j;
for (j = 7; j <= 11; j++)
digitalWrite (j, HIGH);
digitalWrite (c, HIGH);
digitalWrite (dp, LOW);
digitalWrite (b, LOW);
}
void digital_7 (void) // display the number 7
{
unsigned char j;
for (j = 5; j <= 7; j++)
digitalWrite (j, HIGH);
digitalWrite (dp, LOW);
for (j = 8; j <= 11; j++)
digitalWrite (j, LOW);
}
void digital_8 (void) // display the number 8
{
unsigned char j;
for (j = 5; j <= 11; j++)
digitalWrite (j, HIGH);
digitalWrite (dp, LOW);
}
void setup ()
{
int i ;// define variables
for (i = 4; i <= 11; i++)
pinMode (i, OUTPUT) ;// set 4 to 11 pin to output mode
}
void loop ()
{
while (1)
{
digital_1 () ;// display the number 1
delay (2000) ;// delay 2s
digital_2 () ;// display the number 2
delay (1000); // delay 1s
digital_3 () ;// display the number 3
delay (1000); // delay 1s
digital_4 () ;// display the number 4
delay (1000); // delay 1s
digital_5 () ;// display the number 5
delay (1000); // delay 1s
digital_6 () ;// display the number 6
delay (1000); // delay 1s
digital_7 () ;// display the number 7
delay (1000); // delay 1s
digital_8 () ;// display the number 8
delay (1000); // delay 1s
}
}
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -18
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Four digital tube
Contact us
Schematic
As the 7 Segment LED
the four 7Segment led also composed of light emitting diode
So when we use it.
Also want to connect a current limiting resistor,
Otherwise to burn the light emitting diode.
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 *20 220R
*8
This is an example of how to drive a 7 segment LED display from arduino without the use of
current limiting resistors. This technique is very common but requires some knowledge of
electronics – you do run the risk of dumping too much current through the segments and burning
out parts of the display.
int digit1 = 11; //PWM Display pin 1
int digit2 = 10; //PWM Display pin 2
int digit3 = 9; //PWM Display pin 6
int digit4 = 6; //PWM Display pin 8
int segA = A1; // Display pin 14
int segB = 3; // Display pin 16
int segC = 4; // Display pin 13
int segD = 5; // Display pin 3
int segE = A0; // Display pin 5
int segF = 7; // Display pin 11
int segG = 8; // Display pin 15
void setup() {
pinMode(segA, OUTPUT);
pinMode(segB, OUTPUT);
pinMode(segC, OUTPUT);
pinMode(segD, OUTPUT);
pinMode(segE, OUTPUT);
pinMode(segF, OUTPUT);
pinMode(segG, OUTPUT);
pinMode(digit1, OUTPUT);
pinMode(digit2, OUTPUT);
pinMode(digit3, OUTPUT);
pinMode(digit4, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
// long startTime = millis();
displayNumber(millis()/1000);
// while( (millis() - startTime) < 2000) {
// displayNumber(1217);
// }
// delay(1000);
}
// Given a number, we display 10:22
// After running through the 4 numbers, the display
is left turned off
// Display brightness
// Each digit is on for a certain amount of microseconds
// Then it is off until we have reached a total of 20ms for the
function call
// Let's assume each digit is on for 1000us
// If each digit is on for 1ms, there are 4 digits, so the display
is off for 16ms.
// That's a ratio of 1ms to 16ms or 6.25% on time (PWM).
// Let's define a variable called brightness that varies from:
// 5000 blindingly bright (15.7mA current draw per digit)
// 2000 shockingly bright (11.4mA current draw per digit)
// 1000 pretty bright (5.9mA)
// 500 normal (3mA)
// 200 dim but readable (1.4mA)
// 50 dim but readable (0.56mA)
// 5 dim but readable (0.31mA)
// 1 dim but readable in dark (0.28mA)
void displayNumber(int toDisplay) {
#define DISPLAY_BRIGHTNESS 500
#define DIGIT_ON LOW
#define DIGIT_OFF HIGH
long beginTime = millis();
for(int digit = 4 ; digit > 0 ; digit--) {
// Turn on a digit for a short amount of time
switch(digit) {
case 1:
digitalWrite(digit1, DIGIT_ON);
break;
case 2:
digitalWrite(digit2, DIGIT_ON);
break;
case 3:
digitalWrite(digit3, DIGIT_ON);
break;
case 4:
digitalWrite(digit4, DIGIT_ON);
break;
}
// Turn on the right segments for this digit
lightNumber(toDisplay % 10);
toDisplay /= 10;
// Display this digit for a fraction of a second
(between 1us and 5000us, 500 is pretty good)
delayMicroseconds(DISPLAY_BRIGHTNESS);
// Turn off all segments
lightNumber(10);
// Turn off all digits
digitalWrite(digit1, DIGIT_OFF);
digitalWrite(digit2, DIGIT_OFF);
digitalWrite(digit3, DIGIT_OFF);
digitalWrite(digit4, DIGIT_OFF);
}
while( (millis() - beginTime) < 10) ;
//Wait for 20ms to pass before
we paint the display again
}
// Given a number, turns on those segments
// If number == 10, then turn off number
void lightNumber(int numberToDisplay) {
#define SEGMENT_ON HIGH
#define SEGMENT_OFF LOW
switch (numberToDisplay){
case 0:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_OFF);
break;
case 1:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
case 2:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_OFF);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_ON);
break;
case 3:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_ON);
break;
case 4:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 5:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 6:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 7:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
case 8:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 9:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 10:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_OFF);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
}
}
Page 21
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
SEG1 SEG2 SEG3
A F B
E D DP C G SEG4
1 2 3 4 5 6
12 7
8
9
10
11
ARDUINO HOLDER
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Analog
SEG1 SEG2 SEG3
A F B
E D DP C G SEG4
1 2 3 4 5 6
12 7
8
9
10
11
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -19
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
8*8 dot matrix
Contact us
Schematic
The FrequencyTimer2 library steals the hardware timer2 from the PWMs on pin 11 and 3
(on a atmega328) and reprograms it to generate a frequency of your choosing. It can toggle
pin11 if you wish or call a function you supply each cycle.
DOWNLOAD FrequencyTimer2 Library:
http://www.pjrc.com/teensy/td_libs_FrequencyTimer2.html
/*
* Show messages on an 8x8 led matrix,
#include <FrequencyTimer2.h>
#define SPACE { 
{0, 0, 0, 0, 0, 0, 0, 0}, 
{0, 0, 0, 0, 0, 0, 0, 0}, 
{0, 0, 0, 0, 0, 0, 0, 0}, 
{0, 0, 0, 0, 0, 0, 0, 0}, 
{0, 0, 0, 0, 0, 0, 0, 0}, 
{0, 0, 0, 0, 0, 0, 0, 0}, 
{0, 0, 0, 0, 0, 0, 0, 0}, 
{0, 0, 0, 0, 0, 0, 0, 0} 
}
#define H { 
{0, 1, 0, 0, 0, 0, 1, 0}, 
{0, 1, 0, 0, 0, 0, 1, 0}, 
{0, 1, 0, 0, 0, 0, 1, 0}, 
{0, 1, 1, 1, 1, 1, 1, 0}, 
{0, 1, 0, 0, 0, 0, 1, 0}, 
{0, 1, 0, 0, 0, 0, 1, 0}, 
{0, 1, 0, 0, 0, 0, 1, 0}, 
{0, 1, 0, 0, 0, 0, 1, 0} 
}
#define E { 
{0, 1, 1, 1, 1, 1, 1, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 1, 1, 1, 1, 1, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 1, 1, 1, 1, 1, 0} 
}
#define L { 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 0, 0, 0, 0, 0, 0}, 
{0, 1, 1, 1, 1, 1, 1, 0} 
}
#define O { 
{0, 0, 0, 1, 1, 0, 0, 0}, 
{0, 0, 1, 0, 0, 1, 0, 0}, 
{0, 1, 0, 0, 0, 0, 1, 0}, 
{0, 1, 0, 0, 0, 0, 1, 0}, 
{0, 1, 0, 0, 0, 0, 1, 0}, 
{0, 1, 0, 0, 0, 0, 1, 0}, 
{0, 0, 1, 0, 0, 1, 0, 0}, 
{0, 0, 0, 1, 1, 0, 0, 0} 
}
byte col = 0;
byte leds[8][8];
// pin[xx] on led matrix connected to nn
on Arduino
(-1 is dummy to make array start at pos 1)
int pins[17]= {-1, 5, 4, 3, 2, 14, 15, 16, 17,
13, 12, 11, 10, 9, 8, 7, 6};
// col[xx] of leds = pin yy on led matrix
int cols[8] = {pins[13], pins[3], pins[4],
pins[10], pins[06],
pins[11], pins[15], pins[16]};
// row[xx] of leds = pin yy on led matrix
int rows[8] = {pins[9], pins[14], pins[8],
pins[12], pins[1],
pins[7], pins[2], pins[5]};
const int numPatterns = 6;
byte patterns[numPatterns][8][8] = {
H,E,L,L,O,SPACE
};
int pattern = 0;
// Turn off toggling of pin 11
FrequencyTimer2::disable();
// Set refresh rate (interrupt timeout period)
FrequencyTimer2::setPeriod(2000);
// Set interrupt routine to be called
FrequencyTimer2::setOnOverflow(display);
setPattern(pattern);
}
void loop() {
pattern = ++pattern % numPatterns;
slidePattern(pattern, 60);
}
void clearLeds() {
// Clear display array
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
leds[i][j] = 0;
}
}
}
void setPattern(int pattern) {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
leds[i][j] = patterns[pattern][i][j];
}
}
}
void slidePattern(int pattern, int del) {
for (int l = 0; l < 8; l++) {
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 8; j++) {
leds[j][i] = leds[j][i+1];
}
}
for (int j = 0; j < 8; j++) {
leds[j][7] = patterns[pattern][j][0 + l];
}
delay(del);
}
}
// Interrupt routine
void display() {
digitalWrite(cols[col], LOW);
// Turn whole previous
column off
col++;
if (col == 8) {
col = 0;
}
for (int row = 0; row < 8; row++) {
if (leds[col][7 - row] == 1) {
digitalWrite(rows[row], LOW);
// Turn on this led
}
else {
digitalWrite(rows[row], HIGH);
// Turn off this led
}
}
digitalWrite(cols[col], HIGH); //
Turn whole column
on at once (for equal lighting times)
}
The project can be very useful displays. To control a matrix, you connect both its rows and columns
to your microcontroller. The columns are connected to the LEDs cathodes (see Figure 1), so a
column needs to be high for any of the LEDs in that column to turn on. The rows are connected
to the LEDs anodes, so the row needs to be low for an individual LED to turn on. If the row and
the column are both high or both low, no voltage flows through the LED and it doesn’t turn on.
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 *20 220R
*8
Page 22
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
ARDUINO HOLDER
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
nd
G
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Analog
1 8
9
16
Ke es
y
-
+
-
+
-
+
-
+ *1
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
void setup() {
// sets the pins as output
for (int i = 1; i <= 16; i++) {
pinMode(pins[i], OUTPUT);
}
// set up cols and rows
for (int i = 1; i <= 8; i++) {
digitalWrite(cols[i - 1], LOW);
}
for (int i = 1; i <= 8; i++) {
digitalWrite(rows[i - 1], LOW);
}
clearLeds();
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -20
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Servo motor
Contact us
Schematic
Arduino Code
// Controlling a servo position using a potentiometer
(variable resistor)
****************************************************************
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int potpin = A2; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
void setup()
{
myservo.attach(9); //
attaches the servo on pin 9 to the servo object
}
void loop()
{
val = analogRead(potpin); //
reads the value of the potentiometer
(value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); //
scale it to use it with the servo (value between 0 and 180)
myservo.write(val); //
sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 *5 *1
Servo motors have three wires: power, ground, and signal. The power wire is typically red,
and should be connected to the 5V pin on the Arduino board. The ground wire is typically black
or brown and should be connected to a ground pin on the Arduino board. The signal pin is
typically yellow or orange and should be connected to pin 9 on the Arduino board.
A servomotor is a rotary actuator that allows for precise control of angular position,velocity and
acceleration.[1] It consists of a suitable motor coupled to a sensor for position feedback. It also
requires a relatively sophisticated controller, often a dedicated module designed specifically for
use with servomotors. Servomotors are not a different class of motor, on the basis of fundamental
operating principle, but uses servomechanism to achieve closed loop control
with a generic open loop motor.Servomotors are used in applications such as robotics, CNC
machinery orautomated manufacturing.
Page 23
KEYES
Yellow
Out
Red
+5v
Brown
Gnd
Sevro
Vcc
Out
Gnd
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
ARDUINO HOLDER
bread board
K y s
e e
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
e
Ar
f
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -21
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
IR Remote
Contact us
Schematic
IR detectors are little microchips with a photocell that are tuned to listen to infrared light. They are
almost always used for remote control detection - every TV and DVD player has one of these in the
front to listen for the IR signal from the clicker. Inside the remote control is a matching IR LED,
which emits IR pulses to tell the TV to turn on, off or change channels. IR light is not visible to the
human eye, which means it takes a little more work to test a setup.
The common NEC protocol is complicated by its "repeat code". If you hold down a button, the
remote transmits the code once followed by multiple transmissions of special repeat code.
The universal remote records the code, not the repeat code. On playback, it transmits the code
once, followed by the repeat code.
The RC5 and RC6 protocols handle repeated transmissions differently. They use two separate
codes for each function, differing in a "toggle bit". The first time you hold down a button, the firs
t code is transmitted repeatedly. The next time you hold down a button, the second code is
transmitted repeatedly. Subsequent presses continue to alternate. The universal remote code
flips the toggle bit each time it transmits.
/*
* IRremote: IRrecvDemo - demonstrates receiving IR
codes with Irrecv
* An IR detector/demodulator must be connected to
the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*********************************************************
#include <IRremote.h>
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 *3 *1
The IRremote library for the Arduino:https://github.com/shirriff/Arduino-IRremote
The IRremote library for the Arduino:https://github.com/shirriff/Arduino-IRremote
Page 24
KEYES
Out
Gnd
Vcc
Vcc Vout
Gnd
1838
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
ARDUINO HOLDER
bread board
Keyes
-
+
-
+
-
+
-
+
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
d
Gn
Aref
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
ey
K es
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -22
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
1602 LCD screen
The LCDs have a parallel interface, meaning that the microcontroller has to
manipulate several interface pins at once to control the display.
The LiquidCrystal library allows you to control LCD displays that are compatible
with the Hitachi HD44780 driver. There are many of them out there, and you can
usually tell them by the 16-pin interface.
Contact us
Schematic
Code
/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 *15 *1
Before wiring the LCD screen to your Arduino we suggest to solder a pin header strip to the
14 (or 16) pin count connector of the LCD screen, as you can see in the image above.
To wire your LCD screen to your Arduino, connect the following pins:
LCD RS pin to digital pin 12
LCD Enable pin to digital pin 11
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2
Additionally, wire a 10K pot to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3).
Page 25
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
Vss
Vcc
Vo
Rs
R/w
E
Db0
Db1
Db2
Db3
Db4
Db5
Db6
Db7
LED+
LED-
Lcd
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
ARDUINO HOLDER
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
A
ef
r
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Analog
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -23
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Stepper motor drive
Contact us
Schematic
This is a 5v 28YBJ-48 Stepper Motor with Gear Reduction, so it has good torque for its size, but relatively slow motion.
These motors/drivers are made by the millions for A/C units, fans, duct controls etc.
4 Phase 5 Wire Connection
•Current : 160 mA per winding (320 mA in 4-step mode) Measured: 250mA stopped, 200 mA running fast
•Resistance : 31 Ω per coil winding (from Red wire to any coil)
•Voltage : 5V DC
•Step Angle (Internal Motor alone): 5.625° (64 steps per revolution) NOTE: this is with the Half-Step (8-step) sequence.
So the internal motor has 32 steps per revolution in 4-step mode (Arduino Library)
•Step angle: 5.625 x 1/64 at Output Shaft
•Step angle: 11.25 x 1/32 at Output Shaft
•Gear Reduction ratio: 1 / 64
•SO: it takes 2048 steps per output shaft revolution.. In 4-step sequence.
•No-Load Pull-Out Frequency : 800pps
•No-Load Pull-In Frequency : 500pps
•Pull-In Torque : ≥ 78.4mN.m
•Wiring Instruction : A (Blue), B (Pink), C (Yellow), D (Orange), E (Red, Mid-Point)
If your motor vibrates but does not turn, it is probably connected with the wrong sequence.
The Arduino pin connections need to have 4 pins connected to Motor Driver In1, In2, In3, In4 and
then the pins entered in the software in the sequence 1-3-2-4 for proper sequencing. Also,
The + and - pins near "5-12V" need to be connected: - to Arduino Ground, + to Arduino +5
(for one motor test only) or (best) to a separate +5V 1A power supply.
/*-----( Import needed libraries )-----*/
#include <Stepper.h>
/*-----( Declare Constants, Pin Numbers )-----*/
//---( Number of steps per revolution of INTERNAL motor in 4-step mode )---
#define STEPS_PER_MOTOR_REVOLUTION 32
//---( Steps per OUTPUT SHAFT of gear reduction )---
#define STEPS_PER_OUTPUT_REVOLUTION 32 * 64 //2048
/*-----( Declare objects )-----*/
// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
//The pin connections need to be 4 pins connected
// to Motor Driver In1, In2, In3, In4 and then the pins entered
// here in the sequence 1-3-2-4 for proper sequencing
Stepper small_stepper(STEPS_PER_MOTOR_REVOLUTION, 8, 10, 9, 11);
/*-----( Declare Variables )-----*/
int Steps2Take;
void setup() /*----( SETUP: RUNS ONCE )----*/
{
// Nothing (Stepper Library sets pins as outputs)
}/*--(end setup )---*/
void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
small_stepper.setSpeed(1); // SLOWLY Show the 4 step sequence
Steps2Take = 4; // Rotate CW
small_stepper.step(Steps2Take);
delay(2000);
Steps2Take = STEPS_PER_OUTPUT_REVOLUTION / 2;
// Rotate CW ½ turn
small_stepper.setSpeed(100);
small_stepper.step(Steps2Take);
delay(1000);
Steps2Take = - STEPS_PER_OUTPUT_REVOLUTION / 2;
// Rotate CCW 1/2 turn
small_stepper.setSpeed(700); // 700 a good max speed??
Small_stepper.step(Steps2Take);
delay(2000);
}
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 *15 *1
Uln2003an
Page 26
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
Uln2003an
Connect to
Stepper
Motor
Uln2003an
Connect to
Stepper
Motor
ARDUINO HOLDER
Funduino UNO
Digital
0
1
2
3
4
5
6
7
8
9
10
11
12
13
Gnd
ef
Ar
A0 A1 A2 A3 A4 A5
VIN
GND
GND
5V
3.3V
RESET
Analog
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -24
Project -24
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Relay
Contact us
Schematic
Why use a relay with an Arduino board?
Individual applications will vary, but in short – a relay allows our relatively low voltage Arduino to
easily control higher power circuits. A relay accomplishes this by using the 5V outputted from an
Arduino pin to energize an electromagnet which in turn closes an internal, physical switch
attached to the aforementioned higher power circuit. You can actually hear the switch *click*
closed on even small relays – just like the big ones on street corners used for traffic signals.
OUT
VCC
GND
Sdr-
05vdc
Songle
Relay
Funduino UNO
//Arduino Sample Code
int Relay = 3;
void setup()
{
pinMode(13, OUTPUT);
//Set Pin13 as output
digitalWrite(13, HIGH);
//Set Pin13 High
pinMode(Relay, OUTPUT);
//Set Pin3 as output
}
void loop()
{
digitalWrite(Relay, HIGH);
//Turn off relay
delay(2000);
digitalWrite(Relay, LOW);
//Turn on relay
delay(2000);
}
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 *10 *1
OUT VCC GND
Sdr-
05vdc
Songle
Relay
Relay modules. It can be used in interactive projects.
This relay shield uses SONGLE high-quality relay.
It can also be used to control the lighting, electrical and other equipments.
Be careful when you connect it to 220V or 110V!!!
Relay modules. It can be used in interactive projects.
This relay shield uses SONGLE high-quality relay.
It can also be used to control the lighting, electrical and other equipments.
Be careful when you connect it to 220V or 110V!!!
Page 27
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
OUT VCC GND
Sdr-
05vdc
Songle
Relay
ey
K es
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -25
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection Code
Temp & humidity
Contact us
Schematic
This is a multifunctional sensor that gives you temperature and relative humidity
information at the same time. It utilizes a DHT11 sensor that can meet
measurement needs of general purposes. It provides reliable readings when
environment humidity condition inbetween 20% RH and 90% RH, and
temperature condition inbetween 0°C and 50°C, covering needs in most
home and daily applications that don't contain extreme conditions。
#define DHT11_PIN 0 // ADC0
byte read_dht11_dat()
{
byte i = 0;
byte result=0;
for(i=0; i< 8; i++)
{
while(!(PINC & _BV(DHT11_PIN))); // wait for 50us
delayMicroseconds(30);
if(PINC & _BV(DHT11_PIN))
result |=(1<<(7-i));
while((PINC & _BV(DHT11_PIN))); // wait '1' finish
}
return result;
}
void setup()
{
DDRC |= _BV(DHT11_PIN);
PORTC |= _BV(DHT11_PIN);
Serial.begin(9600);
Serial.println("Ready");
}
void loop()
{
byte dht11_dat[5];
byte dht11_in;
byte i;// start condition
// 1. pull-down i/o pin from 18ms
PORTC &= ~_BV(DHT11_PIN);
delay(18);
PORTC |= _BV(DHT11_PIN);
delayMicroseconds(40);
DDRC &= ~_BV(DHT11_PIN);
delayMicroseconds(40);
dht11_in = PINC & _BV(DHT11_PIN);
if(dht11_in)
{
Serial.println("dht11 start condition 1 not met");
return;
}
delayMicroseconds(80);
dht11_in = PINC & _BV(DHT11_PIN);
if(!dht11_in)
{
Serial.println("dht11 start condition 2 not met");
return;
}
delayMicroseconds(80);// now ready for data reception
for (i=0; i<5; i++)
dht11_dat[i] = read_dht11_dat();
DDRC |= _BV(DHT11_PIN);
PORTC |= _BV(DHT11_PIN);
byte dht11_check_sum = dht11_dat[0]+dht11_dat[1]+dht11_dat[2]+dht11_dat[3];
// check check_sum
if(dht11_dat[4]!= dht11_check_sum)
{
Serial.println("DHT11 checksum error");
}
Serial.print("Current humdity = ");
Serial.print(dht11_dat[0], DEC);
Serial.print(".");
Serial.print(dht11_dat[1], DEC);
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(dht11_dat[2], DEC);
Serial.print(".");
Serial.print(dht11_dat[3], DEC);
Serial.println("C ");
delay(2000);
}
DHT11 sensors features extremely accurate calibration of humidity calibration chamber.
The calibration coefficients stored in the OTP program memory, internal sensors detect
signals in the process, we should call these calibration coefficients. The single-wire serial
interface system is integrated to become quick and easy. Small size, low power, signal
transmission distance up to 20 meters, making it a variety of applications and even the
most demanding applications.
Keyes
Gnd
Out
Vcc
Keyes
Gnd
Out
Vcc
Funduino UNO
Funduino UNO
*1 *1
ARDUINO HOLDER
bread board
*1 *1 *1 *3
Page 28
KEYES
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
Keyes
Gnd
Out
Vcc
ey
K es
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Project -26
ABOUT THE PROJECT ITEM PHOTO
PARTS
Connection
Code
Clock
Contact us
Schematic
Download arduino library :Https://github.com/msparks/arduino-ds1302
In this project we will explain how to add a RTC – Real Time Clock to Arduino project. RTC are good to work with time,
you can for example schedule an event to happen at a specific time, turn on a light at 6PM, turn it off at 5AM.
We use a DS1302 Module, the DS1302 it´s low power RTC IC with a complete set of option to work with time and date.
The DS1302 trickle-charge timekeeping chip contains a real-time clock/calendar and 31 bytes of static RAM.
It communicates with a microprocessor via a simple serial interface. The real-time clock/calendar provides seconds,
minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months
with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format
with an AM/PM indicator.
Funduino UNO
*1 *1
ARD UIN O HOL DER
bread board
*1 *1 *1 *5
Ds
1302
Cr2 032
+
+
Example sketch for interfacing with the DS1302 timekeeping chip.
*/
#include <stdio.h>
#include <string.h>
#include <DS1302.h>
/* Set the appropriate digital I/O pin connections */
uint8_t CE_PIN = 5; //Pin RST
uint8_t IO_PIN = 6; //Pin DAT
uint8_t SCLK_PIN = 7; //Pin CLK
/* Create buffers */
char buf[50];
char day[50];
/* Create a DS1302 object */
DS1302 rtc(CE_PIN, IO_PIN, SCLK_PIN);
void print_time()
{
/* Get the current time and date from the chip */
Time t = rtc.time();
/* Name the day of the week */
memset(day, 0, sizeof(day)); /* clear day buffer */
switch (t.day) {
case 1:
strcpy(day, "Sunday");
break;
case 2:
strcpy(day, "Monday");
break;
case 3:
strcpy(day, "Tuesday");
break;
case 4:
strcpy(day, "Wednesday");
break;
case 5:
strcpy(day, "Thursday");
break;
case 6:
strcpy(day, "Friday");
break;
case 7:
strcpy(day, "Saturday");
break;
}
/* Format the time and date and insert into the temporary buffer */
snprintf(buf, sizeof(buf), "%s %02d/%02d/%04d %02d:%02d:%02d",
day,
t.date, t.mon, t.yr,
t.hr, t.min, t.sec);
/* Print the formatted string to serial so we can see the time */
Serial.println(buf);
}
void setup()
{
Serial.begin(9600);
/* Initialize a new chip by turning off write protection and clearing the
clock halt flag. These methods needn't always be called.
See the DS1302
datasheet for details. */
//rtc.write_protect(false);
//rtc.halt(false);
/* Make a new time object to set the date and time */
/* Tuesday, May 19, 2009 at 21:16:37. */
//Time t(2013, 7, 29, 23, 14, 00, 2);
/* Set the time and date on the chip */
//rtc.time(t);
}
/* Loop and print the time every second */
void loop()
{
print_time();
delay(1000);
}
Ds
1302
Cr2032
+
+
Vcc
Gnd
Clk
Dat
Rst
Funduino UNO
During reading, the clock could rollover. That would result in bad clock data. To prevent that, the DS1302 has a buffer
to store the clock data. That buffer can be read in a single communication session, called a "burst" mode.
Any valid program should therefor use that "burst" mode to read the clock data.
The Year data of the DS1302 is only two digits (0-99). The Year '0' is 2000, and not 1970 or 1980. It has a Leap-Year
compensation from 2000 up to 2099 (for a value of 0-99).
Make a new time object to set the date and time: Tuesday, May 19, 2009 at 21:16:37. Time t(2013, 7, 29, 23, 14, 00, 2);
Page 29
KEYES
1
2
3
4
5
6
7
8 DAT
CLK
IO
CE
V
X1
X2
GND
RST
AREF
IO REF
N/C
A0
A1
A2
A3
A4
A5
ARDUINO
3.3V 5V VIN
D13
D12
D11
D10
D9
D8
D7
D6
D5
D4
D3
D2
D1
D0
SCL
SDA
GND
Keyes
-
+
-
+
-
+
-
+
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
*Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno.
Note
*************************************************
Download arduino pdf book and demo code:
https://app.box.com/s/8jycq6yf7g4liqp2wij2
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Not working?you can contact us by email or skybe
our email is szkeyes@126.com
our skybe is zuokejian
Any questions please feel free to contact us.
Trademark statement:
Disclaimer:
Trademarks are registered trademarks of Keyes,
Keyes owned trademarks, without written authorization
from Keyes, shall not in any way or reason to use, copy,
modify, copy propagation, or with other products bundled
sales of any part of the trademark, the trademark on the
illegal use of our behavior, our shall be liable for the acts
and enterprises according to law..
The company all series products, the company has the
right at any time to the corresponding technical information
or documents are updated to the user, the mentioned
products without prior notice. Without the written consent
of the company or the authorized, not unauthorized use,
reproduction, a partial or all of the content version product
description.
The user shall bear the risks in the company's products use
the process. The company produced by the use of this
product for direct, indirect or collateral damage (including
the personal safety of profit loss, loss of credibility and so
on), do not bear any responsibility.
KEYES

Más contenido relacionado

La actualidad más candente

IOT Projects Using Arduino
IOT Projects Using ArduinoIOT Projects Using Arduino
IOT Projects Using ArduinoPhdtopiccom
 
Arduino IOT Projects
Arduino IOT ProjectsArduino IOT Projects
Arduino IOT ProjectsPhdtopiccom
 
IoT Based home automation system using Arduino board
IoT Based home automation system using Arduino boardIoT Based home automation system using Arduino board
IoT Based home automation system using Arduino boardIRJET Journal
 
MIT App Inventor + Arduino + Bluetooth
MIT App Inventor + Arduino + BluetoothMIT App Inventor + Arduino + Bluetooth
MIT App Inventor + Arduino + Bluetoothmike parks
 
Industrial Applications of Arduino using Ladder Logic
Industrial Applications of Arduino using Ladder LogicIndustrial Applications of Arduino using Ladder Logic
Industrial Applications of Arduino using Ladder LogicRobocraze
 
Arduino Based Home Automation (2003) (1003018)
Arduino Based Home Automation (2003) (1003018)Arduino Based Home Automation (2003) (1003018)
Arduino Based Home Automation (2003) (1003018)Rappy Saha
 
IoT BASED SMART HOME USING ARDUINO
IoT BASED SMART HOME USING ARDUINOIoT BASED SMART HOME USING ARDUINO
IoT BASED SMART HOME USING ARDUINOAYSHA S KABEER
 
Arduino in TinyML with Edge Impulse
Arduino in TinyML with Edge ImpulseArduino in TinyML with Edge Impulse
Arduino in TinyML with Edge ImpulseRobocraze
 
Embedded system introduction - Arduino Course
Embedded system introduction - Arduino CourseEmbedded system introduction - Arduino Course
Embedded system introduction - Arduino CourseElaf A.Saeed
 
Arduino based Home Automation System with Android
Arduino based Home Automation System with AndroidArduino based Home Automation System with Android
Arduino based Home Automation System with AndroidSayan Seth
 
Home automation using IoT and AWS Cloud technology
Home automation using IoT and AWS Cloud technologyHome automation using IoT and AWS Cloud technology
Home automation using IoT and AWS Cloud technologyratthaslip ranokphanuwat
 
Airlive smart home iot products and solutions - info tech middle east
Airlive smart home iot products and solutions  -  info tech middle eastAirlive smart home iot products and solutions  -  info tech middle east
Airlive smart home iot products and solutions - info tech middle eastAli Shoaee
 
Arduino TinyML & IoT
Arduino TinyML & IoTArduino TinyML & IoT
Arduino TinyML & IoTRobocraze
 
IoTino - Arduino for Internet of Things
IoTino - Arduino for Internet of ThingsIoTino - Arduino for Internet of Things
IoTino - Arduino for Internet of ThingsAbiro AB
 
Auto Room Lighting System
Auto Room Lighting SystemAuto Room Lighting System
Auto Room Lighting SystemBUBT
 

La actualidad más candente (20)

IOT Uisng Arduino
IOT Uisng ArduinoIOT Uisng Arduino
IOT Uisng Arduino
 
IOT Projects Using Arduino
IOT Projects Using ArduinoIOT Projects Using Arduino
IOT Projects Using Arduino
 
Arduino IOT Projects
Arduino IOT ProjectsArduino IOT Projects
Arduino IOT Projects
 
IoT Based home automation system using Arduino board
IoT Based home automation system using Arduino boardIoT Based home automation system using Arduino board
IoT Based home automation system using Arduino board
 
MIT App Inventor + Arduino + Bluetooth
MIT App Inventor + Arduino + BluetoothMIT App Inventor + Arduino + Bluetooth
MIT App Inventor + Arduino + Bluetooth
 
Industrial Applications of Arduino using Ladder Logic
Industrial Applications of Arduino using Ladder LogicIndustrial Applications of Arduino using Ladder Logic
Industrial Applications of Arduino using Ladder Logic
 
Opencv Projects
Opencv ProjectsOpencv Projects
Opencv Projects
 
Arduino Based Home Automation (2003) (1003018)
Arduino Based Home Automation (2003) (1003018)Arduino Based Home Automation (2003) (1003018)
Arduino Based Home Automation (2003) (1003018)
 
IoT BASED SMART HOME USING ARDUINO
IoT BASED SMART HOME USING ARDUINOIoT BASED SMART HOME USING ARDUINO
IoT BASED SMART HOME USING ARDUINO
 
Arduino in TinyML with Edge Impulse
Arduino in TinyML with Edge ImpulseArduino in TinyML with Edge Impulse
Arduino in TinyML with Edge Impulse
 
Embedded system introduction - Arduino Course
Embedded system introduction - Arduino CourseEmbedded system introduction - Arduino Course
Embedded system introduction - Arduino Course
 
Arduino based Home Automation System with Android
Arduino based Home Automation System with AndroidArduino based Home Automation System with Android
Arduino based Home Automation System with Android
 
Stage 0 seminar
Stage 0 seminarStage 0 seminar
Stage 0 seminar
 
Home automation using IoT and AWS Cloud technology
Home automation using IoT and AWS Cloud technologyHome automation using IoT and AWS Cloud technology
Home automation using IoT and AWS Cloud technology
 
Home automation with arduino
Home automation with arduinoHome automation with arduino
Home automation with arduino
 
Airlive smart home iot products and solutions - info tech middle east
Airlive smart home iot products and solutions  -  info tech middle eastAirlive smart home iot products and solutions  -  info tech middle east
Airlive smart home iot products and solutions - info tech middle east
 
Arduino TinyML & IoT
Arduino TinyML & IoTArduino TinyML & IoT
Arduino TinyML & IoT
 
IoTino - Arduino for Internet of Things
IoTino - Arduino for Internet of ThingsIoTino - Arduino for Internet of Things
IoTino - Arduino for Internet of Things
 
Auto Room Lighting System
Auto Room Lighting SystemAuto Room Lighting System
Auto Room Lighting System
 
green house monitoring system
green house monitoring systemgreen house monitoring system
green house monitoring system
 

Similar a Arduino: Arduino starter kit

Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docxAjay578679
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixelssdcharle
 
introduction of arduino and node mcu
introduction of arduino and node mcuintroduction of arduino and node mcu
introduction of arduino and node mcu6305HASANBASARI
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'tsyogesh46
 
Digital home automation with arduino bluetooth
Digital home automation with arduino bluetoothDigital home automation with arduino bluetooth
Digital home automation with arduino bluetoothShishupal03012015
 
NSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoNSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoBrian Huang
 
Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10stemplar
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino unoRahat Sood
 
Introduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).pptIntroduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).pptansariparveen06
 
Interface stepper motor through Arduino using LABVIEW.
Interface stepper motor through Arduino using LABVIEW.Interface stepper motor through Arduino using LABVIEW.
Interface stepper motor through Arduino using LABVIEW.Ankita Tiwari
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfssusere5db05
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5Syed Mustafa
 
IoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorsIoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorssaritasapkal
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينوsalih mahmod
 

Similar a Arduino: Arduino starter kit (20)

Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
 
What is arduino
What is arduinoWhat is arduino
What is arduino
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
 
introduction of arduino and node mcu
introduction of arduino and node mcuintroduction of arduino and node mcu
introduction of arduino and node mcu
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
 
ARDUINO Presentation1.pptx
ARDUINO Presentation1.pptxARDUINO Presentation1.pptx
ARDUINO Presentation1.pptx
 
Digital home automation with arduino bluetooth
Digital home automation with arduino bluetoothDigital home automation with arduino bluetooth
Digital home automation with arduino bluetooth
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
NSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoNSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and Arduino
 
Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10
 
Arduino day 2019
Arduino day 2019Arduino day 2019
Arduino day 2019
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
 
Introduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).pptIntroduction to Arduino 16822775 (2).ppt
Introduction to Arduino 16822775 (2).ppt
 
Interface stepper motor through Arduino using LABVIEW.
Interface stepper motor through Arduino using LABVIEW.Interface stepper motor through Arduino using LABVIEW.
Interface stepper motor through Arduino using LABVIEW.
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
 
Arduino course
Arduino courseArduino course
Arduino course
 
IoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorsIoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensors
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
 

Más de SANTIAGO PABLO ALBERTO

Manual de teoría y practica electroneumática avanzada
Manual de teoría y practica electroneumática avanzadaManual de teoría y practica electroneumática avanzada
Manual de teoría y practica electroneumática avanzadaSANTIAGO PABLO ALBERTO
 
Programacion de PLC basado en Rslogix 500 por Roni Domínguez
Programacion de PLC basado en Rslogix 500 por Roni Domínguez Programacion de PLC basado en Rslogix 500 por Roni Domínguez
Programacion de PLC basado en Rslogix 500 por Roni Domínguez SANTIAGO PABLO ALBERTO
 
Programación de microcontroladores PIC en C con Fabio Pereira
Programación de microcontroladores PIC en  C con Fabio PereiraProgramación de microcontroladores PIC en  C con Fabio Pereira
Programación de microcontroladores PIC en C con Fabio PereiraSANTIAGO PABLO ALBERTO
 
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...SANTIAGO PABLO ALBERTO
 
Programación de autómatas PLC OMRON CJ/CP1
Programación de  autómatas PLC OMRON CJ/CP1Programación de  autómatas PLC OMRON CJ/CP1
Programación de autómatas PLC OMRON CJ/CP1SANTIAGO PABLO ALBERTO
 
Manual del sistema del controlador programable S7-200 SMART
Manual del sistema del controlador programable S7-200 SMARTManual del sistema del controlador programable S7-200 SMART
Manual del sistema del controlador programable S7-200 SMARTSANTIAGO PABLO ALBERTO
 
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...SANTIAGO PABLO ALBERTO
 
PLC y Electroneumática: Electricidad y Automatismo eléctrico por Luis Miguel...
PLC y Electroneumática: Electricidad y Automatismo eléctrico por  Luis Miguel...PLC y Electroneumática: Electricidad y Automatismo eléctrico por  Luis Miguel...
PLC y Electroneumática: Electricidad y Automatismo eléctrico por Luis Miguel...SANTIAGO PABLO ALBERTO
 
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...SANTIAGO PABLO ALBERTO
 
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...SANTIAGO PABLO ALBERTO
 
Electrónica digital: Introducción a la Lógica Digital - Teoría, Problemas y ...
Electrónica digital:  Introducción a la Lógica Digital - Teoría, Problemas y ...Electrónica digital:  Introducción a la Lógica Digital - Teoría, Problemas y ...
Electrónica digital: Introducción a la Lógica Digital - Teoría, Problemas y ...SANTIAGO PABLO ALBERTO
 

Más de SANTIAGO PABLO ALBERTO (20)

secuencia electroneumática parte 1
secuencia electroneumática parte 1secuencia electroneumática parte 1
secuencia electroneumática parte 1
 
secuencia electroneumática parte 2
secuencia electroneumática parte 2secuencia electroneumática parte 2
secuencia electroneumática parte 2
 
Manual de teoría y practica electroneumática avanzada
Manual de teoría y practica electroneumática avanzadaManual de teoría y practica electroneumática avanzada
Manual de teoría y practica electroneumática avanzada
 
Programacion de PLC basado en Rslogix 500 por Roni Domínguez
Programacion de PLC basado en Rslogix 500 por Roni Domínguez Programacion de PLC basado en Rslogix 500 por Roni Domínguez
Programacion de PLC basado en Rslogix 500 por Roni Domínguez
 
Programación de microcontroladores PIC en C con Fabio Pereira
Programación de microcontroladores PIC en  C con Fabio PereiraProgramación de microcontroladores PIC en  C con Fabio Pereira
Programación de microcontroladores PIC en C con Fabio Pereira
 
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
Análisis y Diseño de Sistemas de Control Digital por Ricardo Fernandez del Bu...
 
Arduino: Arduino de cero a experto
Arduino: Arduino de cero a expertoArduino: Arduino de cero a experto
Arduino: Arduino de cero a experto
 
Fisica I
Fisica IFisica I
Fisica I
 
Quimica.pdf
Quimica.pdfQuimica.pdf
Quimica.pdf
 
Manual básico PLC OMRON
Manual básico PLC OMRON Manual básico PLC OMRON
Manual básico PLC OMRON
 
Programación de autómatas PLC OMRON CJ/CP1
Programación de  autómatas PLC OMRON CJ/CP1Programación de  autómatas PLC OMRON CJ/CP1
Programación de autómatas PLC OMRON CJ/CP1
 
Manual del sistema del controlador programable S7-200 SMART
Manual del sistema del controlador programable S7-200 SMARTManual del sistema del controlador programable S7-200 SMART
Manual del sistema del controlador programable S7-200 SMART
 
Catálogo de PLC S7-200 SMART
Catálogo de PLC S7-200 SMART Catálogo de PLC S7-200 SMART
Catálogo de PLC S7-200 SMART
 
PLC: Automatismos industriales
PLC: Automatismos industrialesPLC: Automatismos industriales
PLC: Automatismos industriales
 
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
PLC: Buses industriales y de campo practicas de laboratorio por Jose Miguel R...
 
PLC y Electroneumática: Electricidad y Automatismo eléctrico por Luis Miguel...
PLC y Electroneumática: Electricidad y Automatismo eléctrico por  Luis Miguel...PLC y Electroneumática: Electricidad y Automatismo eléctrico por  Luis Miguel...
PLC y Electroneumática: Electricidad y Automatismo eléctrico por Luis Miguel...
 
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...
Electrónica: Diseño y desarrollo de circuitos impresos con Kicad por Miguel P...
 
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...
PLC: Diseño, construcción y control de un motor doble Dahlander(cuatro veloci...
 
PLC: Motor Dahlander
PLC: Motor DahlanderPLC: Motor Dahlander
PLC: Motor Dahlander
 
Electrónica digital: Introducción a la Lógica Digital - Teoría, Problemas y ...
Electrónica digital:  Introducción a la Lógica Digital - Teoría, Problemas y ...Electrónica digital:  Introducción a la Lógica Digital - Teoría, Problemas y ...
Electrónica digital: Introducción a la Lógica Digital - Teoría, Problemas y ...
 

Último

Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsSachinPawar510423
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...Amil Baba Dawood bangali
 
Steel Structures - Building technology.pptx
Steel Structures - Building technology.pptxSteel Structures - Building technology.pptx
Steel Structures - Building technology.pptxNikhil Raut
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsDILIPKUMARMONDAL6
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Industrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptIndustrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptNarmatha D
 

Último (20)

Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Vishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documentsVishratwadi & Ghorpadi Bridge Tender documents
Vishratwadi & Ghorpadi Bridge Tender documents
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
NO1 Certified Black Magic Specialist Expert Amil baba in Uae Dubai Abu Dhabi ...
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Steel Structures - Building technology.pptx
Steel Structures - Building technology.pptxSteel Structures - Building technology.pptx
Steel Structures - Building technology.pptx
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
The SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teamsThe SRE Report 2024 - Great Findings for the teams
The SRE Report 2024 - Great Findings for the teams
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Industrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.pptIndustrial Safety Unit-IV workplace health and safety.ppt
Industrial Safety Unit-IV workplace health and safety.ppt
 

Arduino: Arduino starter kit

  • 1. KEYES What Arduino can do Arduino can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is programmed using the Arduino programming language (based on Wiring) and the Arduino development environment (based on Processing). Arduino projects can be stand-alone or they can communicate with software running on a computer (e.g. Flash, Processing, MaxMSP). OPEN SOURCE Arduino starter kit book
  • 2. About the kit About open source hardware About KEYES Our Words About arduino Here is The Arduino Starter Kit! This kit walks you through the basics of using the Arduino in a hands-on way. You'll learn through building several creative projects. The kit includes a selection of the most common and useful electronic components with a book of 26 projects. Starting the basics of electronics, to more complex projects, the kit will help you control the physical world with sensor and actuators. Open-source hardware consists of physical artifacts of technology designed and offered by the open design movement. Both free and open-source software (FOSS) as well as open-source hardware is created by this open-source culture movement and applies a like concept to avariety of components. The term usually means that information about the hardware is easily discerned. Hardware design (i.e. Mechanical drawings, schematics, bills of material, PCB layout data, HDL source code and integrated circuit layout data), in addition to the software that drives the hardware, are all released with the FOSS approach. Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board. Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino projects can be stand-alone, or they can be communicate with software running on your computer (e.g. Flash, Processing, MaxMSP.) The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free. The Arduino programming language is an implementation of Wiring, a similar physical computing platform, which is based on the Processing multimedia programming environment. KEYES is China early development and production of open source hardware company,There are three major brand products, FUNDUINO controller, KEYES sensor, ROBOTALE robot, We continue to develop new products, The open source world we work together。 KEYES
  • 3. Kit list Item list Project list Funduino UNO *1 *4 ARDUINO HOLDER bread board *1 Funduino UNO ARDU INO HOLD ER bre ad bo ard MCU Holder LED RED 5PCS GREEN 5PCS YELLOW 5PCS Resistance 220R10PCS 1KR 10PCS 10KR 10PCS Jump wire 10mm 20pcs Jump wire 20mm 10pcs Dopont wire Female 20mm 10pcs Usb cable Ds 1302 Cr20 32 + + Keyes Gnd Out Vcc OUT VCC GND Sdr- 05vdc Songle Relay Uln2003an 74hc595n LM 35 Box Breadboard Breadboard 400 hole 830hole Battery box Key switch RGB LED *1 *1 *1 *1 *1 *4 *1 *3 *1 *2 *1 *1 *2 *1 *2 *1 *1 *1 *1 *1 *1 *1 *1 *1 *1 Lm35 Sevro 1602 lcd Tilt Photocell Flame Buzzer Infrared receiver Potentiometer 74hc595 Remote controller 7 segment display 7 segment display Four Clock Tempe and humidity Relay Motor Stepping drive dot matrix *1 *1 Project-01 Hello world Blink T r af f i c Li ght Loop Pwm Button Responder RGB led Buzzer Analog read Photocell control buzzer Photocell control light Tilt Frie Temp 74hc595 7segment display Four-7segment display dot matrix Sevro I R Remot e 1602 LCD Stepper motor Relay Temp & humidity Clock Basic building Four in one Project-02 Project-03 Project-04 Project-05 Project-06 Project-08 Project-07 Project-09 Project-10 Project-11 Project-12 Project-13 Project-14 Project-15 Project-16 Project-17 Project-18 Project-19 Project-20 Project-21 Project-22 Project-23 Project-24 Project-25 Project-26 Page 1 KEYES K es ey - + - + - + - + ey K es - + - + - + - + *1 ARDUINO HOLDER bread board e K yes - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd f Are A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET
  • 4. Language Reference Structure The setup() function is called when a sketch starts.Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the Arduino board. After creating a setup() function, which initializes and sets the initial values, the loop() function does precisely what its name suggests, and loops consecutively, allowing yourprogram to change and respond. Use it to actively control the Arduino board. Control Structures If if, which is used in conjunction with a comparison operator, tests whether a certain condition has been reached, such as an input being above a certain number. The format for an if test is: if (someVariable > 50){// do something here} The program tests to see if someVariable is greater than 50. If it is, the program takes a particular action. Put another way, if the statement in parentheses is true, the statements inside the brackets are run. If not, the program skips over the code. if / else if/else allows greater control over the flow of code than the basic if statement, by allowing multiple tests to be grouped together. For example, an analog input could be tested and one action taken if the input was less than 500, and another action taken if the input was 500 or greater. The code would look like this: if (pinFiveInput < 500) {// action A } else { // action B} else can proceed another if test, so that multiple, mutually exclusive tests can be run at the same time. For The for statement is used to repeat a block of statements enclosed in curly braces. An increment counter is usually used to increment and terminate the loop. The for statement is useful for any repetitive operation, and is often used in combination with arrays to operate on collections of data/pins. Constants Data Types Digital Analog Arduino programs can be divided in three main parts: structure, values (variables and constants), and functions. More of the grammar please to:http://arduino.cc/en/Reference/HomePage Page 2 KEYES HIGH The meaning of HIGH (in reference to a pin) is somewhat different depending on whether a pin is set to an INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report HIGH if a voltage of 3 volts or more is present at the pin. LOW The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report LOW if a voltage of 2 volts or less is present at the pin. INPUT Arduino (Atmega) pins configured as INPUT with pinMode() are said to be in a high-impedance state. Pins configured as INPUT make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED. Int On the Arduino Uno (and other ATMega based boards) an int stores a 16-bit (2-byte) value. This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1). On the Arduino Due, an int stores a 32-bit (4-byte) value. This yields a range of -2,147,483,648 to 2,147,483,647 (minimum value of -2^31 and a maximum value of (2^31) - 1).int's store negative numbers with a technique called 2's complement math. The highest bit, sometimes referred to as the "sign" bit, flags the number as a negative number. The rest of the bits are inverted and 1 is added. Char A data type that takes up 1 byte of memory that stores a character value. Character literals are written in single quotes, like this: 'A' (for multiple characters - strings - use double quotes: "ABC"). Characters are stored as numbers however. You can see the specific encoding in the ASCII chart. This means that it is possible to do arithmetic on characters, in which the ASCII value of the character is used (e.g. 'A' + 1 has the value 66, since the ASCII value of the capital letter A is 65). See Serial.println reference for more on how characters are translated to numbers. Long Long variables are extended size variables for number storage, and store 32 bits (4 bytes), from -2,147,483,648 to 2,147,483,647. If doing math with integers, at least one of the numbers must be followed by an L, forcing it to be a long. See the Integer Constants page for details. Time Millis() Returns the number of milliseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 50 days. Micros() Returns the number of microseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 70 minutes. On 16 MHz Arduino boards (e.g. Duemilanove and Nano), this function has a resolution of four microseconds (i.e. the value returned is always a multiple of four). On 8 MHz Arduino boards (e.g. the LilyPad), this function has a resolution of eight microseconds. Delay() Pauses the program for the amount of time (in miliseconds) specified as parameter. (There are 1000 milliseconds in a second.) PinMode() Configures the specified pin to behave either as an input or an output. See the description of digital pins for details on the functionality of the pins. As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with the mode INPUT_PULLUP. Additionally, the INPUT mode explicitly disables the internal pullups. DigitalWrite() Write a HIGH or a LOW value to a digital pin. If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW. If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function. DigitalRead() Reads the value from a specified digital pin, either HIGH or LOW. AnalogReference(type) Configures the reference voltage used for analog input (i.e. the value used as the top of the input range). The options are: DEFAULT: the default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts (on 3.3V Arduino boards) INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or Atmega328 and 2.56 volts on the ATmega8 (not available on the Arduino Mega) INTERNAL1V1: a built-in 1.1V reference (Arduino Mega only) INTERNAL2V56: a built-in 2.56V reference (Arduino Mega only) EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference. AnalogRead() Reads the value from the specified analog pin. The Arduino board contains a 6 channel (8 channels on the Mini and Nano, 16 on the Mega), 10-bit analog to digital converter. This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit. The input range and resolution can be changed using analogReference(). AnalogWrite() Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to analogWrite(), the pin will generate a steady square wave of the specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite() on the same pin). The frequency of the PWM signal on most pins is approximately 490 Hz. On the Uno and similar boards, pins 5 and 6 have a frequency of approximately 980 Hz. Pins 3 and 11 on the Leonardo also run at 980 Hz. Setup() Loop()
  • 5. Getting Started w/ Arduino on Windows This document explains how to connect your Arduino board to the computer and upload your first sketch. 1. Download the Arduino environment 2. Connect the board 3.Install the drivers 4. Launch the Arduino application 5. Open the blink example 6.Select your board 7. Select your serial port 8. Upload the program Get the latest version from the download page. Http://arduino.cc/en/Main/Software When the download finishes, unzip the downloaded file. Make sure to preserve the folder structure. Double-click the folder to open it. There should be a few files and sub-folders inside. The Arduino Uno automatically draw power from either the USB connection to the computer or an external power supply. Connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on. Plug in your board and wait for Windows to begin it's driver installation process. After a few moments, the process will fail, despite its best efforts Click on the Start Menu, and open up the Control Panel.While in the Control Panel, navigate to System and Security. Next, click on System. Once the System window is up, open the Device Manager.Look under Ports (COM & LPT). You should see an open port named "Arduino UNO (COMxx)" Right click on the "Arduino UNO (COmxx)" port and choose the "Update Driver Software" option.Next, choose the "Browse my computer for Driver software" option. Finally, navigate to and select the driver file named "arduino.inf", located in the "Drivers" folder of the Arduino Software download (not the "FTDI USB Drivers" sub-directory). If you are using an old version of the IDE (1.0.3 or older), choose the Uno's driver file named "Arduino UNO.inf" Windows will finish up the driver installation from there. Double-click the Arduino application. (Note: if the Arduino software loads in the wrong language, you can change it in the preferences dialog. See the environment page for details.) Open the example sketch: File > Examples > 1.Basics > Blink. You'll need to select the entry in the Tools > Board menu that corresponds to your Arduino. Choose board>uno Select the serial device of the Arduino board from the Tools | Serial Port menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your Arduino board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port. Now, simply click the "Upload" button in the environment. Wait a few seconds - you should see the RX and TX leds on the board flashing. If the upload is successful, the message "Done uploading." will appear in the status bar. (Note: If you have an Arduino Mini, NG, or other board, you'll need to physically present the reset button on the board immediately before pressing the upload button.) A few seconds after the upload finishes, you should see the pin 13 (L) LED on the board start to blink (in orange). If it does , congratulations! You've gotten Arduino up-and-running. Page 3 KEYES int led = 13; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
  • 6. Project -01 ABOUT THE PROJECT ITEM PHOTO PARTS Note Connection Code Hello world First, only need a Arduino and a usb cablel, Let Arduino say "Hello World!" , This is a Arduino and PC communication experiment, This is an introductory experiment, Hope can lead you into the world of Arduino. Funduino UNO *1 *1 Baud rate is 9600, here to set same to software. When the access specific equipment (such as: Bluetooth) we have to agreement with other equipment baud rate. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. ARDUINO HOLDER bread board *1 *1 Schematic Contact us Not working? you can contact us by email or skybe, email is szkeyes@126.com our skybe is zuokejian, Any questions please feel free to contact us. RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND KEYES Page 4 ARDUINO HOLDER Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Analog ey K es - + - + - + - + //Arduino code: ************************************************ int val ; //define val int ledpin=13; // define of digi tal interface 13 void setup() { Serial .begin (9600); // set the baud rate is 9600. pinMode (ledpin, OUTPUT); // set 13 for the output port . } void loop() { val=Serial.read();// //read the PC machine send instructionsor //character of Arduino, and the instruction //or character is assigned to val if (val=='R' ) // to judge whether //the instruction or character received is "R". { // if recei ved "R" character digitalWrite (ledpin, HIGH); // digi tal 13 LED on delay (500); digitalWrite (ledpin, LOW); // digi tal 13 LED off delay (500); Serial .println ("HelloWorld!"); // display "Hel lo World!" } } ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2
  • 7. KEYES Project -02 ABOUT THE PROJECT ITEM PHOTO PARTS Code To build the circuit, attach a 220-ohm resistor to pin 13. Then attach the long leg of an LED (the positive leg, called the anode) to the resistor.Attach the short leg (the negative leg, called the cathode) to ground. Then plug your Arduino board into your computer, start the Arduino program,and enter the code below.Most Arduino boards already have an LED attached to pin 13 on the board itself. If you run this example with no hardware attached, you should see that LED blink. Blink /* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 13 has an LED connected on most Arduino boards. // give it a name: *********************************************************************** int led = 13; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 Page 5 KEYES Keyes - + - + - + - + Connection In between the on and the off, you want enough time for a person to seethe change, so the delay () commands tell the Arduino to do nothing for 1000 milliseconds, or one second. When you use the delay() command,nothing else happens for that amount of time. Once you've understood the basic examples, check out the Blink Without Delay example to learn how to create a delay while doing other things. Schematic *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA 220R GND ARDUINO HOLDER bread board eyes K - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Analog Contact us Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2
  • 8. Project -03 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Traffic Light Traffic Light We have completed a single LED control project, Next we have to do a bit more complex traffic project, In fact, smart friends can see that this project is the Extending the single LED project into 3 color light, We can realize our simulation of traffic project. Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *3 *4 The project we simulated traffic lights,Red, yellow, and green lights flashing time of traffic lights need seemed really, We can use the Arduino delay () function to control the delay time. 220R *3 Schematic Contact us GND RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA 220R 220R Page 6 KEYES bread board Keyes - + - + - + - + ARDUINO HOLDER Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Analog ey K es - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. //arduino code : ********************************************************************** int redled =10; // define digital interface 10 int yellowled =7; // define digital interface 7 int greenled =4; // define digital interface 4 void setup () { pinMode (redled, OUTPUT); //define red light for the output pinMode (yellowled, OUTPUT);//define yellow light for output pinMode (greenled, OUTPUT); //define green light for output } void loop () { digitalWrite (redled, HIGH); // red light on delay (1000); // 1 second delay digitalWrite (redled, LOW); // red light off digitalWrite (yellowled, HIGH); // yellow light on delay (200); // 0.2 second delay digitalWrite (yellowled, LOW); // yellow light off digitalWrite (greenled, HIGH); // green light on delay (1000); // 1 second delay digitalWrite (greenled, LOW); // green light off } Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 9. Project -04 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Loop This example makes use of 6 LEDs connected to the pins 2 - 7 on the board using 220 Ohm resistors. The sketch makes the LEDs blink in a sequence, one by one using only digitalWrite(pinNumber,HIGH/LOW) and delay(time). Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *6 *14 This example code /*For Loop Iteration */ ******************************************************************** int timer = 100; // The higher the number, the slower the timing. void setup() { // use a for loop to initialize each pin as an output: for (int thisPin = 2; thisPin < 8; thisPin++) { pinMode(thisPin, OUTPUT); } } void loop() { // loop from the lowest pin to the highest: for (int thisPin = 2; thisPin < 8; thisPin++) { // turn the pin on: digitalWrite(thisPin, HIGH); delay(timer); // turn the pin off: digitalWrite(thisPin, LOW); } // loop from the highest pin to the lowest: for (int thisPin = 7; thisPin >= 2; thisPin--) { // turn the pin on: digitalWrite(thisPin, HIGH); delay(timer); // turn the pin off: digitalWrite(thisPin, LOW); } } Often you want to iterate over a series of pins and do something to each one. For example, this example lights up a series of LEDs attached to pins 2 through 7 of the Arduino. 220R *6 Contact us GND RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA 220R 220R 220R 220R 220R 220R Schematic Page 7 KEYES ARDUINO HOLDER bread board Keyes - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 10. Project -05 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code PWM Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off. This on-off pattern can simulate voltages in between full on (5 Volts) and off (0 Volts) by changing the portion of the time the signal spends on versus the time that the signal spends off. The duration of "on time" is called the pulse width. To get varying analog values, you change, or modulate, that pulse width. If you repeat this on-off pattern fast enough with an LED for example, the result is as if the signal is a steady voltage between 0 and 5v controlling the brightness of the LED. In the graphic below, the green lines represent a regular time period. This duration or periodis the inverse of the PWM frequency. In other words, with Arduino PWM frequency at about500Hz, the green lines would measure 2 milliseconds each. A call to analogWrite () is on a scale of 0 - 255, such that analogWrite(255) requests a 100% duty cycle (always on), and analogWrite(127) is a 50% duty cycle (on half the time) for example. Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 Arduino Code /*The example shows how to fade an LED using the analogWrite * *********************************************************** int ledPin = 9; // LED connected to digital pin 9 void setup() { // nothing happens in setup } void loop() { // fade in from min to max in increments of 5 points: for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { // sets the value (range from 0 to 255): analogWrite(ledPin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(30); } // fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(ledPin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(30); } } 220R *1 Demonstrates the use of analog output (Pulse Width Modulation (PWM)) to fade an LED. PWM is a technique for getting an analog-like behavior from a digital output by switching it off and on very fast. Schematic Contact us RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA 220R GND Project -05 Page 8 KEYES ARDUINO HOLDER bread board Key s e - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 G d n r A ef A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 11. Project -06 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Button Pushbuttons or switches connect two points in a circuit when you press them. This example turns on the built-in LED on pin 13 when you press the button. Connect three wires to the Arduino board. The first two, red and black, connect to the two long vertical rows on the side of the breadboard to provide access to the 5 volt supply and ground. The third wire goes from digital pin 2 to one leg of the pushbutton. That same leg of the button connects through a pull-down resistor (here 10 KOhms) to ground. The other leg of the button connects to the 5 volt supply. When the pushbutton is open (unpressed) there is no connection between the two legs of the pushbutton, so the pin is connected to ground (through the pull-down resistor) and we read a LOW. When the button is closed (pressed), it makes a connection between its two legs, connecting the pin to 5 volts, so that we read a HIGH. Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 220R *1 *6 *1 Arduino Code /* Button*/ // constants won't change. They're used here to // set pin numbers: ********************************************************************** const int buttonPin = 2; // the number of the pushbutton pin const int ledPin = 13; // the number of the LED pin // variables will change: int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } void loop() { // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, HIGH); } else { // turn LED off: digitalWrite(ledPin, LOW); }} You can also wire this circuit the opposite way, with a pullup resistorkeeping the input HIGH, and going LOW when the button is pressed.If so, the behavior of the sketch will be reversed, with the LED normallyon and turning off when you press the button. If you disconnect the digital i/o pin from everything, the LED may blink erratically. This is because the input is "floating" - that is, it will randomly return either HIGH or LOW. That's why you need a pull-up or pull-down resistor in the circuit. Schematic Contact us RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUI NO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND 10K LED Page 9 KEYES ARDUINO HOLDER bread board Keyes - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 12. Project -07 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Responder This project is from the button control the led project but Add 3 buttons and 3 leds, occupy 6 digital I/O interface. The principle same to button control the led. Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *3 220R *3 *15 *3 Once you've got a pushbutton working, you often want to do some action based on how many times the button is pushed. To do this, you need to know when the button changes state from off to on, and count how many times this change of state happens. This is called state change detection or edge detection. Schematic Contact us Page 10 KEYES 220R 220R 220R 10K 10K 10K RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND ARDUINO HOLDER bread board y Ke es - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd f Are A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET ey K es - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. //Ardui no code: ********************************************** int redled=10; int yellowled=9; int greenled=8; int redpin=7; int yellowpin=6; int greenpin=5; int red; int yellow; int green; void setup () { pinMode (redled, OUTPUT); pinMode (yellowled, OUTPUT); pinMode (greenled, OUTPUT); pinMode (redpin, INPUT); pinMode (yellowpin, INPUT); pinMode (greenpin, INPUT); } void loop () { red=digitalRead (redpin); if ( red==LOW) {digitalWrite (redled, LOW); } else {digitalWrite (redled, HIGH); } yellow=digitalRead (yellowpin); if ( yellow==LOW) {digitalWrite (yellowled, LOW); } else {digitalWrite (yellowled, HIGH); } green=digitalRead (greenpin); if ( green==LOW) {digitalWrite (greenled, LOW); } else {digitalWrite (greenled, HIGH); } } Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 13. Project -08 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Rgb led RGB LED has 3 sets of output,Through ARDUINO programming, To achieve R, G, B, a mixture of three colours,Achieve the full-color effect, The RGB led has 3 output: 1 R, red output, 2 G, green output, 3 B, blue output. Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 220R *3 *4 Contact us Schematic In this project, you will need to use 3 Pulse Width Modulation pins, PWM for short. Pins that are not specified as PWM pins are digital pins, which can only turn on and off. PWM pins can go from lets say 3.3 volts to five volts to 1.1 volts. In my program Red = pin 11, Blue = pin 10, and Green = pin 9. Page 11 KEYES ARDUINO HOLDER bread board Keyes - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET 220R RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND ey K es - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. int red = 11; //this sets the red led pin int green = 10; //this sets the green led pin int blue = 9; //this sets the blue led pin int redNow; int blueNow; int greenNow; int redNew; int blueNew; int greenNew; void setup() { //this sets the output pins pinMode(red, OUTPUT); pinMode(green, OUTPUT); pinMode(blue, OUTPUT); redNow = random(255); blueNow = random(255); greenNow = random(255); redNew = redNow; blueNew = blueNow; greenNew = greenNow; } #define fade(x,y) if (x>y) x--; else if (x<y) x++; void loop() { analogWrite(blue, blueNow); analogWrite(red, redNow); analogWrite(green, greenNow); redNew = random(255); blueNew = random(255); greenNew = random(255); // fade to new colors while ((redNow != redNew) || (blueNow != blueNew) || (greenNow != greenNew)) { fade(redNow,redNew) fade(blueNow,blueNew) fade(greenNow,greenNew) analogWrite(blue, blueNow); analogWrite(red, redNow); analogWrite(green, greenNow); delay(20); } } Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 14. Project -09 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Buzzer The calculation of the tones is made following the mathematical operation: timeHigh = period / 2 = 1 / (2 * toneFrequency) where the different tones are described as in the table: note frequency period timeHigh c 261 Hz 3830 1915 d 294 Hz 3400 1700 e 329 Hz 3038 1519 f 349 Hz 2864 1432 g 392 Hz 2550 1275 a 440 Hz 2272 1136 b 493 Hz 2028 1014 C 523 Hz 1912 956 This example uses a piezo speaker to play melodies. It sends a square wave of the appropriate frequency to the piezo, generating the corresponding tone. Piezos have polarity. Commercial devices are usually have a red (positive) and a black (negative). Connect the red wire digital pin 9 and the black wire to ground. Sometimes it is possible to acquire Piezo elements without a plastic housing, then they will just look like a metallic disc. Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 Arduino Code ************************************************************************* int speakerPin = 9; int length = 15; // the number of notes char notes[] = "ccggaagffeeddc "; // a space represents a rest int beats[] = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4 }; int tempo = 300; void playTone(int tone, int duration) { for (long i = 0; i < duration * 1000L; i += tone * 2) { digitalWrite(speakerPin, HIGH); delayMicroseconds(tone); digitalWrite(speakerPin, LOW); delayMicroseconds(tone); } } void playNote(char note, int duration) { char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' }; int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 }; // play the tone corresponding to the note name for (int i = 0; i < 8; i++) { if (names[i] == note) { playTone(tones[i], duration); } } } void setup() { pinMode(speakerPin, OUTPUT); } void loop() { for (int i = 0; i < length; i++) { if (notes[i] == ' ') { delay(beats[i] * tempo); // rest } else { playNote(notes[i], beats[i] * tempo); } // pause between notes delay(tempo / 2); } } *1 Contact us Schematic Page 12 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND ARDUINO HOLDER bread board K yes e - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 15. Project -10 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Analog read This example shows you how to read analog input from the physical world using a potentiometer. A potentiometer is a simple mechanical device that provides a varying amount of resistance when its shaft is turned. By passing voltage through a potentiometer and into an analog input on your Arduino, it is possible to measure the amount of resistance produced by a potentiometer (or pot for short) as an analog value. In this example you will monitor the state of your potentiometer after establishing serial communication between your Arduino and your computer. arduino code: /*AnalogReadSerial Reads an analog input on pin 0, prints the result to the serial monitor. Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground. */ // the setup routine runs once when you press reset: ************************************************************** void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // print out the value you read: Serial.println(sensorValue); delay(1); // delay in between reads for stability } Funduino UNO *1 ARDUINO HOLDER bread board *1 In the program below, the only thing that you do will in the setup function is to begin serial communications, at 9600 bits of data per second, between your Arduino and your computer with the command: Next, in the main loop of your code, you need to establish a variable to store the resistance value (which will be between 0 and 1023, perfectfor an int datatype) coming in from your potentiometer: Finally, you need to print this information to your serial window as adecimal (DEC) value. You can do this with the command Serial.println() in your last line of code: Now, when you open your Serial Monitor in the Arduino development environment (by clicking the button directly to the right of the "Upload" button in the header of the program), you should see a steady stream of numbers ranging from 0-1023, correlating to the position of the pot.As you turn your potentiometer, these numbers will respond almost instantly. Serial.begin(9600); int sensorValue = analogRead(A0); Serial.println(sensorValue, DEC) Contact us Schematic Page 13 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND ARDUINO HOLDER bread board Keyes - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd f Are A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET *1 *1 *1 ey K es - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 16. Project -11 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Photocells control buzzer Photocells are sensors that allow you to detect light. They are small, inexpensive, low-power, easy to use and don't wear out. For that reason they often appear in toys, gadgets and appliances. They are often referred to as CdS cells (they are made of Cadmium-Sulfide), light-dependent resistors (LDR), and photoresistors This project will photosensitive resistor connected to the IO port. There is no light, the normal sound, but the sound is extremely small. If The light is stronger , the resistance is smaller, and the buzzer is louder. Funduino UNO *1 ARDUINO HOLDER bread board *1 *1 *1 *1 *1 A photocell's resistance changes as the face is exposed tomore light. When its dark, the sensor looks like an large resistor up to 10MΩ, as the light level increases, the resistance goes down. This graph indicates approximately the resistance of the sensor at different light levels.Remember each photocell will be a little different so use this as a guide only! Contact us Schematic Page 14 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. //Ardui no code: ************************************************ void setup () { pinMode (6, OUTPUT); } void loop () { while (1) { char i, j; while (1) { for (i =0; i<80; i++ )// a frequency voice { digitalWrite (6, HIGH); delay (1); digitalWrite (6, LOW); delay (1); } for (i =0; i<100; i++) // another frequency voice { digitalWrite (6, HIGH); delay (2); digitalWrite (6, LOW); delay (2); }}}} Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 ARDUINO HOLDER bread board y Ke es - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 n G d Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 17. Project -12 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Light control led This project we conducted a relatively simple experiment using a Photocells. the Value with changes in the intensity of the incident light. Light intensity, the Photocells decreases, Weak incident light, the Photocells increases. Usually Photocells for measuring light, And a photoelectric conversion of the light control. photovaristor can be widely used in various light control circuit, Such as lighting control, regulation , can also be used for light control switch. Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 220R *1 *6 *1 10k *1 Photocells are basically a resistor that changes its resistive value (in ohms Ω) depending on how much light is shining onto the squiggly face. They are very low cost, easy to get in many sizes and specifications, but are very innacurate. Each photocell sensor will act a little differently than the other, even if they are from the same batch. The variations can be really large, 50% or higher! For this reason, they shouldn't be used to try to determine precise light levels in lux or millicandela. Instead, you can expect to only be able to determine basic light changes. //arduino code: ******************************************************* int potpin=A0; // define A0 is connected with the //photosensitive resistor int ledpin=11; // define 11 output PWM regulating // LED brightness int val=0; // define val void setup () { pinMode (ledpin, OUTPUT); // define io 11 output Serial.begin (9600); // set the baud rate of 9600 } void loop () { val=analogRead (potpin); // analog read sensor //values are assigned to val Serial.println (val); // display the Val numerical variables analogWrite (ledpin, val); // open LED and set the brightness // (PWM output a maximum of 255) delay (10); // 0.01 second delay } Contact us Schematic Page 15 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND 220R 10k ARDUINO HOLDER bread board K yes e - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 d Gn Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 18. Project -13 Project -13 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Tilt Contact us Schematic The tilt sensor is a component that can detect the tilting of an object. However it is only the equivalent to a pushbutton activated through a different physical mechanism. This type of sensor is the environmental-friendly version of a mercury-switch. It contains a metallic ball inside that will commute the two pins of the device from on to off and viceversa if the sensor reaches a certain angle. The code example is exactly as the one we would use for a pushbutton but substituting this one with the tilt sensor. We use a pull-up resistor (thus use active-low to activate the pins) and connect the sensor to a digital input pin that we will read when needed. Arduino code: ***************************************************************** const int tiltPin = 2; // the number of the tilt pin const int ledPin = 13; // the number of the LED pin // variables will change: int tiltState = 0; // variable for reading the tilt status void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the tilt pin as an input: pinMode(tiltPin, INPUT); } void loop() { // read the state of the tilt value: tiltState = digitalRead(tiltPin); // check if the tilt is Oblique. // if it is, the tiltState is HIGH: if (tiltState == HIGH) { // turn LED on: digitalWrite(ledPin, HIGH); } else { // turn LED off: digitalWrite(ledPin, LOW); } } Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 While not as precise or flexible as a full accelerometer, tilt switches can detect motion or orientation simply. Another benefit to them is that the big ones can switch power on their own. Accelerometers, on the other hand, output digital or analog voltage that must then be analyzed with extra circuitry. Page 16 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND 10k 10k *1 *6 ARDUINO HOLDER bread board e s K ye - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 d Gn Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 19. Project -14 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Fire alarm Contact us Schematic The flame sensor's operating temperature is -25 degrees Celsius to 85 degrees Celsius, in the course of the flame it should be noted that the probe distance from the flame should not be too close inorder to avoid damage. The Flame Sensor can be used to detect fire or other wavelength at 760 nm ~ 1100 nm light. In the fire-fighting robot game, the flame plays an important role in the probe, which can be used as the robot's eyes to find fire source or football. It can make use of fire-fighting robots, soccer robots. Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 *7 *1 10k *1 Page 17 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND 10k ARDUINO HOLDER bread board Keyes - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd r A ef A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET ey K es - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Arduino code: ***************************************************************** int flame=A5; // ANALOG A5 definition of flame int Beep=8; // define the buzzer for digital Io8 int val=0; //DEFINE digital variables; void setup () { pinMode (Beep, OUTPUT); // define buzzer output pinMode (flame, INPUT); // define flame sensor inpu t Serial.begin (9600); // set the baud rate to 9600 } void loop () { val=analogRead (flame); // reading flame value Serial.println (val); // analog value, print it out if (val>=600) // when the analog value is big than 600 { digitalWrite (Beep, HIGH); } else { digitalWrite (Beep, LOW); }} Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 20. Project -15 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Lm35 TEMP Contact us Schematic An analog temperature sensor is pretty easy to explain, its a chip that tells you what the ambient temperature is! These sensors use a solid-state technique to determine the temperature. That is to say, they don't use mercury (like old thermometers), bimetalic strips (like in some home thermometers or stoves), nor do they use thermistors (temperature sensitive resistors). Instead, they use the fact as temperature increases, the voltage across a diode increases at a known rate. (Technically, this is actually the voltage drop between the base and emitter - the Vbe - of a transistor.) By precisely amplifying the voltage change, it is easy to generate an analog signal that is directly proportional to temperature. There have been some improvements on the technique but, essentially that is how temperature is measured. Arduino code: //lM35 Pin Variables ************************************************************************* int sensorPin = 0; //the analog pin the lm35's Vout (sense) pin is connected to //the resolution is 10 mV / degree centigrade with a //500 mV offset to allow for negative temperatures /* * setup() - this function runs once when you turn your Arduino on * We initialize the serial connection with the computer */ void setup() { Serial.begin(9600); //Start the serial connection with the computer //to view the result open the serial monitor } void loop() // run over and over again { //getting the voltage reading from the temperature sensor int reading = analogRead(sensorPin); // converting that reading to voltage, for 3.3v arduino use 3.3 float voltage = reading * 5.0; voltage /= 1024.0; // print out the voltage Serial.print(voltage); Serial.println(" volts"); // now print out the temperature float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree wit 500 mV offset //to degrees ((voltage - 500mV) times 100) Serial.print(temperatureC); Serial.println(" degrees C"); // now convert to Fahrenheit float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0; Serial.print(temperatureF); Serial.println(" degrees F"); delay(1000); //waiting a second } These sensors have little chips in them and while they're not that delicate, they do need to be handled properly. Be careful of static electricity when handling them and make sure the power supply is connected up correctly and is between 2.7 and 5.5V DC - so don't try to use a 9V battery! Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 *3 LM 35 Page 18 KEYES VCC OUT GND VCC GND OUT RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND ARDUINO HOLDER bread board Ke es y - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 d Gn A f re A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET LM 35 Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 21. Project -16 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code 74HC595 Contact us Schematic At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers. This example is based on the 74HC595. The datasheet refers to the 74HC595 as an "8-bit serial-in, serial or parallel-out shift register with output latches; 3-state." In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller . You can link multiple registers together to extend your output even more. Arduino code: ***************************************************************** int data = 2; int clock = 4; int latch = 5; int ledState = 0; const int ON = HIGH; const int OFF = LOW; void setup() { pinMode(data, OUTPUT); pinMode(clock, OUTPUT); pinMode(latch, OUTPUT); } void loop() { int delayTime = 100; for(int i = 0; i < 256; i++) { updateLEDs(i); delay(delayTime); } } void updateLEDs(int value) { digitalWrite(latch, LOW); shiftOut(data, clock, MSBFIRST, value); digitalWrite(latch, HIGH); } void updateLEDsLong(int value) { digitalWrite(latch, LOW); for(int i = 0; i < 8; i++) { int bit = value & B10000000; value = value << 1; if(bit == 128){digitalWrite(data, HIGH);} else{digitalWrite(data, LOW);} digitalWrite(clock, HIGH); delay(1); digitalWrite(clock, LOW); } digitalWrite(latch, HIGH); } int bits[]={B00000001, B00000010, B00000100, B00001000, B00010000, B00100000, B01000000, B10000000}; int masks[] ={B11111110, B11111101, B11111011, B11110111, B11101111, B11011111, B10111111, B01111111}; void changeLED(int led, int state) { ledState = ledState & masks[led]; if(state == ON){ledState = ledState | bits[led];} updateLEDs(ledState); } Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *8 *20 220R *8 74hc595n *1 This set up makes all of the output pins active and addressable all the time. The one flaw of this set up is that you end up with the lights turning on to their last state or something arbitrary every time you first power up the circuit before the program starts to run. You can get around this by controlling the MR and OE pins from your Arduino board too, but this way will work and leave you with more open pins. Page 19 KEYES Q7 MR SHCP STCP OE DS O VCC GND 7 1 6 5 4 3 2 RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND 220R 220R 220R 220R 220R 220R 220R 220R ARDUINO HOLDER bread board es Key - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 n G d Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET 7 4 h c 5 9 5 n Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 22. Project -17 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Digital tube Contact us Schematic The seven segment display is a pretty simple device. It is actually 8 LEDs (the decimal point is the 8th). It can be arranged so that different combinations can be used to make numerical digits. This tutorial will show you how to wire one up and drive it with an Arduino. 7 Segment LED is also composed of light emitting diode So when we use it. Also want to connect a current limiting resistor, Otherwise to burn the light emitting diode. Funduino UNO *1 *1 ARD UIN O HOL DER bread board *1 *1 *1 *20 220R *8 Page 20 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND ARDUINO HOLDER bread board es Key - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 n G d Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 int a = 7 ;// IO7 connect a int b = 6 ;// IO66 connected to b int c = 5 ;// IO5 connection c int d = 11 ;// IO11 connection d int e = 10 ;// IO10 connection e int f = 8 ;// IO8 connection f int g = 9 ;// IO9 connection g int dp = 4 ;// IO4 connection dp void digital_1 (void) // display number 1 { unsigned char j; digitalWrite (c, HIGH) ;// to the digital interface 5-pin high, light c digitalWrite (b, HIGH) ;// lit b segment for (j = 7; j <= 11; j++) // off remaining segments digitalWrite (j, LOW); digitalWrite (dp, LOW) ;// turn off decimal point DP segment } void digital_2 (void) // display the number 2 { unsigned char j; digitalWrite (b, HIGH); digitalWrite (a, HIGH); for (j = 9; j <= 11; j++) digitalWrite (j, HIGH); digitalWrite (dp, LOW); digitalWrite (c, LOW); digitalWrite (f, LOW); } void digital_3 (void) // display the number 3 { unsigned char j; digitalWrite (g, HIGH); digitalWrite (d, LOW); for (j = 5; j <= 7; j++) digitalWrite (j, HIGH); digitalWrite (dp, LOW); digitalWrite (f, LOW); digitalWrite (e, HIGH); } void digital_4 (void) // display the number 4 { digitalWrite (c, HIGH); digitalWrite (b, HIGH); digitalWrite (f, HIGH); digitalWrite (g, HIGH); digitalWrite (dp, LOW); digitalWrite (a, LOW); digitalWrite (e, LOW); digitalWrite (d, LOW); } void digital_5 (void) // display the number 5 { unsigned char j; for (j = 7; j <= 9; j++) digitalWrite (j, HIGH); digitalWrite (c, HIGH); digitalWrite (d, LOW); digitalWrite (dp, LOW); digitalWrite (b, LOW); digitalWrite (e, HIGH); } void digital_6 (void) // display the number 6 { unsigned char j; for (j = 7; j <= 11; j++) digitalWrite (j, HIGH); digitalWrite (c, HIGH); digitalWrite (dp, LOW); digitalWrite (b, LOW); } void digital_7 (void) // display the number 7 { unsigned char j; for (j = 5; j <= 7; j++) digitalWrite (j, HIGH); digitalWrite (dp, LOW); for (j = 8; j <= 11; j++) digitalWrite (j, LOW); } void digital_8 (void) // display the number 8 { unsigned char j; for (j = 5; j <= 11; j++) digitalWrite (j, HIGH); digitalWrite (dp, LOW); } void setup () { int i ;// define variables for (i = 4; i <= 11; i++) pinMode (i, OUTPUT) ;// set 4 to 11 pin to output mode } void loop () { while (1) { digital_1 () ;// display the number 1 delay (2000) ;// delay 2s digital_2 () ;// display the number 2 delay (1000); // delay 1s digital_3 () ;// display the number 3 delay (1000); // delay 1s digital_4 () ;// display the number 4 delay (1000); // delay 1s digital_5 () ;// display the number 5 delay (1000); // delay 1s digital_6 () ;// display the number 6 delay (1000); // delay 1s digital_7 () ;// display the number 7 delay (1000); // delay 1s digital_8 () ;// display the number 8 delay (1000); // delay 1s } } Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 23. Project -18 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Four digital tube Contact us Schematic As the 7 Segment LED the four 7Segment led also composed of light emitting diode So when we use it. Also want to connect a current limiting resistor, Otherwise to burn the light emitting diode. Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 *20 220R *8 This is an example of how to drive a 7 segment LED display from arduino without the use of current limiting resistors. This technique is very common but requires some knowledge of electronics – you do run the risk of dumping too much current through the segments and burning out parts of the display. int digit1 = 11; //PWM Display pin 1 int digit2 = 10; //PWM Display pin 2 int digit3 = 9; //PWM Display pin 6 int digit4 = 6; //PWM Display pin 8 int segA = A1; // Display pin 14 int segB = 3; // Display pin 16 int segC = 4; // Display pin 13 int segD = 5; // Display pin 3 int segE = A0; // Display pin 5 int segF = 7; // Display pin 11 int segG = 8; // Display pin 15 void setup() { pinMode(segA, OUTPUT); pinMode(segB, OUTPUT); pinMode(segC, OUTPUT); pinMode(segD, OUTPUT); pinMode(segE, OUTPUT); pinMode(segF, OUTPUT); pinMode(segG, OUTPUT); pinMode(digit1, OUTPUT); pinMode(digit2, OUTPUT); pinMode(digit3, OUTPUT); pinMode(digit4, OUTPUT); pinMode(13, OUTPUT); } void loop() { // long startTime = millis(); displayNumber(millis()/1000); // while( (millis() - startTime) < 2000) { // displayNumber(1217); // } // delay(1000); } // Given a number, we display 10:22 // After running through the 4 numbers, the display is left turned off // Display brightness // Each digit is on for a certain amount of microseconds // Then it is off until we have reached a total of 20ms for the function call // Let's assume each digit is on for 1000us // If each digit is on for 1ms, there are 4 digits, so the display is off for 16ms. // That's a ratio of 1ms to 16ms or 6.25% on time (PWM). // Let's define a variable called brightness that varies from: // 5000 blindingly bright (15.7mA current draw per digit) // 2000 shockingly bright (11.4mA current draw per digit) // 1000 pretty bright (5.9mA) // 500 normal (3mA) // 200 dim but readable (1.4mA) // 50 dim but readable (0.56mA) // 5 dim but readable (0.31mA) // 1 dim but readable in dark (0.28mA) void displayNumber(int toDisplay) { #define DISPLAY_BRIGHTNESS 500 #define DIGIT_ON LOW #define DIGIT_OFF HIGH long beginTime = millis(); for(int digit = 4 ; digit > 0 ; digit--) { // Turn on a digit for a short amount of time switch(digit) { case 1: digitalWrite(digit1, DIGIT_ON); break; case 2: digitalWrite(digit2, DIGIT_ON); break; case 3: digitalWrite(digit3, DIGIT_ON); break; case 4: digitalWrite(digit4, DIGIT_ON); break; } // Turn on the right segments for this digit lightNumber(toDisplay % 10); toDisplay /= 10; // Display this digit for a fraction of a second (between 1us and 5000us, 500 is pretty good) delayMicroseconds(DISPLAY_BRIGHTNESS); // Turn off all segments lightNumber(10); // Turn off all digits digitalWrite(digit1, DIGIT_OFF); digitalWrite(digit2, DIGIT_OFF); digitalWrite(digit3, DIGIT_OFF); digitalWrite(digit4, DIGIT_OFF); } while( (millis() - beginTime) < 10) ; //Wait for 20ms to pass before we paint the display again } // Given a number, turns on those segments // If number == 10, then turn off number void lightNumber(int numberToDisplay) { #define SEGMENT_ON HIGH #define SEGMENT_OFF LOW switch (numberToDisplay){ case 0: digitalWrite(segA, SEGMENT_ON); digitalWrite(segB, SEGMENT_ON); digitalWrite(segC, SEGMENT_ON); digitalWrite(segD, SEGMENT_ON); digitalWrite(segE, SEGMENT_ON); digitalWrite(segF, SEGMENT_ON); digitalWrite(segG, SEGMENT_OFF); break; case 1: digitalWrite(segA, SEGMENT_OFF); digitalWrite(segB, SEGMENT_ON); digitalWrite(segC, SEGMENT_ON); digitalWrite(segD, SEGMENT_OFF); digitalWrite(segE, SEGMENT_OFF); digitalWrite(segF, SEGMENT_OFF); digitalWrite(segG, SEGMENT_OFF); break; case 2: digitalWrite(segA, SEGMENT_ON); digitalWrite(segB, SEGMENT_ON); digitalWrite(segC, SEGMENT_OFF); digitalWrite(segD, SEGMENT_ON); digitalWrite(segE, SEGMENT_ON); digitalWrite(segF, SEGMENT_OFF); digitalWrite(segG, SEGMENT_ON); break; case 3: digitalWrite(segA, SEGMENT_ON); digitalWrite(segB, SEGMENT_ON); digitalWrite(segC, SEGMENT_ON); digitalWrite(segD, SEGMENT_ON); digitalWrite(segE, SEGMENT_OFF); digitalWrite(segF, SEGMENT_OFF); digitalWrite(segG, SEGMENT_ON); break; case 4: digitalWrite(segA, SEGMENT_OFF); digitalWrite(segB, SEGMENT_ON); digitalWrite(segC, SEGMENT_ON); digitalWrite(segD, SEGMENT_OFF); digitalWrite(segE, SEGMENT_OFF); digitalWrite(segF, SEGMENT_ON); digitalWrite(segG, SEGMENT_ON); break; case 5: digitalWrite(segA, SEGMENT_ON); digitalWrite(segB, SEGMENT_OFF); digitalWrite(segC, SEGMENT_ON); digitalWrite(segD, SEGMENT_ON); digitalWrite(segE, SEGMENT_OFF); digitalWrite(segF, SEGMENT_ON); digitalWrite(segG, SEGMENT_ON); break; case 6: digitalWrite(segA, SEGMENT_ON); digitalWrite(segB, SEGMENT_OFF); digitalWrite(segC, SEGMENT_ON); digitalWrite(segD, SEGMENT_ON); digitalWrite(segE, SEGMENT_ON); digitalWrite(segF, SEGMENT_ON); digitalWrite(segG, SEGMENT_ON); break; case 7: digitalWrite(segA, SEGMENT_ON); digitalWrite(segB, SEGMENT_ON); digitalWrite(segC, SEGMENT_ON); digitalWrite(segD, SEGMENT_OFF); digitalWrite(segE, SEGMENT_OFF); digitalWrite(segF, SEGMENT_OFF); digitalWrite(segG, SEGMENT_OFF); break; case 8: digitalWrite(segA, SEGMENT_ON); digitalWrite(segB, SEGMENT_ON); digitalWrite(segC, SEGMENT_ON); digitalWrite(segD, SEGMENT_ON); digitalWrite(segE, SEGMENT_ON); digitalWrite(segF, SEGMENT_ON); digitalWrite(segG, SEGMENT_ON); break; case 9: digitalWrite(segA, SEGMENT_ON); digitalWrite(segB, SEGMENT_ON); digitalWrite(segC, SEGMENT_ON); digitalWrite(segD, SEGMENT_ON); digitalWrite(segE, SEGMENT_OFF); digitalWrite(segF, SEGMENT_ON); digitalWrite(segG, SEGMENT_ON); break; case 10: digitalWrite(segA, SEGMENT_OFF); digitalWrite(segB, SEGMENT_OFF); digitalWrite(segC, SEGMENT_OFF); digitalWrite(segD, SEGMENT_OFF); digitalWrite(segE, SEGMENT_OFF); digitalWrite(segF, SEGMENT_OFF); digitalWrite(segG, SEGMENT_OFF); break; } } Page 21 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND SEG1 SEG2 SEG3 A F B E D DP C G SEG4 1 2 3 4 5 6 12 7 8 9 10 11 ARDUINO HOLDER Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Analog SEG1 SEG2 SEG3 A F B E D DP C G SEG4 1 2 3 4 5 6 12 7 8 9 10 11 Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 24. Project -19 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code 8*8 dot matrix Contact us Schematic The FrequencyTimer2 library steals the hardware timer2 from the PWMs on pin 11 and 3 (on a atmega328) and reprograms it to generate a frequency of your choosing. It can toggle pin11 if you wish or call a function you supply each cycle. DOWNLOAD FrequencyTimer2 Library: http://www.pjrc.com/teensy/td_libs_FrequencyTimer2.html /* * Show messages on an 8x8 led matrix, #include <FrequencyTimer2.h> #define SPACE { {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0} } #define H { {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1, 1, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0} } #define E { {0, 1, 1, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 1, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 1, 0} } #define L { {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 1, 0} } #define O { {0, 0, 0, 1, 1, 0, 0, 0}, {0, 0, 1, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1, 0}, {0, 0, 1, 0, 0, 1, 0, 0}, {0, 0, 0, 1, 1, 0, 0, 0} } byte col = 0; byte leds[8][8]; // pin[xx] on led matrix connected to nn on Arduino (-1 is dummy to make array start at pos 1) int pins[17]= {-1, 5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 9, 8, 7, 6}; // col[xx] of leds = pin yy on led matrix int cols[8] = {pins[13], pins[3], pins[4], pins[10], pins[06], pins[11], pins[15], pins[16]}; // row[xx] of leds = pin yy on led matrix int rows[8] = {pins[9], pins[14], pins[8], pins[12], pins[1], pins[7], pins[2], pins[5]}; const int numPatterns = 6; byte patterns[numPatterns][8][8] = { H,E,L,L,O,SPACE }; int pattern = 0; // Turn off toggling of pin 11 FrequencyTimer2::disable(); // Set refresh rate (interrupt timeout period) FrequencyTimer2::setPeriod(2000); // Set interrupt routine to be called FrequencyTimer2::setOnOverflow(display); setPattern(pattern); } void loop() { pattern = ++pattern % numPatterns; slidePattern(pattern, 60); } void clearLeds() { // Clear display array for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { leds[i][j] = 0; } } } void setPattern(int pattern) { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { leds[i][j] = patterns[pattern][i][j]; } } } void slidePattern(int pattern, int del) { for (int l = 0; l < 8; l++) { for (int i = 0; i < 7; i++) { for (int j = 0; j < 8; j++) { leds[j][i] = leds[j][i+1]; } } for (int j = 0; j < 8; j++) { leds[j][7] = patterns[pattern][j][0 + l]; } delay(del); } } // Interrupt routine void display() { digitalWrite(cols[col], LOW); // Turn whole previous column off col++; if (col == 8) { col = 0; } for (int row = 0; row < 8; row++) { if (leds[col][7 - row] == 1) { digitalWrite(rows[row], LOW); // Turn on this led } else { digitalWrite(rows[row], HIGH); // Turn off this led } } digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times) } The project can be very useful displays. To control a matrix, you connect both its rows and columns to your microcontroller. The columns are connected to the LEDs cathodes (see Figure 1), so a column needs to be high for any of the LEDs in that column to turn on. The rows are connected to the LEDs anodes, so the row needs to be low for an individual LED to turn on. If the row and the column are both high or both low, no voltage flows through the LED and it doesn’t turn on. Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 *20 220R *8 Page 22 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND ARDUINO HOLDER Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 nd G Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Analog 1 8 9 16 Ke es y - + - + - + - + *1 *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. void setup() { // sets the pins as output for (int i = 1; i <= 16; i++) { pinMode(pins[i], OUTPUT); } // set up cols and rows for (int i = 1; i <= 8; i++) { digitalWrite(cols[i - 1], LOW); } for (int i = 1; i <= 8; i++) { digitalWrite(rows[i - 1], LOW); } clearLeds(); Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 25. Project -20 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Servo motor Contact us Schematic Arduino Code // Controlling a servo position using a potentiometer (variable resistor) **************************************************************** #include <Servo.h> Servo myservo; // create servo object to control a servo int potpin = A2; // analog pin used to connect the potentiometer int val; // variable to read the value from the analog pin void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) myservo.write(val); // sets the servo position according to the scaled value delay(15); // waits for the servo to get there } Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 *5 *1 Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow or orange and should be connected to pin 9 on the Arduino board. A servomotor is a rotary actuator that allows for precise control of angular position,velocity and acceleration.[1] It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servomotors. Servomotors are not a different class of motor, on the basis of fundamental operating principle, but uses servomechanism to achieve closed loop control with a generic open loop motor.Servomotors are used in applications such as robotics, CNC machinery orautomated manufacturing. Page 23 KEYES Yellow Out Red +5v Brown Gnd Sevro Vcc Out Gnd RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND ARDUINO HOLDER bread board K y s e e - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd e Ar f A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 26. Project -21 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code IR Remote Contact us Schematic IR detectors are little microchips with a photocell that are tuned to listen to infrared light. They are almost always used for remote control detection - every TV and DVD player has one of these in the front to listen for the IR signal from the clicker. Inside the remote control is a matching IR LED, which emits IR pulses to tell the TV to turn on, off or change channels. IR light is not visible to the human eye, which means it takes a little more work to test a setup. The common NEC protocol is complicated by its "repeat code". If you hold down a button, the remote transmits the code once followed by multiple transmissions of special repeat code. The universal remote records the code, not the repeat code. On playback, it transmits the code once, followed by the repeat code. The RC5 and RC6 protocols handle repeated transmissions differently. They use two separate codes for each function, differing in a "toggle bit". The first time you hold down a button, the firs t code is transmitted repeatedly. The next time you hold down a button, the second code is transmitted repeatedly. Subsequent presses continue to alternate. The universal remote code flips the toggle bit each time it transmits. /* * IRremote: IRrecvDemo - demonstrates receiving IR codes with Irrecv * An IR detector/demodulator must be connected to the input RECV_PIN. * Version 0.1 July, 2009 * Copyright 2009 Ken Shirriff * http://arcfn.com ********************************************************* #include <IRremote.h> int RECV_PIN = 2; IRrecv irrecv(RECV_PIN); decode_results results; void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver } void loop() { if (irrecv.decode(&results)) { Serial.println(results.value, HEX); irrecv.resume(); // Receive the next value } } Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 *3 *1 The IRremote library for the Arduino:https://github.com/shirriff/Arduino-IRremote The IRremote library for the Arduino:https://github.com/shirriff/Arduino-IRremote Page 24 KEYES Out Gnd Vcc Vcc Vout Gnd 1838 RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND ARDUINO HOLDER bread board Keyes - + - + - + - + Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 d Gn Aref A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET ey K es - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 27. Project -22 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code 1602 LCD screen The LCDs have a parallel interface, meaning that the microcontroller has to manipulate several interface pins at once to control the display. The LiquidCrystal library allows you to control LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. Contact us Schematic Code /* LiquidCrystal Library - Hello World Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. This sketch prints "Hello World!" to the LCD and shows the time. The circuit: * LCD RS pin to digital pin 12 * LCD Enable pin to digital pin 11 * LCD D4 pin to digital pin 5 * LCD D5 pin to digital pin 4 * LCD D6 pin to digital pin 3 * LCD D7 pin to digital pin 2 * LCD R/W pin to ground * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) Library originally added 18 Apr 2008 by David A. Mellis library modified 5 Jul 2009 by Limor Fried (http://www.ladyada.net) example added 9 Jul 2009 by Tom Igoe modified 22 Nov 2010 by Tom Igoe This example code is in the public domain. http://www.arduino.cc/en/Tutorial/LiquidCrystal */ // include the library code: #include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("hello, world!"); } void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(millis()/1000); } Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 *15 *1 Before wiring the LCD screen to your Arduino we suggest to solder a pin header strip to the 14 (or 16) pin count connector of the LCD screen, as you can see in the image above. To wire your LCD screen to your Arduino, connect the following pins: LCD RS pin to digital pin 12 LCD Enable pin to digital pin 11 LCD D4 pin to digital pin 5 LCD D5 pin to digital pin 4 LCD D6 pin to digital pin 3 LCD D7 pin to digital pin 2 Additionally, wire a 10K pot to +5V and GND, with it's wiper (output) to LCD screens VO pin (pin3). Page 25 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND Vss Vcc Vo Rs R/w E Db0 Db1 Db2 Db3 Db4 Db5 Db6 Db7 LED+ LED- Lcd Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 ARDUINO HOLDER Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd A ef r A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Analog Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 28. Project -23 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Stepper motor drive Contact us Schematic This is a 5v 28YBJ-48 Stepper Motor with Gear Reduction, so it has good torque for its size, but relatively slow motion. These motors/drivers are made by the millions for A/C units, fans, duct controls etc. 4 Phase 5 Wire Connection •Current : 160 mA per winding (320 mA in 4-step mode) Measured: 250mA stopped, 200 mA running fast •Resistance : 31 Ω per coil winding (from Red wire to any coil) •Voltage : 5V DC •Step Angle (Internal Motor alone): 5.625° (64 steps per revolution) NOTE: this is with the Half-Step (8-step) sequence. So the internal motor has 32 steps per revolution in 4-step mode (Arduino Library) •Step angle: 5.625 x 1/64 at Output Shaft •Step angle: 11.25 x 1/32 at Output Shaft •Gear Reduction ratio: 1 / 64 •SO: it takes 2048 steps per output shaft revolution.. In 4-step sequence. •No-Load Pull-Out Frequency : 800pps •No-Load Pull-In Frequency : 500pps •Pull-In Torque : ≥ 78.4mN.m •Wiring Instruction : A (Blue), B (Pink), C (Yellow), D (Orange), E (Red, Mid-Point) If your motor vibrates but does not turn, it is probably connected with the wrong sequence. The Arduino pin connections need to have 4 pins connected to Motor Driver In1, In2, In3, In4 and then the pins entered in the software in the sequence 1-3-2-4 for proper sequencing. Also, The + and - pins near "5-12V" need to be connected: - to Arduino Ground, + to Arduino +5 (for one motor test only) or (best) to a separate +5V 1A power supply. /*-----( Import needed libraries )-----*/ #include <Stepper.h> /*-----( Declare Constants, Pin Numbers )-----*/ //---( Number of steps per revolution of INTERNAL motor in 4-step mode )--- #define STEPS_PER_MOTOR_REVOLUTION 32 //---( Steps per OUTPUT SHAFT of gear reduction )--- #define STEPS_PER_OUTPUT_REVOLUTION 32 * 64 //2048 /*-----( Declare objects )-----*/ // create an instance of the stepper class, specifying // the number of steps of the motor and the pins it's // attached to //The pin connections need to be 4 pins connected // to Motor Driver In1, In2, In3, In4 and then the pins entered // here in the sequence 1-3-2-4 for proper sequencing Stepper small_stepper(STEPS_PER_MOTOR_REVOLUTION, 8, 10, 9, 11); /*-----( Declare Variables )-----*/ int Steps2Take; void setup() /*----( SETUP: RUNS ONCE )----*/ { // Nothing (Stepper Library sets pins as outputs) }/*--(end setup )---*/ void loop() /*----( LOOP: RUNS CONSTANTLY )----*/ { small_stepper.setSpeed(1); // SLOWLY Show the 4 step sequence Steps2Take = 4; // Rotate CW small_stepper.step(Steps2Take); delay(2000); Steps2Take = STEPS_PER_OUTPUT_REVOLUTION / 2; // Rotate CW ½ turn small_stepper.setSpeed(100); small_stepper.step(Steps2Take); delay(1000); Steps2Take = - STEPS_PER_OUTPUT_REVOLUTION / 2; // Rotate CCW 1/2 turn small_stepper.setSpeed(700); // 700 a good max speed?? Small_stepper.step(Steps2Take); delay(2000); } Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 *15 *1 Uln2003an Page 26 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND Uln2003an Connect to Stepper Motor Uln2003an Connect to Stepper Motor ARDUINO HOLDER Funduino UNO Digital 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Gnd ef Ar A0 A1 A2 A3 A4 A5 VIN GND GND 5V 3.3V RESET Analog Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 29. Project -24 Project -24 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Relay Contact us Schematic Why use a relay with an Arduino board? Individual applications will vary, but in short – a relay allows our relatively low voltage Arduino to easily control higher power circuits. A relay accomplishes this by using the 5V outputted from an Arduino pin to energize an electromagnet which in turn closes an internal, physical switch attached to the aforementioned higher power circuit. You can actually hear the switch *click* closed on even small relays – just like the big ones on street corners used for traffic signals. OUT VCC GND Sdr- 05vdc Songle Relay Funduino UNO //Arduino Sample Code int Relay = 3; void setup() { pinMode(13, OUTPUT); //Set Pin13 as output digitalWrite(13, HIGH); //Set Pin13 High pinMode(Relay, OUTPUT); //Set Pin3 as output } void loop() { digitalWrite(Relay, HIGH); //Turn off relay delay(2000); digitalWrite(Relay, LOW); //Turn on relay delay(2000); } Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 *10 *1 OUT VCC GND Sdr- 05vdc Songle Relay Relay modules. It can be used in interactive projects. This relay shield uses SONGLE high-quality relay. It can also be used to control the lighting, electrical and other equipments. Be careful when you connect it to 220V or 110V!!! Relay modules. It can be used in interactive projects. This relay shield uses SONGLE high-quality relay. It can also be used to control the lighting, electrical and other equipments. Be careful when you connect it to 220V or 110V!!! Page 27 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND OUT VCC GND Sdr- 05vdc Songle Relay ey K es - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 30. Project -25 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Temp & humidity Contact us Schematic This is a multifunctional sensor that gives you temperature and relative humidity information at the same time. It utilizes a DHT11 sensor that can meet measurement needs of general purposes. It provides reliable readings when environment humidity condition inbetween 20% RH and 90% RH, and temperature condition inbetween 0°C and 50°C, covering needs in most home and daily applications that don't contain extreme conditions。 #define DHT11_PIN 0 // ADC0 byte read_dht11_dat() { byte i = 0; byte result=0; for(i=0; i< 8; i++) { while(!(PINC & _BV(DHT11_PIN))); // wait for 50us delayMicroseconds(30); if(PINC & _BV(DHT11_PIN)) result |=(1<<(7-i)); while((PINC & _BV(DHT11_PIN))); // wait '1' finish } return result; } void setup() { DDRC |= _BV(DHT11_PIN); PORTC |= _BV(DHT11_PIN); Serial.begin(9600); Serial.println("Ready"); } void loop() { byte dht11_dat[5]; byte dht11_in; byte i;// start condition // 1. pull-down i/o pin from 18ms PORTC &= ~_BV(DHT11_PIN); delay(18); PORTC |= _BV(DHT11_PIN); delayMicroseconds(40); DDRC &= ~_BV(DHT11_PIN); delayMicroseconds(40); dht11_in = PINC & _BV(DHT11_PIN); if(dht11_in) { Serial.println("dht11 start condition 1 not met"); return; } delayMicroseconds(80); dht11_in = PINC & _BV(DHT11_PIN); if(!dht11_in) { Serial.println("dht11 start condition 2 not met"); return; } delayMicroseconds(80);// now ready for data reception for (i=0; i<5; i++) dht11_dat[i] = read_dht11_dat(); DDRC |= _BV(DHT11_PIN); PORTC |= _BV(DHT11_PIN); byte dht11_check_sum = dht11_dat[0]+dht11_dat[1]+dht11_dat[2]+dht11_dat[3]; // check check_sum if(dht11_dat[4]!= dht11_check_sum) { Serial.println("DHT11 checksum error"); } Serial.print("Current humdity = "); Serial.print(dht11_dat[0], DEC); Serial.print("."); Serial.print(dht11_dat[1], DEC); Serial.print("% "); Serial.print("temperature = "); Serial.print(dht11_dat[2], DEC); Serial.print("."); Serial.print(dht11_dat[3], DEC); Serial.println("C "); delay(2000); } DHT11 sensors features extremely accurate calibration of humidity calibration chamber. The calibration coefficients stored in the OTP program memory, internal sensors detect signals in the process, we should call these calibration coefficients. The single-wire serial interface system is integrated to become quick and easy. Small size, low power, signal transmission distance up to 20 meters, making it a variety of applications and even the most demanding applications. Keyes Gnd Out Vcc Keyes Gnd Out Vcc Funduino UNO Funduino UNO *1 *1 ARDUINO HOLDER bread board *1 *1 *1 *3 Page 28 KEYES RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND Keyes Gnd Out Vcc ey K es - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 31. Project -26 ABOUT THE PROJECT ITEM PHOTO PARTS Connection Code Clock Contact us Schematic Download arduino library :Https://github.com/msparks/arduino-ds1302 In this project we will explain how to add a RTC – Real Time Clock to Arduino project. RTC are good to work with time, you can for example schedule an event to happen at a specific time, turn on a light at 6PM, turn it off at 5AM. We use a DS1302 Module, the DS1302 it´s low power RTC IC with a complete set of option to work with time and date. The DS1302 trickle-charge timekeeping chip contains a real-time clock/calendar and 31 bytes of static RAM. It communicates with a microprocessor via a simple serial interface. The real-time clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with an AM/PM indicator. Funduino UNO *1 *1 ARD UIN O HOL DER bread board *1 *1 *1 *5 Ds 1302 Cr2 032 + + Example sketch for interfacing with the DS1302 timekeeping chip. */ #include <stdio.h> #include <string.h> #include <DS1302.h> /* Set the appropriate digital I/O pin connections */ uint8_t CE_PIN = 5; //Pin RST uint8_t IO_PIN = 6; //Pin DAT uint8_t SCLK_PIN = 7; //Pin CLK /* Create buffers */ char buf[50]; char day[50]; /* Create a DS1302 object */ DS1302 rtc(CE_PIN, IO_PIN, SCLK_PIN); void print_time() { /* Get the current time and date from the chip */ Time t = rtc.time(); /* Name the day of the week */ memset(day, 0, sizeof(day)); /* clear day buffer */ switch (t.day) { case 1: strcpy(day, "Sunday"); break; case 2: strcpy(day, "Monday"); break; case 3: strcpy(day, "Tuesday"); break; case 4: strcpy(day, "Wednesday"); break; case 5: strcpy(day, "Thursday"); break; case 6: strcpy(day, "Friday"); break; case 7: strcpy(day, "Saturday"); break; } /* Format the time and date and insert into the temporary buffer */ snprintf(buf, sizeof(buf), "%s %02d/%02d/%04d %02d:%02d:%02d", day, t.date, t.mon, t.yr, t.hr, t.min, t.sec); /* Print the formatted string to serial so we can see the time */ Serial.println(buf); } void setup() { Serial.begin(9600); /* Initialize a new chip by turning off write protection and clearing the clock halt flag. These methods needn't always be called. See the DS1302 datasheet for details. */ //rtc.write_protect(false); //rtc.halt(false); /* Make a new time object to set the date and time */ /* Tuesday, May 19, 2009 at 21:16:37. */ //Time t(2013, 7, 29, 23, 14, 00, 2); /* Set the time and date on the chip */ //rtc.time(t); } /* Loop and print the time every second */ void loop() { print_time(); delay(1000); } Ds 1302 Cr2032 + + Vcc Gnd Clk Dat Rst Funduino UNO During reading, the clock could rollover. That would result in bad clock data. To prevent that, the DS1302 has a buffer to store the clock data. That buffer can be read in a single communication session, called a "burst" mode. Any valid program should therefor use that "burst" mode to read the clock data. The Year data of the DS1302 is only two digits (0-99). The Year '0' is 2000, and not 1970 or 1980. It has a Leap-Year compensation from 2000 up to 2099 (for a value of 0-99). Make a new time object to set the date and time: Tuesday, May 19, 2009 at 21:16:37. Time t(2013, 7, 29, 23, 14, 00, 2); Page 29 KEYES 1 2 3 4 5 6 7 8 DAT CLK IO CE V X1 X2 GND RST AREF IO REF N/C A0 A1 A2 A3 A4 A5 ARDUINO 3.3V 5V VIN D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 SCL SDA GND Keyes - + - + - + - + *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. *Our project using FUNDUINO UNO board,100% compatible with ARDUINO Uno. Note ************************************************* Download arduino pdf book and demo code: https://app.box.com/s/8jycq6yf7g4liqp2wij2 Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us. Not working?you can contact us by email or skybe our email is szkeyes@126.com our skybe is zuokejian Any questions please feel free to contact us.
  • 32. Trademark statement: Disclaimer: Trademarks are registered trademarks of Keyes, Keyes owned trademarks, without written authorization from Keyes, shall not in any way or reason to use, copy, modify, copy propagation, or with other products bundled sales of any part of the trademark, the trademark on the illegal use of our behavior, our shall be liable for the acts and enterprises according to law.. The company all series products, the company has the right at any time to the corresponding technical information or documents are updated to the user, the mentioned products without prior notice. Without the written consent of the company or the authorized, not unauthorized use, reproduction, a partial or all of the content version product description. The user shall bear the risks in the company's products use the process. The company produced by the use of this product for direct, indirect or collateral damage (including the personal safety of profit loss, loss of credibility and so on), do not bear any responsibility. KEYES