HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Cheap RC airplane with "outboard" Pi Zero and camera

Tue Aug 08, 2017 6:59 pm

Some time ago I saw a 20$ free shipping offer on banggood.com for 2.4G Piper J-3 Cub RC airplane and ordered it. Besides just flying, I wanted to try adding a Pi Zero with camera to the 23g weight only airplane for flight video recording on SD card.

After having received the plane I did a lot of flights to learn how to fly. Finally I was able to fly despite heavy wind (climbing is easier with that) and even in heavy rain (the built in lipo did 10min normally, did 6:20min in heavy rain). The plane never landed like a real plane (I did not add the shipped wheels), and landing happend on grass.

The first "Pi Zero with camera" experiment I did was to add a 13.8g payload to the airplane and see whether it flies with that:
Image
Lucckily the airplane did fly, in case I chose a payload position that made airplane neither font- nor rear-heavy.

Pi Zero with camera and ribbon cable does weigh 12g:
Image

Pi Zero costs 6$ with shipping. v1 camera (only available in China) 7$ and Pi Zero ribbon cable 1.10$, with free shipping from China. Together with airplane that is 40$ in total.

Next experiment was to open up the airplane and do "something useful". I chose to replace the 5.4g 150mAh lipo with a 17.8g 600mAh lipo for much extended flight time. Here you can see the opened up internals:
Image

I had to create a connector adapter, and most importantly, connect red to black and black to red since the plug into board had opposite colors than used. This shows airplane after the changes, connector adapter is hidden in the airplane, total weight 38.3g:
Image

I did fly successfully, high, and long with this modified airplane. I really like to fly very high, but the problem with that was that I only saw a "dot" in the sky and it was difficult to see the orientation of the plane in order to do the needed flight controller actions. The control range according airplane packing is 80m. Tuesday two weeks ago I did fly high and it was windy. Result was that airplane got out of control range and I could not control it anymore. I did run direction of the plane while it crashed to earth, but I was not able to see where it did land. All I knew was that it landed somewhere in this 95mx33m search area (from gmaps pedometer):
Image

I searched more than an hour that day, in gardens and looking up high trees. I did not find the airplane and ordered a new airplane (for 22$ at that time, that price range is similar on banggood.com and aliexpress.com) the same day. Plan was to add Pi Zero and camera, and go on a Search&Rescue mission when 2nd plane arrives ;-)
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Tue Aug 08, 2017 7:25 pm

Build day :

Last Saturday 2nd airplane arrived, only 11 days after ordering. Saturday was build day for Search&Rescue airplane. The airplane initially did weigh 23g:
Image

I wanted to use another type of lipos (5.2g 160mAh) than the built in 150mAh, mostly because I have 10 of them. This easily allows to change outdoor after one lipo is empty and go for the next flights. I removed the shipped 150mAh lipo and added this connector, that had VCC and GND lines soldered to 5V and GND pins on Pi Zero. Again, as described in previous posting, I had to connect red to black and vice versa:
Image

Soldering is not nice, but the conector works after having taped the blank sections. It is not nice that Pi Zero always gets lipo power and is not controlled by airplane power switch. But plugging new lipo, getting all stuffed into the front and then locking up with rubber band takes less than a minute, This is the first prototype:
Image

Updating "/etc/fake-hwclock.data" on SD card before your flights will give you roughly valid timestamps, at least for the first lipo used, For each power on after lipo change time will restart at that stored in the file.
Last edited by HermannSW on Tue Aug 08, 2017 8:09 pm, edited 1 time in total.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Tue Aug 08, 2017 7:45 pm

Virgin flights:

On Sunday morning I stood up early because only in the early morning hours there was not much wind according weather forecast. It was foggy, and the grass was wet from morning dew:
Image

After having connected the lipo the camera started taking 10s full HD videos with 10ms shutter time, then does a "sync" to make sure data ends up on SD card, and then repeats endlessly. This is frame from 1st video taken after power on:
Image

This is the bash scipt I used (with later slight changes):

Code: Select all

$ cat home/pi/camfly 
#!/bin/bash

cd /home/pi/out.dir
mv old old_
mkdir old
mv * old

cat /proc/uptime > login.`date +%s`.txt
sync

raspivid -t 20000 -fps 25 --shutter  1000 -o fly.`date +%s`.h264
sync

while (true)
do
# raspivid -t 10000 -fps 25 --shutter 10000 -o fly.`date +%s`.h264
# raspivid -t 20000 -fps 25 --shutter  2000 -o fly.`date +%s`.h264
# raspivid -t 20000 -fps 25 --shutter  1000 -o fly.`date +%s`.h264
# raspivid -t 90000 -fps 25 --shutter  1000 -o fly.`date +%s`.h264
  raspivid -t 300000 -fps 25 --shutter  1000 -o fly.`date +%s`.h264
  sync
done
$ 
Since Pi Zero runs headless I added call to that script to /etc/rc.local:

Code: Select all

$ tail -7 etc/rc.local 
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

/home/pi/camfly &

exit 0
$ 
OK, perhaps it is not wise to land unsecured Pi Zero and camera in wet grass, but I did that many times that morning. These photos taken at home are not for the fainthearted ;-)
Image

Waterdrops on CPU, connectors, and on camera board as well. Wet grass in the propeller:
Image

I totally agree that it is better to wait for the sun to come out and wait for drying grass.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Tue Aug 08, 2017 8:25 pm

On tree:

The following (now 20s, 2ms shutter time) video shows a flight that ends after 15s on a 5m high tree. After that all videos show mainly this view:
https://www.youtube.com/watch?v=XKSEDmEXVfs
Image

After 3.5 minutes I tried to kick the airplane out of the tree with help of a 4m long stick. Not much happened besides wobbling branches. In the end this new view was reached:
https://www.youtube.com/watch?v=fEqA57vUjIg
Image

After another 4.5 minutes I had climbed the tree [I have never climbed a tree for more than 10 years, and was surprised that I was able to] and started grabbing the airplane:
https://www.youtube.com/watch?v=r9RwFvpjhmI
Image

In the end I found a free passage in the tree to let the airplane do a free fall to ground. The camera was still recording, and this frame unveils how I was able to climb onto the >2m high lowest branch of the tree ;-)
https://www.youtube.com/watch?v=LRNUT2GKip4
Image

The flight videos were taken with 2ms shutter time, and look not sharp enough to me. All videos after that were taken with 1ms shutter time.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Tue Aug 08, 2017 9:47 pm

Very high flight:

This posting is on a very high flight of airplane, 90s full HD 25fps 1ms shutter time videos of 3:20min flight in total. I did remount the camera, from now on direction airplane front is top of image, before it was left of image.

The first video (0s-89s) shows start and airplane climbing higher and higher. The little white dot is me ;-)
https://www.youtube.com/watch?v=bo0iMjMv46w
Image

I don't know for sure, but would say the airplane was more than 40m above ground. Sometimes the video is shaky, but that is because of the wind up there, and because of the airplane total weight below 40g.

In second video (91s-180s, 1s sync time) airplane crossed line of high trees and flew (unplanned) over settlement, here with video timestamp, the frame is just before leaving settlement area:
https://www.youtube.com/watch?v=qa0Q50m ... tu.be&t=50
Image

While the camera is mounted below airplane and takes vertical images normally, it does take other direction images when flying a curve. Here I got a birds-eye view of our house (middle house of 5 row house block bottom left):
Image

The airplane seemed to climb higher and higher, so that I stopped motors to get it a bit more down as glider. Unfortunately the glider did not make any attempt to decrease height. The trick I used is to start a long left turn. Since turns do loose height with 2 channel flight controllers, that helped to bring down the plane. Third video shows 183s-200s, 2s sync time:
https://www.youtube.com/watch?v=g_bkWS6Wkv8

After back home I made these photos to document the exact positions of Pi Zero (I use that position for trimming) and the fixed mount of camera for the shown very high flight:
Image

Image

Btw, I am really impressed on the ruggedized nature of raw Pi Zero and raw camera. When plane crashed vertically onto grass, the acceleration makes the Pi Zero move into direction of ground, and camera ribbon cable gets dissengaged from Pi Zero. The camera connector is so easy to refill with ribbon cable that it is no problem outdoor.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Tue Aug 08, 2017 10:21 pm

Search&Rescue:

OK, now we come to the part mentioned in first posting of this thread. I did not have time to go home and look into the taken airplane videos, when someone spoke to me and told me about his drone flyaway, and that he informed policy on that, and whether I may have seen it. I had not seen it, but told him that I lost my 1st airplane two weeks ago and, and that the airplane videos should help me to find it. His response surprised me, he said "your airplane is on top of a high tree" and then showed me.

At home I used my video material to "find" the airplane that way. And the airplane was so easy to find, see this video with timestamp. Lost airplane enters video from top right, and leaves at bottom middle, can be seen easily because its yellow:
https://www.youtube.com/watch?v=bo0iMjM ... tu.be&t=52
Image

That was the "Search" part, now comes the "Rescue" part. The airplane is really difficult to see in this 12M photo of high tree with smartphone camera of my son, you have to zoom in to find it (you can see the back rudder):
Image

We brought a 7m long ladder to the tree, my son climbed it and I secured the ladder. Then I gave him the 4m long stick, and that was absolutely needed to kick the airplane out of the tree:
Image

Back at home this photo shows both planes together:
Image

The 600mAh lipo showed a voltage of 0.82V, not good. But I was able to load it to 4.2V.


So now that the planned tasks are completed, next steps are to find out how long the Pi Zero W Wifi range with direct sight is. I have one on one of my robots, but need it there. That is the reason I ordered a new Pi Zero W yesterday. If direct sight Pi Zero W Wifi range will be more than 20m, next project will be FPV airplane control via gstreamer pipeline from Pi Zero W to lapop on ground (with camera pointing to front and not to ground).

Hermann.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Wed Aug 09, 2017 7:36 am

I forgot one important point on the value of the seven 25fps full HD videos uploaded to youtube. I used "raspivid" to record the videos (see "camfly" script in thread above), and that stores ".h264" format files. While these have no format information, although youtube complains on that, it uploads without issues. And youtube default framerate is 25 frames per second, which matches my videos. But looking the videos shows sometimes quick moves of the view. Many of you will know, but for those that do not, youtube allows single-frame-stepping back and fore!
  • stop youtube play
  • press '.' to display next frame of video
  • press ',' to display previous frame of video
Only with this single frame stepping you can watch the details, you may try with the overflight of tree where 1st airplane got found:
https://www.youtube.com/watch?v=bo0iMjM ... tu.be&t=52

Btw, depending on flight height, the movement between successive frames in video is some centimeters, or meters (in any direction because of wind and/or curve flying). But it is always only a few pixels. I really like 90fps raspivid videos for high speed stuff (like counting frames per round of my circular robot moving with 18.9m/s or 68km/h). But these flight videos taken with 25fps -- and single frame stepping youtube videos -- show that 25fps gives a wealth of information as well !

Hermann.

P.S:
Single frame stepping youtube video I found a frame taken during a steep curve flight showing Neckar valley and Eberbach more than 100 height meters below airplane:
Image
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

tvjon
Posts: 624
Joined: Mon Jan 07, 2013 9:11 am

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Wed Aug 09, 2017 9:06 am

Excellent write up Hermann, & very entertaining too! :-)

Now to go & watch your videos...

ElEscalador
Posts: 589
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Wed Aug 09, 2017 12:23 pm

Well that's fun!
A few of my projects below.

https://www.youtube.com/playlist?list=PLdlhFMXxFUNlMpeqHipdSIO20pb4piHfj

User avatar
bitbank
Posts: 246
Joined: Sat Nov 07, 2015 8:01 am
Location: Sarasota, Florida
Contact: Website

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Wed Aug 09, 2017 12:43 pm

Very creative and thanks for sharing the link to the plane. It would be fun to also hack the remote control receiver to control it from the RPi0. Perhaps even create an automated flight path using a GPS+compass. Lots of possibilities for fun projects. How about adding a BME280 to measure the temp/humidity/pressure at different altitudes? Need to find a longer range transmitter to get to greater heights.
The fastest code is none at all :)

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Wed Aug 09, 2017 1:39 pm

bitbank wrote:
Wed Aug 09, 2017 12:43 pm
It would be fun to also hack the remote control receiver to control it from the RPi0.
Definitely!
Perhaps even create an automated flight path using a GPS+compass. Lots of possibilities for fun projects. How about adding a BME280 to measure the temp/humidity/pressure at different altitudes? Need to find a longer range transmitter to get to greater heights.
These are fun projects, but I fear that even adding a small pressure sensor may be a problem for that airplane model. 38.3g weight seems to be at least very near to maximal weight for airplane being able to fly. But you can reduce weight by removing ribbon cable and camera (2-3g) for adding other stuff.

I had similar idea, make Pi Zero hack the "remote receiver+motor controller" board to fly automatically. Without new sensors I wanted to use the sensor I aleady have on board, the camera. Directed to front it maybe could "follow" a 1st, manually controlled airplane. The code I would use for that would be raspiraw, which allows to directly work with raw bayer data received from camera. I just posted a question wrt "yellow" detection here:
viewtopic.php?f=43&t=189661#p1196510

P.S:
A 6 axis gyrometer with header does weigh 1.2g, a 9 axis gyrometer with header does weigh 1.9g.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Wed Aug 09, 2017 11:35 pm

I did a high flight in twilight, until lipo was empty. This took more than 7 minutes, and was first high flight where videos were taken with 300s (full HD, 25fps, 1ms shutter time).

The short shutter time resulted in "black" frames, where only sometimes a white dot appeared. That was me with white T-shirt:
Image

I learned several methods on how to make a video brighter with ffmpeg. For most I did not have the filter needed installed. This was the command I used to increase brightness by factor of 8:

Code: Select all

ffmpeg -i inp.h264 -vf "split [main][tmp]; [tmp] lutyuv="y=val*8" [tmp2]; [main][tmp2] overlay" outp8.h264 
Image

That gave much more details, and showed the footpaths and other details. The 2nd video was terminated by lipo power exhausted, and the last seconds have not been written to SD card. I concatenated both videos, after 5min there is a short 3s gap where the last blocks from 1st video were synced to SD card.:

Code: Select all

ffmpeg -i 'concat:outp8.h264|outp8b.h264' -codec copy outpAll.h264
Here is the 6:58min video, don't forget to select 1080p in youtube:
https://www.youtube.com/watch?v=eVUE3xc ... e=youtu.be

What I find remarkable is that it is the normal v1 camera, not the NoIR camera. Many details are hidden in black, which can be unveiled by increasing brightness. Of course this video does not look as nice as those taken with daylight/sunlight.

Hermann.

P.S:
I tested the 1st, rescued airplane with a 10.2g 380mAh lipo instead of the 600mAh lipo, total airplane weight 30.1g. Had a 23min continuous flight with that.

Later I did put remote controller on our window board, started the motors and then went with only airplane outdoor to measure control distance. I was able to go near to creek with motors still running, a few steps further motors stopped, going quickly back motors started again. Theer are some small trees and garages near plain sight connection between controller and airplane, so the real controller distance may be even larger than 142m.That is definitely more than the 80m mentioned on airplane packing:
Image
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

cpunk
Posts: 80
Joined: Thu Jun 29, 2017 12:39 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Thu Aug 10, 2017 12:50 pm

Quite impressive for such a small plane. :) I'm used to them blowing away with wind. :D

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Thu Aug 10, 2017 8:04 pm

I'm used to them blowing away with wind.
I would have expected this for heavy wind myself. As I said I just recently learned to fly at all, never did before. In learning I tried to push the limits, fly with quite some raining, flying despite heavy wind. It seems that the motors are correctly sized, maybe even a bit oversized. If I move the Raspberry Pi into a little bit too wide back position, making the airplain rear-heavy, the motors allow to go nearly vertically into the sky, before falling off a side. They are just not powerful enough to complete a full looping. Three weeks ago I ordered a pair of spare motors for 1.39$, just in case. I had no problems with the motors I have in both planes, though.

Today I wanted to temporarily use the airplane camera for a side project:
viewtopic.php?f=43&t=189661&p=1197130#p1197130
Sadly "vcgencmd get_camera" always said not detected. I tried different ribbon cables at the other Pi Zero W, no luck. Them I used the camera sitting on top of motor test station for the side project. Finally I reconnected the camera back to airplane and tried there -- not detected :-( I was sure that ribbon cable was connected good, at camera module and at Pi Zero sitting on top of airplane. I looked around for another reason and saw the little connector cable from camera to camera board:
Image

I softly pressed on the connector and it made "click". Then I tested again, and now camera gets detected and works fine. The only explanation I have for this is that the very last flight yesterday evening, better its crash landing, was done with so much power, that it disconnected this little connector ;-)
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

cpunk
Posts: 80
Joined: Thu Jun 29, 2017 12:39 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Sun Aug 13, 2017 6:13 pm

The (fresh) water resistance of unprotected electronics is quite surprising sometimes (at low voltage?). :D

But salt water does things quickly. I have once landed a foam glider in sea, and within the 7 seconds it took me to disconnect power, the receiver and motor controller had already conducted a lot of electrolysis on themselves. :P

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Mon Aug 14, 2017 11:22 pm

The (fresh) water resistance of unprotected electronics is quite surprising sometimes (at low voltage?). :D
Yes, really.

Next step is to determine altitude by BMP180 pressure sensor connected to the Pi Zero on RC airplane.

Writing to SD card only helps after the flight. Last week I ordered a new Pi Zero W which will replace Pi Zero on airplane. It will act as "flying wireless access point" and provide webserver with altitude information.

On weekend I received new Lolin (Arduino) ESP32 with OLED. Plan is to power from wireless airplane remote control and act as airplane altimeter on ground, connecting to flying access point, querying altitude and displaying that:
https://www.youtube.com/watch?v=CcYm_lZPtZk
Image

Will be interesting how high WLAN connection will work, at least direct sight is given.

Hermann.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Tue Aug 22, 2017 7:45 pm

While I am still waiting for new ThePiHut Pi Zero W for ground altimeter flights, I received new Pimoroni Pi Zero as well as 6$ China Raspberry v1 camera and Pi Zero camera ribbon cable. So I mounted all that on 1st RC airplane rescued from 9m high tree. Camera looks not straight forward, but even a bit up:
Image

Should have looked a bit down instead as can be seen in 1st FPV (First Person View) video from RC airplane, if too much sky is in view, the remainder of the frame gets dark. This is intensified by the fact that the video was taken just before twilight, will be better during day:
https://www.youtube.com/watch?v=E9azzhr ... e=youtu.be

Here you can see nice view over district Neckarwimmersbach of city Eberbach, without the need of a steep curve as with camera mounted below airplane before:
Image

Here just before controlled (crash) landing in front of me after 3:25min, camera first into grass:
Image

I have already taken corrective actions wrt camera view, now it looks quite a bit down:
Image

Have to wait for daylight tomorrow to see the effect. Btw, because the camera is screwed into the spread foam parts of the plane, there is no room for lipo inside the plane front. I just tried to fixated it under rubber outside of left cockpit windowand it worked perfectly. Just had to trim the remote control a bit because the airplane had a tendency to turn left without.

Hermann.

P.S:
downtown Eberbach and district Neckarwimmersbach, every 5th frame of video as animated .gif.
Open in separate window for clear full HD view:
Image
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Wed Aug 23, 2017 9:09 pm

Today RC airplane flew at daylight, and that gives much better video compared to 1st FPV video yesterday. And the camera looking slightly down and not just only forward was a very good decision. 6:17min flight time until landing near me because 160mAh lipo did not have enough power anymore (it drives the airplane motors, 2.4GHz remote control as well as Pi Zero and v1 camera). Surprisingly the camera produces viewable frames even when airplance directly flew into the sun:
https://www.youtube.com/watch?v=kSiMpgW0p9o
Image

Still waiting for ground altimeter, with that I will be able to let RC airplane climb higher and look over the surrounding hills.

The airplane was a bit rear heavy during the flight, that is responsible for some shaky flight moves, especially goin into steep climb after some steep decrease.

Hermann.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Sun Aug 27, 2017 5:36 pm

After I received a new Pi Zero W I worked on the ground altimeter described above.

Yesterday I achieved 55m inhouse 38/70 link quality between Lolin ESP32 programmed via Arduino IDE and Pi Zero W. Instead of transmitting continuously the altimeter information, I did transmit link quality information (Pi Zero W "iwconfig wlan0 | grep Link") to ESP32 OLED. I tried to make Pi Zero W an access point and followed these instructions, but it did not work. Then I just let ESP32 be the AP (only one line of code needed for that!), find Pi and Arduino code and details here:
https://forum.arduino.cc/index.php?topi ... msg3391465
Image

I could achieve 55m inhouse distance on a very long floor in youth hostel of Friedrichshafen/Germany at Lake Constance. In Friedrichshafen the famous Zeppelin airships were built. Today I found and bought a solar airship there:
Image

Plan is to use this as platform alternate to the RC airplane for carrying Pi Zero W with camera, BMP180 pressure sensor, accelerometer, probably GPS, ... The airship dimension (3m × 1m !) hopefully allow for more payload than the 23g RC airplane ;-)

In Germany flying above 100m altitude is not allowed in general, but you are allowed to do so on model aircraft airfields. In case airship will fly higher than wireless range of ESP32/Pi Zero W, maybe 2 cables of lightweight copper wire to the airship will allow for two-wire protocol communication.

Next step for altimeter is just to get BMP180 run with Pi Zero W, it works with Arduino Uno already.

Hermann.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

cpunk
Posts: 80
Joined: Thu Jun 29, 2017 12:39 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Tue Aug 29, 2017 11:06 am

The lift of that thing in case of helium: approximately 1 g / L (or alternatively, kg / m3). With hot air, about 10 times less, maybe 0.1, as hot air is comparatively dense, not much lighter than ordinary air.

As for volume, if we assume it's a cylinder, then volume = base area * height.

Base area would be Pi * radius * radius = 3.14 * 0.5 m * 0.5 m = 3.14 * 0.25 = 0.785 m2. So each meter of the "sausage" would have a volume of 0.785 cubic meters.

Now, if it were an ideal cylinder then volume would then be 3 * 0.785 = 2.355 m3.

I would speculate that its total lift (including its own mass) would then be about 2.3 kilos with helium or 230 grams with hot air. :) But beware, helium is expensive and hydrogen ignites in a wide range of mixing ratios. I flew an airship in last year's robotics competition and since we were prohibited from using combustible gases, I used helium and paid a pretty large penny (140 euros :P) for mere gas. :P Maneuvering was awful. :P It really turned like a ship: had to start vectoring its engines for a turn about 5 seconds before the point when a response was needed. :D That's why I'm building a heavier-than-air drone this year.

However, for passive applications (e.g. just let it up and drag it down with thin fishing line), an airship sounds neat. :) And an airship without expensive or explosive gases sounds practical too. :)

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Wed Aug 30, 2017 10:33 pm

Thanks for the calculations, and your remarks to helium prices are valid.

I did plan to use hot air, and 230g would be really cool since with RC airplane the 15g added load (Pi Zero, camera, ribbon cable, rubbers, ...) to base airplane 23g seem to be near limit.

Back to working WiFi distance for ground altimeter, today I found that even 170m inhouse do not introduce any connectivity issues between ESP32 and Pi ZeroW!!
http://forum.arduino.cc/index.php?topic ... msg3395504
Image

This should allow for really good outdoor OLED altimeter connectivity to flying barometric pressure sensor given that in Germany flying above 100m height is forbidden normally.

Hermann
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Thu May 24, 2018 5:41 pm

I came back to the RC airplane and wanted to know the real maximal rotations per minute (rpm) of a propeller. I thought that this could be done with Raspberry v2 camera by recent improvements (640x480 up to 200fps with raspivid, 640x75 at 1007fps with raspiraw).

I started with two arms of Realacc Four Arms Aluminum Alloy soldering station holding RC airplane tight, one arm holding v2 camera and last arm holding 5000lm light:
Image


I started with a 180fps raspiraw video and "-t 0" for HDMI monitor preview to setup scene with 1000lm light:
Image


This was only useful for scene setup (manipulation of Realacc arms), the 1000/180=5.55ms per frame show nothing for the propeller. At least the video shows that while the pitch elevator goes up and down by propeller wind, the motor keeps absolutely stable in place.
https://www.youtube.com/watch?v=qwFlukz ... e=youtu.be


Next I reduced shutter time, and things became better. But going below 1000μs resulted in really dark videos. So I switched to 5000lm light and things got better. But even with 500μs the propeller did not show nice. So I ended up with 200μs(!) shutter time. This are four consecutive frames. Unlike it seems the propeller rotation is clockwise seen from camera:
Image


Image


Image


Image


The 1st and 4th look very similar, but I was sceptical that only 180fps video would be able to detect RC airplane motor rpm. Here is the video taken, you can stop it and single frame step fore/back with "."/"," keys to inspect some really strange rolling shutter effect frames: https://www.youtube.com/watch?v=uR0YZy3 ... e=youtu.be
Video was taken with this command:

Code: Select all

[email protected]:~ $ raspivid -md 7 -w 640 -h 480 -p 706,20,640,480 -fps 180 -ss 200 -pts test.200.pts -t 2000 -o test.200.h264
[email protected]:~ $

Next I switched to using raspiraw, with 640x75 tool capturing with 1007fps. This animated .gif of some frames plays at 1fps for easy inspection (propeller turns clockwise):
Image


I could not make much with that video because both propeller halfes look identical. So I fixated a very small white adhesive label on one near the center. Animated .gif is again played at 1fps:
https://www.youtube.com/watch?v=uhb2TFND9A8
Image


So here after 3 frames the "same" scene appears again. I wanted to be sure and used 640x150_s tool that records every other line/column only and therefore captures with 1007fps as well. Because of the different "capturing position/time after framestart" pair this video is much better to see that indeed the propeller moves 1/3rd of a round per frame (coarser in both directions, but the 640x150 frame shown correctly represents the 640x150 from camera fov covered):
Image


So now we can do the math and see more than 20,000rpm for the propeller:

Code: Select all

$ bc -ql
1007/3
335.66666666666666666666
1007/3*60
20139.99999999999999999960

P.S:
Just in case my interpretation is wrong and the propeller does not 1/3rd of a round per frame, but 4/3rd, then propeller rpm would be 80,000
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Sun Jun 10, 2018 5:48 pm

Last year I did a successful search&rescue mission where I found one of my two RC airplanes first via Raspberry Pi camera below second RC airplane and taking flight videos. Finally I was able to complete the rescue part as well with the help of my son, a 7m ladder and a 4m long stick. This was the part of overflight video frame that showed exactly the airplane in the middle (from ground only back rudder was visible, and only if knowing where to look):
Image


Today I wanted to try out the RC aiplanes again, had 6 fully loaded 150mAh lipos with me and weather was fine (sunny, 28°C in shadow).

The first airplane I tried (no Pi or camera on board this time) had incorrect weight distribution, always the nose went up, and it mainly tried to do right turns. Only if I gave "left" turn command long to airplane, it finally went straight and then did left turn. Unfortunately airplane flew higher and higher, and was in range of wood so that I did not want to let it go down uncontrolled. Finally I saw that it was likely to be at border between wood and fields and did a planned fall because the airplane was so far away that I sometimes could not even see it. Finally I heard "tak----tak-tak" and then nothing.

I took my backpack and went to where I suspected the airplane. I had no (GPS or other) sensor on airplane that would allow to locate it. But then I turned remote control on and off and walked around. After some time I could hear at least one airplane motor going on and off. That allowed me to isolate a bit by sound direction on which tree the airplane is to find.

I called my son because of his better eyes to identify the yellow airplane in the trees, but some leaves lighted by sun look yellow as well. So he was not able find the airplane, but we are pretty sure that it is on the "small" (15-20m height) tree in front, or the much higher trees above that (we walked in circle around those trees and the airplane motor sound direction made us think it is one of the three.

He took 12MP images from the three trees (in center), each of size 5MB. I have not found yellow (only 25x34cm small) airplane in below photos yet. In case your have better eyes or know how to search for it in the photos, any help is appreciated! I will go there again and try to do better audio location triangulation, but will look for updates here with my smartphone in case somebody finds airplane in the photos.

Photo 1:
Image


Photo 2a:
Image


Photo 2b:
Image


It is unclear wether a rescue will be possible if airplane landed very high, but first a successful search is needed ...
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Sun Jun 10, 2018 7:24 pm

I went to the three trees again, but this time the lipo in airplane seemed to be empty, remote control could not connect, no more audio from motors.

It started to rain, so I did a quick movie with the hope that moving images might disclose the yellow airplane location easier. It seems that this was right (not sure yet), 109MB .mp4 shows something that can be the airplane in seconds 40-45 of video, crossing center of frame from left to right:
https://stamm-wilbrandt.de/en/forum/VID ... 202909.mp4

If this is right, then airplane is not that high and should be rescuable.
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

HermannSW
Posts: 717
Joined: Fri Jul 22, 2016 9:09 pm

Re: Cheap RC airplane with "outboard" Pi Zero and camera

Thu Jun 21, 2018 6:53 pm

What I thought to be the plane was a red hering.

Good news:
I found the plane, and it was really one of the three trees I identified acoustically.

Bad news:
The plane landed at least 20m above ground, and in the only conifer amoung those three trees.


How did I find?
I did not want to repeat last search&rescue action, because bringing my 2nd RC airplane to fly again with Pi Zero and camera would have taken quite some time (like last year).

So I wanted to buy a cheap camera drone, which I did 8 days ago (29$, free shipping), arrived in two days last Friday:
https://www.amazon.de/gp/product/B06ZYSFZL3

Luckily that drone was very robust, it survived many crashes from 20-30m height into grass or even asphalt street! That drone stores the captured video/photo on SD card, like I did with RC airplane and Pi Zero with v1 camera.

Last Friday I had to learn how to fly first, did that just outside our garden above a meadow:
https://www.youtube.com/watch?v=VOkPvXm0ifg

Surprisingly good 1280x720 video at 30fps, only when going down (at least how I did that), video is too shaky.

Next day I did my first search flights in front of the three trees identified to have my plane. One crash into meadow that day ended with camera directed to sky and still capturing. I realized 4 insects flying across the scene at home, copied the 4 overflights together and created this 1fps animated .gif:
Image


I did more than 20 recording flights, mainly focusing on the smalller (<20m height) tree in foreground. Then I found the RC airplane in several videos that captured higher areas as well.
This is frame (yellow airplane top left) from a flight where camera drone landed in tree 10m above ground :-(
https://www.youtube.com/watch?v=bcSsYAwJoC4
Image

Luckily turning dorne motors on/off repeatedly made drone fall to ground, so not another loss.

Today I tried to find the RC airplane in the three 5MP photos I posted before, and now knowing where to search roughly (just above the smaller front tree) I found the RC airplane in all three photos! These parts from the three photos are scaled by factor 2:
Image

"gimp" color picker tool is helpful here, r,g,b values are yellow indeed:

Code: Select all

224,210,147
220,218,135
226,214,151
...
Here is bigger part from photo 1 showing yellow RC airplan at bottom center:
Image


Last Monday was super sale at banggood and I was totally surprised how cheap at least some FPV drones were. I did order an Eachine E52 with RTC remore control for 20$ with free shipping -- unbelievable. Reason for that was that getting back airplane is difficult. Since tree is a conifer, waiting for autumn does not help in getting airplane back. And the camera drone I have is no help on the rescue part of RC airplane search&rescue. Maybe E52 drone can do that, I have seen many videos where one FPV drone resued other lost drones from inaccessible places.


P.S:
I would not have bought the first 29$ camera drone only for RC airplane search&rescue. Just ordering another airplane for 20$ would have been cheaper. I have other plans with that drone (or the E52).

First flight time of the drones is 8-10min, and then an hour recharge is needed.
I will first try to eliminate that restriction inhouse.
Instead a lipo I will power the drone with two 0.2mm very thin cables from ground.
If that works, I will have unlimited flight time inhouse and in our garden (of course care has to be taken wrt the cables between drone and ground -- definitely no 360° flips).
[Drones can be powered wirelessly: https://www.youtube.com/watch?v=1_10oKH6z4A]

Next I will try to connect Raspberry Pi to a drone RC controller so that the Pi can control a drone. I already have twi PIs with cameras mounted orthogonal in my Motor Test Station (MTS):
Image

The two cameras should allow to exactly 3D locate drone in MTS. First program would be to keep drone flying in center, some cm above ground with PID control and the RTC drone controller. Headless mode should make that task much easier for the PI. Of course poking the drone with finger would be a test after that works ;-)

Later two cameras at room walls will allow for raspberry Pi controlling the drone flying through room, with 5m long cables even the highest point 4.3m above floor should be reachable for the drone.

All that depends on whether Pi can control drone RTC ...
--> Raspberry camera / gstreamer / raspivid / raspiraw (bookmark list):
https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/fork-raspiraw      https://github.com/Hermann-SW/userland      https://twitter.com/HermannSW

Return to “Camera board”

Who is online

Users browsing this forum: No registered users and 14 guests