So I using a Kookye servo motor 180 degree rotation. I have it connected to a arduino uno, and I want it to rotate 180 degree through a signal from a PIR motion sensor that is connected to another arduino. 180 degree when the signal is ON, and back to 0 degree when the signal is OFF. I have both arduinos connected through a transmitter and a receiver. A 9v battery powers the arduino, ant a 6v battery powers the servo(with a common ground).
The problem is that the servo motor only rotates in counterclock direction till the point where it can’t rotate any more. I have opened the servo motor to see if any of the part inside is broken or not, but everything looks good. I out it back together and checked to see how it works, and it’s still rotates counterclock.
At the moment I’m not sure about sending it to a repair shop or buying another one. Any suggestions on what might be wrong, or if I do need another servo motor, and if I do need another servo motor, what kind/type do you guys recommend?
By default this example uses pin 9, so either modify the example before uploading or connect your servo’s control signal pin to pin 9. It makes the motor turn in both direction to full extension.
If the motor still moves only in one direction with the Sweep example, that would typically mean an issue with either its control chip or encoding system (unable to know its position) or driving circuit (typically a burnt half-bridge).
In either case, you’d need to send it back for replacement from wherever you bought it from.
So I did tried the sweep example, it works 100% fine. A proper signal meaning the PIR sensor is not providing a 100% input?
Ok I’m going to attach a heat sensor instead of a PIR sensor, to see if that works.
So the heat sensor didn’t worked either, the servo again just rotated to counterclock direction.
Here’s the code for the first part, i.e the input part of this project.
Well, it seems very likely your receiver is detecting the wrong thing and getting stuck in one direction.
The best for such systems is to test each module/section of the project individually to ensure proper functionality before integrating it all together (where issues become more difficult to figure out).
So, to test this, here’s what I would recommend:
In your receiver, add some serial code to initialize the serial interface and output the value read by the digital read.
Instead of using the IR transmitter board, connect the IR transmitter LED to a button instead (with proper circuitry to prevent burning it, such as resistors or voltage/current control, etc.).
With that setup, try again your receiver board by itself, connecting it to your computer by USB and to the Arduino IDE serial monitor. Check if the serial output matches the state of your IR LED.
It is very possible that you are picking up noise instead of your signal, preventing proper working. You’ll most likely want to use a more complex (and error-correcting) protocol instead (kinda like what TC remotes do!). There is a lot of code already available for such noise resistance communications, so you may want to look into getting one of these for the receiver part, as they can make communication very reliable.