Quad with wifi, 3G, GPS and prop balancing

Post Reply
greg
Posts: 8
Joined: Mon Jun 11, 2012 11:17 pm

Quad with wifi, 3G, GPS and prop balancing

Post by greg »

Hello,

Over the past year I've been working on a quad with as many additions as seemed practical. RC is over 2.4 GHz wifi, with on-board 486 driving an Arduino Pro Mini, GPS, webcam+gimbal and 3G stick. With PID configuration and all the stats accessible through a custom ground control station running on a laptop. Have also added propeller balancing methods based around the on-board accelerometer.

Extreme closeup:
Image

GCS:
Image
Note -- The stats are from when it was on the ground unarmed, for effect I put the cam image in afterwards.

It weighs 1.2Kg and flies 8 minutes on 1.7Ah, while carrying a 2.4Ah 4 cell LiPo.

Prop balancing seemed to be a big problem, so some extra code was developed to use the accelerometer and an optical sensor to measure vibration and phase relative to the prop. Appears to work:
Image
This shows the effect of moving a 10mm x 5mm piece of insulation tape between ends of the prop blades, with any tape at all and half way along one blade.

Have had a few test flights in the house, in the garden, in a field, thought it was about time it was shown off to some of the people whose work made it possible. More details, images and source can be found here:
http://abatis.org.uk/quadv1/


Richard
Last edited by greg on Sat Jun 30, 2012 10:49 am, edited 1 time in total.

Pyrofer
Posts: 180
Joined: Sat Apr 14, 2012 2:55 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by Pyrofer »

That's pretty cool.

Have you tried to control it over the 3G data connection?
I have always wanted to see how bad the lag was with a dial-in serial connection to fly.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by copterrichie »

I like the Wifi and believe that is the way to go. Have you noticed any delay or lag?

Pyrofer
Posts: 180
Joined: Sat Apr 14, 2012 2:55 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by Pyrofer »

Doesn't range suck?
3G would allow almost unlimited range assuming you had good coverage in the area.
If you could get 3G ip data and feed video back over IP as well, that would be amazing.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by copterrichie »

I have seen videos of guys getting great coverage with WiFi and their Parrot drone.

greg
Posts: 8
Joined: Mon Jun 11, 2012 11:17 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by greg »

The plan was to use the 3G for control and video, but the 486 doesn't have the power for it. I had tested encoding and sending 640x480 mpeg4 over the 3G stick at ~15 fps, and that worked but that was using a desktop cpu. The cpu barely noticed.

The one way 3G lag is about 120ms, which is a large amount. Not sure it would be flyable in acro mode, but level mode or something more high level still (go-over-there mode, tied into the gps) would defo be okay. At the moment, the 3G reports home the GPS coards, video stats and can ftp jpeg images.

I've not tried simulating the lag to see how bad it would be...

Currently flying on wifi, which is okay. Have been careful with it, fly some distance and then go over the logs and check for packet loss. Wifi is low power, but that low power can go a long way when in open air - it is trees and buildings that get in the way of the signal. To get the most out of it, I'm currently testing IBCrazy's cloverleaf aerial design. Haven't tested on the quad, but testing in a field showed it to give a more consistent, stronger signal over a distance of 160 meters.
Last edited by greg on Wed Jun 27, 2012 10:36 pm, edited 1 time in total.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by copterrichie »

Thank you for the information.

This is something that I have been working on to increase the range of Wifi: http://www.youtube.com/watch?v=te97FzUItaI

greg
Posts: 8
Joined: Mon Jun 11, 2012 11:17 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by greg »

Tried that a few years ago, unrelated to flying.
A bi-quad antenna feeding an old style Sky dish. It talk to an AP through a roof, 100 meters of open air, and two brick houses. To get the thing aligned, it was taken to field and parts (feed position, feed angle, dish angle) moved till it had the best signal of an access point that had been taped to a wooden pole, 900 meters away.

For FPV, the best compromise of buildability and performance seems to be a helix at base and clover in the air. Good gain but not so narrow a beam that it is always misaligned.
Last edited by greg on Wed Jun 27, 2012 11:57 pm, edited 1 time in total.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by copterrichie »

Interesting and thanks for the information.

greg
Posts: 8
Joined: Mon Jun 11, 2012 11:17 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by greg »

Have continued to play with this setup. The bifferboard and USB stills camera was replaced with a Pi and Logitech C920. Also replaced the EM408 gps with a Ublox MAX6, and to avoid EMI issues, mounted it on a leg. The C920 produces 1920x1080 at 30 fps, H263 encoded by the camera to whatever bitrate required. At the mo, the data stream is sent over Wif via the Pi to the GCS - shame my monitor doesn't have the resolution for it.

Before the change to Pi:
https://vimeo.com/57029586

So then I came to check out progress with position hold and ... it is so complicated it now requires an additional processing board. Does anybody know of plans to simplify it to run on a pure pro-mini? It would be possible to (re-)port the PH/RTH code to run on the Pi, but that seems like a wasted effort.

Geebles
Posts: 24
Joined: Sat Jan 26, 2013 2:23 am

Re: Quad with wifi, 3G, GPS and prop balancing

Post by Geebles »

I love your system, seems to all go together well! I have a few questions as I'm doing something very similar..

1. You say controlling over wifi - is this by using the Raspberry Pi connected to wifi, with a serial adapter to the Multiwii using 'MultiWii Serial Protocol'? I assume you have set RCSERIAL on the Multiwii? I'm looking into the code to try and get it to listen to standard TX, and if the switch is activated it will listen instead to the serial protocol (sort of like a fail safe)

2. What program on the Pi are you using to transmit the video stream? I've tried to use MJPEG-Streamer and with a crappy webcam it is very delayed and uses a lot of CPU, is this a different story using the C920 (with built in encoding)?

3. My favorite bit is your prop balancer! Are you willing to share any source code for that particular bit? I'm looking to build a small device, which is an Arduino + accel + light sensor + mini LCD, that can be placed on the multicopter and show that 'pattern' of vibrations to aid prop balancing! Because using trial and error is very much like guess work.. Your implementation looks very good and I was wondering if you could even share pseudo code on the best way to implement it!

Thanks, keep up the good work :D
Regards Giles

greg
Posts: 8
Joined: Mon Jun 11, 2012 11:17 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by greg »

1. I'm using MW2.0, which was before the big serial protocol changes of 2.1. Added a serial command to receive stick positions. It sends a 't' followed by 6 channels at 16 bit resolution. This is sent at 15Hz at most from the Pi. The MW parameters are sent to the Pi in two groups, the fast stuff and the slow stuff. The fast stuff consists of all the sensor values (gryo, acc, baro, mag, current, voltage, attitude) at 10Hz and the slow stuff is everything else at 2Hz (about 110 bytes, same response as read by MultiWiiConf). A dual ftdi serial converter connects the Pi to the ProMini and the GPS.

It would be straightforward to have AUX1 choose between source of RC. But if you thought you needed both, why not stick to standard RC?
The only reason I want both is because 3G and wifi means lag with range, so running wifi at the same time is useful. 3G produces 250mS of lag and in acro mode is unflyable. This was tested using the Linux network lag simulator, pointing the H264 camera at a monitor showing a heli flight sim, and flying from the laggy video sent from the camera. Remove the lag simulator and the heli is flyable via the H264+Pi+wifi to laptop link though I'm not sure how many milliseconds of lag there is.

2. The Pi video software is G-Streamer, patched for H264+C920 support, here: http://kakaroto.homelinux.net/2012/09/u ... gstreamer/
Using a large gstreamer command, the resolution, bit-rate and frame rate are specified and the camera produces a data stream which is converted into UDP packets by gstreamer. This packets at the chosen bitrate are all the USB bus sees, keeping the Pi, USB and wifi lightly loaded. The data stream can be decoded at the receiving laptop using another long g-streamer command. I've not yet tested if the video output is any good in flight. Stills look good, but that was the same story as for the 9000Pro. It is a shame this is the digital trade off and necessary for 3G. Go analog and a cheap camera with analog TX produces a very good FPV result.

3. I'll post the above and go and review the prop balancing code before commenting on it. It has been a while, in the mean time have ported to Pi and C920 and then gone off on a tangent and come up with my own waypoint tracking code (implemented in the Pi) - after seeing how the current options just didn't fit with what I had.


Richard
Last edited by greg on Wed Feb 27, 2013 12:28 am, edited 1 time in total.

greg
Posts: 8
Joined: Mon Jun 11, 2012 11:17 pm

Re: Quad with wifi, 3G, GPS and prop balancing

Post by greg »

[writing this again after the editor ate my response...]

Looking at the code, there are about 70 lines at the top of loop() and a few more lines in serial.ino to activate what is in loop().

The code is based on sampling the accelerometer values over a complete prop revolution. An array of 55 pairs of bytes stores the acc values, with the aim of filling 50 of them in a revolution. Every 10 revolutions, the total revolution time of the 9th is used calculate the step size to fill 50 elements in the 10th. At the end of the 10th cycle, the array is sent over the serial port to a PC (the on-board Pi in my case). Overflow is bad and the complete cycle is ignored. Underflow is okay, the Pi can scale the result. Ignoring 8 results gives the code time to settle down after/during sending the data over serial.

A serial command picks the prop and prop speed. Once activated most of the MultiWii code is disabled but the serial code continues to operate. Useful for changing the prop speed, as some speeds can create resonance that will have you chasing ghosts.

At the Pi end, the ~50 element array is searched for the highest magnitude X^2+Y^2, and that position (which equates to an angle relative to the light-dark mark) is incremented. Every 100 or so results, the current histogram is printed. It takes around a minute for the pattern to emerge.

You can have the MW code, that is fairly self contained. The Pi code is a little more tricky, as that is heavily integrated into the rest of the setup - the MW<->Wifi go-between software on the Pi is 1500 lines of C. For that it might be easier to roll your own.


Richard

Post Reply