IR Remote Window Blinds

Hello this is my first project using the Arduino. It will control window blinds using an IR TV remote. I have everything working but i get servo jitter when the blinds are in the open position. (This makes noise) Is there anyway i stop the servo jitter? I am using +5v power from the Arduino to power the micro servo.

Here is my code any help would be appreciated :slight_smile:

#include <Servo.h>
#include <IRremote.h>

unsigned long Value2 = 0x4CB3E11E; // This the IR code from the remote that will close the blinds.
unsigned long Value1 = 0x4CB311EE; // This the IR code from the remote that will open the blinds.

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
 
Servo servo1;

// the setup routine runs once when you press reset:
void setup() {              

Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver

  // initialize the digital pin as an output.

servo1.attach(10); // attack servo to digital pin 10
}
// the loop routine runs over and over again forever:
void loop() {

if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }

if(results.value == Value1) {
servo1.write(120);
}

if(results.value == Value2) {
servo1.write(20);
}

}

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

I am using +5v power from the Arduino to power the micro servo.

That doesn't generally work very well - a separate power supply is preferred.

Is the noise jitter or is it the servo pushing against its end stops? i.e. can it reach 20 and 120?

wildbill:

I am using +5v power from the Arduino to power the micro servo.

That doesn't generally work very well - a separate power supply is preferred.

Is the noise jitter or is it the servo pushing against its end stops? i.e. can it reach 20 and 120?

I just tried powering the servo using and external power supply but still no luck. The noise is not from the servo pushing against the end stops. =(

Servos can start to jitter all by themselves because a potentiometer is a fairly noisy source of feedback. As the wiper on the potentiometer drags across the surface of its internal resistance, the amount of contact will affect the actual resistance. Also, a servo motor that normally goes to one special spot will tend to wear out that area on the potentiometer.

Can you changed your system to just power down the motors when they are in the position you want them? Or perhaps simply apply power for a few seconds after it gets a signal, and then shut them down. If you do this, then you need to have a system that will stay in place after the servos power down.

-Joe