DISTANCE SENSOR

From UCLA IEEE OPS
Jump to: navigation, search

Due Date

Breadboard: Monday, January 28, 2019

Soldering: Wednesday, January 30, 2019

Tips (READ THESE)

  • Placement of your emitter and receiver matters! Make sure you pair up an emitter with a receiver to best achieve the diagram above
  • If you're having trouble with the brightness range, try using the serial monitor to print out the values you're reading, so you can adjust your map/constrain statements
  • You don't need the usb cable to power your Arduino! If you hook up your battery to the Vin and GND pins on the Arduino, it will be powered and run the latest code you uploaded to it.
  • Try experimenting with values using the serial monitor to see what happens when you put your hand closer or farther away from the distance sensor!
  • Try different input ranges for your map function by printing out your readings!
  • If you have an Android phone, you can use your camera to view IR light! Use this to check and see if your IR Emitter is working
  • If you try to map a variable and its outside the inuput range, it will loop around to the other side of the range! So, if you do map(51, 0, 50, 0, 100) for example, it will output 0, which is unintended!
  • If your IR emitter is not working, try connecting it to the 3v3 pin rather than the Vin pin
  • Place print statements and delays in your code to help trace through it and determine what values are being read/calculated. Make sure that everything matches what you expect. This is a crucial part of debugging for this project, you need to be able to print out what you are reading from your receiver so you can determine what your general range is for your distance sensor.
  • Do not test your distance sensor under a light.

About the Project

We will be creating a circuit that allows us to sense the distance of any object (useful for the capstone!). To do this, we will be using infrared diodes to send out infrared light, and phototransistors to receive the IR light. If an object is closer to the emitter and receiver, more light is absorbed by the transistor! You will need to use your Arduino in this project to power the circuit, read data from the phototransistors, and output PWM signals to two LEDs based on your readings.

Slides: https://docs.google.com/presentation/d/1514g2ag057a8ww3D1leQ4K8ehFIl2aPWmhLAHqdYaxo/edit?usp=sharing

Note: If you are a Mac OS user, please refer to the slides from the previous project to handle issues :)

Overarching Idea

Schematic

Distance Sensor Schematic