How can I make a follower robot using the PIR Sensor?


#1

How can I make it so that the robot somewhat comes to my general direction? So far I have come up with this which doesnt work as I want. It’s really inconsistent and randomly moves forward or stops etc. I have some additional sensor like Ultrasonic or IR if any of those helps…From my understanding it should be possible to make a very primitave follower robot with the PIR sensor.


#2

I see a couple of problems with your program:

  1. the PIR sensor is omnidirectional. It will sense motion in any direction. A easy test is to slowly wave your hand on the left side of the sensor and The blue LED will indicate motion. The same for the right side, in front and sometimes behind the sensor.
  2. your program says go forward if the sensor detects any motion otherwise spin in a circle.

You will have to find a way to “shield” the sensor so that it only detects motion in the direction that you want. Maybe a cardboard cover.

In my case, I mounted the ultrasonic sensor on a rotating servo motor so that I can control direction.


#3

I have intentionally made the code so it spins around. It’s inefficient but I tried to achive like “Move towards the heat” scenario so it will somewhat follow. Can you please elaborate how can I better achieve at least partial following?


#4
  1. I would mount the PIR sensor vertical with the sensor sphere facing the front of the robot. That way it will limit the reception field to 180 degrees left to right and 180 degrees top to bottom. You may have to add a cone or tube to further restrict the sensor angle.

  2. I would slow the turn rate speed 75 and stop every 0.5 seconds and check for a PIR value of 1

Things to test:

  • if you put your hand in front of the sensor and not move it, does the blue LED come on and then go off or does it stay on.
  • if you move your hand away from the sensor at the same speed and distance from the sensor as the robot moves, does the blue LED stay on.

It is a heat motion sensor. Does the object and the robot have to be moving at different speeds (changing distances). Think of 2 people in a moving car. They are moving compared to everything outside the car BUT are not moving compared to each other.


#5

Thank you very much! :smiley:


#6