0% found this document useful (0 votes)
54 views

Proximity Sensor For Arduino MCU Using 555 Timer I

This document describes how to build an infrared proximity sensor for an Arduino using a 555 timer integrated circuit. It involves using an IR LED to illuminate the area in front of the sensor and IR detectors to detect when infrared light is reflected back. The 555 timer is used to generate a 38-40kHz signal to drive the IR LED. Code is provided to read the IR detectors and detect when an obstacle is near either detector. The circuit and code are explained over multiple steps with diagrams to illustrate the components and connections.

Uploaded by

lasobere
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Proximity Sensor For Arduino MCU Using 555 Timer I

This document describes how to build an infrared proximity sensor for an Arduino using a 555 timer integrated circuit. It involves using an IR LED to illuminate the area in front of the sensor and IR detectors to detect when infrared light is reflected back. The 555 timer is used to generate a 38-40kHz signal to drive the IR LED. Code is provided to read the IR detectors and detect when an obstacle is near either detector. The circuit and code are explained over multiple steps with diagrams to illustrate the components and connections.

Uploaded by

lasobere
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

instructables

Proximity Sensor for Arduino MCU Using 555 Timer IC

by AravindC8

Hi friend I'm Aravind Chowdary and today we're going see this type of light quite well. When the light is
look into the building of an IR proximity sensor. Let's reflected by an obstacle
get started! in front of the robot, your IR detectors will register that
After setting up light, and, an
your robot’s motors and letting it run, one of the first obstacle. Variables such as texture, surface, color ,
things and reflectivity
you’ll realize, is that most likely it will run straight into affect reliability. The type of infrared light used is
a wall. called near
How do get your robot to detect obstacles, you may infrared, and operates at 800 – 1000 nm, as opposed
wonder. Well, there are to the IR light
a number of different solutions for this problem, such used in security systems or night vision goggles,
as radar, sonar which is called the
(sometimes SODAR in air), bump switches, and one far infrared type of light, and operates from 2000 –
of the most widely used 10,000 nm. The
solutions, Infrared obstacle detection. This type of type of detectors used in this type of IRPD
sensor is called a only allows a certain frequency of light to pass,
proximity sensor, because it can only detect if an usually from 35 to
obstacle is within 40 kHz. Since there are very few sources of IR light
or without a set range. If your application needs an at these frequencies
actual distance there is very little interference. In the system we will
returned, then you probably should use sonar or be building,
DIRRS (digital we will us a 555 timer to produce the desired
infrared rangefinding system). An infrared proximity frequency. There are
detector (IRPD), many other type of frequency generating circuits, but
works by illuminating in front of the robot with infrared the 555 is the
light, this easiest. This frequency can be tuned using a
type of light is invisible to the human eye, but your potentiometer.
home camcorder
can

Proximity Sensor for Arduino MCU Using 555 Timer IC: Page 1
Step 1: Get Your Parts

1 – breadboard for
prototyping (very highly recommended!)
1 – 555 timer
1 – 1-10k potentiometer (value is not imperative)
1 – 0.01 uF cap
2 – 1k resistors
2 – IR receivers (preferably Panasonic 4602 available a Digi-Key.
If you buy Radio Shack detectors don’t expect it to work well at all)
2 – IR LEDs
2 – 470 ohm resistors
2 – 0.1 uF caps

If you're ready with the parts let's get started!

Proximity Sensor for Arduino MCU Using 555 Timer IC: Page 2
Step 2: Circuit Diagram

This project involves two


parts, first, we set the 555 circuit to produce the desired frequency,
then, we set up the IR detectors, and LEDs, and write the
code. We will cover part one this month, and part
two next month.
The first step in building this circuit is to place all the
components on your bread board using the schematic above.

Proximity Sensor for Arduino MCU Using 555 Timer IC: Page 3
Step 3: Program Your Controller

Next, debug dec5 frequency*10,cr


program your controller using the code below. If you goto start
are using something
other than a Basic Stamp, you should have some sort Once your processor has been programmed you then
of display, or should
oscilloscope so you can tune the circuit to the turn the potentiometer until the debug screen, o-
required frequency. scope, or LCD display shows
38,000 (or the correct frequency for your detectors).
‘Frequency count Basic Stamp code Once your
frequency var word circuit is set to the correct frequency, then we can
high 5 ‘turn on oscillator unless vdd move on to the next
is connected to the reset pin section of our project…
start:
count 6,100,frequency {mospagebreak}
‘count frequency on pin 6

Step 4: Let's Recipe What We Done

Lets recap what we’ve done simple Basic Stamp


so far. First, we created a 555 timer circuit to produce program. At this point in the process we need to put
a 38-40khz pulse. in the LEDs IR
We did this so that the detectors would be able to detectors, and write some code to utilize our infrared
recognize the infrared proximity detection
light coming from our robots LEDs and no other type circuit.
of IR light. After
setting up the circuit we then fine tuned it using a

Proximity Sensor for Arduino MCU Using 555 Timer IC: Page 4
Step 5: Infrared Detection

The first step is to assemble you DON’T see any light from the LED’s then you
all your components on your circuit board or bread need to verify that your
board according to the circuit is receiving power, and that the output pin is
schematic. outputting. Next
Before setting up the detectors first find out if the you need to wire up your detectors using the
IRLEDs are doing schematic below. The physical
anything. You can do this by either using you home setup of the detectors and IRLEDs are at a 45 degree
video cassette recorder angle. The picture
or using a IR an IR detector card from Radio Shack. below gives a good representation, with detectors in
Although using the yellow and IRLEDs in
card is probably easier, it’s a bit pricey at $5.00 US. red. Follow the above circuit to build the detector.
Camcorders are
able to pick up the higher wavelength light than a
human eye, so therefore
you can "see" the IR LEDs by looking through your
viewfinder. If

Step 6: Coding
Proximity Sensor for Arduino MCU Using 555 Timer IC: Page 5
Got your detectors set up? Verify the pin x var
connections and fire up your stamp using the code nib
below. RIRdetect var nib

‘Basic Stamp Code LIRdetect var nib


‘Basic Proximity Detection Part 2
INPUT 0 INPUT 0
INPUT 9
INPUT 9
start:
start:

debug In0 RIRdetect = 0

LIRdetect = 0
debug In9,home
‘check 10 times
goto start for right detection

Once you have this for x = 1 to 10


code running, try and put your hand down in front of
you detector and LED. RIRdetect =
Depending on what detector you have at which pin, RIRdetect + in0
on of the debug number
should change from 1 (high) to 0 (low), and remain LIRdetect =
that way as long as LIRdetect + in9
your hand is in front of it. Now try the other detector,
and then both at next
the same time.
Once both of your detector and LED pairs are if (RIRdetect <
functioning correctly then 4) and (LIRdetect < 4) then center
try out the code below.

if RIRdetect <
4 then rdetection

if LIRdetect <
4 then ldetection

goto start

rdetection:

debug
"A right collision was detected!"

goto start

ldetection:

Proximity Sensor for Arduino MCU Using 555 Timer IC: Page 6
debug
"A left collision was detected!"

goto start

center:

debug
"Center collision!"

goto start

Note: I have NOT


tested this code as of yet. It came all FROM MY
HEAD. If it doesn’t work
correctly check for errors. My IRPD circuit is
disassembled at the
moment, and I haven’t had time to put it back
together.

https://youtu.be/uuHmy3xCC_k

Step 7: Lastly

This
is just some basic code that checks for a greater than 60% hit ratio.
Since an output low (0) signals a hit, we test for a value lower than 4.
You can put any code you want into the r and l detection and center
subroutines. Once you have it working congratulations! You now have a
working, albeit, simple obstacle detector.

Thanks for spending your time in reading my instructable.

Proximity Sensor for Arduino MCU Using 555 Timer IC: Page 7

You might also like