Download - Arduino Projects1
-
8/10/2019 Arduino Projects1
1/84
-
8/10/2019 Arduino Projects1
2/84
-
8/10/2019 Arduino Projects1
3/84
Take a wire from the pin marked 'GND' of your arduino and connect it to the '-'ve power rail of
the breadboard. Now all points of the '-' ve power rail will be connected to the ground of thearduino!
http://1.bp.blogspot.com/-e7rlXr-5kJ8/T6TAHeGmrdI/AAAAAAAAAgU/bcZv1YihYh8/s1600/LED4.jpghttp://1.bp.blogspot.com/-e7rlXr-5kJ8/T6TAHeGmrdI/AAAAAAAAAgU/bcZv1YihYh8/s1600/LED4.jpg -
8/10/2019 Arduino Projects1
4/84
Next, Connect a wire between the 11th pin of the arduino(yes the 11th pin and not the 13th pin!)
and the positive terminal of the LED. This is going to be our control line for the LEDProgramming to control the LED So how can you control a LED? Well there are only 2 ways to control an LED. you can eitherswitch it ON / OFF or you can control the intensity with which it glows (Very much like a fan!).So lets see how to do the first control - ON/OFF (we can call this digital control! Very much 0s& 1s)
http://4.bp.blogspot.com/-jVKMt0JsVvI/T6TAJNaeITI/AAAAAAAAAgc/gJHh4cXWNOM/s1600/LED5.jpghttp://4.bp.blogspot.com/-jVKMt0JsVvI/T6TAJNaeITI/AAAAAAAAAgc/gJHh4cXWNOM/s1600/LED5.jpg -
8/10/2019 Arduino Projects1
5/84
-
8/10/2019 Arduino Projects1
6/84
while (intensity < 255) // Check if intensity has reached maximum value, ifyes then exit the loop
{analogWrite (11,intensity);delay (25);intensity++;
}
while (intensity > 0) // Check if intensity has reached minimum value, ifyes then exit the loop
{analogWrite (11,intensity);delay (25);intensity--;
}
}
Simple Labs' Quick Start Kit for Arduino - RGB LED Interfacing - How To?
The RGB LED
The RGB led aka the tricolor led is a led that can help generate a multitude of colors by mixingred, blue & green colors. Its more like 3 leds (red, green & blue) put together into a single led.
It has 4 pins with 1 of the pins being a common cathode and the other 3 pins acting as anodes forthe 3 different colours. by varying the intensity of each of the 3 colours individually, we can
generate various colours. This led is the same as 1 pixel of a LED TV!.Here is how to wire it up
-
8/10/2019 Arduino Projects1
7/84
Pin Mappings of the RGB LED
Place resistor between the common cathode and the '-'ve terminal
http://3.bp.blogspot.com/-0aW-Jlvs2G0/T6YPGzpQKTI/AAAAAAAAAg4/Z0C5b0txvF0/s1600/RGB2.jpghttp://3.bp.blogspot.com/-JbriF93O5ic/T6YPFSqSsnI/AAAAAAAAAgw/zWJZ9j0pWf4/s1600/RGB1.jpghttp://3.bp.blogspot.com/-0aW-Jlvs2G0/T6YPGzpQKTI/AAAAAAAAAg4/Z0C5b0txvF0/s1600/RGB2.jpghttp://3.bp.blogspot.com/-JbriF93O5ic/T6YPFSqSsnI/AAAAAAAAAgw/zWJZ9j0pWf4/s1600/RGB1.jpg -
8/10/2019 Arduino Projects1
8/84
-
8/10/2019 Arduino Projects1
9/84
Next Lets get generating Colors, try the following code. Play around with the values and getyourselves comfortable.[RGB.ino]/* RGB
Sets some random intensity value to the various colours of the RGB LED
*/
void setup (){}void loop (){
analogWrite (11,153); // Setting the voltage for Blue to around 3 VoltsanalogWrite (10,51); // Setting the voltage for Red to around 1 VoltanalogWrite (9,51); // Setting the voltage for Green to around 1 Volt
}
Simple Labs' Quick Start Kit for Arduino -Push Button / Switch Interfacing - How To?
The Push Button Push Buttons like LEDs form a common part of most electronics devices. Push buttons can beused to get user feedback. (image a common scenario of scrolling through a menu and selectingan option - there are buttons all around the process!)
-
8/10/2019 Arduino Projects1
10/84
Working of a Push Button
So Far we have not used the SUPPLY voltage from the Arduino however, for connecting the button, we would need this. So, before connecting the Button, we need to connect our '+'ve
terminal to the 5Volts SUPPLY line on the Arduino. Connect as shown in the image below.
http://2.bp.blogspot.com/-PRSuEhMbeo0/T6YXqJpuMRI/AAAAAAAAAhM/CPdQKkL_9To/s1600/Button1.jpghttp://3.bp.blogspot.com/-P6_kB88az_M/T6YdBE7hBoI/AAAAAAAAAh4/P-NchK8E_HE/s1600/power1.jpghttp://2.bp.blogspot.com/-PRSuEhMbeo0/T6YXqJpuMRI/AAAAAAAAAhM/CPdQKkL_9To/s1600/Button1.jpghttp://3.bp.blogspot.com/-P6_kB88az_M/T6YdBE7hBoI/AAAAAAAAAh4/P-NchK8E_HE/s1600/power1.jpghttp://2.bp.blogspot.com/-PRSuEhMbeo0/T6YXqJpuMRI/AAAAAAAAAhM/CPdQKkL_9To/s1600/Button1.jpg -
8/10/2019 Arduino Projects1
11/84
There are 2 ways to connect a Push Button to the arduino - the Pull-Down Configuration & thePull-Up Configuration. We will take a look at both these.
The Pull-Down Cnfiguration
In this configuration the Push Button is set-up such that it keeps giving a constant LOW signal(0)when not being pressed and gives a HIGH signal(1) when being pressed. To ensure that it keepsgiving a LOW signal at all times, the Input line is also connect to the '-'ve terminal through aresistor. So in when the button is not being pressed, the input line stays connected to theGROUND. When the button is being pressed (and as the path of low resistance is always
preferred) the input line gets connected to the SUPPLY line. Look at the following image to seehow to connect a button in this configuration. We will keep this connection only as a reference aswe will be using the Pull-Up configuration for our circuits.
The Pull-Down Configuration The Pull-UP Cnfiguration In this configuration the Push Button is set-up such that it keeps giving a constant HIGHsignal(1) when not being pressed and gives a LOW signal(0) when being pressed. To ensure thatit keeps giving a HIGH signal at all times, the Input line is also connect to the '+'ve terminalthrough a resistor. So in when the button is not being pressed, the input line stays connected tothe SUPPLY . When the button is being pressed (and as the path of low resistance is always
preferred) the input line gets connected to the GROUND line. Look at the following image to seehow to connect a button in this configuration. This is the most preferred method to connect a
button.
http://4.bp.blogspot.com/-d_8jxNtzlP4/T6YXrrQkSaI/AAAAAAAAAhU/FDajLccuuY0/s1600/Button2.jpg -
8/10/2019 Arduino Projects1
12/84
The Pull-Up Configuration Now try the following code, Pressing the Button increases the intensity of one colour at a time,once the maximum intensity of the colour is reached that colour is set to 0 and the intensity ofthe next colour starts increasing [ RGB_Button.ino]
/* RGB_Button Pressing the Button increases the intensity of one colour at a time, once t
he maximum intensity of the colour is reached that colour is set to 0 and the intensity of the next colour starts increas
ing */
int intensity = 0, pin = 9;
void setup () {pinMode (2, INPUT ); // This is the pin to which we have connected the button }
void loop () {if ( digitalRead (2)==0) // check if the button is being pressed {
Serial . println ( "here" );if (intensity < 255)
http://4.bp.blogspot.com/-bbYQZIIbvyc/T6YXtThW6FI/AAAAAAAAAhc/_zQprbqyEnw/s1600/Button3.jpghttp://4.bp.blogspot.com/-bbYQZIIbvyc/T6YXtThW6FI/AAAAAAAAAhc/_zQprbqyEnw/s1600/Button3.jpg -
8/10/2019 Arduino Projects1
13/84
{intensity++;}else {
intensity=0;analogWrite (pin,intensity);if (pin
-
8/10/2019 Arduino Projects1
14/84
Simple Labs' Quick Start Kit for Arduino -Trimpot / Potentiometer Interfacing - HowTo?Trimpot Trimpots are used for getting variable / adjustable user inputs. Common example of a trimpot isthe volume knob of your stereo player, Tuning knob of the radio, etc.
A Trimpot aka variable resistor has three pins and an adjustment screw. A Trimpot acts as a
potential divider and gives an output voltage on the 2nd pin. This output voltage is in-betweenthe voltages supplied to the 1st and 3rd pins. The output voltage can be varied by adjusting thescrew. The 1st and 3rd pins are connected to SUPPLY / GROUND and the middle pin isconnected to Analog Input 0 on the arduino using a wire.
Connect the trimpot as shown in the images below
The Trimpot - See the markings for pins
http://4.bp.blogspot.com/-5uXxf4agW2I/T6jxYMbK32I/AAAAAAAAAiE/XfvaAW0QgcI/s1600/trimpot1.jpg -
8/10/2019 Arduino Projects1
15/84
Place the trimpot as shown
Connect a wire between pin 1 of the trimpot and the '+'ve terminal
http://4.bp.blogspot.com/-gdHZJRz7VVA/T6jxaqazcsI/AAAAAAAAAiM/ibryImoChvY/s1600/trimpot2.jpghttp://4.bp.blogspot.com/-GMCZO1y5PzU/T6jxcoi_8UI/AAAAAAAAAiU/W8O-BJyHEL4/s1600/trimpot3.jpghttp://4.bp.blogspot.com/-gdHZJRz7VVA/T6jxaqazcsI/AAAAAAAAAiM/ibryImoChvY/s1600/trimpot2.jpghttp://4.bp.blogspot.com/-GMCZO1y5PzU/T6jxcoi_8UI/AAAAAAAAAiU/W8O-BJyHEL4/s1600/trimpot3.jpghttp://4.bp.blogspot.com/-gdHZJRz7VVA/T6jxaqazcsI/AAAAAAAAAiM/ibryImoChvY/s1600/trimpot2.jpg -
8/10/2019 Arduino Projects1
16/84
Connect a wire between pin 3 of the trimpot and the '-'ve terminal
Connect a wire between pin 2 of the trimpot and the Analog In 0 of the Arduino
http://4.bp.blogspot.com/-UuK-y40Rm-0/T6jxhBqedSI/AAAAAAAAAik/TZcgR8Ywox0/s1600/trimpot5.jpghttp://2.bp.blogspot.com/-NvVAofWsbW4/T6jxe8bv4fI/AAAAAAAAAic/Q1CK62_JzzQ/s1600/trimpot4.jpghttp://4.bp.blogspot.com/-UuK-y40Rm-0/T6jxhBqedSI/AAAAAAAAAik/TZcgR8Ywox0/s1600/trimpot5.jpghttp://2.bp.blogspot.com/-NvVAofWsbW4/T6jxe8bv4fI/AAAAAAAAAic/Q1CK62_JzzQ/s1600/trimpot4.jpg -
8/10/2019 Arduino Projects1
17/84
Here is the connection going to the Analog In 0The Analog Input pins on the Arduino let you connect sensors and other analog devices like
trimpots that product a voltage output in the range of 0-5 volts. The Analog input on Arduino isof 10-bit resolution. 10-bit resolution means that the Voltage range of 0-5 Volts is represented in1024 steps from 0-1023. So you would be reading an input value in the range of 0-1023 where1023 would correspond to 5 Volts
Arduino[the IDE!] comes with a serial library that can be used to transmit data serially to acomputer. We shall make use of this library to transmit our trimpot value to a Computer every 1second. You can open the 'Serial Monitor' in the Arduino IDE to view these values. You canopen the 'Serial Monitor' by going to the 'Tools' menu. When using the 'Serial Monitor' ensurethat the baud rate selected is the same as the one used in the program.
http://2.bp.blogspot.com/-Aa14w1tmii4/T6jxjjJ7ZJI/AAAAAAAAAis/aa6N74u-zTY/s1600/trimpot6.jpghttp://2.bp.blogspot.com/-Aa14w1tmii4/T6jxjjJ7ZJI/AAAAAAAAAis/aa6N74u-zTY/s1600/trimpot6.jpg -
8/10/2019 Arduino Projects1
18/84
Try the following program and see the values you get by varying the trimpot [simple_trimpot.ino]
/* A Simple Program to display the value read from the trimpot onto the Serial
Monitor
*/
int intensity = 0;
void setup () {Serial . begin (9600);}
void loop () {intensity = analogRead (0);Serial . print ( "Current Value:" );Serial . print ( " " );Serial . println (intensity);
}If you notice, you will see values from 0-1023. Now we are going to use the trimpot as part ofour previous experiment. We will use the button to select the active color of the RGB LED andthen use the trimpot to set the intensity of that color. Remember that this would involve scaling0-1023 to 0-255 (or divide by 4!)
Try the following program [RGB_button_trimpot.ino]/*
Pressing the Button changes the current active color of the RGB LED and varying the trimpot changes the intensity of the color
*/
int intensity = 0, pin = 9;
void setup () {pinMode (2, INPUT );Serial . begin (9600);}
void loop () {if ( digitalRead (2)==0) // Switch being pressed {
if (pin
-
8/10/2019 Arduino Projects1
19/84
Serial . print ( " " );Serial . println (intensity);
}
Heres the final setup and the output!
http://3.bp.blogspot.com/-S5exJ3GY7K0/T6jxmt5nCrI/AAAAAAAAAi0/XxLnB_dBJX8/s1600/trimpot7.jpg -
8/10/2019 Arduino Projects1
20/84
Simple Labs' Quick Start Kit for Arduino -Sensor Interfacing - LM35 Temperature
Sensor- How To?Working with Sensors - LM35
So lets get started with some sensors, LM35 is a simple temperature sensor. LM35 has 3 pins.Refer to the following image for the pin mappings
This is the LM35 as it looks
http://4.bp.blogspot.com/-Ii_Ec9hp368/T6kOlkc_ktI/AAAAAAAAAjI/dj0Z5UDWt94/s1600/LM35_1.jpg -
8/10/2019 Arduino Projects1
21/84
The LM35 pin Mapping. Note: The image on the left is a BOTTON view. This is how you willfind it in the Product Datasheet
Place the LM35 as shown
http://2.bp.blogspot.com/-E4jXSVlAWUU/T6kOkcLGj_I/AAAAAAAAAjA/RvOfB5myU2A/s1600/LM35_0.jpghttp://3.bp.blogspot.com/-Fd6bD9MlB0o/T6kOnOaZ2WI/AAAAAAAAAjQ/4WStUE6Qn1Q/s1600/LM35_2.jpghttp://2.bp.blogspot.com/-E4jXSVlAWUU/T6kOkcLGj_I/AAAAAAAAAjA/RvOfB5myU2A/s1600/LM35_0.jpghttp://3.bp.blogspot.com/-Fd6bD9MlB0o/T6kOnOaZ2WI/AAAAAAAAAjQ/4WStUE6Qn1Q/s1600/LM35_2.jpghttp://2.bp.blogspot.com/-E4jXSVlAWUU/T6kOkcLGj_I/AAAAAAAAAjA/RvOfB5myU2A/s1600/LM35_0.jpg -
8/10/2019 Arduino Projects1
22/84
Connect Wires to Supply & Ground. Take a wire from the middle pin and connect it to AnalogIn 2 of the Arduino
Heres the finished Setup Now time for the program. Try the following program. Pressing the Button changes the currentactive color of the RGB LED & prints the current temperature value to the Serial Monitor andvarying the trimpot changes the intensity of the color [RGB_button_lm35.ino]
http://2.bp.blogspot.com/-8hbyLJKhPws/T6kOodxGSbI/AAAAAAAAAjU/9XakknItgGg/s1600/LM35_3.jpghttp://2.bp.blogspot.com/-8hbyLJKhPws/T6kOodxGSbI/AAAAAAAAAjU/9XakknItgGg/s1600/LM35_3.jpghttp://2.bp.blogspot.com/-8hbyLJKhPws/T6kOodxGSbI/AAAAAAAAAjU/9XakknItgGg/s1600/LM35_3.jpg -
8/10/2019 Arduino Projects1
23/84
/* Pressing the Button changes the current active color of the RGB LED & print
s the current temperature value to the Serial Monitor and varying the trimpot changes the intensity of the color
*/
int intensity = 0, pin = 9;
void setup () {pinMode (2, INPUT );Serial . begin (9600);}
void loop () {
if ( digitalRead (2)==0) // Switch being pressed {
Serial . print ( "Temperature is : " );int temp = analogRead (2)/2;
Serial . println (temp);if (pin
-
8/10/2019 Arduino Projects1
24/84
Simple Labs' Quick Start Kit for Arduino -Sensor Interfacing - LDR Simple Light
Sensor- How To?LDR - Light Dependent Resistor - A Simple Light Sensor The LDR is a variable resistor, whose resistance varies based on the light incident upon it. Morethe light, less the resistance. Now the LDR cannot be used directly. We would need to convertthe change in resistance of the ldr to change in voltage. We can achieve this by constructing a
potential divider using the ldr and a fixed resistor. Then we can take the output of the potentialdivider and connect it to an Analog In pin on the arduino.
Follow the images below and connect the LDR
This is the LDR
http://3.bp.blogspot.com/-24B4VkEFrf8/T6kYY6BsdhI/AAAAAAAAAjs/7rthhCY-Bv4/s1600/LDR1.jpg -
8/10/2019 Arduino Projects1
25/84
Place the LDR as shown and connect a resistor as shown
Connect Supply & Ground. Take a Wire from the Junction of the Resistor & LDR and connect itto Analog In 4 of the Arduino
http://3.bp.blogspot.com/-XA3EYdm0pvM/T6kYarlNUJI/AAAAAAAAAj0/PULzGVA8Ygo/s1600/LDR2.jpghttp://1.bp.blogspot.com/-RHiW01iMbDs/T6kYccDRa3I/AAAAAAAAAj8/9iwiqTRlbXA/s1600/LDR3.jpghttp://3.bp.blogspot.com/-XA3EYdm0pvM/T6kYarlNUJI/AAAAAAAAAj0/PULzGVA8Ygo/s1600/LDR2.jpghttp://1.bp.blogspot.com/-RHiW01iMbDs/T6kYccDRa3I/AAAAAAAAAj8/9iwiqTRlbXA/s1600/LDR3.jpghttp://3.bp.blogspot.com/-XA3EYdm0pvM/T6kYarlNUJI/AAAAAAAAAj0/PULzGVA8Ygo/s1600/LDR2.jpg -
8/10/2019 Arduino Projects1
26/84
Here is how the Finished Setup will look likeTry the following Code [RGB_button_ldr.ino]/*
Pressing the Button changes the current active color of the RGB LED & prints the current temperature value to the Serial Monitor
and the light intensity detected by the LDR determines the intensity level of the active color
*/
int intensity = 0, pin = 9;void setup () {
pinMode (2, INPUT );Serial . begin (9600);
}
void loop () {if ( digitalRead (2)==0) // Switch being pressed{
int temp = analogRead (2)/2;Serial . print ( "Temperature is : " );Serial . println (temp);analogWrite (10,0);analogWrite (9,0);
analogWrite (11,0);if (pin
-
8/10/2019 Arduino Projects1
27/84
while ( digitalRead (2)==0);delay (100);
}
}
Please check the spelling mistakes in program [RGB_button_ldr.ino] and it givescompiling errors. I had corrected the errors and the program is as follows:
/*Pressing the Button changes the current active color of the RGB LED & prints the currenttemperature value to the Serial Monitor and the light intensity detected by the LDRdetermines the intensity level of the active color*/
int intensity = 0, pin = 9;void setup() {
pinMode(2,INPUT);Serial.begin(9600);}
void loop() {if(digitalRead(2)==0) // Switch being pressed{Serial.print("Temperature is : ");int temp = analogRead(2)/2;analogWrite(10,0);
Serial.println(temp);if(pin
-
8/10/2019 Arduino Projects1
28/84
Simple Labs' Quick Start Kit for Arduino -Generating Sound - Buzzer + Transistor -
How To?Generating Sound - Buzzer + Transistor
Next lets see how we can generate sound using a Buzzer. The Buzzer would require more currentthan provided by the pins of the arduino. To provide the buzzer with more current, we shall use atransistor to trigger the buzzer. The transistor in turn will be triggered by a pin on the arduino. Ifyou do not know about transistors, its advisable you check it outhttp://en.wikipedia.org/wiki/Transistor
Here's what our Transistor 2N2222A looks like
2N2222A
http://en.wikipedia.org/wiki/Transistorhttp://en.wikipedia.org/wiki/Transistorhttp://4.bp.blogspot.com/-ce-IsopIAu4/T6kb8XTXTzI/AAAAAAAAAlA/VfSyBuoeeLI/s1600/Tran1.jpghttp://en.wikipedia.org/wiki/Transistor -
8/10/2019 Arduino Projects1
29/84
-
8/10/2019 Arduino Projects1
30/84
-
8/10/2019 Arduino Projects1
31/84
Now Connect a Wire from the Other end of the Resistor to the 7th pin (digital) of the Arduino
Here is how the Final Setup Looks Like
http://3.bp.blogspot.com/-tBCcg3S89rI/T6kb5ReJiJI/AAAAAAAAAkw/HViWyelRKtk/s1600/Buzzer4.jpghttp://3.bp.blogspot.com/-6nBKKC6ia6M/T6kb6zyAJRI/AAAAAAAAAk4/1_78sL0MXkU/s1600/Buzzer5.jpghttp://3.bp.blogspot.com/-tBCcg3S89rI/T6kb5ReJiJI/AAAAAAAAAkw/HViWyelRKtk/s1600/Buzzer4.jpghttp://3.bp.blogspot.com/-6nBKKC6ia6M/T6kb6zyAJRI/AAAAAAAAAk4/1_78sL0MXkU/s1600/Buzzer5.jpghttp://3.bp.blogspot.com/-tBCcg3S89rI/T6kb5ReJiJI/AAAAAAAAAkw/HViWyelRKtk/s1600/Buzzer4.jpg -
8/10/2019 Arduino Projects1
32/84
Try the following code where the Buzzer stays on as you keep pressing the Button in our previous program [RGB_button_ldr_buzzer.ino]/*
Pressing the Button changes the current active color of the RGB LED & prints the current temperature value to the Serial Monitor and Generates a Buzzertone
for the duration the button is being pressed. The light intensity detected by the LDR determines the intensity level of the active color
*/
int intensity = 0, pin = 9;
void setup () {pinMode (2, INPUT );pinMode (7, OUTPUT);Serial . begin (9600);}
void loop () {
if ( digitalRead (2)==0) // Switch being pressed {
digitalWrite (7, HIGH);Serial . print ( "Temperature is : " );int temp = analogRead (2)/2;Serial . println (temp);
if (pin
-
8/10/2019 Arduino Projects1
33/84
Simple Labs' Quick Start Kit for Arduino -7-Segment Display Interfacing- How To?
The 7-Segment Display
7-Segment displays are another common component in the world of electronics. These displayshave 8 LEDs split into different segments designed to be able to display numerals from 0-9 and adot. All The LEDs have a common ground / supply line. There are 5 pins at the top and 5 pins atthe bottom. The middle pins in the top and bottom are connected to each other internally andhave to be connected to Ground / Supply depending upon the type of the 7-segment Display.You can control each segment like an individual LED. However, this method of controlling the7-segment LED to display numbers would be hectic. So, we will use a technique called PortManipulation. Pins on the Arduino are grouped together as a PORT. You can control a wholePORT at a time. Read the following write up on the Arduino website before you proceed => Port
Manipulation The 7-Segment Display included in the starter kit is a Common Cathode Type.
7 - Segment LED
http://www.arduino.cc/en/Reference/PortManipulationhttp://www.arduino.cc/en/Reference/PortManipulationhttp://www.arduino.cc/en/Reference/PortManipulationhttp://www.arduino.cc/en/Reference/PortManipulationhttp://4.bp.blogspot.com/-d4ug4mb_Cw0/T6y7ZVrbb-I/AAAAAAAAAsE/nj6Tfp0j26s/s1600/SEV1.jpghttp://www.arduino.cc/en/Reference/PortManipulationhttp://www.arduino.cc/en/Reference/PortManipulation -
8/10/2019 Arduino Projects1
34/84
Segment & Pin Mapping of a 7-Segment LED / We will be connecting segments A-G & P todigital pins 0-6 & 7 of the Arduino
Place the 7-segment Display on the Breadboard.
http://3.bp.blogspot.com/-wQ1lwH7QAhM/T6zz-MMRKUI/AAAAAAAAAtw/ZZ2ptND8sBQ/s1600/7seg_pinouts.pnghttp://2.bp.blogspot.com/-FF0qft6lvh0/T6y7fsbWl5I/AAAAAAAAAsk/L_UstCPCELk/s1600/SEV2.jpghttp://3.bp.blogspot.com/-wQ1lwH7QAhM/T6zz-MMRKUI/AAAAAAAAAtw/ZZ2ptND8sBQ/s1600/7seg_pinouts.pnghttp://2.bp.blogspot.com/-FF0qft6lvh0/T6y7fsbWl5I/AAAAAAAAAsk/L_UstCPCELk/s1600/SEV2.jpghttp://3.bp.blogspot.com/-wQ1lwH7QAhM/T6zz-MMRKUI/AAAAAAAAAtw/ZZ2ptND8sBQ/s1600/7seg_pinouts.png -
8/10/2019 Arduino Projects1
35/84
Place a 1K resistor between the middle pin on the top and the '-'ve terminal
Connect a Wire from Segment A to digital pin 0 of the Arduino
http://1.bp.blogspot.com/-f9pN-2qpzgk/T6y7hGVxt-I/AAAAAAAAAss/It6WiQ5FDEQ/s1600/SEV3.jpghttp://1.bp.blogspot.com/-_q30QXnHUCM/T6y7inaVv5I/AAAAAAAAAs0/w-_IN1FDF6s/s1600/SEV4.jpghttp://1.bp.blogspot.com/-f9pN-2qpzgk/T6y7hGVxt-I/AAAAAAAAAss/It6WiQ5FDEQ/s1600/SEV3.jpghttp://1.bp.blogspot.com/-_q30QXnHUCM/T6y7inaVv5I/AAAAAAAAAs0/w-_IN1FDF6s/s1600/SEV4.jpghttp://1.bp.blogspot.com/-f9pN-2qpzgk/T6y7hGVxt-I/AAAAAAAAAss/It6WiQ5FDEQ/s1600/SEV3.jpg -
8/10/2019 Arduino Projects1
36/84
Connect a Wire from Segment B to digital pin 1 of the Arduino
Connect a Wire from Segment C to digital pin 2 of the Arduino
http://3.bp.blogspot.com/-TKZcpXQPlDM/T6y7kKymi6I/AAAAAAAAAs8/8EDRU54TUJU/s1600/SEV5.jpghttp://3.bp.blogspot.com/-zEon3LE39Hw/T6y7lrSiSHI/AAAAAAAAAtE/88pOizpna7k/s1600/SEV6.jpghttp://3.bp.blogspot.com/-TKZcpXQPlDM/T6y7kKymi6I/AAAAAAAAAs8/8EDRU54TUJU/s1600/SEV5.jpghttp://3.bp.blogspot.com/-zEon3LE39Hw/T6y7lrSiSHI/AAAAAAAAAtE/88pOizpna7k/s1600/SEV6.jpghttp://3.bp.blogspot.com/-TKZcpXQPlDM/T6y7kKymi6I/AAAAAAAAAs8/8EDRU54TUJU/s1600/SEV5.jpg -
8/10/2019 Arduino Projects1
37/84
Connect a Wire from Segment D to digital pin 3 of the Arduino
Connect a Wire from Segment E to digital pin 4 of the Arduino
http://3.bp.blogspot.com/-Xp9doZ7k9Ks/T6y7nc2IvFI/AAAAAAAAAtM/MRrkSoFQu_w/s1600/SEV7.jpghttp://1.bp.blogspot.com/-8Qi5-LuLsJg/T6y7pNoEMVI/AAAAAAAAAtU/5LuyQKwk14M/s1600/SEV8.jpghttp://3.bp.blogspot.com/-Xp9doZ7k9Ks/T6y7nc2IvFI/AAAAAAAAAtM/MRrkSoFQu_w/s1600/SEV7.jpghttp://1.bp.blogspot.com/-8Qi5-LuLsJg/T6y7pNoEMVI/AAAAAAAAAtU/5LuyQKwk14M/s1600/SEV8.jpghttp://3.bp.blogspot.com/-Xp9doZ7k9Ks/T6y7nc2IvFI/AAAAAAAAAtM/MRrkSoFQu_w/s1600/SEV7.jpg -
8/10/2019 Arduino Projects1
38/84
Connect a Wire from Segment F to digital pin 5 of the Arduino
Connect a Wire from Segment G to digital pin 6 of the Arduino
http://3.bp.blogspot.com/-ydqhDxVfxOY/T6y7q3c_ZsI/AAAAAAAAAtc/pbULDuBdEEw/s1600/SEV9.jpghttp://1.bp.blogspot.com/-AYABKioQkdM/T6y7a9WNveI/AAAAAAAAAsM/k_XlVk4wM4I/s1600/SEV10.jpghttp://3.bp.blogspot.com/-ydqhDxVfxOY/T6y7q3c_ZsI/AAAAAAAAAtc/pbULDuBdEEw/s1600/SEV9.jpghttp://1.bp.blogspot.com/-AYABKioQkdM/T6y7a9WNveI/AAAAAAAAAsM/k_XlVk4wM4I/s1600/SEV10.jpghttp://3.bp.blogspot.com/-ydqhDxVfxOY/T6y7q3c_ZsI/AAAAAAAAAtc/pbULDuBdEEw/s1600/SEV9.jpg -
8/10/2019 Arduino Projects1
39/84
Connect a Wire from Segment P to digital pin 7 of the Arduino
Our Final Setup with a Program
http://4.bp.blogspot.com/-700ytV5VYHM/T6y7cMzH2MI/AAAAAAAAAsU/hkQdRY3-S5o/s1600/SEV11.jpghttp://2.bp.blogspot.com/-QBTKKgwDOVE/T6y7dvz_AEI/AAAAAAAAAsc/t6w05vr-1DU/s1600/SEV12.jpghttp://4.bp.blogspot.com/-700ytV5VYHM/T6y7cMzH2MI/AAAAAAAAAsU/hkQdRY3-S5o/s1600/SEV11.jpghttp://2.bp.blogspot.com/-QBTKKgwDOVE/T6y7dvz_AEI/AAAAAAAAAsc/t6w05vr-1DU/s1600/SEV12.jpghttp://4.bp.blogspot.com/-700ytV5VYHM/T6y7cMzH2MI/AAAAAAAAAsU/hkQdRY3-S5o/s1600/SEV11.jpg -
8/10/2019 Arduino Projects1
40/84
First Try the following program that cycles from digits 0 - 9. [SEV_SEG.ino]/*
This is to Display numbers 0-9 on the seven segment LED
*/
/*
WiringSeg A - Pin 0 Seg B - Pin 1 Seg C - Pin 2 Seg D - Pin 3 Seg E - Pin 4 Seg F - Pin 5 Seg G - Pin 6 Seg H - Pin 7
*/
/* To Display '0' we need to make high All Segments except G & H based on this lets make a list of values to write to port D [pins 0-7 are grouped together as port D] When we write a binary value to the port the MSB or the 8th bit will be written to pin 7 and the lsb will be written to pin 0
0 => B00111111 1 => B00000110 2 => B01011011 3 => B01001111 4 => B01100110
5 => B01101101 6 => B01111101 7 => B00000111 8 => B01111111 9 => B01101111
*/
int val[]={B00111111,B00000110,B01011011,B01001111,B01100110,B01101101,B01111101, B00000111, B01111111, B01101111};
void setup (){
DDRD = B11111111;}
void loop (){
for ( int i=0; i
-
8/10/2019 Arduino Projects1
41/84
-
8/10/2019 Arduino Projects1
42/84
-
8/10/2019 Arduino Projects1
43/84
-
8/10/2019 Arduino Projects1
44/84
Connect the Brown wire of the IR sensor to the 8th pin of the Arduino
This is how your final setup should look like
http://2.bp.blogspot.com/-8XQfgPGnxdo/T6yMvrhpcQI/AAAAAAAAAm4/H-F-Nq9hI_M/s1600/IR3.JPGhttp://3.bp.blogspot.com/-ahQ12lpQPAw/T6yMyfsl8GI/AAAAAAAAAnA/9jB7upv6JUQ/s1600/IR4.JPGhttp://2.bp.blogspot.com/-8XQfgPGnxdo/T6yMvrhpcQI/AAAAAAAAAm4/H-F-Nq9hI_M/s1600/IR3.JPGhttp://3.bp.blogspot.com/-ahQ12lpQPAw/T6yMyfsl8GI/AAAAAAAAAnA/9jB7upv6JUQ/s1600/IR4.JPGhttp://2.bp.blogspot.com/-8XQfgPGnxdo/T6yMvrhpcQI/AAAAAAAAAm4/H-F-Nq9hI_M/s1600/IR3.JPG -
8/10/2019 Arduino Projects1
45/84
Lets program to trigger the Buzzer everytime the sensor gives a HIGH signal. Try the following program. [ULN_Buzzer_IR.ino]/* ULN2003- Buzzer This program drives a Buzzer using ULN2003*/
void setup (){
pinMode (7, OUTPUT);}void loop (){
digitalWrite (7, HIGH);delay (2000);digitalWrite (7, LOW);delay (3000);
}
Simple Labs' Quick Start Kit for Arduino - LCDInterfacing - How To?LCD - Liquid Crystal Display LCDs are commonly used display devices that you would find in most appliances / electronicdevices. Your music players, Pay phones, Etc.
Here's an interesting Write up to get you understanding the working of the LCDhttp://joshuagalloway.com/lcd.html
Wiring up the LCD
http://joshuagalloway.com/lcd.htmlhttp://joshuagalloway.com/lcd.htmlhttp://joshuagalloway.com/lcd.html -
8/10/2019 Arduino Projects1
46/84
The 16x2 LCD Display
LCD Pin Mappings
http://2.bp.blogspot.com/-8lLPsnXFIIQ/T6ycLG3OFSI/AAAAAAAAAqI/aWLkb05uUrI/s1600/LCD3.JPGhttp://4.bp.blogspot.com/-o5itaO6TcvE/T1LcUU3-B3I/AAAAAAAAAfI/YmUH-EZQ_Is/s640/LCD_Pins.jpghttp://2.bp.blogspot.com/-8lLPsnXFIIQ/T6ycLG3OFSI/AAAAAAAAAqI/aWLkb05uUrI/s1600/LCD3.JPGhttp://4.bp.blogspot.com/-o5itaO6TcvE/T1LcUU3-B3I/AAAAAAAAAfI/YmUH-EZQ_Is/s640/LCD_Pins.jpghttp://2.bp.blogspot.com/-8lLPsnXFIIQ/T6ycLG3OFSI/AAAAAAAAAqI/aWLkb05uUrI/s1600/LCD3.JPG -
8/10/2019 Arduino Projects1
47/84
-
8/10/2019 Arduino Projects1
48/84
This is what you should have now
Place the Trimpot Next to the LCD as shown (a bit away from the LCD pins)
http://3.bp.blogspot.com/-hua8dkKC9jE/T6ycSFiRGeI/AAAAAAAAAqY/FYGWwWn5Gjo/s1600/LCD5.JPGhttp://3.bp.blogspot.com/-oQRNYDTem1Q/T6ycUZKMIJI/AAAAAAAAAqg/cOvNjG-NtHk/s1600/LCD6.JPGhttp://3.bp.blogspot.com/-hua8dkKC9jE/T6ycSFiRGeI/AAAAAAAAAqY/FYGWwWn5Gjo/s1600/LCD5.JPGhttp://3.bp.blogspot.com/-oQRNYDTem1Q/T6ycUZKMIJI/AAAAAAAAAqg/cOvNjG-NtHk/s1600/LCD6.JPGhttp://3.bp.blogspot.com/-hua8dkKC9jE/T6ycSFiRGeI/AAAAAAAAAqY/FYGWwWn5Gjo/s1600/LCD5.JPG -
8/10/2019 Arduino Projects1
49/84
Connect the Supply & Ground Lines for the Trimpot
The First and Last pins of the LCD are GND pins. First Connect a Wire from the 1st pin of theLCD to the '-'ve terminal
http://2.bp.blogspot.com/-UskI6AtUdr4/T6ycW70KVSI/AAAAAAAAAqo/bfxvlQZq1s8/s1600/LCD7.JPGhttp://3.bp.blogspot.com/-rOjrrnSwkR4/T6ycZHk3dJI/AAAAAAAAAqw/sydFeiV3qcs/s1600/LCD8.JPGhttp://2.bp.blogspot.com/-UskI6AtUdr4/T6ycW70KVSI/AAAAAAAAAqo/bfxvlQZq1s8/s1600/LCD7.JPGhttp://3.bp.blogspot.com/-rOjrrnSwkR4/T6ycZHk3dJI/AAAAAAAAAqw/sydFeiV3qcs/s1600/LCD8.JPGhttp://2.bp.blogspot.com/-UskI6AtUdr4/T6ycW70KVSI/AAAAAAAAAqo/bfxvlQZq1s8/s1600/LCD7.JPG -
8/10/2019 Arduino Projects1
50/84
Connect a wire from the 16th pin of the LCD to the '-'ve terminal
The 2nd & 15th Pins of the LCD are Supply Pins, Connect Wires from these to the '+'veTerminal as shown
http://3.bp.blogspot.com/-aCtEWHj70Mc/T6ycbs8UazI/AAAAAAAAAq4/DBiR50o1UqU/s1600/LCD9.JPGhttp://3.bp.blogspot.com/-ifQBIb4uIg8/T6ybrUo3Q4I/AAAAAAAAAoo/BhQQScOUjFI/s1600/LCD10.JPGhttp://3.bp.blogspot.com/-aCtEWHj70Mc/T6ycbs8UazI/AAAAAAAAAq4/DBiR50o1UqU/s1600/LCD9.JPGhttp://3.bp.blogspot.com/-ifQBIb4uIg8/T6ybrUo3Q4I/AAAAAAAAAoo/BhQQScOUjFI/s1600/LCD10.JPGhttp://3.bp.blogspot.com/-aCtEWHj70Mc/T6ycbs8UazI/AAAAAAAAAq4/DBiR50o1UqU/s1600/LCD9.JPG -
8/10/2019 Arduino Projects1
51/84
The 5th of the LCD is the RW pin. This pin is used to toggle between Read / Write Mode of theLCD. Writing a HIGH signal to this pin corresponds to Read Mode and Writing a LOW signal
corresponds to Write Mode. Since we will be using only the Write mode, we can wire this pin toGND / '-'ve terminal [This is equivalent of writing a LOW signal to the pin]
Connect a Wire from the middle pin of the trimpot to the 3rd pin of the LCD. The 3rd pin of theLCD is the contrast pin and the contrast of the display can be varied by varying the trimpot
http://2.bp.blogspot.com/-yI0T1nM0y70/T6ybt9oupUI/AAAAAAAAAow/cQg94xsIKhA/s1600/LCD11.JPGhttp://1.bp.blogspot.com/-ax2o-8_K5h8/T6ybwNyPlXI/AAAAAAAAAo4/WXSMgwmB6Rk/s1600/LCD12.JPGhttp://2.bp.blogspot.com/-yI0T1nM0y70/T6ybt9oupUI/AAAAAAAAAow/cQg94xsIKhA/s1600/LCD11.JPGhttp://1.bp.blogspot.com/-ax2o-8_K5h8/T6ybwNyPlXI/AAAAAAAAAo4/WXSMgwmB6Rk/s1600/LCD12.JPGhttp://2.bp.blogspot.com/-yI0T1nM0y70/T6ybt9oupUI/AAAAAAAAAow/cQg94xsIKhA/s1600/LCD11.JPG -
8/10/2019 Arduino Projects1
52/84
Connect a Wire between the RS pin of the LCD (4th pin) and digital pin 2 of the Arudino. TheRS pin helps select between the 2 registers of an LCD - Data & Command - for communication
Connect a wire between the Enable pin (the 6th pin) of the LCD and digital pin 4 of the Arduino
http://3.bp.blogspot.com/-7Aw-kGdlhsM/T6yby6U4ScI/AAAAAAAAApA/R42wdNLv0Nc/s1600/LCD13.JPGhttp://2.bp.blogspot.com/-OBo2jiwmQvY/T6yb1kapMzI/AAAAAAAAApI/KeQqCvSPRQ8/s1600/LCD14.JPGhttp://3.bp.blogspot.com/-7Aw-kGdlhsM/T6yby6U4ScI/AAAAAAAAApA/R42wdNLv0Nc/s1600/LCD13.JPGhttp://2.bp.blogspot.com/-OBo2jiwmQvY/T6yb1kapMzI/AAAAAAAAApI/KeQqCvSPRQ8/s1600/LCD14.JPGhttp://3.bp.blogspot.com/-7Aw-kGdlhsM/T6yby6U4ScI/AAAAAAAAApA/R42wdNLv0Nc/s1600/LCD13.JPG -
8/10/2019 Arduino Projects1
53/84
Connect a Wire between D4 of the LCD (11th pin) and digital pin 8 of the Arduino
Connect a Wire between D5 of the LCD (12th pin) and digital pin 9 of the Arduino
http://2.bp.blogspot.com/-rdXj2tLHMLY/T6yb5SuWM0I/AAAAAAAAApQ/fMWKYG3TAtI/s1600/LCD15.JPGhttp://3.bp.blogspot.com/-Rs8lrBPtzYc/T6yb7ygnHVI/AAAAAAAAApY/s1ER-FJRl-Y/s1600/LCD16.JPGhttp://2.bp.blogspot.com/-rdXj2tLHMLY/T6yb5SuWM0I/AAAAAAAAApQ/fMWKYG3TAtI/s1600/LCD15.JPGhttp://3.bp.blogspot.com/-Rs8lrBPtzYc/T6yb7ygnHVI/AAAAAAAAApY/s1ER-FJRl-Y/s1600/LCD16.JPGhttp://2.bp.blogspot.com/-rdXj2tLHMLY/T6yb5SuWM0I/AAAAAAAAApQ/fMWKYG3TAtI/s1600/LCD15.JPG -
8/10/2019 Arduino Projects1
54/84
Connect a Wire between D6 of the LCD (13th pin) and digital pin 10 of the Arduino
Connect a Wire between D7of the LCD (14th pin) and digital pin 11 of the Arduino
http://2.bp.blogspot.com/-CQw6kJ7kNQA/T6yb-CaMcfI/AAAAAAAAApg/5f3KTpp32jY/s1600/LCD17.JPGhttp://2.bp.blogspot.com/-ZezgAHxqVzw/T6ycAqMcChI/AAAAAAAAApo/qb0dovwRVHI/s1600/LCD18.JPGhttp://2.bp.blogspot.com/-CQw6kJ7kNQA/T6yb-CaMcfI/AAAAAAAAApg/5f3KTpp32jY/s1600/LCD17.JPGhttp://2.bp.blogspot.com/-ZezgAHxqVzw/T6ycAqMcChI/AAAAAAAAApo/qb0dovwRVHI/s1600/LCD18.JPGhttp://2.bp.blogspot.com/-CQw6kJ7kNQA/T6yb-CaMcfI/AAAAAAAAApg/5f3KTpp32jY/s1600/LCD17.JPG -
8/10/2019 Arduino Projects1
55/84
The Finished Setup
Sample Hello World ProgramSo Lets program the LCD. We can take the sample hello world program found under File ->Examples -> LiquidCrystal menu of Arduino IDE and change the pin numbers in the followingstatement
http://4.bp.blogspot.com/-WLR55na-1Uk/T6ycDRKEbuI/AAAAAAAAApw/CC6rWIAUoMY/s1600/LCD19.JPGhttp://2.bp.blogspot.com/-CXZCW_OUvqc/T6ycIf66qzI/AAAAAAAAAqA/-uN1Y6YksQk/s1600/LCD20.JPGhttp://4.bp.blogspot.com/-WLR55na-1Uk/T6ycDRKEbuI/AAAAAAAAApw/CC6rWIAUoMY/s1600/LCD19.JPGhttp://2.bp.blogspot.com/-CXZCW_OUvqc/T6ycIf66qzI/AAAAAAAAAqA/-uN1Y6YksQk/s1600/LCD20.JPGhttp://4.bp.blogspot.com/-WLR55na-1Uk/T6ycDRKEbuI/AAAAAAAAApw/CC6rWIAUoMY/s1600/LCD19.JPG -
8/10/2019 Arduino Projects1
56/84
FromLiquidCrystal lcd(12, 11, 5, 4, 3, 2);ToLiquidCrystal lcd(2,4,8,9,10,11);
####IMPORTANT - IN CASE NOTHING IS DISPLAYED ON THE LCD KEEP VARYINGTHE TRIMPOT TILL YOU CAN SEE THE CHARACTERS###
Try the following Simple LCD program [Simple_LCD.ino]/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with theHitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface.
*/
// include the library code: #include < LiquidCrystal .h>
// initialize the library with the numbers of the interface pins LiquidCrystal lcd(2,4,8,9,10,11);
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);
}
-
8/10/2019 Arduino Projects1
57/84
-
8/10/2019 Arduino Projects1
58/84
Simple Labs' Quick Start Kit for Arduino -LCD Interfacing - How To?LCD - Liquid Crystal Display LCDs are commonly used display devices that you would find in most appliances / electronicdevices. Your music players, Pay phones, Etc.
Here's an interesting Write up to get you understanding the working of the LCDhttp://joshuagalloway.com/lcd.html
Wiring up the LCD
The 16x2 LCD Display
http://joshuagalloway.com/lcd.htmlhttp://joshuagalloway.com/lcd.htmlhttp://2.bp.blogspot.com/-8lLPsnXFIIQ/T6ycLG3OFSI/AAAAAAAAAqI/aWLkb05uUrI/s1600/LCD3.JPGhttp://joshuagalloway.com/lcd.html -
8/10/2019 Arduino Projects1
59/84
LCD Pin Mappings
First Connect A Wire between the GND pin of the Arduino and the '-'ve terminal. Then ConnectAnother Wire from the 5V pin of the Arduino to the '+'ve terminal.
http://4.bp.blogspot.com/-o5itaO6TcvE/T1LcUU3-B3I/AAAAAAAAAfI/YmUH-EZQ_Is/s640/LCD_Pins.jpghttp://4.bp.blogspot.com/-EJwseDHEv8c/T6ycGBeyAYI/AAAAAAAAAp4/DJEDCxgd5A0/s1600/LCD2.JPGhttp://4.bp.blogspot.com/-o5itaO6TcvE/T1LcUU3-B3I/AAAAAAAAAfI/YmUH-EZQ_Is/s640/LCD_Pins.jpghttp://4.bp.blogspot.com/-EJwseDHEv8c/T6ycGBeyAYI/AAAAAAAAAp4/DJEDCxgd5A0/s1600/LCD2.JPGhttp://4.bp.blogspot.com/-o5itaO6TcvE/T1LcUU3-B3I/AAAAAAAAAfI/YmUH-EZQ_Is/s640/LCD_Pins.jpg -
8/10/2019 Arduino Projects1
60/84
-
8/10/2019 Arduino Projects1
61/84
Place the Trimpot Next to the LCD as shown (a bit away from the LCD pins)
http://3.bp.blogspot.com/-oQRNYDTem1Q/T6ycUZKMIJI/AAAAAAAAAqg/cOvNjG-NtHk/s1600/LCD6.JPGhttp://3.bp.blogspot.com/-oQRNYDTem1Q/T6ycUZKMIJI/AAAAAAAAAqg/cOvNjG-NtHk/s1600/LCD6.JPG -
8/10/2019 Arduino Projects1
62/84
Connect the Supply & Ground Lines for the Trimpot
http://2.bp.blogspot.com/-UskI6AtUdr4/T6ycW70KVSI/AAAAAAAAAqo/bfxvlQZq1s8/s1600/LCD7.JPGhttp://2.bp.blogspot.com/-UskI6AtUdr4/T6ycW70KVSI/AAAAAAAAAqo/bfxvlQZq1s8/s1600/LCD7.JPG -
8/10/2019 Arduino Projects1
63/84
The First and Last pins of the LCD are GND pins. First Connect a Wire from the 1st pin of the
LCD to the '-'ve terminal
http://3.bp.blogspot.com/-rOjrrnSwkR4/T6ycZHk3dJI/AAAAAAAAAqw/sydFeiV3qcs/s1600/LCD8.JPGhttp://3.bp.blogspot.com/-rOjrrnSwkR4/T6ycZHk3dJI/AAAAAAAAAqw/sydFeiV3qcs/s1600/LCD8.JPG -
8/10/2019 Arduino Projects1
64/84
Connect a wire from the 16th pin of the LCD to the '-'ve terminal
http://3.bp.blogspot.com/-aCtEWHj70Mc/T6ycbs8UazI/AAAAAAAAAq4/DBiR50o1UqU/s1600/LCD9.JPGhttp://3.bp.blogspot.com/-aCtEWHj70Mc/T6ycbs8UazI/AAAAAAAAAq4/DBiR50o1UqU/s1600/LCD9.JPG -
8/10/2019 Arduino Projects1
65/84
The 2nd & 15th Pins of the LCD are Supply Pins, Connect Wires from these to the '+'ve
Terminal as shown
http://3.bp.blogspot.com/-ifQBIb4uIg8/T6ybrUo3Q4I/AAAAAAAAAoo/BhQQScOUjFI/s1600/LCD10.JPGhttp://3.bp.blogspot.com/-ifQBIb4uIg8/T6ybrUo3Q4I/AAAAAAAAAoo/BhQQScOUjFI/s1600/LCD10.JPG -
8/10/2019 Arduino Projects1
66/84
The 5th of the LCD is the RW pin. This pin is used to toggle between Read / Write Mode of the
LCD. Writing a HIGH signal to this pin corresponds to Read Mode and Writing a LOW signalcorresponds to Write Mode. Since we will be using only the Write mode, we can wire this pin toGND / '-'ve terminal [This is equivalent of writing a LOW signal to the pin]
http://2.bp.blogspot.com/-yI0T1nM0y70/T6ybt9oupUI/AAAAAAAAAow/cQg94xsIKhA/s1600/LCD11.JPGhttp://2.bp.blogspot.com/-yI0T1nM0y70/T6ybt9oupUI/AAAAAAAAAow/cQg94xsIKhA/s1600/LCD11.JPG -
8/10/2019 Arduino Projects1
67/84
Connect a Wire from the middle pin of the trimpot to the 3rd pin of the LCD. The 3rd pin of the
LCD is the contrast pin and the contrast of the display can be varied by varying the trimpot
http://1.bp.blogspot.com/-ax2o-8_K5h8/T6ybwNyPlXI/AAAAAAAAAo4/WXSMgwmB6Rk/s1600/LCD12.JPGhttp://1.bp.blogspot.com/-ax2o-8_K5h8/T6ybwNyPlXI/AAAAAAAAAo4/WXSMgwmB6Rk/s1600/LCD12.JPG -
8/10/2019 Arduino Projects1
68/84
-
8/10/2019 Arduino Projects1
69/84
Connect a wire between the Enable pin (the 6th pin) of the LCD and digital pin 4 of the Arduino
http://2.bp.blogspot.com/-OBo2jiwmQvY/T6yb1kapMzI/AAAAAAAAApI/KeQqCvSPRQ8/s1600/LCD14.JPGhttp://2.bp.blogspot.com/-OBo2jiwmQvY/T6yb1kapMzI/AAAAAAAAApI/KeQqCvSPRQ8/s1600/LCD14.JPG -
8/10/2019 Arduino Projects1
70/84
Connect a Wire between D4 of the LCD (11th pin) and digital pin 8 of the Arduino
http://2.bp.blogspot.com/-rdXj2tLHMLY/T6yb5SuWM0I/AAAAAAAAApQ/fMWKYG3TAtI/s1600/LCD15.JPGhttp://2.bp.blogspot.com/-rdXj2tLHMLY/T6yb5SuWM0I/AAAAAAAAApQ/fMWKYG3TAtI/s1600/LCD15.JPG -
8/10/2019 Arduino Projects1
71/84
Connect a Wire between D5 of the LCD (12th pin) and digital pin 9 of the Arduino
http://3.bp.blogspot.com/-Rs8lrBPtzYc/T6yb7ygnHVI/AAAAAAAAApY/s1ER-FJRl-Y/s1600/LCD16.JPGhttp://3.bp.blogspot.com/-Rs8lrBPtzYc/T6yb7ygnHVI/AAAAAAAAApY/s1ER-FJRl-Y/s1600/LCD16.JPG -
8/10/2019 Arduino Projects1
72/84
Connect a Wire between D6 of the LCD (13th pin) and digital pin 10 of the Arduino
http://2.bp.blogspot.com/-CQw6kJ7kNQA/T6yb-CaMcfI/AAAAAAAAApg/5f3KTpp32jY/s1600/LCD17.JPGhttp://2.bp.blogspot.com/-CQw6kJ7kNQA/T6yb-CaMcfI/AAAAAAAAApg/5f3KTpp32jY/s1600/LCD17.JPG -
8/10/2019 Arduino Projects1
73/84
Connect a Wire between D7of the LCD (14th pin) and digital pin 11 of the Arduino
http://2.bp.blogspot.com/-ZezgAHxqVzw/T6ycAqMcChI/AAAAAAAAApo/qb0dovwRVHI/s1600/LCD18.JPGhttp://2.bp.blogspot.com/-ZezgAHxqVzw/T6ycAqMcChI/AAAAAAAAApo/qb0dovwRVHI/s1600/LCD18.JPG -
8/10/2019 Arduino Projects1
74/84
The Finished Setup
http://4.bp.blogspot.com/-WLR55na-1Uk/T6ycDRKEbuI/AAAAAAAAApw/CC6rWIAUoMY/s1600/LCD19.JPGhttp://4.bp.blogspot.com/-WLR55na-1Uk/T6ycDRKEbuI/AAAAAAAAApw/CC6rWIAUoMY/s1600/LCD19.JPG -
8/10/2019 Arduino Projects1
75/84
Sample Hello World ProgramSo Lets program the LCD. We can take the sample hello world program found under File ->
Examples -> LiquidCrystal menu of Arduino IDE and change the pin numbers in the followingstatementFromLiquidCrystal lcd(12, 11, 5, 4, 3, 2);ToLiquidCrystal lcd(2,4,8,9,10,11);
####IMPORTANT - IN CASE NOTHING IS DISPLAYED ON THE LCD KEEP VARYINGTHE TRIMPOT TILL YOU CAN SEE THE CHARACTERS###
Try the following Simple LCD program [Simple_LCD.ino]/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with theHitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface.
*/
http://2.bp.blogspot.com/-CXZCW_OUvqc/T6ycIf66qzI/AAAAAAAAAqA/-uN1Y6YksQk/s1600/LCD20.JPGhttp://2.bp.blogspot.com/-CXZCW_OUvqc/T6ycIf66qzI/AAAAAAAAAqA/-uN1Y6YksQk/s1600/LCD20.JPG -
8/10/2019 Arduino Projects1
76/84
// include the library code: #include < LiquidCrystal .h>
// initialize the library with the numbers of the interface pins LiquidCrystal lcd(2,4,8,9,10,11);
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);
}
// include the library code:#include
// initialize the library with the numbers of the interface pinsLiquidCrystal lcd(2,4,8,9,10,11);
void setup(){// set up the LCD's number of columns and rows:
lcd.begin(16, 2);// initialize the serial communications:Serial.begin(9600);}
void loop(){// when characters arrive over the serial port...if (Serial.available()) {// wait a bit for the entire message to arrivedelay(100);
// clear the screenlcd.clear();// read all the available characterswhile (Serial.available() > 0) {// display each character to the LCDlcd.write(Serial.read());
}
-
8/10/2019 Arduino Projects1
77/84
-
8/10/2019 Arduino Projects1
78/84
-
8/10/2019 Arduino Projects1
79/84
Connect a Wire from the 4th pin of DS1307 (GND) to the '-'ve terminal
Connect a Wire from the 8th pin of DS1307 (+5V) to the '+'ve terminal
http://3.bp.blogspot.com/-v_gdim6a7RQ/T6yUM_vuPHI/AAAAAAAAAnc/fr1yGa-n84k/s1600/RTC3.JPGhttp://4.bp.blogspot.com/-8HNps3EmOKg/T6yUPCmlrDI/AAAAAAAAAnk/1qgraS3E4aw/s1600/RTC4.JPGhttp://3.bp.blogspot.com/-v_gdim6a7RQ/T6yUM_vuPHI/AAAAAAAAAnc/fr1yGa-n84k/s1600/RTC3.JPGhttp://4.bp.blogspot.com/-8HNps3EmOKg/T6yUPCmlrDI/AAAAAAAAAnk/1qgraS3E4aw/s1600/RTC4.JPGhttp://3.bp.blogspot.com/-v_gdim6a7RQ/T6yUM_vuPHI/AAAAAAAAAnc/fr1yGa-n84k/s1600/RTC3.JPG -
8/10/2019 Arduino Projects1
80/84
Place the Cyrstal as shown between the 1st and 2nd pin of the DS1307 IC- There is no polarity('+' / '-' ve) for the crystal. So you can place it anyway
Place one resistor between the SDA Pin and the '+'ve terminal and one resistor between the SCLPin and the '+'ve terminal
http://2.bp.blogspot.com/-adfzS6GGyqA/T6yURd3L-yI/AAAAAAAAAns/3W4_tsD92VE/s1600/RTC5.JPGhttp://4.bp.blogspot.com/-WwwkwNaOpYI/T6yUT2-tV1I/AAAAAAAAAn0/jQcnztCBei8/s1600/RTC6.JPGhttp://2.bp.blogspot.com/-adfzS6GGyqA/T6yURd3L-yI/AAAAAAAAAns/3W4_tsD92VE/s1600/RTC5.JPGhttp://4.bp.blogspot.com/-WwwkwNaOpYI/T6yUT2-tV1I/AAAAAAAAAn0/jQcnztCBei8/s1600/RTC6.JPGhttp://2.bp.blogspot.com/-adfzS6GGyqA/T6yURd3L-yI/AAAAAAAAAns/3W4_tsD92VE/s1600/RTC5.JPG -
8/10/2019 Arduino Projects1
81/84
Connect a Wire between the SDA pin (pin5 of DS1307) and the SDA pin of the Arduino(Analog IN 4)
Connect a Wire between the SCL pin (pin6 of DS1307) and the SCL pin of the Arduino (AnalogIN 5)
http://4.bp.blogspot.com/-4t8LwS_dB_A/T6yUWhgJDJI/AAAAAAAAAn8/YPDrjpxQ2c4/s1600/RTC7.JPGhttp://2.bp.blogspot.com/-BSbW88KidyI/T6yUaEMlQtI/AAAAAAAAAoE/ZyQmPEiPqBc/s1600/RTC8.JPGhttp://4.bp.blogspot.com/-4t8LwS_dB_A/T6yUWhgJDJI/AAAAAAAAAn8/YPDrjpxQ2c4/s1600/RTC7.JPGhttp://2.bp.blogspot.com/-BSbW88KidyI/T6yUaEMlQtI/AAAAAAAAAoE/ZyQmPEiPqBc/s1600/RTC8.JPGhttp://4.bp.blogspot.com/-4t8LwS_dB_A/T6yUWhgJDJI/AAAAAAAAAn8/YPDrjpxQ2c4/s1600/RTC7.JPG -
8/10/2019 Arduino Projects1
82/84
-
8/10/2019 Arduino Projects1
83/84
{lcd. setCursor (0,0);lcd. print ( "Date:" );lcd. print (DD);lcd. print ( "/" );lcd. print (MM);lcd. print ( "/" );lcd. print (YY);lcd. setCursor (0,1);lcd. print ( "Time:" );lcd. print (hh);lcd. print ( ":" );lcd. print (mm);lcd. print ( ":" );lcd. print (ss);prev=ss;
}}
void get_time()
{ Wire . beginTransmission (rtc); // start communication over i2c with DS1307Wire . write (( byte )0); // Write the value of the register to point toWire . endTransmission (); // End communication over i2c with DS1307
Wire . requestFrom (rtc,7); // This will request 7 bytes of data//starting from the '0' the register
ss=bcd_to_dec( Wire . read ());mm=bcd_to_dec( Wire . read ());hh= Wire . read ();time_format=hh&(1
-
8/10/2019 Arduino Projects1
84/84
Wire . endTransmission ();}
int dec_to_bcd( int dec){
return dec/10*16 + (dec%10);}
int bcd_to_dec( int bcd){
return bcd/16*10 + (bcd%16);}