Thursday, 23 February 2017

Ultrasonic Sensor tutorial| ARDUINO





ULTRASONIC SENSOR TUTORIAL



This is Arduino based tutorial for ultrasonic sensor. in this video, I described how to connect ultrasonic sensor with Arduino also interface LCD with this.



Component required for tutorial

(1) Arduino microcontroller

(2) Ultrasonic sensor

(3) LCD



ciruit diagram is given in video.



Arduino Code for tutorial:



Ultrasonic sensor tutorial by IGENTECH



#include<LiquidCrystal.h> // include header file of lcd

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //assign pins of lcd

const int trigPin = 8; // assign trig pin to 8

const int echoPin = 7; // assign echo pin to 7

// defines variables

long duration;

int distance;





void setup()

{

  lcd.begin(16,2); // begin lcd

  lcd.print("UltrasonicSensor"); // print ultrasonic sensor on lcd

  lcd.setCursor(0,2);            // set cursor to second row of lcd

  lcd.print("   IGENTECH      "); // print igentech to second row

  delay(2000);

 

pinMode(trigPin, OUTPUT); // set trig pin as a output

pinMode(echoPin, INPUT);  // set echopin as input pin

}



void loop() {

lcd.clear(); // clear lcd screen

// clear trig

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH); // trig high to get a wave for 10 microsecond

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH); // estimate duration of pulse high

distance= duration*0.034/2;   // calculate distance from duration

// print output in lcd

lcd.print("Distance in cm:");

lcd.setCursor(0,2);

lcd.print(distance);

delay(200);

}


Saturday, 18 February 2017

How to program An Arduino pro mini using Arduino





This is easy way to upload code in an Arduino Pro mini through any Arduino board. We make Arduino board as a programmer and then get flashed code in Arduino. This uses only tx and rx connection to upload the code.



Component required:

(1) Arduino pro mini

(2) any other Arduino board

(3) Jumper wires



pin connections



Arduino pro mini                              other Arduino

            Tx                                                  Tx

            Rx                                                  Rx

            Vcc                                                 5 v

             Gnd                                               Gnd

                                                                 Reset-Gnd


Thursday, 16 February 2017

HOW TO MAKE A MOBI CAM STAND WITH ARDUINO| CAM AND BT INTERFACE



This project is base on Arduino microcontroller. this video explain how to make a mobile camera stand using servos and drafter. we make a 4 leg camera stand which is controlled by Arduino using Bluetooth module and interface mobile cam with web browser using IP CAM software.

COMPONENT REQUIRED FOR PROJECT:
(1)- A drafter
(2)- two servo motors
(3)- Arduino pro mini microcontroller
(4)- Bluetooth HC05 module
(5)- bicycle spokes
(6)- bolt and screws

Software required for this project:

(1)- Arduino IDM
(2)- Proteus for circuit design
(3)- Bluetooth serial controller for android devices
(4)- IP CAM app for android

Arduino coding:

#include<Servo.h>
#include<SoftwareSerial.h>
#include <Wire.h>
Servo myservo1;
Servo myservo2;
SoftwareSerial myserial(10,11);// rx and tx
uint8_t temp = 'x';
int i = 0, l = 0;
unsigned int val1, val2, sin_wave[251], sin_wave1[251];

void setup() {
  Serial.begin(9600);
  myserial.begin(9600); // BT begin here
  while(!myserial)
  {
    ;
  }
Serial.println("welcom igen to camera stand");
myservo1.attach(5);           // servo tilt motion
myservo2.attach(6);           // servo pan motion


 for (int k = 623; k <= 873; k++)
  {
    float angle = TWO_PI * k / 1500;        //here 1500 is the max number of steps
    val2 = (sin(angle)) * (180);
    val1 = (sin(angle)) * (70);
    val2 += 89;
    val1 += 35;
    sin_wave[k - 623] = val1;
    sin_wave1[k - 623] = val2;
  }

  myservo1.write(180 - sin_wave[100]);
  myservo2.write(180 - sin_wave1[100]);
  i=129,l=129;                              //align head in middle
  }

void loop() {
  if(myserial.available()>0)           // checking for connection with BT
  {
    temp=myserial.read();
    Serial.print("you got serial data:   ");
    Serial.println(temp);
   }


if (int(temp)>=97)
{

switch(temp)
{
  case 's':                     // tilt down motion
   for (; (i <= 250 && (temp != 'q' || temp == 'w' )); i++)
            {
              myservo1.write(180 - sin_wave[i]);
              delay(10);
            }
            break;

   case 'w':                  // tilt up motion
            for (; (i >= 0 && (temp != 'q' || temp == 's')); i--)
            {
              myservo1.write(180 - sin_wave[i]);
              delay(10);
            }
            break;

    case 'a':                   // pan left motion
            for (; (l <= 250 && (temp != 'q' || temp == 'a')); l++)
            {
              myservo2.write(180 - sin_wave1[l]);
              delay(10);
            }
         
            break;
      case 'd':                   // pan right motion
            for (; (l >= 0 && (temp != 'q' || temp == 'd')); l--)
            {
              myservo2.write(180 - sin_wave1[l]);
              delay(10);
            }
            break;

      case 'v':                // moving pan to middle portion
             for (; (l <= 100 && (temp != 'q' )); l++)
                {
                  myservo1.write(180 - sin_wave1[l]);
                  delay(10);
                }

              for (; (l >= 100 && (temp != 'q' )); l--)
                {
                  myservo2.write(180 - sin_wave1[l]);
                  delay(10);
                }
            break;
}
}

else
{
  myservo1.write(int(temp));          // taking value from bt app
  delay(10);
}
}


My title page contents

Tuesday, 14 February 2017

��LED MATRIX (3X3) | ARDUINO PROJECT | DIY





This project is based on Arduino microcontroller with interfacing the led 3x3 matrix.

The component required for this project are follows:
(1) Arduino microcontroller (UNO)
(2) color led Red, Green, yellow
(3) jumper wires for connections
(4) resistors (1 k ohm)
(5) soldering iron for solder.
(6) Dot matrix pcb


Circuit diagram:

for circuit diagram please see given video.


working principle:

First we make a led matrix 3x3 cube using 9 Red, 9 Green , and 9 Yellow led. we arrange this by tow method first one by common anode and second one in by common Cathode. In this video i used common anode algorithm for controlling every led. we connect all the anode terminal in row of led patter or we can say in one layer and extract one terminal for Arduino. Other terminal of led connected in column way. this will give 9 connection in ground and 3 connection for every layer. these 12 wire are connected with Arduino. after that below given code was upload in Arduino.


Arduino Code:

int i=0;
void setup() {
  for (i=2; i<=13; i++)
  {
    pinMode(i, OUTPUT);// Assign pin 2 to 13 as output
  }

  }

void loop()
{
//this loop for assiging 8 pin of column to low and 3 layers to high
 for (i=1; i<=8; i++)
 {
  digitalWrite(11, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(13, HIGH);
  digitalWrite(i, HIGH);
  delay(500);
  digitalWrite(i,LOW);
  delay(500);
 }

 for (i=1; i<=8; i++)
 {
  digitalWrite(11, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(13, HIGH);
  digitalWrite(i, HIGH);
  delay(500);
  }

for (i=8; i>=1; i--)
 {
  digitalWrite(11, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(13, HIGH);
  digitalWrite(i, LOW);
  delay(500);
  }

for(i=1; i>=3; i++)
  {
    digitalWrite(i, LOW);
    delay(1000);
  }

}