Tuesday, August 11, 2020

16*2, 16*1, 20*4 LCD Interfacing Using Arduino Uno By Engr.Habib Ur Rehman

 

                 16*2, 16*1, 20*4 LCD Interfacing                 

  Using Arduino Uno

  By Engr.Habib Ur Rehman

 

16*2 LCD

Components/Equipment Required:

            Following Components/Equipment are required to perform task.

1.    Arduino Uno (https://piees.pk/product/arduino-uno-r3/)

2.    16*2 LCD (https://piees.pk/product/16x2-lcd/)

3.    220Ω Resistor (https://piees.pk/product/220-ohm-1-4-watt-resistor/)

4.    10KΩ Potentiometer

5.    Breadboard

6.    Jumper Wires (https://piees.pk/product/220-ohm-1-4-watt-resistor/)

Circuit Diagram:

Arduino Program:

#include "LiquidCrystal.h"

// initialize the library by providing the nuber of pins to it

LiquidCrystal lcd(2, 3, 8, 9, 10, 11);

void setup() {

lcd.begin(16,2);

// set cursor position to start of first line on the LCD

lcd.setCursor(0,0);

//text to print

lcd.print("16x2 LCD Interfac");

// set cusor position to start of next line

lcd.setCursor(2,1);

lcd.print("by Engr.Habib");

}

void loop()

{}

Note:

            If text is not visible the potentiometer is used for visibility of character.

16*1 LCD

Components/Equipment Required:

            Following Components/Equipment are required to perform task.

1.    Arduino Uno (https://piees.pk/product/arduino-uno-r3/)

2.    16*1 LCD (https://piees.pk/product/16x1-lcd/)

3.    220Ω Resistor (https://piees.pk/product/220-ohm-1-4-watt-resistor/)

4.    10KΩ Potentiometer

5.    Breadboard

6.    Jumper Wires (https://piees.pk/product/220-ohm-1-4-watt-resistor/)

Circuit Diagram:

Arduino Program:

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(2, 3, 8, 9, 10, 11); /// REGISTER SELECT PIN,ENABLE PIN,D4 PIN,D5 PIN, D6 PIN, D7 PIN

void setup()

{

  // set up the LCD's number of columns and rows:

lcd.begin(16,-1);

}

void loop()

{

lcd.print("  16  *  1  LCD ");//print name

}

Note:

            If text is not visible the potentiometer is used for visibility of character.

 

20*4 LCD

Components/Equipment Required:

            Following Components/Equipment are required to perform task.

1.    Arduino Uno (https://piees.pk/product/arduino-uno-r3/)

2.    20*4 LCD (https://piees.pk/product/20x4-lcd/)

3.    220Ω Resistor (https://piees.pk/product/220-ohm-1-4-watt-resistor/)

4.    10KΩ Potentiometer

5.    Breadboard

6.    Jumper Wires (https://piees.pk/product/220-ohm-1-4-watt-resistor/)

Circuit Diagram:

Arduino Program:

#include "LiquidCrystal.h"

// initialize the library by providing the nuber of pins to it

LiquidCrystal lcd(2, 3, 8, 9, 10, 11);

void setup() {

lcd.begin(20,4);

// set cursor position to start of first line on the LCD

lcd.setCursor(0,0);

//text to print

lcd.print("20x4 LCD Interfacing");

// set cusor position to start of next line

lcd.setCursor(3,1);

lcd.print("by  Engr.Habib");

lcd.setCursor(9,2);

lcd.print("Ur");

lcd.setCursor(7,3);

lcd.print("Rehman");

}

void loop()

{}

Note:

            If text is not visible the potentiometer is used for visibility of character.

 


Monday, July 6, 2020

IR Obstacle Detection Module Interfacing with Arduino Uno By Engr.Habib Ur Rehman

IR Obstacle Detection Module 
Interfacing with Arduino Uno
By Engr.Habib Ur Rehman

Components/Equipment Required:

            Following Components/Equipment are required to perform task.

1.    Arduino Uno (https://piees.pk/product/arduino-uno-r3/)

2.    IR Obstacle Detection Module (https://piees.pk/product/ir-obstacle-detection-module/)

4.    Breadboard

5.    Jumper Wires (https://piees.pk/product-category/jumper-wires/)

Circuit Diagram:

Arduino Program:


const int ODSensor=2;

void setup() {               

  pinMode(ODSensor,INPUT);

  pinMode(12, OUTPUT); 

}

void loop() {

  if(digitalRead(ODSensor)==HIGH)     

  {

    digitalWrite(12, LOW);  

  }

  else

  {

    digitalWrite(12, HIGH);   

  }

  delay(100);             

}


HC-12 433MHz Transceiver Interfacing with Arduino Uno By Engr.Habib Ur Rehman

HC-12 433MHz Transceiver 
Interfacing with Arduino Uno
By Engr.Habib Ur Rehman


Components/Equipment Required:

            Following Components/Equipment are required to perform task.

1.    Arduino Uno (https://piees.pk/product/arduino-uno-r3/)

2.    HC-12 433MHz Transceiver x 2 (https://piees.pk/product/hc-12-433mhz-transceiver/)

3.    Breadboard

4.    Jumper Wires (https://piees.pk/product-category/jumper-wires/)

Circuit Diagram:

Arduino Program:

#include <SoftwareSerial.h>

SoftwareSerial HC12(10, 11);

void setup() {

  Serial.begin(9600);            

  HC12.begin(9600);              

}

void loop() {

  while (HC12.available()) {       

    Serial.write(HC12.read());     

  }

  while (Serial.available()) {     

    HC12.write(Serial.read());     

  }

}   

Note:

Transmitter and receiver program is same

Saturday, July 4, 2020

DHT11 Humidity and Temperature Sensor Interfacing with Arduino Uno By Engr.Habib Ur Rehman

DHT11 Humidity and Temperature Sensor
Interfacing with Arduino Uno
By Engr.Habib Ur Rehman 


Components/Equipment Required:

            Following Components/Equipment are required to perform task.

1.    Arduino Uno (https://piees.pk/product/arduino-uno-r3/)

2.    DHT11 humidity and temperature sensor (https://piees.pk/product/dht11-humidity-sensor/)

3.    Breadboard

4.    Jumper Wires(https://piees.pk/product-category/jumper-wires/)

Circuit Diagram:

 Arduino Program:

#include<dht.h>

dht DHT;

#define DHT11_PIN 3

void setup() {

Serial.begin(9600);

Serial.println("DHT11 Interfacing with Arduino Uno"); }

void loop()

{ // READ DATA

int chk = DHT.read11(DHT11_PIN);

if (digitalRead(0)>35)

{

digitalWrite(A3, HIGH);

delay(75000);

digitalWrite(A3, LOW);

}

Serial.print("Humidity ");

Serial.print(DHT.humidity, 1);

Serial.print("    Temparature ");

Serial.println(DHT.temperature, 1);

delay(2000);

}

Note:

            DHT Library folder should be added in Arduino library folder “C:\Program Files\Arduino\libraries”

Friday, July 3, 2020

433MHz Transmitter and Receiver Interfacing with Arduino Uno By Engr.Habib Ur Rehman



433MHz Transmitter and Receiver Interfacing
                       with Arduino Uno
                By Engr.Habib Ur Rehman 


Components/Equipment Required:

            Following Components/Equipment are required to perform task.

1.    Arduino Uno

2.    433MHz Transmitter and Receiver

3.    Breadboard

4.    Jumper Wires

433Mhz Transmitter

Circuit Diagram:

Arduino Program:

#include <RH_ASK.h>

#include <SPI.h> 

RH_ASK rf_driver;

void setup()

{

    if (rf_driver.init())

     {

         Serial.begin(9600);

         Serial.println("init Sucesssful");

     }

     else if (!rf_driver.init())

     {

         Serial.println("init Fail");

     }

}

void loop()

{

    const char *msg = " Pak Innovative Electronics & Embedded Systems (PIEES)";

    rf_driver.send((uint8_t *)msg+1, strlen(msg));

    rf_driver.waitPacketSent();

    delay(1000);

}

Note:

            Radio Head Library folder should be added in Arduino library folder “C:\Program Files\Arduino\libraries”

433Mhz Reciever

Circuit Diagram:

Arduino Program:

#include <RH_ASK.h>

#include <SPI.h>

RH_ASK rf_driver;

void setup()

{

    if (rf_driver.init())

     {

         Serial.begin(9600);

         Serial.println("init Sucesssful");

     }

     else if (!rf_driver.init())

     {

         Serial.println("init Fail");

     }

}

void loop()

{

    uint8_t buf[54];

    uint8_t buflen = sizeof(buf);

    if (rf_driver.recv(buf, &buflen))

    {

      Serial.print("Message Received:");

      Serial.println((char*)buf);        

    }

}

Note:

            Radio Head Library folder should be added in Arduino library folder “C:\Program Files\Arduino\libraries”

 

 


Thursday, July 2, 2020

8x8 Dot Matrix Interfacing with Arduino Uno By Engr.Habib Ur Rehman


 
 8x8 Dot Matrix Interfacing
  with Arduino Uno
 By Engr.Habib Ur Rehman

Components/Equipment Required:
            Following Components/Equipment are required to perform task.
2.    8x8 Dot Matrix Max7219 Module
3.    Breadboard
Circuit Diagram:
Arduino Program:
Note: 8x8 Dot Matrix Library for Arduino Uno is named as “LEDControlMS”, just copy and paste LEDControlMS folder in Arduino library Folder. (https://github.com/shaai/Arduino_LED_matrix_sketch)

//We always have to include the library
#include "LedControlMS.h"
LedControl lc=LedControl(12,11,10,1);
unsigned long delaytime=100;
void setup() {
  lc.shutdown(0,false);
  lc.setIntensity(0,8);
  lc.clearDisplay(0);
}
void writeArduinoOnMatrix() {
  byte a[5]={B01111110,B10001000,B10001000,B10001000,B01111110};
  byte r[5]={B00111110,B00010000,B00100000,B00100000,B00010000};
  byte d[5]={B00011100,B00100010,B00100010,B00010010,B11111110};
  byte u[5]={B00111100,B00000010,B00000010,B00000100,B00111110};
  byte i[5]={B00000000,B00100010,B10111110,B00000010,B00000000};
  byte n[5]={B00111110,B00010000,B00100000,B00100000,B00011110};
  byte o[5]={B00011100,B00100010,B00100010,B00100010,B00011100};
  lc.setRow(0,0,a[0]);
  lc.setRow(0,1,a[1]);
  lc.setRow(0,2,a[2]);
  lc.setRow(0,3,a[3]);
  lc.setRow(0,4,a[4]);
  delay(delaytime);
  lc.setRow(0,0,r[0]);
  lc.setRow(0,1,r[1]);
  lc.setRow(0,2,r[2]);
  lc.setRow(0,3,r[3]);
  lc.setRow(0,4,r[4]);
  delay(delaytime);
  lc.setRow(0,0,d[0]);
  lc.setRow(0,1,d[1]);
  lc.setRow(0,2,d[2]);
  lc.setRow(0,3,d[3]);
  lc.setRow(0,4,d[4]);
  delay(delaytime);
  lc.setRow(0,0,u[0]);
  lc.setRow(0,1,u[1]);
  lc.setRow(0,2,u[2]);
  lc.setRow(0,3,u[3]);
  lc.setRow(0,4,u[4]);
  delay(delaytime);
  lc.setRow(0,0,i[0]);
  lc.setRow(0,1,i[1]);
  lc.setRow(0,2,i[2]);
  lc.setRow(0,3,i[3]);
  lc.setRow(0,4,i[4]);
  delay(delaytime);
  lc.setRow(0,0,n[0]);
  lc.setRow(0,1,n[1]);
  lc.setRow(0,2,n[2]);
  lc.setRow(0,3,n[3]);
  lc.setRow(0,4,n[4]);
  delay(delaytime);
  lc.setRow(0,0,o[0]);
  lc.setRow(0,1,o[1]);
  lc.setRow(0,2,o[2]);
  lc.setRow(0,3,o[3]);
  lc.setRow(0,4,o[4]);
  delay(delaytime);
  lc.setRow(0,0,0);
  lc.setRow(0,1,0);
  lc.setRow(0,2,0);
  lc.setRow(0,3,0);
  lc.setRow(0,4,0);
  delay(delaytime);
}
void rows() {
  for(int row=0;row<8;row++) {
    delay(delaytime);
    lc.setRow(0,row,B10100000);
    delay(delaytime);
    lc.setRow(0,row,(byte)0);
    for(int i=0;i<row;i++) {
      delay(delaytime);
      lc.setRow(0,row,B10100000);
      delay(delaytime);
      lc.setRow(0,row,(byte)0);
    }
  }
}
void columns() {
  for(int col=0;col<8;col++) {
    delay(delaytime);
    lc.setColumn(0,col,B10100000);
    delay(delaytime);
    lc.setColumn(0,col,(byte)0);
    for(int i=0;i<col;i++) {
      delay(delaytime);
      lc.setColumn(0,col,B10100000);
      delay(delaytime);
      lc.setColumn(0,col,(byte)0);
    }
  }
}
void single() {
  for(int row=0;row<8;row++) {
    for(int col=0;col<8;col++) {
      delay(delaytime);
      lc.setLed(0,row,col,true);
      delay(delaytime);
      for(int i=0;i<col;i++) {
        lc.setLed(0,row,col,false);
        delay(delaytime);
        lc.setLed(0,row,col,true);
        delay(delaytime);
      }
    }
  }
}
void loop() {
  writeArduinoOnMatrix();
  rows();
  columns();
  single();
}