HobbyKing.com New Products Flash Sale
R/C Groups.com   RCCars Crack Roll Flying Giants RC Power The E Zone Lift Zone Our Sponsors
R/C Groups.com


Go Back   RC Groups > Aircraft - General > DIY Electronics

Reply Post New Thread  Previous Thread Next Thread
 
Thread Tools
Old Apr 28, 2009, 11:39 AM   #1
7000mw of raw power!
 
rich smith's Avatar
 
Join Date: Dec 2006
Posts: 4,438
DIY 2.4ghz RC Control Via PC

A few people have expressed interest in RC control via a PC so here's a circuit and code for an XBee/servo adapter. It only costs a dollar or two and takes a few minutes to build. Originally it was for a model boat project but I tried it in my 48" foamie last week and seems to work great for flying a plane too.

The regular RC transmitter and receiver are not required. A pair of low cost 2.4ghz XBee RF modules replace the 72mhz RC link and can be controlled via numeric keypad of a PC running WINDOWS HYPERTERM or other basic comm program. It's also possible to develop custom software for things like fully automated flight etc. and with 2-way GPS link PC control of UAV, FPV, or aerial photography. Single character commands are as follows (numlock on):

'8'=elevator up
'2'=elevator down
'4'=rudder left
'5'=rudder center
'6'=rudder right
'*'=throttle full
'9'=throttle up
'3'=throttle down
DEL=throttle off
'0'=reset (throttle off, R/E center)

Notice that they are similar to those of Microsoft Flight Simulator.

Diagram below shows wiring for the plane module. As you can see it's based on an Atmel Tiny25 chip but also works with Tiny45 and Tiny85 w/o modification. It uses the same interface cable for the PC end from the XB/GPS project:

http://www.rcgroups.com/forums/showthread.php?t=993165

SRVPC50x.TXT is the Intel Hex file for downloading to a Tiny25 (fuseh=d7 fusel=e2 fusex=fe). It's a pretty simple program, only about a hundred instructions. Baud is 4800bps instead of the XBee default 9600 so DI pin can be optionally connected to a GPS for plane tracking.

Configuration of the XBee via AT commands is required. Must be plugged into the PC end for this:

+++
atrp1
atbd2
atac
(change PC to 4800)
atwr

Technically this only need be done on the plane module but I do it to both so they will be interchangeable."atrp1" is optional but enables short blink on the RSSI pin so you can see individual characters come in.

As usual let me know if you find any bugs or documentation errors. If there's interest I'll see if I can come up with photos and maybe a video.




Update:

Here's photos of the assembled unit and also new simpler version of the XB/Tiny schematic with a diagram added for the XB/PC end. The regulator can be replaced by a couple diodes which are cheaper and easier to obtain (Radio Shack). Also the original bin was for idle lo serial for an older RF modem and is replaced with idle hi for the XB. Channel 4 is shown in the schematic but is not implemented by the code at this time. Old files moved to post #12 for anyone who needs that type serial.

Notice the Associate and RSSI LEDs are attached to the top of the XBee now instead of the adapters. Tiny SMD types are very light and very bright. Maybe you can make them out in the photo. All my XBee modules have these now. Very helpful in telling if power is applied and if link is established regardless of what they are plugged into.

Assembly hints (no PCB):

1. Gorilla glue the XBee socket to one side of an 8 pin DIP socket. Glue 2x4 and 1x4 pins (3x4) to the servo side. Be careful not to get any glue on the contacts as it will wick in and ruin them. Mixing a little bit of water into PU will cause it to foam and set faster which helps prevent this. Let set overnight.

2. Solder regulator or diode circuit to the XBee socket and then solder connections between DIP and servo pins.

3. Test the module and if OK add more glue to the bottom for physical strength (photos taken before this step). Allow it to foam up and set overnight.

4. Similar technique for the XB/PC adapter. Again, don't let any glue wick into the contacts of the XBee socket. If using a PC drive power connector then block position 3 of the cable and cut that pin on the connector (polarizing key) so it can't be plugged in wrong.

5. To test simply plug everything in and see if the Associate LEDs light indicating power. Even with no servos or LEDs connected you can check the link because if the plane end is wired for loopback (DI to DO) every time a key is hit it's echoed on the PC. RSSI LEDs blink too if attached. Next see if numpad keys move the servos at which point it's ready to fly.




Update:

New hex for 4800bps instead of 9600bps. This allows optional connection of DI to a GPS for plane tracking. Plane XBee must be configured for the new baud via AT commands. EE location 0 still holds OSCCAL value for fine tuning but now factory default is used if 0xFF (never programmed). Most will not have to put anything there.

In addition a change has been suggested to the schematic for easier plug in of an EM406 or other GPS. Connecting DI to the channel 4 pins through a 1k resistor allows those to be used for that purpose. This means there is no echo now so if you want that feature use the old schematic. You can still add code for another servo on channel 4 w/o hardware change if there is no GPS plugged in.

Old files moved to post #64.
Attached Thumbnails
  • Name: srvpcs07.jpg
Views: 200
Size: 49.4 KB
Description: new schematic new schematic 49.4 KB · Views: 200

  • Name: IMG_0064.jpg
Views: 156
Size: 54.3 KB
Description: top top 54.3 KB · Views: 156

  • Name: IMG_0076.jpg
Views: 177
Size: 64.8 KB
Description: bottom bottom 64.8 KB · Views: 177

  • Name: IMG_0040.jpg
Views: 183
Size: 70.0 KB
Description: with servos and XBee with servos and XBee 70.0 KB · Views: 183

  • Name: IMG_0044.jpg
Views: 171
Size: 74.1 KB
Description: PC end PC end 74.1 KB · Views: 171

Attached Files

Last edited by rich smith; May 22, 2009 at 07:25 AM. Reason: new files
rich smith is offline Find More Posts by rich smith   Reply With Quote
Old Apr 28, 2009, 01:07 PM   #2
Registered User
 
Join Date: Apr 2006
Posts: 1
Is it possible to use analog resistors from buddy box (Futaba Skysport4 for example) to control a plane? What kind of adapter needs to be installed between XBee and servo (if more than 3 channels)?
Thanks
boldive is offline Find More Posts by boldive   Reply With Quote
Old Apr 28, 2009, 02:15 PM   #3
Registered User
 
Join Date: Nov 2008
Location: North Carolina
Posts: 248
There's interest! I'm very interested in this. I'm building a remotely operated (underwater) robot that is currently being controlled by a DX5e radio, but my future plans are to control it by computer. The 2.4 GHz signal is sent down a single wire to the receiver which resides in the robot several hundred feet away. The reason for using an RF signal is that data can be sent very long distances on a single wire. I'd be very interested in replacing my current radio / receiver with a pair of Xbee modules but up 'til now I had no idea where to start. Your post has shed some light on the subject and a glimmer of hope! I'll start googling for info on coding the Xbee, but in the mean time what would be involved to expand what you've done to 6 or 8 servo channels instead of 3? Using a joystick, gamepad or other analog Windows HID device instead of the numpad?

Last edited by gobigkahuna; Apr 28, 2009 at 02:31 PM.
gobigkahuna is offline Find More Posts by gobigkahuna   Reply With Quote
Old Apr 28, 2009, 02:50 PM   #4
Registered User
 
Join Date: Nov 2006
Location: Cromer,Norfolk, UK
Posts: 1,468
If its possible to use a PC for flight control, then would it be possible to use that PC for almost infinite programming possibilities, and tie those into telemetry from the model?

Thus, if flying a sailplane, one could have a 2-way comm link between a laptop and the model. Telemetry from the model "tells" the laptop what it is doing, and the laptop "tells" the model the best combination of flaps, trim etc.

You could select a setting "minimum sink" "maximum LD" etc, and the model would automatically and continually adjust itself, leaving the pilot free to concentrate on searching out lift and such.

Also, for landing approaches with large models, one could programme in an ILS approach. Define a glideslope and sink rate in the laptop and the telemetry link looks after that aspect of the approach.

There's even a possibility for a failsafe. If the model has a radio failure, a VHF (or whatever) telemetry link could take over and, using a GPS unit mounted in the model, could actually bring the model back and land it on the strip.

Last edited by MCarlton; Apr 28, 2009 at 02:56 PM.
MCarlton is offline Find More Posts by MCarlton   Reply With Quote
Old Apr 29, 2009, 11:56 AM   #5
7000mw of raw power!
 
rich smith's Avatar
 
Join Date: Dec 2006
Posts: 4,438
I don't know about resistors but it is quite common to use a micro to convert PC serial into PPM for the buddy box input and the TX then sends the signal to a plane. The plane uses a regular unmodified RX/ESC in this case. XBee is used for the current setup because 2-way communication was required which is not possible with RC TX. Since RC TX/RX are not required the XBee approach is actually cheaper too.

It's also possible to connect the buddy box output to an XBee and use the same circuit shown below for the plane. In this case another micro is needed to convert PPM from the TX to serial for the XBee. Requires a different program.

In the current project the Tiny25 micro goes between XBee and servos on the plane. For the PC end the transmit XBee connects directly to the serial port. Only a regulator to convert 5v to 3v and inverter are used. No micro for the PC end.



Quote:
Originally Posted by boldive
Is it possible to use analog resistors from buddy box (Futaba Skysport4 for example) to control a plane? What kind of adapter needs to be installed between XBee and servo (if more than 3 channels)?
Thanks
rich smith is offline Find More Posts by rich smith   Reply With Quote
Old Apr 29, 2009, 12:16 PM   #6
7000mw of raw power!
 
rich smith's Avatar
 
Join Date: Dec 2006
Posts: 4,438
I'll dust off the camera and take picks of the assembled unit sometime in the next day or so. Next time I go out to the field I'll try to get video of the unit in action.

That's interesting about using RF to control underwater. I'm not sure 2.4ghz is best choice though because very thick insulation would be needed to prevent siganl from bleeding off. Lower frequency like 72mhz or, better still, 27mhz will go farther. In fact really low frequency RF (khz range) cuts through water and may not need a wire at all. That's what is used to talk to subs on the other side of the world.

As far as more channels the idiots at Atmel made an unbelievable blunder by putting Timer1 and Timer0 on the same pins limiting Tiny to only 3 PWM channels. One fix is to write bit bang code to do more than 3 which will increase code size by 10. Another is switch to Mega (i.e. Mega48) which has 6 PWMs or use 90sPWM AVR or DsPIC which have jillions of PWM pins.

As far as HID is should be easy to throw together custom WINDOWS code (Visual Studio) to replace HYPERTERMINAL. Non-HID is a bit more complicated. I'm not sure what the benefit would be over regular RC TX/RX though.


Quote:
Originally Posted by gobigkahuna
There's interest! I'm very interested in this. I'm building a remotely operated (underwater) robot that is currently being controlled by a DX5e radio, but my future plans are to control it by computer. The 2.4 GHz signal is sent down a single wire to the receiver which resides in the robot several hundred feet away. The reason for using an RF signal is that data can be sent very long distances on a single wire. I'd be very interested in replacing my current radio / receiver with a pair of Xbee modules but up 'til now I had no idea where to start. Your post has shed some light on the subject and a glimmer of hope! I'll start googling for info on coding the Xbee, but in the mean time what would be involved to expand what you've done to 6 or 8 servo channels instead of 3? Using a joystick, gamepad or other analog Windows HID device instead of the numpad?
rich smith is offline Find More Posts by rich smith   Reply With Quote
Old Apr 29, 2009, 12:38 PM   #7
Registered User
 
Join Date: Nov 2008
Location: North Carolina
Posts: 248
Quote:
That's interesting about using RF to control underwater. I'm not sure 2.4ghz is best choice though because very thick insulation would be needed to prevent siganl from bleeding off. Lower frequency like 72mhz or, better still, 27mhz will go farther. In fact really low frequency RF (khz range) cuts through water and may not need a wire at all. That's what is used to talk to subs on the other side of the world.
The way I understand it, the benefit to using 2.4 ghz is the reduction in noise. We're building this based on the advice of a consultant who's done this before so hopefully he's right.

Quote:
As far as more channels the idiots at Atmel made an unbelievable blunder by putting Timer1 and Timer0 on the same pins limiting Tiny to only 3 PWM channels. One fix is to write bit bang code to do more than 3 which will increase code size by 10. Another is switch to Mega (i.e. Mega48) which has 6 PWMs or use 90sPWM AVR or DsPIC which have jillions of PWM pins.
Way over my head. I'll take that as to mean, no adding more than 3 channels would not be easy to do.

Quote:
As far as HID is should be easy to throw together custom WINDOWS code (Visual Studio) to replace HYPERTERMINAL. Non-HID is a bit more complicated.
So when you plug this into your USB port I'm assuming Windows recognizes it (ie. you didn't need to create any drivers)? So you're able to plug it in and then just send commands to a COM port?

Quote:
I'm not sure what the benefit would be over regular RC TX/RX though.
I'm not sure there would be a benefit to using an XBEE since it's limited to only 3 channels. But I was hoping to use it as a computer interface instead of a standard RC TX/RX because of a) cost, b) wouldn't required "destructive" hacking c) takes up less space d) more easily customized.
gobigkahuna is offline Find More Posts by gobigkahuna   Reply With Quote
Old Apr 30, 2009, 12:27 PM   #8
7000mw of raw power!
 
rich smith's Avatar
 
Join Date: Dec 2006
Posts: 4,438
Yes, the potential is huge. Right now we're not using the XBee "downlink" capability but it would allow the possibility of having a ground PC do UAV type duties instead of a wimpy on-board micro. The existing circuit is pretty much ready to go for that.

I was always fascinated by the prospect for "intelligent soaring" software Even without downlink but never did anything. For example when sensing a wing being lifted then bank in that direction hoping to catch the thermal. And, like you say, automatically adjusting for flight conditions.

On the subject of failsafe I have code buried in other projects for just that purpose and maybe incorporate it into this project or do another thread. Similar to this but with RC RX in addition to the XBee. There is still one unused port bit available.

Quote:
Originally Posted by MCarlton
If its possible to use a PC for flight control, then would it be possible to use that PC for almost infinite programming possibilities, and tie those into telemetry from the model?

Thus, if flying a sailplane, one could have a 2-way comm link between a laptop and the model. Telemetry from the model "tells" the laptop what it is doing, and the laptop "tells" the model the best combination of flaps, trim etc.

You could select a setting "minimum sink" "maximum LD" etc, and the model would automatically and continually adjust itself, leaving the pilot free to concentrate on searching out lift and such.

Also, for landing approaches with large models, one could programme in an ILS approach. Define a glideslope and sink rate in the laptop and the telemetry link looks after that aspect of the approach.

There's even a possibility for a failsafe. If the model has a radio failure, a VHF (or whatever) telemetry link could take over and, using a GPS unit mounted in the model, could actually bring the model back and land it on the strip.
rich smith is offline Find More Posts by rich smith   Reply With Quote
Old Apr 30, 2009, 12:35 PM   #9
7000mw of raw power!
 
rich smith's Avatar
 
Join Date: Dec 2006
Posts: 4,438
Quote:
Originally Posted by gobigkahuna
So when you plug this into your USB port I'm assuming Windows recognizes it (ie. you didn't need to create any drivers)? So you're able to plug it in and then just send commands to a COM port?
Actually you plug it into a serial port (COM1-4) or, if there's no RS232 available like with notebooks, use an USB-to-serial converter (COM5+). For the adapters XP drivers are required (FTD/Prolific) but I think Vista don't need any.

Please keep us updated on that robot-sub project. I tried doing something like that many years ago but failed miserably due to lack of know-how.
rich smith is offline Find More Posts by rich smith   Reply With Quote
Old May 01, 2009, 08:03 AM   #10
fungus amungus
 
Join Date: Apr 2009
Posts: 29
I dont mean to sound like a killjoy but you guys do realise that this kind of thing is against broadcasting laws as the system hasnt been approed by roff.
fungus amungus is offline Find More Posts by fungus amungus   Reply With Quote
Old May 01, 2009, 09:55 AM   #11
7000mw of raw power!
 
rich smith's Avatar
 
Join Date: Dec 2006
Posts: 4,438
Quote:
Originally Posted by fungus amungus
I dont mean to sound like a killjoy but you guys do realise that this kind of thing is against broadcasting laws as the system hasnt been approed by roff.

Not sure if "approed by roff" but as holder of 2nd class RadioTelephone license I can assure you these are legit in the U.S.. Note FCC ID in photo.
rich smith is offline Find More Posts by rich smith   Reply With Quote
Old May 02, 2009, 08:28 AM   #12
7000mw of raw power!
 
rich smith's Avatar
 
Join Date: Dec 2006
Posts: 4,438
I've uploaded photos, updated hex, assembly hints, and a new simpler schematic to post #1. A couple emails indicated trouble with original hex files. Problem was idle lo serial used for a dffierent RF modem so the new one is proper idle hi for XBee. The old one was moved here to allow use of other RF modems which need that type of serial.

Biggest hardware change is replacing regulator with common diodes. Also a diagram for the XB/PC adapter was added using diodes instead of regulator too. A regulator is a safer more accurate supply but costs more and harder to procure. The original schematic is reproduced in this post so you can go either way. LEDs have been removed from the adapter and can be soldered to the top of the XBee modules which is more convenient.

Always go to post #1 for latest files with bug fixes and improvements.
Attached Thumbnails
  • Name: srvpc01.jpg
Views: 164
Size: 37.6 KB
Description: reg version schematic reg version schematic 37.6 KB · Views: 164

  • Name: IMG_0025.jpg
Views: 89
Size: 94.1 KB
Description: reg version top reg version top 94.1 KB · Views: 89

  • Name: IMG_0029.jpg
Views: 87
Size: 70.3 KB
Description: reg version bottom reg version bottom 70.3 KB · Views: 87

Attached Files

Last edited by rich smith; May 05, 2009 at 09:02 AM. Reason: move old version from post #1
rich smith is offline Find More Posts by rich smith   Reply With Quote
Old May 03, 2009, 04:40 AM   #13
Gaftopher
 
Gary Mortimer's Avatar
 
Join Date: Feb 2007
Location: Nottingham Road South Africa/Bedford UK
Posts: 1,412
Blimey Rich, the boys in heavy jackets and sunglasses from JR Futaba et al will be knocking on your door to explain the errors of your ways.

Well done top use of xbees.

I was just wondering when somebody was going to bring all of the UAV function to the computer on the ground!!

Automatic soaring certainly is interesting, yesterday I flew my 40 inch electric V tail, not made for soaring airfame into a boomer and was soon joined by 3 real gliders! The power saving for that portion of flight is obviously tremendous.

I have often thought that a slope that you know well from hand flying that works when conditions are a certain way would be a great place to put a radio relay of some sort.

Could you wire a couple of maxstream extends for this??

This thread will certainly be followed with great interest!

Cheers

G

Last edited by Gary Mortimer; May 03, 2009 at 05:15 AM.
Gary Mortimer is offline Find More Posts by Gary Mortimer   Reply With Quote
Old May 04, 2009, 10:43 AM   #14
7000mw of raw power!
 
rich smith's Avatar
 
Join Date: Dec 2006
Posts: 4,438
Thanks Gary. These XBee modules are great. Wireless RS232. It was love at first sight. I just got through testing a couple of the 6 mile 900mhz units with modified RCCam patch. Got a little over 3 miles in my case. These are actually cheaper than the 2.4ghz and weigh about the same so I may switch over.

The 40 mile Xtend units are a little heavy (and pricey ) for my application but RS232 is RS232 so they should work. May put something together in the future.

Also tried flying one of the 1B1M Delta with this setup. Not as easy as the more stable 48" foamie because they're a little "frisky" but no problem. You definitely have to set the typematic rate on the keypad to minimum.

So far there are 3 units built (5 counting my 2) and they all work so that's a good indication bugs have been worked out. I got a couple requests to change baud to 4800 so it would be compatible with the GPS tracker. Apparently reconfiguring the XBee with AT commands is not that big a deal so maybe another bin coming down the pike. And pics of the diode version.

Quote:
Originally Posted by Gary Mortimer
Blimey Rich, the boys in heavy jackets and sunglasses from JR Futaba et al will be knocking on your door to explain the errors of your ways.

Well done top use of xbees.

I was just wondering when somebody was going to bring all of the UAV function to the computer on the ground!!

Automatic soaring certainly is interesting, yesterday I flew my 40 inch electric V tail, not made for soaring airfame into a boomer and was soon joined by 3 real gliders! The power saving for that portion of flight is obviously tremendous.

I have often thought that a slope that you know well from hand flying that works when conditions are a certain way would be a great place to put a radio relay of some sort.

Could you wire a couple of maxstream extends for this??

This thread will certainly be followed with great interest!

Cheers

G

Last edited by rich smith; May 04, 2009 at 10:50 AM. Reason: typo
rich smith is offline Find More Posts by rich smith   Reply With Quote
Old May 05, 2009, 08:48 AM   #15
7000mw of raw power!
 
rich smith's Avatar
 
Join Date: Dec 2006
Posts: 4,438
I put pics of the diode XBee circuit in post #1 and moved the regulator ones to post #12 so photos will be with corresponding schematics.

A buddy of mine just gave me a Tiny25 chip that don't work. It programs ok and code and fuses read correct but it fails in my socket so somethings amiss. The only thing different is it's from a batch that's couple years newer than my Tiny45s. Probably the internal oscillator is off or something. I'll take a closer look today at lunch.
rich smith is offline Find More Posts by rich smith   Reply With Quote
Reply Post New Thread  Previous Thread Next Thread

Castle Creations      DRIVE / FLY / SUPPORT  

Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Discussion another DIY 2.4GHz RC system using Cypress CYRF6936. mrdunk DIY Electronics 135 Jun 22, 2009 03:18 AM
Discussion DIY 2.4GHz RC project XJet DIY Electronics 22 Jun 23, 2008 04:58 AM
Question 900mhx video interfering with 2.4ghz RC radio Don@HomeHobbies Video Piloting (FPV/RPV) 15 Oct 08, 2007 12:51 PM
RC Control through PC of Plane Keith Sevcik rec.models.rc.land 5 Sep 10, 2003 10:19 AM
RC Control through PC of Plane Keith Sevcik rec.models.rc.air 4 Jan 28, 2003 03:42 PM




All RCGroups content copyright 1996 - 2009 by RCGroups.com and Jim Bourke except where otherwise indicated.
Terry the transmitter, the RCGroups name and logo, The E Zone, Lift Zone, and RC Power are all trademarks of RCGroups and Jim Bourke. Please report any misuse of our trademarks using the contact form. Thank you.

Bored? Want to fight?
Join the RCGroups clan!

Powered by vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.