I have a robot and under it I can point a sensor to the ground and it will be about 2cm from the ground pointing down. So I am wondering if there is a sensor that I can integrate to arduino to check if the robot is moving. I can use an encoder on the wheels because sometimes they slip and rotate without moving the robot.
I need to detect if the robot is actually moving relative to the ground. I think ultrassonic sensor wouldnt help because they measure distance and the distance from the robot to the ground will always be the same. Also the PIR motion sensor I think is not suitable because it works with infrared light and the ground probably emits a constant infrared light when the robot is moving or when is not moving.
Do you have any idea my friends?
The easiest way is to look at the motor control, powered or not.
I am sorry, I didnt understand @raildoarder. You are telling me to use encoders on the motor? It will not work if the wheels slip!
No, no encoders, just the controller logic telling motors to run.
Slip? Use a HC-04 in the direction of the moving direction to avoid getting stuck and slipping.
Use the innards of an optical mouse. It offers most sensitive, quantitative and directional information on most surfaces.
Another free moving wheel and a simple sensor noticing its rotation.
You con use an IMU sensor to measure the moving distances
IMU measures accelerations, not distances.
I means we can calculate the distances based on values from sensor
I am already using MPU6050 to keep relative positions of the robot but I dont think I can use acceleration to check if the robot is moving or not because if it's moving at constant speed the accel will be 0, as if it was not moving.
Using another wheel attached to the ground would be nice but I see not easy "module" that I can use for that. Regarding the mouse optical sensor, do you know if there is an arduino module for that? Cause I think it would not be easy to get the optical sensor and plug it to arduino, surelly I would need some driver to parse the data from the sensor, right?
The MPU6050 will report vibration and bouncing, which would surely be useful to tell the difference between "not moving" and "moving".
But the sensor is not useful for estimating either distance traveled or velocity.
I considered an optical mouse but rejected it as a solution for your application because it requires close contact with a relatively smooth surface. Similarly using a low-res video camera would require post processing and optics beyond the scope of a simple project.
I like @railroader's solution - reading the movement of any free moving un-driven wheels, with a rotary encoder - or perhaps you could use a very small PM DC motor as the sensor.
I tested this idea with a motor recovered from a printer - I got a voltage proportional to the speed and direction of rotation
@johnerrington indeed so far the best alternative is using another wheel with an encoder. The mouse alternative I think would complicate too much my project. I liked the suggestion of using MPU6050 to detect motion using the accelerometer but they are too sensitive and I am pretty sure there will be tons of trial and error to be able to check if the robot is indeed moving or stationary using accelerometers only.
What's your budget for this? You could use a camera with OpenMV. Any magic method using dollar parts would be all over every robot by now if it existed.
Consider mounting a sensitive tilt sensor on a thin, flexible post.
Paul
@aarg my budget is a few dolars, electronics are very expensive here in brazil, more now because the dolar/real is so high.
@Paul_KD7HB I didnt understand how mounting a tilt sensor would help me understand if my robot is stationary!
batata004:
@aarg my budget is a few dolars, electronics are very expensive here in brazil, more now because the dolar/real is so high.
@Paul_KD7HB I didnt understand how mounting a tilt sensor would help me understand if my robot is stationary!
It forms a pendulum so any movement will cause a "tilt" of the sensor.
Paul
You can pull a pm dc motor from scrap electronics such as a printer or scanner, battery operated toy eg car ...
I dont think the "inverted pendulum" would work as it crudely measures (acceleration = force), not displacement. And anyway would need to be damped or it would wag about.
@Paul_KD7HB thank you but in my case I wouldnt need the inverted pendulum to measure acceleration cause MPU6050 already does that, but it's not reliable enough, there is just too much noise.
@johnerrington thanks for your suggestion! I think the easier method might be using the additional wheel with encoder, but I am still investigating cause it would not be simple since the robot can make curves I would need a bearing on the wheel to allow it to rotate sideways!
Look at movable tables, office chairs that have a swiveling wheel arrangement. The wheel rotates and the attachment of the wheel can rotate in the horizontal plane.