PDA

View Full Version : RC servo to PIC controlled via RC transmitter



Dickeysbbq
- 25th November 2014, 03:58
Hello, so what I would like to be able to do is attach a RC servo to a PIC which communicates with the receiver (which communicates with the RC transmitter) so that when I press a certain button or switch on the transmitter it sends a signal to the PIC which tells the servo to activate. Would anyone know how to program something like this?

Thanks!

Archangel
- 25th November 2014, 04:15
So you want to send a button press to the pic via a radio signal, and have the PIC control a servo . . . Why not control the servo from the receiver? There MUST BE more to this story . . . BUT Yea that should be do-able use a comparator input to convert signal to a switch input, pic can output servo signals . . . this is right up Acetronics alley, but I would need a bit more information than you have been forthcoming with. Bottom line, whay are you trying to do? Decode a button push, some text?

Acetronics2
- 25th November 2014, 08:12
Nothing to add ...

What exactly is to do with that servo ??? "activated" or NOT.

BTW note the servo ALWAYS is activated ... you just "tell " it the position you want it to reach @ 50 times per second ...

As Archangel wrote, your R/C set very probably can do that without any added Gadget ...

Just ... RTFM ( just Read that ... R/C Manual !!! )

Now, the good question is ...
Does this pushbutton already exist aboard your transmitter ??? ....

this could be an interesting story, then.


Alain

Dickeysbbq
- 26th November 2014, 03:36
How is the servo angle controlled using the RC transmitter since there is no coding involved?

And the servo didn’t come with a manual nor have I been able to find one online. Sorry this is my first experience with any kind of servo.

Thanks

Amoque
- 26th November 2014, 12:31
I think this is very doable... You might start by looking at the "PULSIN" or "COUNT" functions - they are for measuring or counting incoming pulses. Output, for only one servo, I think nothing fancy is required.

There is a thread here discussing it - even in PicBasic: http://www.rc-cam.com/forum/index.php?/topic/594-sensing-rc-receiver-signal-w-pic/

Acetronics2
- 26th November 2014, 12:42
Have a look here ...
http://www.societyofrobots.com/actuators_servos.shtml

Alain

Archangel
- 26th November 2014, 19:18
. . . and DO avail youself of the forum search feature, I got from using just the word servo :http://www.picbasic.co.uk/forum/search.php?searchid=1323450

Dickeysbbq
- 27th November 2014, 01:12
. . . and DO avail youself of the forum search feature, I got from using just the word servo :http://www.picbasic.co.uk/forum/search.php?searchid=1323450

No Matches?

And thanks Amoque for the link, that could be very useful!

Archangel
- 27th November 2014, 01:22
There were about 30 matches when I posted, SO. . . IN THE SEARCH BOX type servo and click the little spyglass icon. It Works.

Dickeysbbq
- 27th November 2014, 08:17
Thanks and I did look through some of those threads however I'm still curious as to how the transmitter can control the rotation angle of the servo? Basically what I'm trying to do is use the servo to control a claw (opening and closing arms) however the servo only needs to rotate around 20 degrees.

Archangel
- 27th November 2014, 19:03
I am not an R/C guy, BUT I did play with servos with success. You have 3 wires on the servo. one + one - and one for signal. Signal is the key word. on tha SIGNAL wire send a pulse train of varying pulse width. The servo will change it's position. Go back to the link Acetronics2 posted, it explains it.

As for limiting the servo to 20 degrees, personally I would gear it down and use the extra resolution to make a smoother movement. You could create a lookdown table for servo positions if you need exact places for it to stop. Then you could just send your PIC a number or other symbol as instructions as where to go.

Read Sec 5.66 of the manual PULSOUT

Amoque
- 28th November 2014, 15:38
The definitive servo control link: http://www.merlotti.com/EngHome/Computing/servo_controller.pdf. This PDF explains mechanics, electronics, and control... with line by line description of how and what is happening and why. It goes over interrupts, serial input to controller from PC, and about every other thing you'd likely want to know. If you EVER intend to control a servo, I'd suggest downloading this 18 page, easy to follow, tutorial/ primer.

The author states the code is in Mikro-Pascal - and that may be, I don't know Pascal, but it is so close in appearance to PicBasic that I had to look twice...

Scampy
- 2nd December 2014, 20:41
I'm confused.

You want to send a signal from an RC transmitter, to be received by an RC receiver, and then want to have a PIC connected to the receiver which then controls the servo ? why not just plug the servo directly into the receiver like a normal RC set up ?

If you want to drive a servo from a PIC, you need to generate a a pulse proportional signal between 1ms and 2ms refreshed every 50ms. If you could elaborate on what project you are working on and why you need a PIC between the receiver and servo it might help us to offer more suggestions

Amoque
- 3rd December 2014, 03:58
Scampy, There are actually several reasons to do this.

While some newer transmitters have the ability to modify the servo response curve, older or simpler units require exactly this type of set-up. Suppose for example, rather than a linear response from the servo you require a logarithmic one? Or, rather than a smooth rotation, 10 discrete positions... with a microprocessor between the receiver and the servo virtually any response may be programmed to affect the servo - or servos. Really, nothing requires that the output be limited (or similar) to output to more than one servo. also, timing may be a reason - flip the stick to half... and the servo follows in a timed arc - "realistic" flying, where pilots try to mimic the look of real aircraft while flying is an aspect of this hobby many enjoy. I suspect that with proper timing and knowledge complex "3D" moves as well as many visual effects (lights, landing gear, bomb drops, camera activation) might be customized to the switches, sliders, and knobs on today's transmitters.

I have a pretty nice Futaba that limits the response of one servo based on the position of another - say, for example, to keep flaps from deploying at full speed or reducing control surface response at high throttle settings. Many of today's hi-tech models - from "Wings" to "V-tails" require complex control interaction to fly. And, of course there are any number of ground and water based models - and robots - that would only be possible with this type of control.

Scampy
- 4th December 2014, 11:32
That's interesting... thing is I have a 13 year old FM transmitter (old school given todays standards) and most of what you mentioned can be programmed into the transmitter, so the technology isn't that new.

I can see the logic though, you could have the PIC monitor the pulse width and if it's more than centre stick turn on lights etc.