Controlling servo using arduino and receiver

I am going to make an arduino stabilize a rc plane using a gyroscope, the way it will work is that when I press a switch on the transmitter the arduino reads that from the receiver and starts engaging the stabilizing using the Servo.h library. And when I flip the switch again it should stop stabilizing and the servo should move corresponding to the transmitter signal. However, the servo won't move at all when the pin to the arduino is connected. Maybe this is due to the arduinoprogram wanting to have it in the last servo position it wrote or something? I have tried using the detach() in Servo.h, which makes the servo moveable using my hand pushing it, but not with the transmitter. Someone I talked to said the reason it couldn't be moved using the transmitter was because the arduino "pinned" the servo pin to low, or atleast a state even when it was not writing anything to the servo. Is there a way to "disconnect" the pin from the arduino, making it totally float, with no input from the arduino? See attached image for wiring.
Thanks in advance!

1 Like

Note that the second arduino on the image only is there to represent how it is connected to the receiver...

What receiver ?

Your servo input is controlled by two outputs, do not tie outputs together !

Powering a servo from the 5v pin on the Arduino will damage the Arduino !


Rc plane transmitter and receiver like this. The servo is getting 5v from the receiver, imagine the second arduino marked "Receiver" being the rc plane receiver.

Your servo input is controlled by two outputs, do not tie outputs together !

I need the two outputs to go to the same servo that is why they are tied together. Is there a different solution to this?

Powering a servo from the 5v pin on the Arduino will damage the Arduino

I've been powering servos using the 5v pin on Arduino for years and never damaged anyone

The correct way to do it is to the read the RC receiver's servo signal in the Arduino and then pass EITHER that OR your stabiliser signal on to the servo.One signal connection only to the servo.

Could it be done by transistors/octocouplers?

“I've been powering servos using the 5v pin on Arduino for years and never damaged anyone”

If you power the servos from the UNO USB connector like you show you are, your PC needs to supply the maximum servo current from that device.

Just because you have not seem problems doesn’t mean you aren’t causing component stress.

We need to know what single is coming from the receiver and what will the Arduino be sending the servo.

The receiver will send whatever the joystick on the transmitter corresponds to. The Arduino will send (when on) a servo position based on the orientation of a gyroscope.

Sounds like the two inputs to the servo can happen at the same time.

If so, the two servo PWM signals will interfere with each other.

How will you prevent one source from sending a signal when the other is sending a signal ?

I was thinking that I would not touch the transmitter when stabilizer was engaged. The problem I was though is how to "disconnect" the servo from the arduino

I told you that in #5. No DIRECT connection to the receiver. All signals go through the Arduino. It's been done many times.

Steve

Hi, Sorry had to spread it out a bit.

Can you please post a circuit diagram, pen(cil) and paper is fine.
Label ALL hardware and power supplies, label pins and connections.

Thanks.. Tom... :smiley: :+1: :australia:
PS, Your drawn diagram will be easier than trying to use odd components in Fritzy.

I solved the problem doing this:
Setting the pin connected to the servo first as servo attach(9). Then pinMode(9, input).and finally digital write(9, HIGH). What I've been told: Since the pin is told to be an input, it won't tie the pin to a particular state when not in use.
Setting it high - I don't know...

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.