Toronto-based collaborative duo Hopkins Duffield created a gaming environment running on Arduino Mega in which the player battles a laser wielding A.I. security system gone awry. It’s like being in an action movie, walking in a pitch black room filled with the hollow sound of a machine breathing and a series of red laser fences slicing through the fog-filled air!
In this blog you will get amazing information I have gathered in past few months of my intense research and study and working on many projects what i have explored is written in here.I started it from scrap level to most advance topics so one can be expert of thing named Arduino
Monday 31 August 2015
Wednesday 26 August 2015
PREPARING 200 TEACHERS TO INSPIRE STUDENTS WITH ELECTRONICS
Arduino Verkstad has just started CTC* Catalunya 2015 in Barcelona with David Cuartielles preparing a group of 200 teachers that will be teaching CTC to students in Cataluña next September. A technology fair will be hosted at the end of the program and we are expecting more than 2500 people to attend.
Creative Technologies in the Classroom (CTC) is a collaborative learning curriculum designed for schools that wish to incorporate emerging technologies into their existing technology classes. It’s also a collection of experiments aimed at transforming the way technology is taught in schools around the world. These experiments introduce basic concepts in programming, electronics, and mechanics.These experiments introduce basic concepts in programming, electronics, and mechanics.
Monday 24 August 2015
Arduino projects discussion :
Hi everyone
i am back after some long time to my blog
hope you all visiters are also fine i am starting this post for those persons who are going to do arduino projects in future so they can openly come and discuss their problems and their solutions.
Any positive feedback and comments will be highly appreciated.
Regards
Umar Yasin
i am back after some long time to my blog
hope you all visiters are also fine i am starting this post for those persons who are going to do arduino projects in future so they can openly come and discuss their problems and their solutions.
Any positive feedback and comments will be highly appreciated.
Regards
Umar Yasin
New IDE realease
Hi everyone
We've just released IDE 1.6.5. This release includes support to the new Arduino Zero and fixes to 470 issues (with many old ones)
Arduino Zero support is available through Boards Manager.
We also have a new editor, a serial monitor that stays open (disabled) while uploading, and a File > Open Recent menu showing the last 5 opened sketches.
The complete list of changes is available here.
The list of available unofficial boards support urls has grown to 18 and library manager lists 229 different libraries.
We hope you'll enjoy all the effort we put into the IDE
Any feedback is very much appreciated.
As said by federico who is software engineer @ Arduino
We've just released IDE 1.6.5. This release includes support to the new Arduino Zero and fixes to 470 issues (with many old ones)
Arduino Zero support is available through Boards Manager.
We also have a new editor, a serial monitor that stays open (disabled) while uploading, and a File > Open Recent menu showing the last 5 opened sketches.
The complete list of changes is available here.
The list of available unofficial boards support urls has grown to 18 and library manager lists 229 different libraries.
We hope you'll enjoy all the effort we put into the IDE
Any feedback is very much appreciated.
As said by federico who is software engineer @ Arduino
Friday 21 August 2015
Last July 7 at Wallops Flight Facility, NASA launched Black Brant IX , a suborbital sounding rocket to test “wireless-in-space” with XBee and Arduino :
Onboard the rocket was an experiment testing Exo-Brake technology. XBee was used to collect sensor data including temperature, air pressure, and 3-axis acceleration parameters. NASA is considering Exo-brakes as a possible solution for returning cargo from the International Space Station (ISS), orbiting platforms or as possible landing mechanisms in low-density atmospheres. This was one of many tests used to analyze its effectiveness, but the first to incorporate an XBee connected sensor network. If you would like to read more about the Exo-brake, check out this article.
As part of a program to determine potential applications of wireless technologies in space, NASA chose XBee® ZigBee modules and Arduino Mega
Friday 22 May 2015
Arduino lesson 16 : Controlling other devices with Arduino.
Intro to topic :
Once you are able to get the LED controlled from the TV remote it is only one step further process to control something more bigger then just LED so controlling of relays from arduino and controlling other devices from relays can be usefull in autmoation projects so here is the tuturial.
please refer to the last tuturial i have written to control led from TV remote to complete this one.
please refer to the last tuturial i have written to control led from TV remote to complete this one.
Hardware required :
- Arduino UNO board.
- TV remote
- IR receiver
- Relay (with coil rating with 6VDC Or 5VDC)
- Connecting wires/Jumper wires.
- PC to configure arduino board (with arduino software installed).
- Bread board.
Explanation to Circuit :
As we have to control external circuit or element through relay first of all we have to consider the relay structure its working principle and how to operate it for automation of things.
Here i have posted two pictures of most commonly used DC relays after applying 5VDC to its coil terminals the relay coil will get energized and the movable pin will get connected with NO point and after releasing the voltage the movable pin will gets to its start position with NC pin so this is the key principle to remember while working with relays of any kind.
The circuit we have shown is used to operate the relay with Arduino board directly by applying 5Vdc and Gound to jack1 and middle pin will goto the transistor base pin which will amplify the arduino Current of 50ma max to 200ma round about and which will be enough to energize the relay coil. The led1 will only indicate the ON and OFF the state of relay and can be omitted.
Steps to follow :
- Connect the Circuit according to schematic image on bread board.
- Plud the Middle pin of jack1 to arduino pin 5.
- Connect the 5v and groung connections correctly.
- Use Qn3904 or D400 transister (Recommended and tested).
- Check polaroty of Transister before applying to any Circuit.
- The resisters and LED part of circuit is not much essential so you can ignore it the circuit will still work better.
- Connect JP2 pin 2 relay on arduino PIN 13 of LED and power it up with 5v and ground.
- open up the Arduino IDE in PC and upload the following code.
- After succesfull u[loading you can control the devices with your tv remote.
- Whatever switch which you want to get controlled you can connect it to relay outputs. or at JP3 connector.
Code to be uploaded :
#include <IRremote.h>
#define irPin 3
IRrecv irrecv(irPin);
decode_results results;
int vcc = 12;
int gnd = 11;
int in = 10 ;
int led = 13;
int light = 4;
void setup() {
Serial.begin(9600);
pinMode(vcc,OUTPUT);
pinMode(led,OUTPUT);
pinMode(gnd,OUTPUT);
pinMode(in,INPUT);
digitalWrite(vcc, HIGH);
digitalWrite(gnd, LOW);
digitalWrite(led, LOW);
digitalWrite(light, LOW);//
irrecv.enableIRIn();
}
void loop() {
if (irrecv.decode(&results)) {
switch (results.value) {
case 0xFF30CF:
Serial.println("1");
break;
case 0xFF18E7:
Serial.println("2");
break;
case 0xFF7A85:
//Serial.println("POWER");
if(digitalRead(13)==HIGH)
{
digitalWrite(led, LOW);// turn on the led on pin 13
digitalWrite(light, LOW);//
Serial.println("LED Turned OFF");
}
else if(digitalRead(13)==LOW)
{
digitalWrite(led, HIGH);// turns off the led at pin 13
digitalWrite(light, HIGH);//
Serial.println("LED Turned ON");
}
break;
}
irrecv.resume();
}
}
If you have any more things to ask let it be in comments i will try to more explain it.
Arduino Lesson 15 : Blinking LED on Arduino UNO with IR(TV remote)
Intro to topic :
When we talk about communicating with arduino boards there are many many possibilities either by using buttons,keypads. sensors.shields or wireless mediums. The simplest wireless medium is to use IR sensors with arduino. So here is the tutorial how to use them with arduino and use them to control other things wirelessly.
Hardware required :
- Arduino UNO board.
- IR sensor TSOP 1738
- Any IR transmitter or TV remote.
- Connecting wires/Jumper wires.
- PC to configure arduino board (with arduino software installed).
- Bread board.
Explanation to Circuit :
As i have shown you the fritzing image the IR sensor TSOP1738 has three pins out of which two pins are used to power it up from 5v and ground and the third pin whenever recieves any IR signal on it produces on TTL signal or produces on hex value related to signal incident on it. So this trick can be used to detect the hex codes related to any button of IR sender or IR based remote like TV remote.
Steps to follow :
- Connect the Circuit according to schematic image on bread board.
- Power up the IC by applying it the 5v and ground.
- Connect the 5v and groung connections correctly and make sure they are connected to right numbered pins.
- Once connected correctly connect arduino to PC.
- open up the Arduino IDE in PC and upload the following code.
Code to be uploaded :
#include <IRremote.h>
#define irPin 2
IRrecv irrecv(irPin);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.print("0x");
Serial.println(results.value, HEX);
delay(250);
irrecv.resume();
}
}
#define irPin 2
IRrecv irrecv(irPin);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.print("0x");
Serial.println(results.value, HEX);
delay(250);
irrecv.resume();
}
}
Once you uploaded the Code open up your serial monitor in Arduino IDE and take any IR remote in your home and come in front of your circuit and press any button in front of it and see the magic. As you press any key your key code will be decoded and HEX equivalent will be shown up in serial monitor. So this shows that you have used this IC correctly and these codes can be further used in different projects like automation of devices with TV remotes.
Notice down all HEX codes of your remote with every button on page to use them here.
Notice down all HEX codes of your remote with every button on page to use them here.
Steps to follow :
- Now once you got HEX codes of your TV remote upload the following code by changing the HEX code values as according to your own Remote.
#include <IRremote.h>
#define irPin 10
IRrecv irrecv(irPin);
decode_results results;
int vcc = 12;
int gnd = 11;
int in = 10 ;
int led = 13;
int light = 4;
void setup() {
Serial.begin(9600);
pinMode(vcc,OUTPUT);
pinMode(led,OUTPUT);
pinMode(gnd,OUTPUT);
pinMode(in,INPUT);
digitalWrite(vcc, HIGH);
digitalWrite(gnd, LOW);
digitalWrite(led, LOW);
digitalWrite(light, LOW);//
irrecv.enableIRIn();
}
void loop() {
if (irrecv.decode(&results)) {
switch (results.value) {
case 0xFF30CF:
Serial.println("1");
break;
case 0xFF18E7:
Serial.println("2");
break;
case 0xFF7A85:
//Serial.println("POWER");
if(digitalRead(13)==HIGH)
{
digitalWrite(led, LOW);// turn on the led on pin 13
digitalWrite(light, LOW);//
Serial.println("LED Turned OFF");
}
else if(digitalRead(13)==LOW)
{
digitalWrite(led, HIGH);// turns off the led at pin 13
digitalWrite(light, HIGH);//
Serial.println("LED Turned ON");
}
break;
}
irrecv.resume();
}
}
- now once you uploaded this code change the HEX code for your tv remote so this code will work for you.
- every time you press the key which is associated with to turn on or off the LED on arduino board the LED will once turn on and then turns off.
- You can also check the status on serial monitor for more details because the Message will be displayed accordingly there that LED is turned on or Off.
If you have any more things to ask let it be in comments i will try to more explain it.
Sunday 17 May 2015
Arduino Lesson 14 : Interfacing IR sensor with Arduino UNO
Intro to topic :
When we talk about communicating with arduino boards there are many many possibilities either by using buttons,keypads. sensors.shields or wireless mediums. The simplest wireless medium is to use IR sensors with arduino. So here is the tutorial how to use them with arduino.
Hardware required :
- Arduino UNO board.
- IR sensor TSOP 1738
- Connecting wires/Jumper wires.
- PC to configure arduino board (with arduino software installed).
- Bread board.
Explanation to Circuit :
As i have shown you the fritzing image the IR sensor TSOP1738 has three pins out of which two pins are used to power it up from 5v and ground and the third pin whenever recieves any IR signal on it produces on TTL signal or produces on hex value related to signal incident on it. So this trick can be used to detect the hex codes related to any button of IR sender or IR based remote like TV remote.
Steps to follow :
- Connect the Circuit according to schematic image on bread board.
- Power up the IC by applying it the 5v and ground.
- Connect the 5v and groung connections correctly and make sure they are connected to right numbered pins.
- Once connected correctly connect arduino to PC.
- open up the Arduino IDE in PC and upload the following code.
Code to be uploaded :
#include <IRremote.h>
#define irPin 2
IRrecv irrecv(irPin);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.print("0x");
Serial.println(results.value, HEX);
delay(250);
irrecv.resume();
}
}
#define irPin 2
IRrecv irrecv(irPin);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.print("0x");
Serial.println(results.value, HEX);
delay(250);
irrecv.resume();
}
}
Once you uploaded the Code open up your serial monitor in Arduino IDE and take any IR remote in your home and come in front of your circuit and press any button in front of it and see the magic. As you press any key your key code will be decoded and HEX equivalent will be shown up in serial monitor. So this shows that you have used this IC correctly and these codes can be further used in different projects like automation of devices with TV remotes.
If you have any more things to ask let it be in comments i will try to more explain it.
Saturday 16 May 2015
Arduino Lesson 13 : Controlling External Relays
Intro to topic :
Now its time to talk about little bit of external hardware we can control or attach with arduino boards to control other hardware or boards. One of the most used automatically operation switches is relays which is used in electronics and many smart applications to control so here is tutorial you can follow and know how to control relays through Arduino
Hardware required :
- Arduino UNO board.
- Relay (with coil rating with 6VDC Or 5VDC)
- Connecting wires/Jumper wires.
- PC to configure arduino board (with arduino software installed).
- Bread board.
Explanation to Circuit :
As we have to control external circuit or element through relay first of all we have to consider the relay structure its working principle and how to operate it for automation of things.
Here i have posted two pictures of most commonly used DC relays after applying 5VDC to its coil terminals the relay coil will get energized and the movable pin will get connected with NO point and after releasing the voltage the movable pin will gets to its start position with NC pin so this is the key principle to remember while working with relays of any kind.
The circuit we have shown is used to operate the relay with Arduino board directly by applying 5Vdc and Gound to jack1 and middle pin will goto the transistor base pin which will amplify the arduino Current of 50ma max to 200ma round about and which will be enough to energize the relay coil. The led1 will only indicate the ON and OFF the state of relay and can be omitted.
Steps to follow :
- Connect the Circuit according to schematic image on bread board.
- Plud the Middle pin of jack1 to arduino pin 5.
- Connect the 5v and groung connections correctly.
- Use Qn3904 or D400 transister (Recommended and tested).
- Check polaroty of Transister before applying to any Circuit.
- The resisters and LED part of circuit is not much essential so you can ignore it the circuit will still work better.
- open up the Arduino IDE in PC and upload the following code.
Code to be uploaded :
int relay =5;
void setup() {
pinMode(relay, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH); // turn the relay on (HIGH is the voltage level)
void setup() {
pinMode(relay, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH); // turn the relay on (HIGH is the voltage level)
delay(2000); // wait for a 2 second
digitalWrite(led, LOW); // turn the relay off by making the voltage LOW
delay(2000); // wait for a 2 second
}
Once you uploaded the Code you will clearly can listen the voice of TIK TIK from relay after every two seconds and more you can test the continuity of relay ports with DMM(digital multimeter) or apply any load to get on and off for every two seconds.
If you have any more things to ask let it be in comments i will try to more explain it.
If you have any more things to ask let it be in comments i will try to more explain it.
Friday 15 May 2015
Arduino Lesson 12 : Arduino UNO with 4*4 Keypad and 16*2 LCD
Intro to topic :
Keyboard or in this case keypad is very essential for many types of user data entry like passwords,number, or data integers so it is important to know about interfacing of keypad with arduino and manipulating it. Here i am discussing that how to interface keypad with arduino UNO.
Some time we needed that data we are entering should be shown to some sort of display or screen we used LCD to display the data entered.
Some time we needed that data we are entering should be shown to some sort of display or screen we used LCD to display the data entered.
Hardware required :
Steps to follow :
- Connect the Keypad and LCD according to image.
- Use equal length jumper wires for ease.
- After this connect the board to PC by USB cable and then open up the IDE in PC
- Then upload the following Code.
- Connect the Keypad and LCD according to image.
- Use equal length jumper wires for ease.
- After this connect the board to PC by USB cable and then open up the IDE in PC
- Then upload the following Code.
Code to be uploaded :
#include<LiquidCrystal.h>
LiquidCrystal lcd(7,6,5,4,3,2);
int row[]={A1,A0,8,9};// Defining row pins of keypad connected to Arduino pins
int col[]={10,11,12,13};//Defining column pins of keypad connected to Arduino
int i,j,lcd_count,count=1,key_id=0,flag,entry=0;// See About the Program
int col_scan;// Variable to identify a key press
char temp_press; // Variable to hold value of key press
char check[6],pass[6]; // See About the Program
void setup()
{
lcd.begin(16,2);
for(i=0;i<=3;i++)
{
pinMode(row[i],OUTPUT);
pinMode(col[i],INPUT);
digitalWrite(col[i],HIGH);
}
lcd.print("SET 5 Digit PASS");
}
/* Main Program Begins */
void loop()
{
while(entry<=4)// Password Setting Loop begins
{
SetPassword();
}
// Password Setting Loop Ends
key_id=0;
keyscan(); // Scan for a Key Press
/* Actions on Key Press begins */
if(key_id==1) // Condition to Check Key is Pressed
{
check[count]=temp_press;
count++;
/* Condition to Unlock Begins*/
if(temp_press=='A')
{
checkPassword();
if(flag==0)
{
lcd.setCursor(0,0);
lcd.print("UNLOCKED");
}else{
lcd.setCursor(0,0);
lcd.print("WRONG PASSWORD");
delay(200);
lcd.clear();
lcd.print("LOCKED");
}
count=1; // Resetting the counter variable
}
/* Condition to Unlock Ends*/
/* Condition to Change Password Begins */
else if(temp_press=='C')
{
checkPassword();
if(flag==0)
{
lcd.setCursor(0,0);
lcd.print("ENTER NEW PASS");
key_id=0;
entry=0;
}else{
lcd.setCursor(0,0);
lcd.print("WRONG PASSWORD");
}
count=1; // Resetting the counter variable
}
/* Condition to Change Password Ends */
/* Condition to LOCK Begins*/
else if(temp_press=='B')
{
lcd.setCursor(0,0);
lcd.print("LOCKED");
count=1; // Resetting the counter variable
}
/* Condition to LOCK Ends*/
}
/* Actions on Key Press Ends*/
}
/* Main Program Ends */
void SetPassword() // Subroutine to SET User Defined Password
{
keyscan();
if(key_id==1)
{
if(temp_press=='A'||temp_press=='C'||temp_press=='B') // Condition to Check for an Invalid Keypress
{
lcd.setCursor(0,0);
lcd.print("INVALID KEYS");
entry=0;
}
else
{
pass[entry]=temp_press;
}
}
key_id=0;
if(entry==5)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("PASSWORD SET & LOCKED");
}} // Subroutine to SET Password ENDS
char keyscan()// Subroutine to Scan Keypad for a Keypress
{
for(i=0; i<=3; i++)
{
digitalWrite(row[0],HIGH);
digitalWrite(row[1],HIGH);
digitalWrite(row[2],HIGH);
digitalWrite(row[3],HIGH);
digitalWrite(row[i],LOW);
for(j=0; j<=3; j++)
{
col_scan=digitalRead(col[j]);
if(col_scan==LOW)
{
key_id=1;
entry++;
temp_press=keypress(i,j);
lcd.setCursor(lcd_count++,1);
lcd.print(temp_press);
if(temp_press=='A'||temp_press=='C'||temp_press=='B')
{
lcd_count=0;
lcd.clear();
}
delay(300);
break;
}}
}}// Subroutine to Scan Keypress Ends
char keypress(int i, int j) // Subroutine to Identify the value of Key pressed
{
if(i==0&&j==0)
{
return('1');
}
if(i==0&&j==1)
{
return('2');
}
if(i==0&&j==2)
{
return('3');
}
if(i==0&&j==3)
{
return('A');
}
if(i==1&&j==0)
{
return('4');
}
if(i==1&&j==1)
{
return('5');
}
if(i==1&&j==2)
{
return('6');
}
if(i==1&&j==3)
{
return('B');
}
if(i==2&&j==0)
{
return('7');
}
if(i==2&&j==1)
{
return('8');
}
if(i==2&&j==2)
{
return('9');
}
if(i==2&&j==3)
{
return('C');
}
if(i==3&&j==0)
{
return('*');
}
if(i==3&&j==1)
{
return('0');
}
if(i==3&&j==2)
{
return('#');
}
if(i==3&&j==3)
{
return('D');
}
} // Subroutine to identify Keypress Ends
void checkPassword() // Subroutine to Check User Input Data with SET Password
{
flag=0;
for(i=1;i<=5&&flag==0;i++)
{
if(check[i]==pass[i])
{
flag=0;
}
else
{flag=1;
}}} // Subroutine to check password ends
#include<LiquidCrystal.h> LiquidCrystal lcd(7,6,5,4,3,2); int row[]={A1,A0,8,9};// Defining row pins of keypad connected to Arduino pins int col[]={10,11,12,13};//Defining column pins of keypad connected to Arduino int i,j,lcd_count,count=1,key_id=0,flag,entry=0;// See About the Program int col_scan;// Variable to identify a key press char temp_press; // Variable to hold value of key press char check[6],pass[6]; // See About the Program void setup() { lcd.begin(16,2); for(i=0;i<=3;i++) { pinMode(row[i],OUTPUT); pinMode(col[i],INPUT); digitalWrite(col[i],HIGH); } lcd.print("SET 5 Digit PASS"); } /* Main Program Begins */ void loop() { while(entry<=4)// Password Setting Loop begins { SetPassword(); } // Password Setting Loop Ends key_id=0; keyscan(); // Scan for a Key Press /* Actions on Key Press begins */ if(key_id==1) // Condition to Check Key is Pressed { check[count]=temp_press; count++; /* Condition to Unlock Begins*/ if(temp_press=='A') { checkPassword(); if(flag==0) { lcd.setCursor(0,0); lcd.print("UNLOCKED"); }else{ lcd.setCursor(0,0); lcd.print("WRONG PASSWORD"); delay(200); lcd.clear(); lcd.print("LOCKED"); } count=1; // Resetting the counter variable } /* Condition to Unlock Ends*/ /* Condition to Change Password Begins */ else if(temp_press=='C') { checkPassword(); if(flag==0) { lcd.setCursor(0,0); lcd.print("ENTER NEW PASS"); key_id=0; entry=0; }else{ lcd.setCursor(0,0); lcd.print("WRONG PASSWORD"); } count=1; // Resetting the counter variable } /* Condition to Change Password Ends */ /* Condition to LOCK Begins*/ else if(temp_press=='B') { lcd.setCursor(0,0); lcd.print("LOCKED"); count=1; // Resetting the counter variable } /* Condition to LOCK Ends*/ } /* Actions on Key Press Ends*/ } /* Main Program Ends */ void SetPassword() // Subroutine to SET User Defined Password { keyscan(); if(key_id==1) { if(temp_press=='A'||temp_press=='C'||temp_press=='B') // Condition to Check for an Invalid Keypress { lcd.setCursor(0,0); lcd.print("INVALID KEYS"); entry=0; } else { pass[entry]=temp_press; } } key_id=0; if(entry==5) { lcd.clear(); lcd.setCursor(0,0); lcd.print("PASSWORD SET & LOCKED"); }} // Subroutine to SET Password ENDS char keyscan()// Subroutine to Scan Keypad for a Keypress { for(i=0; i<=3; i++) { digitalWrite(row[0],HIGH); digitalWrite(row[1],HIGH); digitalWrite(row[2],HIGH); digitalWrite(row[3],HIGH); digitalWrite(row[i],LOW); for(j=0; j<=3; j++) { col_scan=digitalRead(col[j]); if(col_scan==LOW) { key_id=1; entry++; temp_press=keypress(i,j); lcd.setCursor(lcd_count++,1); lcd.print(temp_press); if(temp_press=='A'||temp_press=='C'||temp_press=='B') { lcd_count=0; lcd.clear(); } delay(300); break; }} }}// Subroutine to Scan Keypress Ends char keypress(int i, int j) // Subroutine to Identify the value of Key pressed { if(i==0&&j==0) { return('1'); } if(i==0&&j==1) { return('2'); } if(i==0&&j==2) { return('3'); } if(i==0&&j==3) { return('A'); } if(i==1&&j==0) { return('4'); } if(i==1&&j==1) { return('5'); } if(i==1&&j==2) { return('6'); } if(i==1&&j==3) { return('B'); } if(i==2&&j==0) { return('7'); } if(i==2&&j==1) { return('8'); } if(i==2&&j==2) { return('9'); } if(i==2&&j==3) { return('C'); } if(i==3&&j==0) { return('*'); } if(i==3&&j==1) { return('0'); } if(i==3&&j==2) { return('#'); } if(i==3&&j==3) { return('D'); } } // Subroutine to identify Keypress Ends void checkPassword() // Subroutine to Check User Input Data with SET Password { flag=0; for(i=1;i<=5&&flag==0;i++) { if(check[i]==pass[i]) { flag=0; } else {flag=1; }}} // Subroutine to check password ends
Once the code is uploaded you can follow up the screen and any time you input correct code the pin will be unlocked
Arduino Lesson 11 : Interfacing 4*4 Hex Keypad with Arduino UNO
Intro to topic :
Keyboard or in this case keypad is very essential for many types of user data entry like passwords,number, or data integers so it is important to know about interfacing of keypad with arduino and manipulating it. Here i am discussing that how to interface keypad with arduino UNO.
Hardware required :
Steps to follow :
- Connect the Keypad according to image.
- Use equal length jumper wires for ease.
- After this connect the board to PC by USB cable and then open up the IDE in PC
- Then upload the following Code.
- Connect the Keypad according to image.
- Use equal length jumper wires for ease.
- After this connect the board to PC by USB cable and then open up the IDE in PC
- Then upload the following Code.
Code #1 to be uploaded :
int row[]={6,7,8,9};// Defining row pins of keypad connected to Aeduino pins
int col[]={10,11,12,13};//Defining column pins of keypad connected to Arduino
int i,j; // Two counter variables to count inside for loop
int col_scan; // Variable to hold value of scanned columns
void setup()
{
Serial.begin(9600);
for(i=0;i<=3;i++)
{
pinMode(row[i],OUTPUT);
pinMode(col[i],INPUT);
digitalWrite(col[i],HIGH);
} }
void loop()
{
for(i=0; i<=3; i++)
{
digitalWrite(row[0],HIGH);
digitalWrite(row[1],HIGH);
digitalWrite(row[2],HIGH);
digitalWrite(row[3],HIGH);
digitalWrite(row[i],LOW);
for(j=0; j<=3; j++)
{
col_scan=digitalRead(col[j]);
if(col_scan==LOW)
{
keypress(i,j);
delay(300);
}}
}}
void keypress(int i, int j)
{
if(i==0&&j==0)
Serial.println("1");
if(i==0&&j==1)
Serial.println("2");
if(i==0&&j==2)
Serial.println("3");
if(i==0&&j==3)
Serial.println("A");
if(i==1&&j==0)
Serial.println("4");
if(i==1&&j==1)
Serial.println("5");
if(i==1&&j==2)
Serial.println("6");
if(i==1&&j==3)
Serial.println("B");
if(i==2&&j==0)
Serial.println("7");
if(i==2&&j==1)
Serial.println("8");
if(i==2&&j==2)
Serial.println("9");
if(i==2&&j==3)
Serial.println("C");
if(i==3&&j==0)
Serial.println("*");
if(i==3&&j==1)
Serial.println("0");
if(i==3&&j==2)
Serial.println("#");
if(i==3&&j==3)
Serial.println("D");
}
int row[]={6,7,8,9};// Defining row pins of keypad connected to Aeduino pins int col[]={10,11,12,13};//Defining column pins of keypad connected to Arduino int i,j; // Two counter variables to count inside for loop int col_scan; // Variable to hold value of scanned columns void setup() { Serial.begin(9600); for(i=0;i<=3;i++) { pinMode(row[i],OUTPUT); pinMode(col[i],INPUT); digitalWrite(col[i],HIGH); } } void loop() { for(i=0; i<=3; i++) { digitalWrite(row[0],HIGH); digitalWrite(row[1],HIGH); digitalWrite(row[2],HIGH); digitalWrite(row[3],HIGH); digitalWrite(row[i],LOW); for(j=0; j<=3; j++) { col_scan=digitalRead(col[j]); if(col_scan==LOW) { keypress(i,j); delay(300); }} }} void keypress(int i, int j) { if(i==0&&j==0) Serial.println("1"); if(i==0&&j==1) Serial.println("2"); if(i==0&&j==2) Serial.println("3"); if(i==0&&j==3) Serial.println("A"); if(i==1&&j==0) Serial.println("4"); if(i==1&&j==1) Serial.println("5"); if(i==1&&j==2) Serial.println("6"); if(i==1&&j==3) Serial.println("B"); if(i==2&&j==0) Serial.println("7"); if(i==2&&j==1) Serial.println("8"); if(i==2&&j==2) Serial.println("9"); if(i==2&&j==3) Serial.println("C"); if(i==3&&j==0) Serial.println("*"); if(i==3&&j==1) Serial.println("0"); if(i==3&&j==2) Serial.println("#"); if(i==3&&j==3) Serial.println("D"); }
OR
Code #2 to be uploaded :
int r1=6;
int r2=7;
int r3=8;
int r4=9;
int c1=10;
int c2=11;
int c3=12;
int c4=13;
int colm1;
int colm2;
int colm3;
int colm4;
void setup()
{
pinMode(r1,OUTPUT);
pinMode(r2,OUTPUT);
pinMode(r3,OUTPUT);
pinMode(r4,OUTPUT);
pinMode(c1,INPUT);
pinMode(c2,INPUT);
pinMode(c3,INPUT);
pinMode(c4,INPUT);
Serial.begin(9600);
digitalWrite(c1,HIGH);
digitalWrite(c2,HIGH);
digitalWrite(c3,HIGH);
digitalWrite(c4,HIGH);
}
void loop()
{
digitalWrite(r1,LOW);
digitalWrite(r2,HIGH);
digitalWrite(r3,HIGH);
digitalWrite(r4,HIGH);
colm1=digitalRead(c1);
colm2=digitalRead(c2);
colm3=digitalRead(c3);
colm4=digitalRead(c4);
if(colm1==LOW)
{Serial.println("1");
delay(200);}
else
{
if(colm2==LOW)
{Serial.println("2");
delay(200);}
else
{
if(colm3==LOW)
{Serial.println("3");
delay(200);}
else
{
if(colm4==LOW)
{Serial.println("A");
delay(200);}
}}}
digitalWrite(r1,HIGH);
digitalWrite(r2,LOW);
digitalWrite(r3,HIGH);
digitalWrite(r4,HIGH);
colm1=digitalRead(c1);
colm2=digitalRead(c2);
colm3=digitalRead(c3);
colm4=digitalRead(c4);
if(colm1==LOW)
{Serial.println("4");
delay(200);}
else
{
if(colm2==LOW)
{Serial.println("5");
delay(200);}
else
{
if(colm3==LOW)
{Serial.println("6");
delay(200);}
else
{
if(colm4==LOW)
{Serial.println("B");
delay(200);}
}}}
digitalWrite(r1,HIGH);
digitalWrite(r2,HIGH);
digitalWrite(r3,LOW);
digitalWrite(r4,HIGH);
colm1=digitalRead(c1);
colm2=digitalRead(c2);
colm3=digitalRead(c3);
colm4=digitalRead(c4);
if(colm1==LOW)
{Serial.println("7");
delay(200);}
else
{
if(colm2==LOW)
{Serial.println("8");
delay(200);}
else
{
if(colm3==LOW)
{Serial.println("9");
delay(200);}
else
{
if(colm4==LOW)
{Serial.println("C");
delay(200);}
}}}
digitalWrite(r1,HIGH);
digitalWrite(r2,HIGH);
digitalWrite(r3,HIGH);
digitalWrite(r4,LOW);
colm1=digitalRead(c1);
colm2=digitalRead(c2);
colm3=digitalRead(c3);
colm4=digitalRead(c4);
if(colm1==LOW)
{Serial.println("*");
delay(200);}
else
{
if(colm2==LOW)
{Serial.println("0");
delay(200);}
else
{
if(colm3==LOW)
{Serial.println("#");
delay(200);}
else
{
if(colm4==LOW)
{Serial.println("D");
delay(200);}
}}}
}
After the successful uploading of program goto PC and open up serial monitor and the press any key what ever you will press automatically comes on screen of PC in serial monitor.
Notice that this code can be used to display up characters on the screen of LCD we have covered in last Lesson.
int r1=6; int r2=7; int r3=8; int r4=9; int c1=10; int c2=11; int c3=12; int c4=13; int colm1; int colm2; int colm3; int colm4; void setup() { pinMode(r1,OUTPUT); pinMode(r2,OUTPUT); pinMode(r3,OUTPUT); pinMode(r4,OUTPUT); pinMode(c1,INPUT); pinMode(c2,INPUT); pinMode(c3,INPUT); pinMode(c4,INPUT); Serial.begin(9600); digitalWrite(c1,HIGH); digitalWrite(c2,HIGH); digitalWrite(c3,HIGH); digitalWrite(c4,HIGH); } void loop() { digitalWrite(r1,LOW); digitalWrite(r2,HIGH); digitalWrite(r3,HIGH); digitalWrite(r4,HIGH); colm1=digitalRead(c1); colm2=digitalRead(c2); colm3=digitalRead(c3); colm4=digitalRead(c4); if(colm1==LOW) {Serial.println("1"); delay(200);} else { if(colm2==LOW) {Serial.println("2"); delay(200);} else { if(colm3==LOW) {Serial.println("3"); delay(200);} else { if(colm4==LOW) {Serial.println("A"); delay(200);} }}} digitalWrite(r1,HIGH); digitalWrite(r2,LOW); digitalWrite(r3,HIGH); digitalWrite(r4,HIGH); colm1=digitalRead(c1); colm2=digitalRead(c2); colm3=digitalRead(c3); colm4=digitalRead(c4); if(colm1==LOW) {Serial.println("4"); delay(200);} else { if(colm2==LOW) {Serial.println("5"); delay(200);} else { if(colm3==LOW) {Serial.println("6"); delay(200);} else { if(colm4==LOW) {Serial.println("B"); delay(200);} }}} digitalWrite(r1,HIGH); digitalWrite(r2,HIGH); digitalWrite(r3,LOW); digitalWrite(r4,HIGH); colm1=digitalRead(c1); colm2=digitalRead(c2); colm3=digitalRead(c3); colm4=digitalRead(c4); if(colm1==LOW) {Serial.println("7"); delay(200);} else { if(colm2==LOW) {Serial.println("8"); delay(200);} else { if(colm3==LOW) {Serial.println("9"); delay(200);} else { if(colm4==LOW) {Serial.println("C"); delay(200);} }}} digitalWrite(r1,HIGH); digitalWrite(r2,HIGH); digitalWrite(r3,HIGH); digitalWrite(r4,LOW); colm1=digitalRead(c1); colm2=digitalRead(c2); colm3=digitalRead(c3); colm4=digitalRead(c4); if(colm1==LOW) {Serial.println("*"); delay(200);} else { if(colm2==LOW) {Serial.println("0"); delay(200);} else { if(colm3==LOW) {Serial.println("#"); delay(200);} else { if(colm4==LOW) {Serial.println("D"); delay(200);} }}} }
Notice that this code can be used to display up characters on the screen of LCD we have covered in last Lesson.
Thursday 14 May 2015
Arduino lesson 10 : Interfacing 16*2 LCD with Arduino UNO
Intro to topic :
Now once you have got some confidence of using some very basic operation from your arduino board in last tutorials. Now its time to take our efforts to next level of interfacing external hardware i.e LCD display (16*2)
Hardware required :
- Arduino UNO board.
- LCD (of any color)
- POT 500ohm - 1Kohm (for controlling LCD brightness)
- Resister 560ohm (not mandatory)
- Connecting wires/Jumper wires.
- PC to configure arduino board (with arduino software installed).
- Bread board.
Steps to follow :
- Connect the Lcd according to Fritzing image
- The resister if added good otherwise it is not necessary to put on resister because the current is limited to each pin of arduino boards.
- After this connect the board to PC by USB cable and then open up the IDE in PC.
- Goto File>Examples>LiquidCrystal>HelloWorld
- The following Code will open.
Code to be uploaded :
/*
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
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 1K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
*/
// 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);
}
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
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 1K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
*/
// 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);
}
Once you have uploaded the code correctly just see that Lcd will turn on and the word "hello world" will be shown on screen if not then change the value of POT resistor to change lcd contrast and brightness.
Arduino lesson 9 : How to fade LED brightness continously :
Intro to topic :
Some times we need that some variable or some analog voltage continuously varies from one value to another one like starting LED from zero brightness to its max and then reverting all the process can be tricky and will be useful for us to handle situations like this.
Hardware required :
- Arduino UNO board.
- LED (of any color)
- Resister 330ohm (not mandatory)
- Connecting wires/Jumper wires.
- PC to configure arduino board (with arduino software installed).
- Bread board.
Fritzing project |
Steps to follow :
- Connect the Led by identifying the positive lead of led according to Fritzing image
- The resister if added good otherwise it is not necessary to put on resister because the current is limited to each pin of arduino boards.
- After this connect the board to PC by USB cable and then open up the IDE in PC.
- Goto File>Examples>01.Basics>fade
- The following Code will open.
Code to be uploaded :
/*
Fade
This example shows how to fade an LED on pin 13
using the analogWrite() function.
This example code is in the public domain.
*/
int led = 13; // the pin that the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
// the setup routine runs once when you press reset:
void setup() {
// declare pin 13 to be an output:
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 13:
analogWrite(led, brightness);
// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
Once you have uploaded the code correctly just see that Led will start fading and increasing its brightness to zero and max positions.
Samsun New launch with Arduino
When you think about Samsung, the first products that come to mind are probably phones or televisions, not Maker-focused electronics. Today, with their announcement at Internet of Things World, Samsung has entered the Maker world with their ARTIK platform, an Arduino compatible family of devices targeted towards Internet of Things applications.
Combining this powerful hardware with the ease of use and existing knowledge base of the Arduino platform, Samsung hopes to make development of IoT platforms easy to get off the ground:Currently there are three ARTIK devices: The ARTIK 1, ARTIK 5, and ARTIK 10. All are multi-core ARM processors with built in Bluetooth Low Energy. The ARTIK 5 and 10 also include Wi-Fi, BT, Zigbee, and Thread wireless connections.
“Our approach is to provide open platforms to help accelerate the development of IoT for our customers, developers, and end users” said Curtis Sasaki, Vice President of Ecosystem, Samsung Electronics. “Being part of Arduino’s Certified Program helps millions of developers familiar with Arduino IDE to take advantage and focus all of their energy to building new and innovative products.”
Arduino lesson 8 : Reading analog voltages :
Intro to topic :
It is sometimes essential to us read the analog value from different sensors and Shields in order to perform certain tasks let see resistance change in some path or voltage drops of some sort. So in arduino you can read analog quantities directly without any external hardware.
Hardware needed :
- Arduino UNO board
- Bread board
- Jumper wires
- PC on which the arduino IDE is installed
- Variable resisters (Potentiometers)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZh89jW29zLD4WhS4_kRvuXPTDb4i8Oy1IQIJLyl-t1nCkcM2mo5de3Feap6rHIAKzA6nkMCwrCnIO_S6bGOn5JjBdfeIb7nVmvSVkykPJuNLD4v5vfjziI-sIMeDp-ZObgfl8dV-GRZI/s1600/download.jpg)
Steps to follow :
- First of All complete the circuit as below
- Connect the one pin of POT to Arduino Pin A0 and other pins to 5V and GND respectively.
- Connect the arduino board to PC and open up the software.
- Goto file>examples>01.basic>Analog read serial.
- After opening it upload this code to your board and then wait for uploading.
- Now open Up serial monitor from tools>serial monitor Or simply press Ctrl+Shift+M.
- You will see that there will be list of values going on in Serial monitor screen once you get this.
- Change the POT value by moving its knob to some other point as you change the value on serial monitor will automatically change.
Code to Upload :
*
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.
This example code is in the public domain.
*/
// 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
}
Wednesday 13 May 2015
Arduino Lesson 7 : LED blinking on Arduino UNO R3
Project :
We are going to do this project in which we can blink led either on board or off the board according to our wish.
Hardware required :
- Arduino UNO board.
- LED (of any color)
- Resister 330ohm (not mandatory)
- Connecting wires/Jumper wires.
- PC to configure arduino board (with arduino software installed).
- Bread board.
Fritzing project |
Steps to follow :
- Connect the Led by identifying the positive lead of led according to Fritzing image
- The resister if added good otherwise it is not necessary to put on resister because the current is limited to each pin of arduino boards.
- After this connect the board to PC by USB cable and then open up the IDE in PC.
- Goto File>Examples>01.Basics>blink
- The following Code will open.
- By clicking the new window will open in which the piece of code will be written.
- Check that your board is correctly selected and serial port is correct.
- Click on upload button and wait for code to get uploaded.
- After successful uploading of code the LED will start blinking automatically.
- Notice that every time you restart your Arduino Board the Led will automatically start blinking it self.
Subscribe to:
Posts (Atom)