Project 7: Eagle CAD: PCB layout
Project 7: Eagle CAD: PCB Layout
Red light Green light is a simple obstacle detector implemented with IR emitters and detectors. This project must have three LEDs, but using a different color for each is optional. You will define three ranges (e.g. plus/minus 50 from the baseline is one such range) for values of reflected IR light measured from your detector by MCU. Each range will have an associated LED and the program must turn it on when an object falls in the corresponding range.
This project has two purposes: to develop your independence in embedded programming and to provide a platform from which you can tackle the spring quarter projects. Unlike Projects 4 and 5, we will not be providing you with detailed skeleton code. Rather, you must develop your own program based on our recommended Arduino functions and a description of the desired system behavior.
The schematic includes two emitters, but this project can be completed with only one (we will only be using one next quarter). The reason we have included two is that there will be more light reflected for the detector to pick up. With only one emitter, the analog readings drop off very quickly and you must get very close for a noticeable change. Be sure to angle the emitter(s) and detector slightly when assembling the circuit.
Here are a few other tips for getting good readings:
Cupping your hand over the emitter and detector will reduce ambient noise
Different colors reflect IR in different ways. Set your thresholds with an object you will test with consistently.
If your project doesn't seem to be working, take out a phone. Most cellphone cameras will pick up the light from the IR emitter (some shade of purple), so you can verify that your emitters are on.
analogRead(analog_pin): This is needed to measure the signal from the IR detector. analog_pin will be one of the pins labeled with an A on your MCU.
General Program Behavior
1. Acquire baseline reading
Average some values to find this
3. Enter loop
2. Read value from detector and compare to baseline
3. Turn on an LED depending on the difference from the baseline
Serial.println: Although not exactly required, this will enable you to calibrate your ranges. Refer to the Meeting 6 presentation for instructions on using it.
Parts for the Project
Product page for the emitters/detectors: https://www.sparkfun.com/products/241
2x IR Emitter (the yellow dot)
1x IR Detector (the red dot)
1x 910kOhm resistor
3x Current limiting resistor for LEDs
2x Current limiting resistors for IR LED (Use something like 100ohm, we want a higher current for greater detection distance)
Which pin is which on the IR Emitter and Detector?
Please refer to the datasheets here: https://www.sparkfun.com/products/241