Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Mon May 07, 2012 1:38 am

As ideas evolved, I ended up wondering if it were possible to simplify a radio controlled device with first person view camera into a single unit utilizing wifi and RPi thusly:

PC with wifi and remote connection to RPi, possibly remote desktop

RPi with wifi and camera connected controls an Arduino, if even necessary.

Arduino provides multiple signal outputs including PWM to drive either ESCs and servos directly

Alternatively such a setup could even drive a KK quadcopter board or something more complex.

The idea is to have cheap, simple wifi dongles with 150 mbps+ connectivity over long enough ranges and to entirely bypass expensive radio controllers, receivers and separate units for telemetry and video feedback.

A simple program on the RPi would interact with the Arduino to turn feedback from a game controller or keypad input directly into the PWM signal equivalent recognized by ESCs and servos, that's 50+ Hz and 1-2 ns pulse width, depending on type of servo I reckon? Autonomy and automatic flight adjustments could be achieved with more complex software that is relatively easily implemented on the RPi platform.

Video feedback and other telemetry would be simply available through most any USB camera, and upgrades as well as other plug and play devices would be simple to add. USB GPS devices, or ones available at a low cost for the Arduino could be added as well, along with altimeters, electronic compasses and such to be viewed through a user friendly and programmable / customizable interface.

Ultimately, such a setup would allow simple, affordable and highly customizable radio control setups and even automation. I've found a couple sources for highly costly ready-made and specialized wifi controllers with software for iPhones and such, but I'd rather use a low cost laptop and an xbox 360 controller or a joystick for an unlimited multi-platform remote controller. Standalone FPV systems are generally prohibitively costly due specialized hardware, firmware and limited demand. With the RPi it is possible to utilize the high bandwidth of the already low cost, yet long range wifi platforms without added cost or need for HAM radio license or similar at worst due local regulations.

Well, I missed the RPi release, but I signed up for the queue.

Thanks to Raspberry Pi for sparking my imagination and a thanks in advance for replies.

User avatar
jbeale
Posts: 3578
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: RC via wifi - PC to RPi

Mon May 07, 2012 2:23 am

There have been some issues getting some WiFi plugs to work on the R-Pi, including power (onboard USB has 140 mA limit without a hub) and software (drivers, and a kernel driver bug which may have been recently fixed just in the past week). Anyway some people have reported working WiFi devices on the R-Pi, and you should be able to do anything with it that the WiFi bandwidth, and your software can support. I know of no reason that remote-controlled robots with video feeds wouldn't work. At the highest bandwidth (bitrate), don't expect really long range from your WiFi unless you have a directional antenna, though.

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Mon May 07, 2012 7:03 am

Thanks for the reply jb. 140 mA limit does seem a bit low when looking at the current draw of some of the USB wifi cards. However, an easy remedy would be to add a stripped down USB hub in between with power supply from the same 5 volt regulator that powers the RPi with high enough current limit.

Not expecting ranges beyond a couple hundred meters, maybe up to a kilometer with a high gain antenna, but definitely something that would be an improvement over the cheap'o RC hacks through the original radio controller with no feedback. Besides, the idea is to have a proof of concept and a test platform to expand upon, not a long range FPV device from the get go.

Bandwidth wouldn't have to be much higher than what is required to stream 720p video, which would be the bulk of the data stream. A couple Mbps should suffice, perhaps even less than 1 with h.264 or other form of compression, but not many low cost USB cameras have hardware encoding. Something like the 27€ Logitech C270 seems mighty fine as per reviews.

A small form plug and play 500 mW wifi card with antenna costs some 15€ with a reported range on the better side of half a kilometer with direct line of sight, out of the box. Might be better, if users just haven't had to see how far they can get.

AtMega328 based mini board 12 euros with six PWM outputs would be fine for a KK quad board 25€.

Assorted ESCs, motors, propellers and such for around 100€ and a <250€ HD FPV quad flyer controlled with a PC would be quite possible.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: RC via wifi - PC to RPi

Mon May 07, 2012 12:31 pm

Miyuki said:


Assorted ESCs, motors, propellers and such for around 100€ and a <250€ HD FPV quad flyer controlled with a PC would be quite possible.



Ever had a wifi dropout? Thought so. I wouldn't personally want to trust anything in the air unless it had a rock solid control link. Are you aware of the BMFA/CAA regs on FPV flying? (If you are, I'll shut up, but it's not quite the case that you can just do whatever you like.)
Alex Eames RasPi.TV, RasP.iO

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Mon May 07, 2012 2:32 pm

Wifi dropouts did cross my mind, from simple packet loss to complete signal loss. Was thinking of making the software automatically revert to hover mode if the connection drops for too long, or if no user input is forthcoming. Perhaps with an advanced mode for automatic landing and obstacle avoidance with an audible warning as a later upgrade. RC car or a crawler doesn"t have the issue to begin with, it just gets stranded. The real danger would lie with an RC airplane out of control.

BMCA / CAA, wrong country ^_^

But yes I'm aware that rules apply here just as well. None the less, there"s so much beautiful wilderness out there where RC hobbyists usually go. Long range on the transceiver would be more of a safeguard against accidentally flying out of range and ensuring better signal within safe flying zone even with a couple trees in between than to actually fly as far as possible, as the control platform is supposed to be just as mobile.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: RC via wifi - PC to RPi

Tue May 08, 2012 1:59 pm

Miyuki said:



BMCA / CAA, wrong country ^_^

But yes I'm aware that rules apply here just as well.


OK. I won't preach at you any more then. Sounds like you know what you're doing. I see no reason why you shouldn't be able to have some fun with this.
Alex Eames RasPi.TV, RasP.iO

thingle
Posts: 2
Joined: Wed Apr 25, 2012 2:04 pm

Re: RC via wifi - PC to RPi

Thu May 17, 2012 8:55 am

I am interested in what state are your plans for this project. I might try something with a RC car in the beginning with my Pi once I get it (probably in fall :/ ).
I am interested in what kind of components you are planing on using. What kind of board to control the servos and drive motor for the vehicle.

Good luck with your projects
Thingle

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Mon May 21, 2012 2:03 pm

Hi thingle, seems I don't get thread updates by email anymore, so I missed the message.
Project is waiting for me to get a job for the summer, busy with studies still. Once I get some cash, I'll probably buy an arduino a KK quadcopter board, ESCs, motors and batteries. Could make a quad even if I don't eventually get an RPi.

Current plan is to use an Arduino plugged directly via USB to the RPi or computer to control and generate the PWM signals for servos and ESCs for brushless motors. There are plenty of choices for the software for the Arduino generalized as servo controllers that generates up to 6 PWM outputs from a mini Arduino and 16 on the larger 1280 and 2560 which would be good for controlling even a more complicated robot. The arduino program translates a numeric value given by the computer program into steps in the PWM output accordingly.

The same signal that a servo uses to determine the rotation angle is the one interpreted by ESCs and is generally >50Hz with 1-2 nanosecond pulse width. For an ESC without reverse, 1 ns PW primes the ESC but produces 0 output and 2 ns gives full output. For a servo or ESC with reverse 1 ns is fully in one direction and 2 in the other, 1.5 being the middle ground.

For a simple land vehicle all that is necessary to move it is one PWM output for the ESC with reverse or programmable functions (not all have that,) with a single brushed or brushless motor setup and one output for the servo to steer. More outputs could be used to perhaps rotate a camera with two more servos. There's free software for a "creeperbot" that uses an xbox controller via PC through wifi to arduino to do exactly this. The difference being that I'd use the RPi to provide wifi interface rather than the Xbee for Arduino used in the bot. The RPi also provides more user friendly computing power if I wanted to add more sensors for autonomous operation with something like open source obstacle recognition software through cameras, ultrasonic or light sensors and whatever, anything really.

funnel
Posts: 48
Joined: Sat May 05, 2012 8:00 am

Re: RC via wifi - PC to RPi

Mon May 21, 2012 2:47 pm

I have to correct you. The pulse width signal for controlling servos and ESC's is 1-2ms(not ns). Some faster digital servos have the center at 0.76ms to allow them to work at higher frequencies.

Nice project. I was thinking the same thing to remotely control a camera mounted on a rc plane, helicopter, quadrocopter, balloon or kite, and get liveview feedback through wifi.

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Mon May 21, 2012 3:36 pm

Uhh, whops of an order of a magnitude. You're absolutely right funnel, dunno why or how it is possible to miss that when I still had the actual guide page on the issue open since my original post to boot... I'm getting old (keep telling that to myself and I might feel less silly about it.)

thingle
Posts: 2
Joined: Wed Apr 25, 2012 2:04 pm

Re: RC via wifi - PC to RPi

Mon May 21, 2012 9:06 pm

Thanks for the info Miyuki. I've looked at some robotics stores here in Finland and that's pretty much what I came up with even dough I have no idea yet what I'm doing. That's why I like to see updates from this project. Looks interesting even if I might be biting off a bigger piece than I can chew. Hopefully the community can help :). Once I have some hardware I probably will have more on the subject. I am only waiting now for my first paycheck from my summer job so that I can start tinkering :)

blobert123
Posts: 13
Joined: Wed May 23, 2012 6:48 pm

Re: RC via wifi - PC to RPi

Sun Jun 10, 2012 12:08 pm

i don't know about a weight restricted quad-copter but with robots on the ground wifi coverage could be pretty patchy but what about using the mobile phone network ? using dongle or a phone ( mine, a Samsung galaxy young can provide a wifi hotbot through mobile signal ) mobile coverage is often very good extending the range of the device. just adding a few ideas :-)

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Wed Jun 20, 2012 3:17 pm

I had been looking at GSM shields for the Arduino, but the costs are pretty prohibitive, with even a basic version costing around 100 € with local taxes. This is without including the cost of a new SIM card and a monthly plan with limitless internet plus the actual usage fees, though I had been planning on getting a GSM GPS locator for my motorcycle with a prepaid connection.

Besides, if WiFi connections have been patchy, then data through phone connection hasn't exactly been reliable either with random packet losses and high latencies, despite excellent coverage around here.

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Sat Jun 23, 2012 5:36 pm

Yay, got my pre-order on the RPi, so this project will actually get somewhere on my part.

User avatar
VBT
Posts: 21
Joined: Sat Mar 10, 2012 12:33 am
Contact: Website

Re: RC via wifi - PC to RPi

Mon Jun 25, 2012 8:11 pm

Interesting project, please keep us updated on how it goes. I was thinking of something similar in the form of a solar robotic lawnmower so I'll be interested to see how this turns out. :)

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Thu Jul 19, 2012 6:26 am

Received notice from Farnell that they've mailed the RPi, time to start ordering the other parts!

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Thu Jul 19, 2012 10:13 am

Modified my original plan somewhat as I found a $30 sensor module with gyros, accelerometers and altimeter that is most likely compatible with the Arduino based AeroQuad software. Now the idea is to bypass the whole idea of using the PWM outputs from the Arduino to control a KK quadcopter board or similar and instead use the ATMega2560 that I just ordered with the sensor module itself as the controller and direct control of ESCs. This should provide me with a much higher degree of customization, all the while reducing the overall price by not having to add individual sensors as add-ins.

Ordered the following parts:
4x Mystery 930 KV outrunners
4x Mystery 30 Amp ESCs
10x4.5 prop sets
2400 mAh LiPo pack
Arduino (clone) ATMega2560 as recommended for the AeroQuad
The aforementioned sensor pack and some assorted connectors and variable voltage regulators.

Have yet to order the WiFi links and camera, not to mention having a frame to build. Probably going to use the glass fiber I have lying around and buy some carbon fiber tubes from a local hobby shop.

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Thu Jul 26, 2012 6:35 pm

Just booted up my RPi for the first time, with Raspbian, but hard to get further without a USB keyboard or a PS2->USB adapter. Dangit, shouldn't have skimped and walked out of the store without buying that flexible portable keyboard after already splurging on other accessories.

Other parts are on their way and I'll go and see what sort of materials I have for the frame on the weekend.

fenris
Posts: 1
Joined: Mon Nov 28, 2011 11:13 pm

Re: RC via wifi - PC to RPi

Sun Jul 29, 2012 10:08 pm

Have you thought about usingZigbee / Xbee for the radio - low power and good range?

The "slice of Pi" add on board has the relevant connectors according to this site
http://shop.ciseco.co.uk/slice-of-pi-ad ... pberry-pi/

They are quite common in Arduino based projects - along with oddball ebay radio links!

flightvision
Posts: 21
Joined: Sat Apr 21, 2012 9:04 am

Re: RC via wifi - PC to RPi

Mon Jul 30, 2012 12:40 am

Interesting topic ;) I am doing the same. My base idea was 'controlling a model plane via IP network with cheap components'. I was quite sure I would not be unique in seeing this potential in the Pi ;)
I am nearly there now:
  • Have the base station software with HID joystick input (Linux, but easily adaptable to Win or Mac). It monitors link quality and allows to show sensor values from the model stations. It has provisions for mixing inputs or applying functions to them (set max/min values etc.), but that is not ready yet. I have planned for a long time to compete with the crappy software of most R/C transmitters that are sold for loads of money so I am very motivated to get good in this field 8-) .
  • Have a videolink (very basic with a USB-Webcam and gstreamer, although I have provisions for it in the base station Qt software but it was more difficult than thought at first - anyway gstreamer is fine). Waiting what cameras will be available for Pi's CSI interface.
  • Have the model software which controls servos and will be able to send sensor values from an altimeter/variometer sensor (BMP085 via I²C, 70% ready). btw, I use the same software for base station and model, it just loads different plugins. It is based on a simple UDP-protocol I made up, similar to a LAN-chat with auto-discovery. It runs headless (no GUI) on the plane to control it via a SSH session.
  • since yesterday I have the servo control ready! Used a Pololu 207 mini board for that, driven via UART/serial. Typical latency over WLAN (adhoc-network, WPA2) is 30-50ms (which is a tad high for fast planes, but I want to stay with UDP/IP for simplicity).
  • tested WLAN fidelity by putting the Pi onto my plane and the laptop next to me. Logger showed good connection up to 200-300m with my absolutely cheapish WLAN stick. Will need to dive into antenna/WLAN devices because I need 1000m for real free flight. Ping (roundtrip) times where 20-40ms in this range, up to 200ms when 500m away. Bandwidth is always enough for a videolink of 2 Mbps or the like.
The WLAN transmission is the weak point until now. Zigbee sounds good, but the high power devices (ranges of 80km lool) are not available in Germany and control via IP-network opens up a whole bunch of possibilities like smartphones, controlling a car via a browser etc. Additionally it is just plain simple and gives full control over your software via SSH which is very sexy (and the 1 big difference why I think a Pi has so much more creative potential than for example an Arduino).
I do not plan any autopilot capabilities so this cannot be a backup if the link is lost at distance. As long as I am not 100% sure, the Pi will fly with me but I still use the good old 35 MHz FM stock R/C link for control.
I am using the Laptop/netbook with a USB R/C transmitter as base station. Depending on what type of antenna will be needed on the base station (might be that this might get a bit special...), building the Pi into a used R/C transmitter and adding maybe a display to it is an idea, too. 1st-person-view-flying with glasses and head-up-display would make the display obsolete...

andyroyal
Posts: 32
Joined: Fri Jul 20, 2012 7:41 pm
Location: Berkshire, UK
Contact: Website

Re: RC via wifi - PC to RPi

Mon Jul 30, 2012 10:43 am

> an easy remedy would be to add a stripped down USB hub in between with power supply from the same 5 volt regulator that powers the RPi with high enough current limit

I was looking at doing something like this. Has anyone actually tried it and got it working? The power bit's easy, I'd be more worried about maintaining the signal integrity on the data lines. Maybe I worry too much and should just try it?

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Mon Jul 30, 2012 5:15 pm

@fenris
The problem with ZigBee / XBee is the limited bandwidth of barely up to 9.6 kbps, hardly enough to transmit HD video. Unless I missed something?

@flightvision
After having watched videos from the Team Black Sheep on youtube with their FPV flying wing, I am tempted to also try and make a fixed wing craft, but that will have to wait after I get the hardware and software set up. It's also harder to set up a safe mode where the craft goes into hover mode or automatic landing if radio link cuts off for too long.

Network latencies of that range shouldn't be an issue with a self-stabilizing craft with some autonomous functions, but I can imagine it becoming an issue with a craft that could turn into a self propelled kinetic projectile at any moment. The range also seems fine for what I'm after, but it does seem like a weak point once again with a fast flying device. The regulations on the output power of these devices is quite prohibitive, so delving into higher gain antennas is the only option without getting amateur radio license.

@andyroyal
In its simplest form, they use USB Y-cables that split the input end into two jacks, one with data and one without to draw power from two USB jacks, so there isn't really a problem in using the next step that is a powered USB hub.

I'm currently going to use two separate batteries and variable voltage regulators such that the ESCs and motors get their power from the 2400 mAh LiPo (~150 grams) and the "brains" get their power from a separate light weight 850 mAh LiPo (~65g) through a regulator box (5g) that splits the cables into a 11.1V 2.5/5.5 plug for the Arduino (~40g) a 5V 1,4/3.4 plug for my USB hub (20g) and micro B USB plug for the RPi (~45g.) Overall weight so far ~350g for the electronics.

For frame construction there's plenty of spare 8/6 mm aluminum tubing and aircraft quality aluminum alloy sheets to build a durable frame. Trying to keep the weight of the frame at around 300 grams as well as per calculations done with Inventor... overall maximum theoretical thrust to weight ratio should be sufficient at 1.5 to 1 (800g / 1200g) with a small camera, motors and other crap mounted.

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Tue Jul 31, 2012 4:17 am

A correction to my previous post: So, according to two other calculators I used, I should get more than twice the previously reported 1.2 kilos of thrust, so even if I increase the weight of the chassis to 1.2 kilos, it would still have a thrust to weight ratio of 2:1. Plenty good if I ever decide to get another battery to extend flight times from the expected 10-20 minutes depending on the amount of acrobatics.

Bigfoot
Posts: 1
Joined: Tue Aug 14, 2012 8:49 pm

Re: RC via wifi - PC to RPi

Tue Aug 14, 2012 9:00 pm

Hi,

I've been reading this tread with great interest since I too have had a plan on making a quadcopter with wifi video feed. My first idea with arduino based wifi shield was shattered because of the speed limit. My current plan is as follows:

Use a RPi with wifi usb to connect to usb cam as well as a KK board powering/steering the esc and everything else. The RPi will therefore be the RC and video unit only. It might be a good idea to have an additional arduino unit between the boards for pwm, but im not sure.

Since am a social science guy in real life I'll happily accept any guidence in what I need to do and learn :geek:

Any suggestions on what programs (and OS for that matter) to use in the RPi to connect the wifi to video and KK board?

Br
Sam

Miyuki
Posts: 14
Joined: Sun May 06, 2012 11:51 pm

Re: RC via wifi - PC to RPi

Fri Aug 17, 2012 6:50 pm

Arduino was finally shipped the other day, but it'll still take a while to get here and I'm only just now about to order two WiFi dongles.
I'm going to go through the actual software and available code once I get the Arduino to interface well enough with the RPi to actually control any PWM outputs and get input data in legible format.

As I've been thinking of accessing the RPi with a remote desktop client that starts whenever the RPi is booted up, I did find this guide that should help me get started on controlling both the RPi and the Arduino through it with a PC at the other end... Remains to be seen what works with the Raspbian I currently run.

Return to “Automation, sensing and robotics”