go away spammer

Author Topic: PIR  (Read 5479 times)

0 Members and 1 Guest are viewing this topic.

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
PIR
« on: October 09, 2007, 06:05:06 AM »
Anybody has info about how to interface a PIR to a microcontroller?
or a website that explains it?
what data does the PIR OUTPUTS?
good ol' BeNNy

Offline jsmoker

  • Full Member
  • ***
  • Posts: 118
  • Helpful? 2
Re: PIR
« Reply #1 on: October 09, 2007, 08:27:56 AM »
I would double check with an oscilloscope for your particular model, but most just output an analog signal which you would interface to your A/D.  But like I said, you might want to check.  a PIR just looks for movement, so if it already has an internal circuit it might output a temporary 1 when it detects movement and go back to a 0 after a time period.  Or it could output a digital signal with (for example) 8 bits for a 0-254 range, but like I said, the most common is the analog output (who's max will also depend on the model).

Offline Steve Joblin

  • Supreme Robot
  • *****
  • Posts: 405
  • Helpful? 2
    • Roebotz
Re: PIR
« Reply #2 on: October 09, 2007, 05:59:54 PM »
Check out http://www.parallax.com/detail.asp?product_id=555-28027... has great documentation and sample programs

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: PIR
« Reply #3 on: October 09, 2007, 08:13:38 PM »
Before we go on . . . feel free to look up a few PIR sensors . . . most of them already mention how to interface them :P

check out this $23 all-in-one PIR sensor at digikey:
http://pewa.panasonic.com/pcsd/product/sens/pdf_cat/amn.pdf

Only three pins: power, ground, and ADC output (goes directly to your microcontroller ADC, and you're done!)

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: PIR
« Reply #4 on: October 10, 2007, 03:40:55 AM »
well both links are pretty good in explaining the PIR thanks guys but thing is that the PIR only detecs the changes in the infrared levels emitted by surrounding objects
well,, any moving object? not only humans?
and,, this thing doesnt give information data about the position ,, so it just detecs motion
so how would you command the robot where to go?
whats used for detecting the position the object is moving? or is it done differently?
good ol' BeNNy

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: PIR
« Reply #5 on: October 10, 2007, 04:46:41 AM »
PIR sensor can only detect motion of heat generationg objects/persons/animals. So for a static person, the robot has to pan the sensor to detect it (mount the sensor on a servo). By monitoring the servo while panning, you can find the direction the object is located. If you need to find the distance, use a IR or sonar distance sensor monted on the same servo.
Check out the uBotino robot controller!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: PIR
« Reply #6 on: October 10, 2007, 04:48:29 AM »
http://www.societyofrobots.com/robotforum/index.php?topic=1136.0

(remember to always search the forum first ;D)

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: PIR
« Reply #7 on: October 10, 2007, 08:37:37 AM »
yea admin , the videos on that link aint working,, dunno if its my pc.
well about mounting the sensor on a servo,, the sensor has a vision angle of -50 to +50 degrees
so its hard to know the exact direction of the human,, or do you mean when turnin the servo to the right and it detecs so the +50 axis of the sensor is the way to the human?
is it used for exact locating of the direction? maybe if ist a spot directing sensor it would help a lot more.

i have another question about the servo carring the sensor,
how can someone make a servo move so slow? and do u need an encoder to monitor the servo direction?
good ol' BeNNy

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: PIR
« Reply #8 on: October 10, 2007, 09:05:30 AM »
yea admin , the videos on that link aint working,, dunno if its my pc.
well about mounting the sensor on a servo,, the sensor has a vision angle of -50 to +50 degrees
so its hard to know the exact direction of the human,, or do you mean when turnin the servo to the right and it detecs so the +50 axis of the sensor is the way to the human?
is it used for exact locating of the direction? maybe if ist a spot directing sensor it would help a lot more.

i have another question about the servo carring the sensor,
how can someone make a servo move so slow? and do u need an encoder to monitor the servo direction?

It seems that you don't know how a servo works...
Using a IR distance sensor together with the PIR sensor will give you exactly the position of the human, because the IR distance sensor has a narrow beam and will detect the human as an object in front of it. There are lots of examples on the forum for this. Use the admin's code for Stampy and add the PIR reading just to make sure the object is a human, not something else.
Check out the uBotino robot controller!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: PIR
« Reply #9 on: October 10, 2007, 09:10:35 AM »
Please read this:
http://www.societyofrobots.com/robotforum/index.php?topic=602.0

(the videos work, its your computer :P)

Quote
well about mounting the sensor on a servo,, the sensor has a vision angle of -50 to +50 degrees
so its hard to know the exact direction of the human,
You can put a shield around the sensor to reduce the angle. And when you scan, you look for the highest signal, which just so happens to be where the human is. The vision angle doesnt matter.
Its very similar to the concept with a scanning rangefinder:
http://www.societyofrobots.com/sensors_sharpirrange.shtml

Quote
i have another question about the servo carring the sensor,
how can someone make a servo move so slow? and do u need an encoder to monitor the servo direction?
As I said before, forget the cool stuff, learn the basics first:
http://www.societyofrobots.com/robotforum/index.php?topic=2108.msg13991#msg13991

And search the website first before asking questions!
http://www.societyofrobots.com/robot_tutorial_index.shtml

Its all here.
http://www.societyofrobots.com/actuators_servos.shtml
http://www.societyofrobots.com/sensors_encoder.shtml

addendum since Ro-Bot-X beat me to the reply . . .
he is right, use my Stampy code/design exactly the way it is and it will work with zero programming/thinking on your part
http://www.societyofrobots.com/robot_sumo.shtml
http://www.societyofrobots.com/robot_50_robot_sharpIR.shtml

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: PIR
« Reply #10 on: October 10, 2007, 03:53:52 PM »
yea admin and robox i know what im asking,, here is what your tutorial explains about velocity
Quote
Velocity
The servo turn rate, or transit time, is used for determining servo rotational velocity. This is the amount of time it takes for the servo to move a set amount, usually 60 degrees. For example, suppose you have a servo with a transit time of 0.17sec/60 degrees at no load. This means it would take nearly half a second to rotate an entire 180 degrees. More if the servo were under a load. This information is very important if high servo response speed is a requirement of your robot application. It is also useful for determining the maximum forward velocity of your robot if your servo is modified for full rotation. Remember, the worst case turning time is when the servo is at the minimum rotation angle and is then commanded to go to maximum rotation angle, all while under load. This can take several seconds on a very high torque servo.


true?  ;) i dont see an explanation on how to CONTROL its speed......

and yea robox if i know a lot about servos i wouldnt ask a question..hope you're glad you know how to control its velocity.
and about monitoring the servo's direction i know about encoders used but i was just wondering if you guys maybe have some other way of doing that

anyway im sorry to ask you questions,,
good ol' BeNNy

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: PIR
« Reply #11 on: October 11, 2007, 06:36:46 PM »
This should explain it (and everything else below it on the servo tutorial)
Quote
Signal Wire (Yellow/Orange/White wire)
While the black and red wires provide power to the motor, the signal wire is what you use to command the servo. The general concept is to simply send an ordinary logic square wave to your servo at a specific wave length, and your servo goes to a particular angle (or velocity if your servo is modified). The wavelength directly maps to servo angle.

Basically by changing the wavelength, you change the angle (or for a modified servo, the velocity)


Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: PIR
« Reply #12 on: October 12, 2007, 06:59:18 AM »
The speed of the unmodified servo can't be changed from software, but can be modified with external gearing, or by getting a slower servo.

However, in your code, you want the servo to turn a small amount of degrees, take a sensor measurement (this will be a step), then turn a little more, take another measurement and so on. When you reach the end of travel, turn the other way step by step. When you get a positive reading from the sensor, keep going until no pozitive reading, then you can calculate the angle the center of the object is and drive the robot towards that direction. Then change the direction of the scanning and repeat.

So you don't have to worry about servo speed, worry about the time it takes for a sensor reading!
« Last Edit: October 12, 2007, 07:02:15 AM by Ro-Bot-X »
Check out the uBotino robot controller!

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: PIR
« Reply #13 on: October 12, 2007, 07:21:49 AM »
thanks robox for this explanation
i was thinking of shielding the sides of the pir (so it looks just forward in a very narrow angle)
and it goes like this
turn 5 degrees
have a reading
and so on

but as what u said the motor should stop (for a very little time) to have a reading
,,as long as the sensor is not moving and the human is not moving howcome the sensor would indicate anything moving ??? or this little time of mottor stopping should be very little that the sensor wouldnt be totally stable?
good ol' BeNNy

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: PIR
« Reply #14 on: October 12, 2007, 08:53:02 AM »
You have to experiment with your PIR sensor. Move the servo 5 deg and read the sensor. The sensor response time may not be as fast as the servo move. It takes a little time to trigger, you have enough time to take a reading. Then it will take a little time until it will be reset. If it is too fast, add a capacitor on the signal line and ground. This way you will delay the reset so you have enough time to take the reading. The principle is good, but you have to tweak it a little. Also take a reading of a Sharp IR distance sensor right after the PIR. It will show you the range to the object detected.
Check out the uBotino robot controller!

 


Get Your Ad Here