In my last post I talked about using the si4463 chip to send video, telemetry and RC data to the quadcopter. I calculated the bandwidth and it seemed that 500kbps video with 5/7 FEC coding should be possible.
I wrote the code, linked everything together and it kind of worked. The video was stable, not many packets lost but the latency was pretty bad. It got up to ~200ms from the current 100-130ms but worse than this, the video was very choppy. I managed to narrow it down to the H264 codec in the raspberry pi: the bitrate you configure in the codec is an average bitrate, per second. Each frame can vary a lot in size as long as the average is preserved (with some allowed over and undershoot). I got I-frames of 12-16KB and P-frames of 400-500 bytes (at 30 FPS). The I-frames took way longer to send than the P-frames and this resulted in a choppy video. I tried to play around with settings – like disabling CABAC and activating CBR but nothing made the bitstream uniform enough.
The final, biggest problem was actually caused by the RF4463F30 module – and it’s the same problem I had months ago when I tried to use them: they introduce a LOT of noise in the power line, enough to cause all the I2C chips on the quad to fail.
I tried all kinds of capacitors to decouple the module and reduced the noise a lot but there seem to always be some capacitive/inductive coupled noise persisting.
In the end I just gave up and went back to the RFM22B chip which just works. For video I went back to the monitor mode/injection system but did change the modulation to CCK, 5.5Mb to hopefully reduce the possibility of interference with other 2.4Ghz RC systems. CCK is spread spectrum similar to DSSS and should be able to coexist with RC systems around.
So yeah, FPV through a very constrained channel with a temperamental H264 encoder and a very temperamental transceiver module is not fun…
It’s been a while since my last post and that’s not because I abandoned silkopter, but because I’ve been very busy working on it.
During my latest test 3 weeks ago I noticed that the video link is not as stable as I wanted. I’m using a system similar to wifibroadcast – wifi cards in monitor mode doing packet injection. They are working on 2.4Ghz and the area where I’m flying seems to have this band a bit crowded, causing the video link to be glitchy.
On the other hand my 433Mhz RC link has been pretty solid. So inspired by this I started thinking if I could do the same thing: send video through my RC link.
I already had the RF4463F30 transceivers which are using the si4463 chip and I knew them well (and hated them a lot) so I thought to give it a try.
Now – the max bandwidth the si4463 supports is limited to 1mbps which might seem like enough for 640×480 resolution but there is a lot of overhead that effectively limit this to around 755kbps. Since I want some FEC – say 5/7 coding – I end up with 500kbps target video bitrate.
I made an xls to ease the calculations. It allows me to specify the air bitrate, packet sizes, packet overhead, video bitrate, fps, preamble/sync sized, header sizes etc and calculates all kind of nice info, including if the link is viable or not.
Here is a screenshot with my current calculations:
For the video link, 500kbps seems like enough as there’s not a lot of movement in a quad, specially with a gimbal. To further improve quality and decrease latency I’m experimenting with the x264 software compressor library instead of the GPU compressor in the PI. It seems to be able to compress real-time a 640×480 video with good quality, zero latency setting and 2 cores only.
I still have to compare the quality between the 2 (GPU and x264) though.
Here’s the case after my best attempt:
It looks… bad. The paint coat is horrible and full of scratches and the screen is too big.
But worst of all, the screen is not bright enough in direct sunlight. Not even close. I don’t have a photo but after brief testing I’d say it’s unusable.
So I’m pretty disappointing with the result – I ended up with a big, heavy RC system that is too dim to be usable for FPV.
I searched for a week for alternative capacitive touch screens, preferable in the 5-7 inches range but found nothing bright enough under 100 euros.
So after a mild diy depression I got an idea that will solve at lease 3 of the issues – cost, bright screen and the RC size: use my Galaxy Note4 phone as the screen.
The setup will look like this:
- The quad will send video through 2.4Ghz, packet injection (a.k.a. wifibroadcast method) and RC stream through 433Mhz
- The RC will receive both video and RC data and relay them to the phone using another 5.8Ghz wifi UDP connection. The phone will decompress the H264 video using OMX (or whatever is available) and display it with telemetry on top.
- The phone will also act like a touchscreen interface to control the RC/Quad
Basically this is what most commercial quads (like Mavic) are doing. I’m sure the video link is 2.4GHz due to longer range than 5.8 and better penetration and the connection with the phone is done over a 5.8, low power link.
So the next steps are:
- Redesign a smaller case that will accomodate a Raspberry Pi 3, the RC stick and fader + buttons and wifi cards
- Write a quick android application that can connect to the RC and decompress the video stream
After the latest incident and the loss of my quad it became clear that I need reliability. So far I focused on physical reliability – if the quad is sturdy enough to take a light crash, if it’s well balanced, etc. But I kind of ignored the other 2 aspects – software and comms. Well – not ignored, more like I hoped for the best.
So the next issues to fix are:
- Solid comms for the commands (RC) and telemetry. The RFM22B is the perfect candidate for this:
- It’s lightweight and small.
- Very sensitive receiver (-104dbm @125Kbps)
- Powerful TX amp @20dbm
- 64byte FIFO so I can drive it directly from the raspberry pi
- SPI interface, which the RPI has enough
- Good penetration due to the low frequency (433Mhz)
With this setup I should have 5-10Km range, way more than the WIFI video like allows.
The issue will be the comms protocol as the device is half-duplex and the bandwidth is not that much. I made a quick calculation and it should take around 5ms to send an entire 64byte message. With a simple protocol where the GS is the master and the quad the slave, I can allocate 5ms slots to each in turn. This will give me a symmetric 7Kbyte bandwidth, -protocol losses lets say a 5Kbyte bandwidth per second. Should be enough for control and telemetry data.
2. Solid software, especially the GS. I intend to get a RPI3 and display and build a dedicated GS to replace my laptop. For now I will keep my PS4 controller but in the future I will aim to build an entire RC system with integrated touchscreen around the RPI.
I want to run the RPI without an X server and for this I will need a QT version that supports this. Don’t know if it’s possible though.
If this fails, I’ll stop using QT and do all the rendering and UI using something else but this will be quite painful… I’m used to QT and despite all it’s quirks it’s very powerful when doing quick UI work.
What I do know that works in the current setup is:
- The RPI2 is powerful enough to handle a quad with WIFI video streaming. It was using ~16-20% CPU at any moment with around 5 threads so no issues here
- The case I designed is very sturdy. It’s a combination of 10mm carbon fiber tubes for the arms and ABS plastic for everything else.
- Flight time with the current weight of 650grams is around 20-25 min with a 3000mAh multistar LiHV battery. Enough time to enjoy the landscape
- The motors + ESC pair are a nice match. RcTimer 1806 1450Kv and RTFQ 4-in-1 12A ESC seem to handle the load nicely. A bit underpowered due to the props – 7×2.4inches but I plan to move to 8×4.5 for the next quad.
So back to the drawing board for a while.
I took the quad for a spin yesterday and figured out 4 things:
- It flew, quite good. Very stable, video quality was good and the signal was very strong even 4-500 meters away
- I crashed a few times. See video here: https://www.youtube.com/watch?v=AjwiUQltHaE&feature=youtu.be
- Flight time was around 20-25 min with a 3000mAh Multistar LiHV battery. Average amps for hover was around 6-7 which is great. AUW around 630g
- Eventually it flew away in a near-by forest and I couldn’t find it. The reason was a sudden loss of signal which triggered the fail safe routine. The quad started climbing to 50m, went home and then dropped to 5m. Problem was that ‘home’ was a few hundred meters into the near-by forest due GPS interference from the camera….
So it’s gone, have to build another one.
The lesson here is that I have some software issues to iron out and that I really need another signal path for the control. I plan to use a rfm22b for this.
The material loss is not that huge – a raspberry pi, 4 rctimer 1806 motors, a brand new battery and a Navio board. A total of 250 euros plus about 2 weeks of work to print all the pieces, etc.
So the next one will need to fix these issues:
- Rock solid RC link for control
- Solid software without glitches. My GS crashed once in mid-flight (see video) due to the h264 decoder
- More portable GS. A laptop with 2 wifi cards, a ps4 controller and many wires is not a fun way to go to the field and fly
- The raspicam interferes with the GPSsomething fierce. Even after copper shielding the H Acc went from 2m to 50m after starting the camera…