Showing posts with label arduino code. Show all posts
Showing posts with label arduino code. Show all posts

Saturday, 28 October 2017

Line Following Robot

LINE FOLLOWING ROBOT

LINE SEGUIDOR


Components Required: -

  1. Arduino Uno or any other micro-controller
  2. IR sensors or module
  3. L293D or module
  4. DC motor with wheels
  5. Frame
  6. Connecting wires
  7. LED's

Connection Diagram of IR sensors


IR transmitter and receiver connections

In the figure the IR0, IR1, IR2, IR3 and IR4 represents the transmitter and D0, D1, D2, D3 and D4 represents the receiver.
The receiver IR is connected to the analog pins of Arduino uno or any other micro-controller.

Note: - Adjust the placing of the IR sensor after measuring the distance and place them in this order and way only. Further if you want to change the positioning then you should make slight adjustment in the code accordingly.

MOTOR DRIVER IC L293D


L293D IC

This IC can controll two DC motor. And can be used to control left and right motor in line following robot.

PIN DIAGRAM

BASIC CONNECTION DIAGRAM

PIN CONNECTIONS FOR ARDUINO



Note: - After reading the code find the connection of indicator and connect the indicator according to your need.

Monday, 12 June 2017

HOW TO CONVERT THE LDR (Light Dependent Resistor) VALUE TO LUX

Q) What is LUX?

The lux (symbol: lx) is the SI unit of illuminance and luminous emittance, measuring luminous flux per unit area. It is equal to one lumen per square metre. In photometry, this is used as a measure of the intensity, as perceived by the human eye, oflight that hits or passes through a surface.

Q) What is LDR?

A photoresistor (or light-dependent resistor, LDR, or photoconductivecell) is a light-controlled variable resistor. The resistance of a photoresistor decreases with increasing incident light intensity; in other words, it exhibits photoconductivity. A photoresistor can be applied in light-sensitive detector circuits, and light- and dark-activated switching circuits.
LDR Sensor
LDR SYMBOL



We can connect the LDR to the Analog Pin of any micro-controller and in few steps we can directly convert the value to the illumination (lx).


Connection for LDR

Connection

  1. Connect LDR and Resistor in Series (Take resistance of value 10K).
  2. Now Ground one pin of the LDR (Which is not coonnected to Resistor).
  3. Connect one pin of the resistance to power supply that is not connected to LDR (Do not connect it to higher power supply than the micro-controller usually +5V).
  4. Connect the common pin of LDR and of RESISTOR to the Analog PIN of the micro-controller.

CALCULATIONS INVOLVED

  1. RL=500/lux
  2. V0=5*(RL/(RL+R))
  3. V0=LDR_value*ADC_value
  4. lux=(250/V0)-50
Where: 
  • RL is the resistance of LDR
  • R is the resistance connected to LDR
  • LDR_value is the Analog value read by micro-controller pin
  • ADC_value is system_voltage/Resolution of ADC
  • V0 is the analog measured voltage
  • lux is illumination calculated

A sample example using ARDUINO UNO micro-controller

CODE
OUTPUT


Copy the code


/*  RL=500/lux
 *  V0=5*(RL/(RL+R))
 *  V0=LDR_value*ADC_value
 *  lux=(250/V0)-50
 *  Author: Ashish Kumar 
    Org: INVOOTECH                  */
float lux=0.00,ADC_value=0.0048828125,LDR_value;

void setup() {

  pinMode(A0,INPUT);    //make analog pin A0 as input

  Serial.begin(9600);   //initialize serial monitor

}

void loop() {

  LDR_value=analogRead(A0);

  lux=(250.000000/(ADC_value*LDR_value))-50.000000;

  Serial.println(lux);

  delay(1000);

}


SERVO MOTOR CONTROL USING PIC16F877A (with 20MHz Crystal Oscillator)

SERVO MOTOR CONTROL USING PIC16F877A SERVO MOTOR Servo motors are used to control many things as it offers very precise rotation o...