I need to make a robot that can somehow sense motion in its surroundings. I only have the advanced sensor kit to work with, so I am wondering if it might be possible to use either the ultrasonic range finder or the line sensor part of the line tracker to do this?
Would a robot have to be stationary in order to sense motion? In other words, would stationary objects appear to be moving if the robot was moving? If so, can you program the robot to only sense intermittently, so that the robot could stop every so often and then only “turn on” the sensor at that point (or at least, be programmed to only react to the sensor input at that point)?
Would be very grateful for any suggestions you might have.
Vexan
This thread discusses using a cheap PIR sensor to accomplish motion sensing (from a stationary robot). I’m not sure if that is an option for you, but check it out.
I think it would be challenging to do this with the advanced sensors, though you might be able to use ultrasonic with some fairly sophisticated software to do a decent job of it. You could also use the light sensor to look for changes to the ambient light.
Do you want to look for motion anywhere in the surroundings of the robot, or are you willing to constrain the motion detection to a smaller area? For instance: You could use the ultrasonic sensor to scan a 360° circle around the robot a few times and look for any areas where the reading changes between subsequent scans. Motion directly above the robot wouldn’t be detected since it wouldn’t be in the same plane as the robot’s circular scan. However, another robot (or person) moving across the floor could potentially be detected.
You said you have only one advance motion kit. That means one ultrasonic range finder, which is probably the best sensor for the job of traditional motion detection. Can you describe a little more about what you’re trying to do though? For example, the line sensor would work great for motion detection 1-2cm away from the sensor. The US can be used to detect motion right in front of it pretty well with the right programming. And if you want a broader range, you can also have it detect motion by sweeping back and forth. That second approach will take a little more programming, but it can be done without too much effort. Do you need help with the programming? If so, what language are you using?
We had an ultrasonic turret set up for motion detection to introduce slightly more advanced programming to the new programmers. It isn’t all that difficult, but problems the ultrasonic’s reliability will not allow the turret to move very fast.
Actually, it’s for a school project. The idea is to detect a person entering and trying to cross a classroom. It probably won’t be perfect, and I guess doesn’t need to be either. If it picks up motion, it will have some kind of output (sounding some kind of alarm). It all has to be in autonomous mode.
I’m guessing the room is too big for the US to cover from one location, so the robot should ‘patrol’, for example using the line follower, or a pre-programmed sentry route. I’m thinking it could then scan back and forth with the US for a little while, then move again, etc.
In terms of program logic, my immediate thought was to use an infinite outer loop, with a couple of embedded loops in sequence for the US scanning then moving the robot a bit, then scanning, then moving etc. Inside the scanning loop, there’s an if-statement that activates appropriate output (alarm) if motion is detected.
I’m using EasyC for this - am new to EasyC and robot programming in general, but have done other types of programming. Still, I guess my initial program structure idea might be off…
Just an alternative, if the room has a door, put a limit switch so it is closed when the door is closed and open when the door is. That would make programming really easy.
I don’t know exactly what you’ll end up doing, but I’ll explain briefly how I made a simple motion sensing turret. I stuck an ultrasonic sensor on a motor and attached a potentiometer to track it’s position. I had the sensor scan back and forth 180 degrees. This span was split up into a couple hundred different sections, and the value of each section was stored in an array. After running some filtering to weed out bad values, the sensor would check the value at the angle it was pointing to against the corresponding array index. If the value of a few consecutive indices had changed by a certain threshold, the robot would declare that there was motion.
He he, yes it would, and we did consider that, but it wouldn’t allow for the possibility of intruders through the window, and there are also some minimal complexity requirements set in the task.
Ah, of course, I had not thought of the need to only scan when the sensor is motionless, so if you want to do a sweep rotating the sensor back and forth across an area you have to stop the rotation at intervals. This makes perfect sense, although it does add some complexity. Thanks!
Since I assume you want a pretty high resolution, it would take too long to stop the sensor at every increment. Just have the motor running at a slow speed. Theoretically it should work even if the motor is going faster (taking into consideration the speed the the sound takes to bounce back of course), but after a certain speed the data won’t be as reliable. I remember getting good results running the motor at around motor power 15 (ROBOTC motor power goes from 0 to 127, so that’s around 11% of full speed) with no gearing.