Please help me with arduino!!!

Discussion in 'The Projects Forum' started by rezvisquikz, Jul 27, 2016.

  1. rezvisquikz

    Thread Starter New Member

    Jun 9, 2016
    15
    0
    Hi All

    I am doing a small project where the objective is to control a DC small motor.

    My tools : Arduino mega 2560 & L298N IC

    Closest match to this project here : http://www.allaboutcircuits.com/projects/control-a-motor-with-an-arduino/

    The above link rotates the motor in each direction for 3 seconds, but my requirement is that the motor should turn slowly 180 degrees clockwise then 180 degrees anti clockwise. This needs to be repeated for a 10 cycles.

    Is there any way I can control the motion ? Is it advanced programming required?

    In my head I was thinking to stop the motor using the time delay at 180 degrees, is this the way to go on about it?

    Let me know thanks.

    (bear in mind I am noob) :(
     
  2. DickCappels

    Moderator

    Aug 21, 2008
    2,658
    632
    I can think of two ways to do this and there are probably better ways.

    Use a stepper motor. With each step the motor will rotate a fixed amount and then stop. That's a different motor and a different driver.

    Use an indexing device, though this is likely to work poorly, but you can use the same motor and the same driver you have now. With this method you attach a disk to the motor's shaft and make hole in it, and then use an optical detector to tell when the disk is in the position in which light passes through the hole. To make the motor run slowly enough to stop right after the hole is in front of the sensor, job the motor will narrow pulses at a low frequency. A lot of experimentation will be required.

    [​IMG]
     
  3. rezvisquikz

    Thread Starter New Member

    Jun 9, 2016
    15
    0
    wow, good advise but that is too advanced for me i think :( .

    I havent even got to drive my moto using the link I provided in my previous post.

    Any easy way?
     
  4. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,132
    267
    Sounds like a job for a Hobby RC servo.

    You can control them using an Arduino, you don't need any feedback hardware to sense the position, it's built into the servo.
     
  5. DickCappels

    Moderator

    Aug 21, 2008
    2,658
    632
    What is it that you want your motor to do.
     
  6. rezvisquikz

    Thread Starter New Member

    Jun 9, 2016
    15
    0
    Well mainly its a project at work. I have a small motor geared down, I have used it using a DC source, and the motor is operatable at 0.3mA. I want the motor to operate at 0.3mA constant (slow motion), and want to use it so that the motor starts and stops at 180 degrees clockwise motion and then stops and moves back to 0 degrees anticlockwise for 5 times. Hope that explains it.
     
  7. KeepItSimpleStupid

    Well-Known Member

    Mar 4, 2014
    1,147
    204
    Without feedback of some sort, its the wrong motor. You can't guarantee 180 degrees with a DC motor. An AC synchronous, RC servo or stepper could be a better choice.

    I'd consider limit switches and possibly an adjustable clutch and possibly go that route.

    Yes, you should brake, stop briefly and reverse direction. Time won't cut it. Errors will accumulate.
     
  8. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    I did this some time back it's simple to with 2 limit switches
     
Loading...