Hi,
I wired up my circuit as per the details on the link https://learn.adafruit.com/using-an-inf ... -with-ir-1.
I see that the IR receiver is decoding the values. It responds to the adafruit mini remote control buttons. The dump results shows the values for each of the keys that are being used by the code. The issue that I am running into is that the servo is not moving in response to the IR decoded value for the buttons. As per the details, this one is using the NEC protocol. The IRLib sees the special sequence and returns the value 0xFFFFFFFF.
Can you please provide some pointers? Really appreciate any help on this problem.
Thank you.
Controlling a Servo with IR
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Controlling a Servo with IR
Please post some photos showing you you have it all connected.
Some examples of the serial output may be helpful as well.
Some examples of the serial output may be helpful as well.
- adafruit_learner
- Posts: 47
- Joined: Wed Oct 07, 2015 9:08 pm
Re: Controlling a Servo with IR
Hi,
Please find attached the image of the circuit and the serial monitor.
Thank you.
Please find attached the image of the circuit and the serial monitor.
Thank you.
- Attachments
-
- IMG_4165.JPG (1015.82 KiB) Viewed 692 times
-
- IMG_4170.JPG (950.86 KiB) Viewed 692 times
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Controlling a Servo with IR
The text in your screen images is not legible. Just cut and paste the actual text into your post.
- kcl1s
- Posts: 1512
- Joined: Tue Aug 30, 2016 12:06 pm
Re: Controlling a Servo with IR
The code you linked to is using pin 9 for the servo and it looks like you have it wired to pin 7 or maybe 6. Did you change the code?
Keith
Keith
- adafruit_learner
- Posts: 47
- Joined: Wed Oct 07, 2015 9:08 pm
Re: Controlling a Servo with IR
Hello,
I am using pin 7 as the pin for my servo motor. I have changed the code to match this pin. The picture reflects the same. The following is the output from the serial monitor when I pressed the right arrow key on the remote.
Thank You,
Any help is appreciated
Decoded NEC(1): Value:FD50AF Adrs:0 (32 bits)
Raw samples(68): Gap:60450
Head: m9000 s4450
0:m550 s550 1:m600 s550 2:m550 s550 3:m550 s600
4:m550 s550 5:m550 s600 6:m550 s550 7:m550 s550
8:m600 s1650 9:m550 s1650 10:m550 s1650 11:m600 s1650
12:m550 s1650 13:m550 s1650 14:m600 s550 15:m550 s1650
16:m600 s550 17:m550 s1650 18:m550 s600 19:m550 s1650
20:m550 s550 21:m600 s550 22:m550 s550 23:m550 s600
24:m550 s1650 25:m550 s550 26:m600 s1650 27:m550 s550
28:m600 s1650 29:m550 s1650 30:m550 s1650 31:m550 s1700
32:m550
Extent=66350
Mark min:550 max:600
Space min:550 max:1700
ark min:550G|
I am using pin 7 as the pin for my servo motor. I have changed the code to match this pin. The picture reflects the same. The following is the output from the serial monitor when I pressed the right arrow key on the remote.
Thank You,
Any help is appreciated
Decoded NEC(1): Value:FD50AF Adrs:0 (32 bits)
Raw samples(68): Gap:60450
Head: m9000 s4450
0:m550 s550 1:m600 s550 2:m550 s550 3:m550 s600
4:m550 s550 5:m550 s600 6:m550 s550 7:m550 s550
8:m600 s1650 9:m550 s1650 10:m550 s1650 11:m600 s1650
12:m550 s1650 13:m550 s1650 14:m600 s550 15:m550 s1650
16:m600 s550 17:m550 s1650 18:m550 s600 19:m550 s1650
20:m550 s550 21:m600 s550 22:m550 s550 23:m550 s600
24:m550 s1650 25:m550 s550 26:m600 s1650 27:m550 s550
28:m600 s1650 29:m550 s1650 30:m550 s1650 31:m550 s1700
32:m550
Extent=66350
Mark min:550 max:600
Space min:550 max:1700
ark min:550G|
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Controlling a Servo with IR
So it is detecting the value 0xFD50AF which is correct for a RIGHT_ARROW.Decoded NEC(1): Value:FD50AF Adrs:0 (32 bits)
Try replacing your setup() with the following. Does the servo sweep back and forth at startup?
Code: Select all
void setup()
{
myServo.attach(7); // attaches the servo on pin 9 to the servo object
pos = 90; // start at midpoint 90 degrees
Speed = 3; // servo moves 3 degrees each time left/right is pushed
// Add a quick sweep to test that the servo is working
myServo.write(0);
delay(250);
myServo.write(180);
delay(250);
myServo.write(pos); // Set initial position
myReceiver.enableIRIn(); // Start the receiver
}
- adafruit_learner
- Posts: 47
- Joined: Wed Oct 07, 2015 9:08 pm
Re: Controlling a Servo with IR
Hello,
When I tried your code, it did not dump results to the serial monitor until I added Serial.begin(9600); The servo does not sweep at startup. I see the following output on the serial monitor.
Thank you.
Decoded NEC(1): Value:FFFFFFFF Adrs:0 (0 bits)
Raw samples(4): Gap:22326
Head: m9066 s2250
0:m570
Extent=11886
Mark min:570 max:570
Space min:32767 max:0
When I tried your code, it did not dump results to the serial monitor until I added Serial.begin(9600); The servo does not sweep at startup. I see the following output on the serial monitor.
Thank you.
Decoded NEC(1): Value:FFFFFFFF Adrs:0 (0 bits)
Raw samples(4): Gap:22326
Head: m9066 s2250
0:m570
Extent=11886
Mark min:570 max:570
Space min:32767 max:0
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Controlling a Servo with IR
If the servo is not moving at startup, then the problem is either with the servo or the servo wiring. The IR seems to be working correctly.
Does the servo twitch or make any noise or vibration when you power it up?
Does the servo twitch or make any noise or vibration when you power it up?
- adafruit_learner
- Posts: 47
- Joined: Wed Oct 07, 2015 9:08 pm
Re: Controlling a Servo with IR
Hello,
Just want to mention that the servo motor moved once after 15 minutes of run time. The servo motor is twitching and vibrating whenever we connect the usb to the Arduino Uno.
Thank you.
Just want to mention that the servo motor moved once after 15 minutes of run time. The servo motor is twitching and vibrating whenever we connect the usb to the Arduino Uno.
Thank you.
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Controlling a Servo with IR
If it is twitching and vibrating, then you at least have power to it. I suspect that there is a problem with your control signal connection on pin 7. Try re-wiring that with a different jumper wire.
- adafruit_learner
- Posts: 47
- Joined: Wed Oct 07, 2015 9:08 pm
Re: Controlling a Servo with IR
1. I used a different jumper wire and tried the code again. The servo does not seem to move. Can you provide some pointers so that I can debug the servo. I also need to make the servo respond to the IR which seems to be responding to the remote keys.
2. The code which dumps the results in the serial monitor is showing the results when the remote keys are pressed. However when I try to print the myDecoder.value from the sample code upon which the switch statement works I don't seem to find the values being printed to the serial monitor. Could this be one of the reasons as a result of which the servo is not moving.
Appreciate your help.
Thank you.
2. The code which dumps the results in the serial monitor is showing the results when the remote keys are pressed. However when I try to print the myDecoder.value from the sample code upon which the switch statement works I don't seem to find the values being printed to the serial monitor. Could this be one of the reasons as a result of which the servo is not moving.
Appreciate your help.
Thank you.
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Controlling a Servo with IR
1) - Try operating the servo by itself as in this tutorial. https://learn.adafruit.com/adafruit-ard ... s/overview
If you can't get the servo to sweep with the example code and wiring, then your servo should be replaced.
2) - If you post the complete code that you are using, we can take a look.
If you can't get the servo to sweep with the example code and wiring, then your servo should be replaced.
2) - If you post the complete code that you are using, we can take a look.
- adafruit_learner
- Posts: 47
- Joined: Wed Oct 07, 2015 9:08 pm
Re: Controlling a Servo with IR
Hi,
I replaced the servo motor with a different new servo motor and got the sweep code to work. As I had purchased the original servo motor from adafruit, I wanted to know the next steps to get a replacement. Can you let me know.
Thank you.
I replaced the servo motor with a different new servo motor and got the sweep code to work. As I had purchased the original servo motor from adafruit, I wanted to know the next steps to get a replacement. Can you let me know.
Thank you.
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Controlling a Servo with IR
Please contact [email protected] with a link to this thread and we can send one out to you.
Please be positive and constructive with your questions and comments.