can i programm a motor to not move at all?

Hey,
I’m very new to Arduino and programing and I wanted to build a motor that opens my window blinds for me. (They have to be pulled up by a rope and for that I wanted the motor to do that for me)

I have 2 problems:

  1. the motor isn’t actually strong enough to pull up the blind
    I used a 12V DC motor
    Do you know any good while cheap motors?

  2. Even if it could pull it up once I set the motor speed to 0 it moves freely again but I want it to hold the weight.

Is there a way to programm the motor to not move at all?

This is my code (I attached it also as a file because i dont know if it will show correctly):

int lightValue;
const unsigned long SECOND = 1000;
const unsigned long MINUTE = 60 * SECOND;
const int motorA = 5;
const int motorB = 6;
const int motorSpeed = 3;
void setup()
{
pinMode(motorA, OUTPUT);
pinMode(motorB, OUTPUT);
Serial.begin(9600);
}
void loop()
{
lightValue = analogRead(A0);
Serial.println(lightValue);

if (lightValue < 640){
digitalWrite(motorA, HIGH);
digitalWrite(motorB, LOW);
analogWrite(motorSpeed, 150);
delay(1000);
analogWrite(motorSpeed, 200);
delay(1000);
analogWrite(motorSpeed, 250);
delay(1000);
analogWrite(motorSpeed, 255);
delay(4000);

while (lightValue < 640){
analogWrite(motorSpeed, 0);
lightValue = analogRead(A0);
if (lightValue >= 640){
delay(5000);
}
lightValue = analogRead(A0);
Serial.println(lightValue);
delay(200);
}
}
if (lightValue >= 640){
digitalWrite(motorA, LOW);
digitalWrite(motorB, HIGH);

analogWrite(motorSpeed, 75);
delay(1000);
analogWrite(motorSpeed, 100);
delay(1000);
analogWrite(motorSpeed, 150);
delay(2600);

while (lightValue >= 640){
analogWrite(motorSpeed, 0);
lightValue = analogRead(A0);
if (lightValue < 640){
delay(5000);
}
lightValue = analogRead(A0);
Serial.println(lightValue);
delay(200);
}
}

}

Final.ino (1.5 KB)

You need a motor with a worm type gear box - if remove power it will just stop where it is.

You can’t just hold a motor stalled it will overheat and burn out.

I think what you could do is that you would have a limit switch somewhere when the blinds would be open, the switch would just send a signal to the arduino and tell it to stop. And as hammy said its a good idea to use a worm gearbox, they can be found on eBay, Amazon and if you have a 3D printer, you can make it that way. Only thing is that it would be really slow. What you can also do, is to use an airsoft motor, but it needs to be with neodymium magnets, where you potentially would have to use any gear reduction system, but I am not sure. On the other hand, these are REALLY strong, you could use PWM to drive them slowly, as they are intended to drive back high power springs. good one : MOTOR BOOST 30000 ASG.
Hope that helped a bit :slight_smile:

To size a motor and gearing you need to start with some idea of wanted speed and torque.

The simplest way to prevent back-driving is a worm-gear or a large reduction-ratio spur-gear set.

Many gearmotors are available in a large range of gear-ratios. A bare motor has torque limited by
its size, more torque usually means more reduction ratio.

alright! thanks for the replies! I'll try the worm-gear recomandation :slight_smile: