I am trying to make a stepper motor rotate a poster down (like a motorized projected screen) upon the Arduino receiving power, when the Arduino loses power for it to retract. The reasoning behind this is to connect it to a smart plug, so I can activate it via my google home. This is my first Arduino project, so I apologize if it seems really basic. I was thinking that I could use a capacitor or something to charge on power on which could be discharged on power loss by powering the motor, but I'm unsure how/where to connect a capacitor to the Arduino board.

For reference what I will be using:

  • Arduino Uno board with AC power adapter plugged into smart plug
  • CNC shield
  • Driver
  • Nema 14 Stepper motor

enter image description here

If there is a better solution or something else I could use (I saw in someone's projector screen project that they used a potentiometer) I'd love to hear about it.

  • $\begingroup$ Welcome to Engineering SE. Can you tell us more about the Hardware Setup? Your thinking is correct. One method is to place a capacitor across the positive and GND terminal into to the Arduino Uno board. But you also need the find a method to detect power loss and command the motor to retract. Also consider using super capacitor. Another method is to have an alternate power supply such as a battery that will be used during power loss for retraction purposes only. Sorry for the long comment. I will convert this to answer after I get more details on the Hardware configuration. $\endgroup$ Jan 4, 2021 at 19:37
  • $\begingroup$ I'm still in the process of ordering the parts, so at this point I can change whatever hardware needs to be changed. But with an alternative power supply, how could I make it detect the power loss from the wall plug to trigger the motor to retract the poster? $\endgroup$
    – Geo
    Jan 4, 2021 at 20:04
  • 1
    $\begingroup$ Is the power loss externally and intentionally initiated, or is it related to line power going out due to external factors? If the former, consider to reverse the order of actions, that is, retract the screen, then remove the power? $\endgroup$
    – fred_dot_u
    Jan 4, 2021 at 20:59
  • $\begingroup$ So the power loss is caused by the command from the google home to a smart plug, so that way when I tell google to turn off that plug, I want the poster to retract, sorry if I'm not making sense. Edit: here is the link to the smart pluglink $\endgroup$
    – Geo
    Jan 4, 2021 at 21:03
  • 2
    $\begingroup$ The easiest way to do this will be to use a continuously on power source, then you just use the switched power source as an up/down signal. $\endgroup$
    – Drew
    Jan 5, 2021 at 9:12

2 Answers 2


End of stroke limit switches would be an appropriate input to an Arduino. The end of stroke should be able to hold the load (latches, latching, overcenter) without requiring continually powered motors (overheating). This may require a sloenoid to kick the support out of latch prior to motion when retracting.

Just make sure you never go beyond the end of stroke limit switches. Once activated, keep it activated until it leaves that position and moves towards the middle range of stroke. You will be able to determine start-up position by the state of the limit switchs. If neither is active (shut-off mid stroke) have it perform a home sequence at start-up.

Be sure to place fuses in appropriate places. You don't want the device to overheat and cause fire. Maybe even also monitor the temperature of the motor(s) and cut power if significant.

If the system is "heavy" you might consider adding a gas spring, counter balance, or other means of limiting the weight being lifted.

  • $\begingroup$ I think it is a partial answer. Partial answers are okay. I removed the "this is a comment" part. But don't post comments as answers, they will be deleted. If they are useful, they might be converted to a comment below the question, but in no case you gain rep. However, you already have 41 rep, meaning that you only need to collect a single up and you will be able to comment everywhere (it requires 50 rep). $\endgroup$
    – peterh
    Jan 5, 2021 at 22:38
  • $\begingroup$ After your comments (posted as answers) are deleted, you will be able to get their list here. Beware, you will see this list only 2 months long! If you can comment, you will be able to post them - this time, as real comments, already. $\endgroup$
    – peterh
    Jan 5, 2021 at 22:40
  • $\begingroup$ Is there a particular reason to use steppers if one uses limitswitches. $\endgroup$
    – joojaa
    Jan 5, 2021 at 22:51
  • $\begingroup$ Btw, I think you can write good posts, and with this intensity you will be soon a reviewer. $\endgroup$
    – peterh
    Jan 5, 2021 at 22:58
  • $\begingroup$ Now you have 50, you can post comments $\endgroup$ Jan 6, 2021 at 12:46

There are three ways I can think of to do this off the top of my head.

The first would be to spring load the poster in the retracted position. When the motor loses power, the poster retracts on its own. When the Arduino is powered, it can drive the motor to open the poster and hold it there. Mechanically this is more complex. It requires well balanced forces, and likely some sort of viscous damper to prevent the poster from slamming like a measure tape. Additionally, you would probably want some verification of the true poster position that the Arduino can read on boot.

The second is the same idea that you already had. You can place a super capacitor or battery (and appropriate charge controller) across the Arduino's power so that when the power is lost, it can supply enough to drive the motor for a short time. This will require a method to detect the power loss. An easy way to do this would be put a diode in series with the Arduino power (upstream of the aforementioned battery), and a high value (100k or so) resistor in parallel with the power wires upstream of the diode. Feed the voltage off this resistor into one of the Arduino GPIO pins (with voltage divider if required). When the power is cut, the voltage on that pin will drop because the diode prevents the battery from back-powering the resistor. This voltage drop can then be used to trigger the poster retracting.

The third method, and the method that is definitely the simplest and easiest to implement, is to leave the Arduino always powered. The wifi switch would then simply be used as a signal. But it would not provide power. Messing with 120 V AC can be deadly. To stay safe you could power a small 5 volt power supply from the wifi switch. Detecting the ON/OFF then becomes as simple as feeding the 5V from that supply into a GPIO pin and ground on the Arduino.


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.