Hello everyone , so I have this university project that am working on and I need your help. I need a motor to keep turning as long as an object is in front of a sensor , if the object moves from its place the motor stop turning . so what I need is a motor and a sensor and how to connect them together , any ideas ? thanks
Well an ultrasonic sensor might be a good start. Get one of those and write some code that tells you if there's something close to it or not. Look at the Ping example code in the IDE or Google "arduino distance sensor" and you'll get lots of useful ideas.
When that's working add the motor. It's about a simple as a project can get. Every obstacle avoiding robot ever made uses the same principle.
Firas23: so I have this university project [...] so what I need is a motor and a sensor and how to connect them together , any ideas ? thanks
Don't they teach you anything at that University? Or were you just not listening?
At the very least I would expect University to teach people to find out things for themselves. Of course maybe it's a management course and the pinnacle of achievement is to sit back and get others to do the work.
Firas23: I need a motor to keep turning
What kind of motor? How is it to be powered and controlled?
as long as an object is in front of a sensor ,
What kind of object? Size, distance in front of the sensor? What kind of sensor?
if the object moves from its place the motor stop turning
Is that "if the object moves" or "if the object moves out of the detection range of the sensor"?
For testing I'd indeed start with the sensor, replacing the motor with an LED. Get the LED to react as the motor should, then replace it with the motor.
@Robin2 no sadly they don't teach us anything about these stuffs , I love mechatronics and robotics and that is why I came to this university to study it and I was also surprised by the fact that they just give you a project to work on without any knowledge of anything and you hit your head on the wall and find the solution , so believe me am doing my best to learn something new from you guys , so maybe you can get over the judging part and try to write only important things like maybe an answer if you had one .
@wvmarle thank you for asking , actually we are supposed to build something that can calculate the coefficient of friction , we have to make a small motor powered by a batterie lift a wood plan of about 20 cm , on that plan we put an 8 cm3 cube in front of a sensor , the motor keep lifting the plan till a certain angle where this cube starts to slip and that's when the motor is supposed to stop , and then with the help of Arduino UNO R3 and MPU6050 we can now the exact angle when the cube slipped and that is how we calculate its tang, and therefrom the coefficient.
@slipstick , thank you !
1) Mechanical: microswitch, mounted at what will become the high side. Toggles when the cube moves by a few mm - depending on the actual switch. Does put a small additional pressure on the object of course: the pressure needed to keep the switch pressed down. Select the switch carefully.
2) Magnetic: hall effect sensor or reed switch. Small magnet on your cube, sensor next to it on what will become the high side. The reed switches I have played with react to proximity of a few mm to about 1 cm; hall effect sensors I have no direct experience with. Larger distance and less precise where exactly it triggers, but contactless. Do some experiments.
3) Optical: break beam sensor. Contactless, can be very precise (could detect 1-2 mm displacement if placed strategically - right in front of the cube, at what will be the low side), but probably the hardest to get just right, in part as you can't see the beam itself.
Beware of vibrations, as vibrations will affect your measurement (making the cube slip sooner). Use some kind of linear actuator to move your platform up - ideally one with position feedback if you can get one/have the budget. Then upon triggering of your sensor the Arduino can output not only the time it took and the position it ended up in, but also calculate the force right away. It's just some math, and looks good if that number is given right away.
That's what I can think of, there may be other methods.
Ultrasound is out, not precise.
Knowing how much you lifted the platform will probably give you a much more precise measure of the angle than those accelerometers.
Now that you have explained the project it is easier to think about what might be needed.
There is a lot more to it than simply a motor and a sensor.
How do you propose to use the motor to lift the piece of wood? Are you going to make a device like a crane with a string that is wound up by the motor? Or maybe you are thinking of making a screw jack?
To use a motor with an Arduino you also need a suitable motor driver as an Arduino cannot produce the current needed by a motor.
You might consider using a servo as it contains all the electronics and gearing inside it. Regular servos move an arm through about 180 degrees. You can also get continuous rotation servos that are really a DC motor with gearing and electronics.
Another option is to use an optical detector to tell when the cube moves out of position - i..e. it is no longer blocking the light, or no longer reflecting the light.
thank you ! Both f you :D