How to Make a Simple Proximity Sensor Using Arduino

Steps

  1. How to Make a Simple Proximity Sensor Using Arduino Picture 1
    Start off by setting aside the required materials
  2. How to Make a Simple Proximity Sensor Using Arduino Picture 2
    Prepare the IR LED by cutting a small piece of the electric tape and then wrapping it around the LED to form a tube as shown above.
  3. How to Make a Simple Proximity Sensor Using Arduino Picture 3
    Using the breadboard, jumper wires, resistor & LED's set up connection as follows.
    1. Connect the resistor from 5v to the positive( big pin) on the IR receiver.
    2. Connect all the IR LEDs to the 3.3v pin on the Arduino.
    3. Connect a jumper from A0 on the Arduino to the positive leg on the IR receiver.
    4. Connect all of the negatives of both the receiver and the LEDs to the GND on Arduino.
    5. Make sure none of the wires or LEDs are shorting as LEDs are very sensitive and can burn.
  4. How to Make a Simple Proximity Sensor Using Arduino Picture 4
    Build your code. This is a simple code that will print out the IR data on your computer screen, these variables can then be used to control almost anything. This code will allow for a simple analog read of the IR sensor.
    int IRreceiver = A0; // initialize
    How to Make a Simple Proximity Sensor Using Arduino Picture 5
    int IRval;
    How to Make a Simple Proximity Sensor Using Arduino Picture 6
    void setup()
    {
    pinMode(IRreceiver, INPUT); // declare its an input
    Serial.begin(9600); // speed at which the communication will happen
    }
    void loop()
    {
    int IRval= analogRead(IRreceiver); // declare data
    Serial.println(IRval); // print the data
    delay(10); } // add a delay to smoothen things out
  5. Make sure all the connections are safe and then upload the code to your Arduino. After it's uploaded bring up the serial communication.
  6. Examine the data. The data should vary as the distance between the sensor and the object varies.
  7. How to Make a Simple Proximity Sensor Using Arduino Picture 7
    Finished.
4 ★ | 2 Vote

May be interested

  • How to Run a Toy DC Motor by Using ArduinoPhoto of How to Run a Toy DC Motor by Using Arduino
    one of the most basic (and fun) things you can do with an arduino microcontroller is wire a dc motor. you can make a simple table fan or go all in and build a remote controlled car. either way you will need to know how to actually make a...
  • How to Protect a PC in a ThunderstormPhoto of How to Protect a PC in a Thunderstorm
    the earth has 100 lightning strikes per secondhttps://www.reference.com/science/many-times-per-day-lightning-strike-earth-66d5e236ffaa2aca - about 3.15 billion per year. lightning damage to home electronics happens when a strike brings an...
  • How to Upgrade USBPhoto of How to Upgrade USB
    usb stands for 'universal serial bus,' a connection port system that connects external devices to the central processing system. you can upgrade usb to benefit from faster communication between your external devices and computer. find out...
  • How to Configure RAIDPhoto of How to Configure RAID
    raid is a great way to add additional security and redundancy to a computer workstation. a raid array is a setup of two or more hard drives that have been synchronized to provide protection against data loss due to a malfunctioning hard...
  • How to Format a Floppy DiskPhoto of How to Format a Floppy Disk
    need to format that ancient floppy disk? windows and mac both have built in formatting tools, or you can use the windows command prompt for even more control. formatting your disk will erase everything on it, so ensure that you have any...
  • How to Connect a USB Printer to a NetworkPhoto of How to Connect a USB Printer to a Network
    this wikihow teaches you how to connect a usb printer to a network by connecting it to a router or using a print server. if your router has a usb port, you can connect your printer directly to your router. you will then need to configure...