Extending Raspberry Pi WiFi

Hey all.
I have a couple of projects that I have been working on for quite a while in the automated camera and slider/dolly area.
These use Raspberry Pi at the core for all the heavy lifting, but control of everything is done over WiFi from your phone or tablet etc.

The nature of the time-lapse photography that I do usually ends up with me setting up the camera dolly in a remote location and leaving it running for 24 hours or more.
All good, works great, like this:

The issue that I have is that the internal WiFi on the Pi really only has a very limited range, and is especially limited if there is vegetation in the line of sight.

Ideally I would love to have some form of external antenna or some plug in repeater or similar that would give me much better connectivity, ie not having to walk into the shot to get close enough.

I have tried USB range extenders on separate power banks judiciously placed to get me some longer range, but they can be fiddly and you then have to power them to the same time as your timelapse.
A solution that could run off the main battery for the pi would be ideal, as would having it close to the main set of gear a to not have to go looking for where you put the repeater when you pack up.

So, any feasible ideas?

4 Likes

Hi Andrew
A bit of a dilemma here. I think the WiFi transmitter power would be limited by law as it is a universally used unlicensed system. Directional antennas or an omni directional one with a bit of gain may help but there is a very good chance of losing all or more of the gain in the cable unless it is kept very short.

WiFi “extenders” for the home are available but usually plug in to an available power point so being 240VAC operated would not be much use. I am not sure how they work but physics says they would have to change frequency. If you don’t, any amplification has to be less than the “front to back ratio” of the antennas otherwise you will get “sing around” and have a very good 2.4G oscillator. You also need directional antennas and with the gain limitation you don’t get much of a result. Reason being that once you re transmit the “free path attenuation” starts all over again and at microwave frequencies most of the signal is gone in the first 400M or so.

Bit of head scratching required.
Cheers Bob

2 Likes

Thanks Bob.
400m would be the dream solution, to be honest I’d probably be happy with 100m.
The last sequence I shot I needed to be at 10m to get signal.

1 Like

Hi Andrew,

That timelapse is looking great, you must have your camera rig well dialed in.

At the risk of stating the obvious, I’m assuming you’re using the 2.4GHz instead of the 5GHz band of WiFi which will usually have a greater range, though still not amazing with the Pis built-in antenna.

I think Bob’s suggestions of small directional antennae may be the best of what can be achieved on battery power while still using WiFi.
If the range you’re after can’t be done due to the power limits of the band it might be worth considering a lower frequency radio link to bridge the distance. Though it will add complexity using an RFM69/95/96 LoRa or packet radio down in the MHz ISM band should be able to get a range in the hundred of meters easily, you will just need a device to take the SPI module and translate back to WiFi. Which might be doable with a Pico W, I’d need to look into it further.

2 Likes

What a fantastic capture!

Maybe a USB WiFi device with an SMA connector, that you could hook up to this?

https://www.kogan.com/au/buy/zakarriey-rp-sma-24ghz-25dbi-directional-outdoor-wireless-yagi-antenna-wifi-for-router-zxzlrfo53nf5/

It might have some questionable ACMA compliance @25dBi, and you could run into issues with gain matching. But at that price point … and the types of terrain it is being used … could be worth a shot.

This may lead to different configs depending on the range setup: eg close range this antenna will likely saturate signals and not be useful (so use the built-in antenna instead).

3 Likes

Thanks Trent, yes the managed exposure is working exceptionally well now, considering that went from super bright sunlight to darkest of dark night, then the moon rise, then back to super bright light. Im very happy with that.

Not so chuffed in having to keep walking up the bloody hill to check on it :wink:

So LoRa I have played with before, but isnt a good fit for this use case, unfortunately, as I need to transmit way way too much data to make it usable. ie preview images and video.
Thats the secret sauce to the camera time-lapse rig, I can preview what the time-lapse is looking like, in real time as it is still shooting. Makes it exceptionally easy to use.

I think that I will look for a USB WiFi with antenna as @Gramo suggest below.

3 Likes

Thanks!

I’ll take another look at the USB WiFi solutions, and a yagi would certainly look the part, but that does kinda limit to pretty directional access.
You are right though, at that price it’s worth a try.

Thanks!

1 Like

Hi Andrew
I didn’t say this was going to work at 400M. I just pointed out that due to the logarithmic nature of the beast at microwave frequencies most of the attenuation (dbs) happens in the first 400M. With point to point microwave systems a lot of this is compensated for with the higher antenna gains (parabolic dishes) achievable at these higher frequencies.
Cheers Bob

2 Likes

Hi Andrew,

Agreed for your high datarate requirements like previewing images and video you’ll need to stick with WiFi. @Gramo seems to have found the most likely candidate there.

LoRa won’t be useful beyond monitoring battery levels or similar low-data applications.

2 Likes

Hi Andrew

Yes you are limited to using while within the Yagi beam. BUT that is the trade off for gain. The “gain” is obtained by directing the available energy into a narrow beam both horizontally and vertically thus achieving an apparent “gain”. You will get very little signal “off beam” which with a claimed 25db gain will be pretty narrow. Unfortunately this is a classic case of having a cake and eating it, you can’t do both at once.
A vertical whip type antenna achieves some “gain” by restricting vertical power and re directing it downwards to assist the power transmitted horizontally.
Incidentally all antennas reciprocate and behave exactly the same in the receive function.
Bit of trivia.
Cheers Bob
PS: Just found my microwave slide rule. 25db gain @2.4GHz is equivalent to a parabolic dish of approx 1M which has a half power (-3db) beam width of 9.5º. The Yagi won’t be far off this and might give you some idea of what to expect.

4 Likes

I have found the following that is supposedly an out of the box add on for Raspberry Pi.

Ill do some testing and report back.

2 Likes

Hi Andrew
That 5db gain antenna would be a big improvement on the little PCB antenna probably on your present set up for a start.
Cheers Bob

That’s what I am hoping. I should have one by the end of the week, so I will test over the weekend and update this thread.
It is more than I wanted to spend, but if I can buy something and plug it in and have it work as I need it, then it is worth it to stop any mucking around.

1 Like

Hi Andrew
That antenna is also omni directional so solves the problem of getting into some sort of beam. I am assuming that your control end is somewhat mobile.
The antenna situation is the same at the other end too. I assume your kit would have the little PCB antenna. A similar improvement could be made if you could use the same sort of whip somehow with little or no cable.
Cheers Bob

1 Like

Hi Bob,

the Pi end has been the internal antenna, the remote end is either a phone, tablet or laptop, that connects to the pi in AP mode.

Hi Andrew
I take it then that the Pi end is at, and controlling the camera and it is this end that is going to use your linked device with the whip.
As antenna characteristics could not care less whether they TX or RX and performance is the same for both, putting the whip at either end has got to have the same level of improvement. Both ends would probably be better if possible but what you intend to do might be enough to be workable.
Cheers Bob

1 Like

Yep, Ill give it a go, it has to be big improvement.

Hi Andrew
Nice time lapse sequence!

A few thoughts on your WiFi connection problem…

One of the problems with the RPi WiFi sub-system is that the antenna is embedded in the PCB, and while the actual antenna design is pretty clever, the overall performance is generally quite constrained by the location of the device and the presence of surrounding materials that absorb and reflect the signal.

Typical WiFi “stick” antennas offer gains of a few dB, but the placement of the antenna can easily affect the end to end signal path by several 10s of dBs.

A general rule of thumb for maximising WiFi range is to place the antennas as high as possible above the ground (at least 2-3 metres), and try to get a clear line of sight between the WiFi stations.
This is due, at least in part, to the Fresnel Zone effect:
https://www.digitalairwireless.com/articles/blog/fresnel-zones-what-are-they-and-why-are-they-so-important

For a simple vertical ‘stick’ antenna, the signal is radiated in a pattern that is strongest in the horizontal direction. Plotted in 3D, the signal strength looks like a doughnut shape around the antenna. As the antenna gain increases, the doughnut flattens out ie more signal is pushed horizontally, and less vertically.

It is relatively easy to get a working range of several hundred metres between standard WiFi devices with simple omni-directional “stick” antennas, as long as they are properly positioned with a reasonable line of sight.

For the RPi, it is generally not practical to fit an external antenna as such, so it is usually necessary to adopt an alternative approach which involves providing another WiFi device connected to the RPi using USB or Ethernet.

The Alfa USB WiFi adapter device that you mentioned should provide a good omni-directional signal from its 5dB antenna, and you can use several metres of USB extension cable to locate the antenna in the best possible position, without incurring any RF signal loss as you would with an antenna connected by RF coax cable.

One thing to note about using USB WiFi adapters with the RPi is that not all USB WiFi adapters will support AP mode on the RPi - some will only support Client mode.

A second issue is that the RPi needs to have the software driver for the particular WiFi chipset loaded. The standard RPi image has a range of drivers pre-installed for common chipsets, but I don’t know whether the MT7610 chipset used in that Alfa device is specifically supported by default in the RPi software.

However there are many low cost USB WiFi adapters that will work with the RPi, at least in Client mode.
This device is based on the MT7601 chipset, and works quite well, but only in Client mode on the RPi:
https://www.ebay.com.au/itm/195295928535

Another alternative is to connect a second WiFi device to the RPi by Ethernet. I have successfully used the GL-iNet travel routers for this purpose.

https://www.gl-inet.com/products/gl-ar300m/
https://www.gl-inet.com/products/microuter-n300/
https://www.gl-inet.com/products/gl-mt300n-v2/ 

The AR300M is available with external antennas, but even the devices with internal PCB antennas will work quite well when suitably positioned.

These devices are USB powered and use around 200mA of current, and so will run from a USB battery pack for many hours.
You can also use simple passive Power over Ethernet adapters to deliver power and data over the same Cat5 cable.
https://www.ebay.com.au/itm/275278064420

In this arrangement, the internal RPi WiFi is not used and can be disabled. The router device can be configured as either AP or Client, depending on how you want to connect the phone/tablet device at the other end.

In a simple set up, you can run the WiFi Router connected to the RPi as an AP, and have the phone/tablet connect to it as a WiFi client. The RPi and the phone will be assigned IP addresses by the router and so establish a network connection.
It is probably worthwhile setting up a static IP for the RPi so that you know its URL in advance.

Of course the WiFi performance of the phone/tablet is also constrained by its small internal WiFi antenna and the presence of nearby objects (such as a human hand wrapped around the phone).

One way to get around this problem is to provide a second WiFi Router.
In this scenario, you would run the WiFi Router connected to the RPi as a Client, and the second WiFi Router as an AP. The phone would connect to the AP, and thus get a network connection to the RPi via the WiFi Router Client device.

You can position the second WiFi Router so that it gets good signals from both the RPi end and from the phone end.

You can even use this arrangement to “see around corners”.
For example if you have a hill between the RPi and the phone/tablet, then you can position the AP WiFi router on top of the hill where both devices can see it, even though they can’t see each other.

As a last resort, you can change the radiation pattern of an omni-directional antenna by using a simple reflector to make it somewhat directional. This technique can typically add a few dB of signal strength.

https://electronicsdesk.com/corner-reflector.html
https://www.pcworld.idg.com.au/slideshow/261270/extend-your-wi-fi-range-parabolic-reflector/

I hope some of this might be helpful. Please post back and let us know how you go.

3 Likes

Wow @Terry199397 that was a fantastic post.
Thank you for taking the time to go to that much trouble!
Just to explain the architecture a bit more, the RPi has to run in AP more, so that rules out quite a few USB WiFi options.
You use a device to connect to the RPi as a hotspot and browse to the RPi webserver and have full control over the system, camera and 3 axis dolly from your phone etc.

In the early days of my camera dolly, when I was using a RPi 2 or 3 that didnt have in-built WiFi, I was using a USB dongle. We got far better range out if it.
Then when I started to go to place like the Warrumbungles for a week every year to shoot the Milky Way and multi day time-lapses, the distance issue started to bite.
The quick solve for that was to use a USB based repeater.
This worked well, but was another device to manage that you had to put a distance away from the RPi in order to stretch the distance. It was a PITA to do.

In the last couple of years, we put more and more processing internal to the RPi and moved to Pi4’s, now with inbuilt WiFi.
The WiFi dongle seemed redundant at this point, so we dropped it.
Of course, it took another trip, to Narrabri this time, to shake out that the WiFi distances were greatly reduced now.

The AWUS036ACHM will be here today, so I will give it a good look in over the next week or so and see what it can do for range.

I really like your idea of the Access point at the remote end though, I have a heap of old APs here, I can certainly give that a go.

2 Likes

Hi Andrew

Ah… I had assumed that the RPi AP was only used for communication with the phone, but if you are using it for other things then you can always leave it in place, and add another device just for doing the long range communications. Just need to juggle the networking and IP addresses so all the devices can communicate.

I am interested to hear how the AWUS036ACHM device goes.

4 Likes