1
\$\begingroup\$

I'm designing a circuit with a fallback function and would like to know whether it's flawed or can be done with less components.

The MCU here starts a motor in "up" or "down" direction. (Only "up" is shown).

  • If the top end switch is touched, then positively, definitely do not go further up.
  • The MCU needs to know if the end switch is touched, not only for the sake of stopping.
  • The push button is multi-purpose, including the menu navigation and alike.
  • However, if the MCU is down (a firmware update went wrong etc.), the push button starts the motor.
  • As long as the MCU is running (signalling this fact with a logic "1" at a push-pull output), the push button is solely for the MCU and should not start the motor.

Answering @Bruce Abbott 's question. I had VDD=5V in mind. D1 protects the opto-isolator U1, which might have a maximum reverse voltage around 5V. Without D2 the BtnUp input would always read "1". Both D1 and D2 could probably be omitted with VDD=3.3V?

D3 is green or longer wavelength but good that you asked. I ought to count p-n junctions in this path.

R1 and R4 might become MCU's internal pull-down resistors, but they might be too high-ohmic from EMI perspective.

Fallback

Partially inspired by this Tri-State post and lednique.com

\$\endgroup\$
2
  • \$\begingroup\$ you're right, sorry. \$\endgroup\$ Commented Mar 6, 2020 at 22:31
  • \$\begingroup\$ What is the purpose of the diode across the lower optocoupler? What voltage is Vdd, and what color is the 'going up' LED? \$\endgroup\$ Commented Mar 7, 2020 at 1:31

1 Answer 1

1
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. An alternative.

This might be a little simpler - if I've covered all requirements.

If the top end switch is touched, then positively, definitely do not go further up.

Satisfied. Opening UP_LS will turn off the opto-LED.

The MCU needs to know if the end switch is touched, not only for the sake of stopping.

Satisfied. The limit switch monitor [C] will pull high when the switch opens.

The push button is multi-purpose, including the menu navigation and alike.

Satisfied - maybe. The button monitor [A] will report the state of the switch. During automatic opreation [B] will pull high and VA will be equal to the VF of D1. If this is a problem another diode in series with R1 and a pull-down on [A] should fix that.

However, if the MCU is down (a firmware update went wrong etc.), the push button starts the motor.

If the microcontroller is running then [B] should be low which will short out D1. If the micro fails (and the output tri-states) then the UP button will illuminate D1.

As long as the MCU is running ... the push button is solely for the MCU and should not start the motor.

Satisfied. When [B] is low the LED is short-circuited.

I have deliberately omitted your indication LED for simplicity. Adding it back in affects the VF considerations above so the additional diode and pull-down would be required to prevent false button reads on [A].

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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