Electrical Circuit Project: Two Motors + Button | Help Needed!

AI Thread Summary
The discussion revolves around creating an electrical circuit project involving two motors and a button to control specific actions. The user seeks guidance on implementing a sequence where pressing the button activates the motors to open and close doors and screens in a defined order. Suggestions include using a microcontroller like Arduino for easier programming and flexibility, particularly for managing button presses and motor control. Key points include understanding servo connections, coding for button press detection, and implementing debouncing techniques to ensure accurate button readings. The community emphasizes leveraging existing resources and tutorials to aid in the project's development.
croc
Messages
5
Reaction score
0
hello,

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
Done

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
Done

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
 
Engineering news on Phys.org
You have already described a state machine. You can implement it using digital circuits, but it is easier using a microcontroller.
 
What do you mean by "spins into a certain position" ? Perhaps look at servos used for model cars/boats?
 
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 that's 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:
 
croc said:
I think it is really simple :smile:
Yes it is, when you know how to do it.
Svein said:
You have already described a state machine. You can implement it using digital circuits, but it is easier using a microcontroller.
You must sketch a ( synchronous ) logic state machine like this:
http://ece224web.groups.et.byu.net/labs/08_4x7_Segment_Display/4x7_h3.gif

and then you can design a logic circuit like this:
avFigure9.gif


. . . 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:
Wow thank you

I think μ-controller will be the best solution :D problem is I want only one brutton :)
 
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!
 
  • Like
Likes donpacino
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.
 
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:
  • #10
Power supply.
 
  • #11
  • #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 :)
 
  • #13
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
 
  • #14
Svein said:
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
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.
 
Back
Top