Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Electromotors circuit

  1. Nov 17, 2015 #1

    I am absoloute dummy in electrical circuits, so please can you help me with my project?

    My idea is circuit with two electromotors and button.
    After 1st button press I need:
    Motor 1 spins into certain position
    After that motor 2 spins into certain position
    After that motor 1 spin back to start position

    After 2nd button press I need:
    Motor 1 spins Into certain position
    After that motor 2 spin back into start position
    After that motor 1 spin back to start position

    Afrer this another button press acts like 1st and another 2nd again, again...

    Any idea? How to make this idea real ? I 'd use some gearbox but it is not possible for this project
  2. jcsd
  3. Nov 18, 2015 #2


    User Avatar
    Science Advisor

    You have already described a state machine. You can implement it using digital circuits, but it is easier using a microcontroller.
  4. Nov 19, 2015 #3


    User Avatar
    Science Advisor
    Homework Helper

    What do you mean by "spins into a certain position" ? Perhaps look at servos used for model cars/boats?
  5. Nov 27, 2015 #4
    well I "into position" I thought to open little doors :) here is the plan: I have little doors (plastic cover) that I want to connect to motor no.1 and little screen to pop up thats connected to motor n.2

    So I want to push button
    door opens
    screen slides out
    door closes again.

    push button again
    door opens
    screen slides back
    door closes

    I think it is really simple :smile:
  6. Nov 27, 2015 #5


    User Avatar
    Gold Member

    Yes it is, when you know how to do it.
    You must sketch a ( synchronous ) logic state machine like this:
    http://ece224web.groups.et.byu.net/labs/08_4x7_Segment_Display/4x7_h3.gif [Broken]

    and then you can design a logic circuit like this:

    . . . or you can implement it by relays or a μ-controller.

    The important thing is, that when you sketch the logic diagram, you will have to consider what is going to happen if you press both buttons at the same time: Will the door be disintegrated ?
    Last edited by a moderator: May 7, 2017
  7. Nov 27, 2015 #6
    Wow thank you

    I think μ-controller will be the best solution :D problem is I want only one brutton :)
  8. Nov 27, 2015 #7


    User Avatar
    Gold Member

    Trying to implement a discrete state machine in digital logic is not a flexible approach, and the design is very difficult for a beginner (both to design, and to implement)
    (Nearly all digital designers implement state machines in an HDL and compile to a hardware solution in an FPGA or cell library)

    Buy an arduino and a shield (IO board) to drive the motors. Choose the shield based on what kind of motors (servo, stepper, etc). You can easily implement what you are doing, and then adapt it to many other functions and projects. The challenge will be a steep learning curve in the beginning as you learn the hardware, the development environment, and the programming languages. There are MANY tutorials on line, and you will probably find example designs that are very close to what you want to do.

    It is an extensive sharing community of do-it-yourselfers.

    If you have trouble getting started, post further questions!
  9. Nov 28, 2015 #8


    User Avatar
    Science Advisor
    Homework Helper

    It you are just making one of these devices i would use an arduino to drive a pair of model car/plane servos. Avoids any need to build gears, limit switches etc.
  10. Nov 28, 2015 #9
    Thats exactly what I've thought, pair of model car/plane servos.
    Thank you very much for ideas, yes I think I'll try that arduino.

    I was checking models so I'd like to confirm with you before I buy it :)

    Arduino micro (I need as small as possible)
    2 rc car/plane servos
    1 button

    Thats all ?

    Thank you :)
    Last edited: Nov 28, 2015
  11. Nov 28, 2015 #10


    User Avatar
    Science Advisor
    Homework Helper

    Power supply.
  12. Nov 28, 2015 #11


    User Avatar
    Gold Member

  13. Nov 29, 2015 #12
    Thank you sir :) ¨
    Well, last few days I was watching youtube tutorials and reading tons of texts :D
    I think I know how to connect servos, how to set positions on them etc. I think I know how to connect servos to arduino and code it. The only thing I don´t know is how to do buttons press changes. I´ve found only button hold changes...

    basically I have two pieces of code and want to start after button press not hold.
    1st button press first piece of code.
    2nd button press second piece of code.
    3rd button press first piece of code again.

    thats the only thing I don´t know yet :D maybe some boolean variable and if question :)
  14. Nov 29, 2015 #13


    User Avatar
    Science Advisor

    Some hints:
    1. A pushbutton does not give a steady signal. It bounces (contact - no contact - contact etc.) for several milliseconds. Therefore the best way of detecting a true switch closure is to read it several times and require the level to be steady for a set number of times (if you read the switch every millisecond, the number should be 4 or 5, if you read it every 10ms 3 may be enough)
    2. Remember that pushing the button and releasing it are two separate transitions. You must require the button to be released before you can look for the next push.
    3. The easiest way to implement a state machine in C is to use the switch statement
  15. Nov 30, 2015 #14


    User Avatar
    Gold Member

    a note about debouncing. many people have written denouncing functions. ardunio might have a few built in (I cannot remember if I used a pre-built one native to aruidno's libraries, or I built one and added it to the library myself.)

    As others have said, what you are trying to do has been done before. You can find all the info you need online. don't reinvent the wheel... unless you want to for fun.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Electromotors circuit
  1. No. Of circuits (Replies: 2)

  2. What is this circuit? (Replies: 3)

  3. Current in the circuit (Replies: 1)

  4. Circuit difference (Replies: 1)