I try to think on a good way to control motor when I shut down the main PCB (which includes the MCU).

How the system works today is when it's ON, the MCU enables the motor, the motor moves a mechanical part which presses on a push button and "lock" it (gives the MCU the sign to disable motor).

I would like your help to think on a way to return the motor to his normal state after I turn off the system and the MCU no longer have voltage.

What I was thinking on is another small PCB circuit that will connect to the same motor and another push button. The small PCB will always get voltage and when system turns off, it will "recognize" it, maybe using a transistor base (please advise if possible), turn the motor to the other way and press the other push button- which will stop the motor from moving.

Other suggestion is somehow "delay" the "shut down" after moving the "shut down" switch and give a few second to the MCU to keep work, activate the motor to the other way and then turn it off.

I would appreciate any kind of help to that hard problem.

Added in edit: enter image description here

The MCU controls the motor driver which controls the Motor using A and B nets. If "10" is send, motor switch to one direction, if "01" it switched to the other direction and if "00" then it stops. The system start by moving the motor, let say with "10", until a mechanical part pressing the "open motor" button, which tells the MCU to stop motor ("00"). My problem is, that I want somehow, that when I completely shut down the voltage, the motor will move to the other way until it presses the other button ("close motor" button) and then stop moving. How can I in the most simple and low cost way you can think of?

I was thinking on adding another PCB which will always get voltage from batteries, connect to shutdown switch, A and B nets and close motor button. How can I make such PCB do the trick and close it?


  • \$\begingroup\$ Can you clarify how the motor is acting? I am guessing you have an actuator which runs from an idle state to an active state, and the motor runs for a time backwards or forwards to transition. \$\endgroup\$ – Sean Houlihane May 15 '16 at 10:05
  • \$\begingroup\$ Hi, if the motor driver gets "10" it turns forward and if "01" it turns backwards (+ if "00" it deosn't turn). Thanks. \$\endgroup\$ – Dudi May 15 '16 at 10:56
  • \$\begingroup\$ It would help if you draw out where the boundaries are that you can control, and the information that passes these points. You've not given enough detail about the abstract form of the problem to get any more help. \$\endgroup\$ – Sean Houlihane May 15 '16 at 15:24
  • \$\begingroup\$ Hi Sean, I edited my message. Please see the other part with block diagram \$\endgroup\$ – Dudi May 16 '16 at 13:41
  • 1
    \$\begingroup\$ Put a small inexpensive MCU on your additional small board and have that be what always actually runs the motor. Have it monitor the signals from the main board and act on those when they are available or deemed reasonable, and act autonomously otherwise. \$\endgroup\$ – Chris Stratton May 16 '16 at 16:59

OK, new answer since the problem now differs from my original understanding.

I assume you can connect your 2nd PCB to Battery, main PCB power and also intercept the 4 wires to the battery. I assume you can provide enough current through the A and B to turn the motor.

When you detect the main board is off, and the motor is not closed, Isolate B, drive A high. Continue until closed, then you can power off the 2nd board until the main board is powered again.

The easiest way to achieve the control is to use a 2 pole, dual-throw relay. Anything else risks feeding voltage back into the main pcb which could damage it or cause odd effects. Power the relay when you detect the power removed condition, and release power to the relay once you detect closed. Wire the 10 values you need for A/B for when the relay is active. (there are other ways you could switch the relay of course, maybe power the relay when the main board is powered, and use the off state of the relay to pass through your control signal)

Any way round, you probably need to invert the 'CLOSED' signal. Maybe a 2nd relay is the easiest way to do that - relays are reliable, and quite logical.

| improve this answer | |
  • \$\begingroup\$ Thanks for your suggestion. I also was thinking on using a motor driver (maybe H-bridge), what do you think? \$\endgroup\$ – Dudi May 18 '16 at 11:22
  • \$\begingroup\$ Yes, this is probably just as good (on balance) as a relay. For me, its the topology that really matters, more than the choice of components - you might have access to some parts, and the voltage/current might drive your selection too. \$\endgroup\$ – Sean Houlihane May 18 '16 at 13:09

It sounds like you should implement a 4-phase handshake between the two parts which can be powered independantly, you already have most of this, I think - but its not clear what the full set of constraints you have to fit this modification into your existing system.

If you signal 'run' from the MCU, and 'ready to run' back from the motor, the motor (or its shim) can self-reset once the RUN signal goes low. As soon as the motor is idle, it can indicate to the MCU that it is ready again.

This give the rules that the MCU should not drive RUN high until the motor is ready, and should keep RUN high the READY signal goes low. Check where you have delays in the system, and adjust the rules (maybe require the MCU to see READY low for 1sec before drivign high) so that all possible states are understood - particularly when each part can have power applied and removed.

Once you have designed your state machine, move on to the implementation detail. You can use capacitors to store power or state for a short time, but shouldn't need to rely on precise timing around the power turning on and off.

| improve this answer | |
  • \$\begingroup\$ Thanks for the answer Sean. Unfortunately, the RUN signal don't "goes low" when you turn off the system. The system just don't get any voltage at this point and you can't control the logic stages since nothing is working. I can't re-design the maing PCB at this stage so I have to think on a way of adding another small PCB that can allow me to control the same motor and "bring it back to default" then make it stop working. I hope it is clearer. \$\endgroup\$ – Dudi May 15 '16 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.