Skip to main content

Posts

Showing posts from March, 2017

Object detector using arduion

It is simple object detector project using arduino ultrasonic module

Parts list--

Bread board

LED ( RED & GREEN)

Resistor -220 ohms

Male to male jumper wire

arduino uno

arduino ultrasonic module ( HC-SR04)


HC-SR04 connection

VCC--5V
GND--GND
TRIG-- D2
ECHO-D3

LED RED -- D8
GND via resistor

LED GREEN-- D9
GND via resistor

PIEZO BUZZER --D11

GND--GND
Supply 9V Battery





ARDUINO CODE :-


//Ultasonic Sensor

//Pins connected to the ultrasonic sensor
#define trigPin  2
#define echoPin 3
//LED pins
#define ledGreen 9
#define ledRed 8
//Pin connected to the piezo buzzer
#define alarm 11

int range = 5;//range in inches

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  //initialize the sensor pins
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  //initialize LED pins
  pinMode(ledGreen, OUTPUT);
  pinMode(ledRed, OUTPUT);
  //set LEDs
  digitalWrite(ledGreen, HIGH);
  digitalWrite(ledRed, LOW);

}
void loop()
{
  // establish variables for duration of the ping, 
  // and the distance re…