Recent

Author Topic: Wifi signal strength test for ESP controllers + cantenna  (Read 790 times)

ccrause

  • Hero Member
  • *****
  • Posts: 997
Wifi signal strength test for ESP controllers + cantenna
« on: February 02, 2025, 06:54:06 pm »
This post is not primarily about Pascal, but hopefully will inspire some to combine Pascal, microcontrollers and a bit of DIY.

There are spots around my house that is not properly covered by my single wifi router (TP-Link TL-MR3420 v2 running OpenWrt). I thought it would be interesting to build a cantenna on the cheap to see how much one can improve wifi (2.4 GHz) signal. Doing it cheaply was my main motivation, so instead of the recommended 50 Ohm cable and SMA connectors, I settled for an RG6 TV cable with F-connectors.  The coaxial cable was connected to an ESP32-WROVER-IB board with a U.fl connector (connector stripped form an old DSL router) soldered to the end of the RG6 coaxial cable.  So pretty much not how it is supposed to be done... Attached a picture of the cantenna mounted (with sticky tape) to a tripod.

To record the wifi signal strength I wrote a simple Pascal program that connects to the router and send the RSSI value over serial every second.

For reference other boards with build-in antennas were also tested, see attachment Wifi signal tests.png.  In this test the cantenna signal was on average 8 dB stronger than the best board.  Surprisingly the humble ESP-01 came second out of the boards with onboard PCB antennas. Another interesting observation is that the bottom three boards all have their modules with PCB antenna mounted on top of another PCB that covers the bottom side of the antennas.

In general the best orientation for signal strength is when the copper tracing of the PCB antenna is facing the router.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8227
Re: Wifi signal strength test for ESP controllers + cantenna
« Reply #1 on: February 02, 2025, 09:16:08 pm »
Cantenna design can be very hit-and-miss.

A couple of years ago I needed something in a hurry, and knocked together an approximation based on two Tesco drinking chocolate cans sweated together and a probe made out of an SMA connector.

It's good enough to identify the access points at the airfield about 3/4 mile away.

Unfortunately I had to use the wrong gender of connector, which meant that even though apparently well-tuned (in defiance of the "standard" dimensions) I was potentially losing signal due to reflections at the adapter I had to use to connect to the Ralink Wi-Fireceiver.

Even more unfortunately, despite a significant amount of faffing around with a lathe, I've not yet been able to improve things.

See https://www.eevblog.com/forum/rf-microwave/cantenna-implementation-just-how-tricky-is-it/msg4903340/#msg4903340

Updated: in a slightly different context (ADS-B antenna for local rather than extreme-range coverage) I found xnec2c as shipped by Debian interesting. However I didn't get far enough into it to work out whether it could cope with a waveguide-to-probe transition.

There are of course two ways of looking at this: /either/ seek to analyze the performance of whatever materials are available, /or/ tool up with enough metalworking gear that you can fabricate waveguides and horns to precise dimensions.

MarkMLl
« Last Edit: February 02, 2025, 09:40:27 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

dbannon

  • Hero Member
  • *****
  • Posts: 3223
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Wifi signal strength test for ESP controllers + cantenna
« Reply #2 on: February 03, 2025, 03:12:33 am »
At these frequencies, antenna design is as much magic as science. But it is a space where size does matter.

I am interested in what chips you are targeting ?  I dipped my toes into the water early last year, then all I could buy was the ESP32-C3 and their RISC-V was a problem.

You seem to be using the (lot older) ESP-DOWD ? You have done some great work in that repo but does it translate to more available chips like ESP32-S2 and boards like  Wemos S2 Mini ESP32-S2 ?

(I have moved my work over to RasPi Zero, lot more power but easier. And an ADS1115 A/D walks all over that RasPi Pico.  But be fun to test the ESP model.)

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

ccrause

  • Hero Member
  • *****
  • Posts: 997
Re: Wifi signal strength test for ESP controllers + cantenna
« Reply #3 on: February 03, 2025, 06:11:41 am »
Cantenna design can be very hit-and-miss.

A couple of years ago I needed something in a hurry, and knocked together an approximation based on two Tesco drinking chocolate cans sweated together and a probe made out of an SMA connector.

It's good enough to identify the access points at the airfield about 3/4 mile away.

Unfortunately I had to use the wrong gender of connector, which meant that even though apparently well-tuned (in defiance of the "standard" dimensions) I was potentially losing signal due to reflections at the adapter I had to use to connect to the Ralink Wi-Fireceiver.

Even more unfortunately, despite a significant amount of faffing around with a lathe, I've not yet been able to improve things.

See https://www.eevblog.com/forum/rf-microwave/cantenna-implementation-just-how-tricky-is-it/msg4903340/#msg4903340
Interesting read, thanks.

Quote
Updated: in a slightly different context (ADS-B antenna for local rather than extreme-range coverage) I found xnec2c as shipped by Debian interesting. However I didn't get far enough into it to work out whether it could cope with a waveguide-to-probe transition.

There are of course two ways of looking at this: /either/ seek to analyze the performance of whatever materials are available, /or/ tool up with enough metalworking gear that you can fabricate waveguides and horns to precise dimensions.

MarkMLl

I've used xnec2 to analyse the dimensions of my can.  The gain seems to be reasonable, but VSWR is terrible (> 10).  Next test should probably be a throughput test.

Data rate is however not always important - I installed a pump controller at a friend's and wanted an http interface so that the status and history can be viewed over local wifi.  A standard ESP32 module could not connect to the local wifi due to poor signal, a similar cantenna (toilet brush holder) ensured a stable connection and access to the onboard web pages.

ccrause

  • Hero Member
  • *****
  • Posts: 997
Re: Wifi signal strength test for ESP controllers + cantenna
« Reply #4 on: February 03, 2025, 06:21:43 am »
At these frequencies, antenna design is as much magic as science. But it is a space where size does matter.

I am interested in what chips you are targeting ?  I dipped my toes into the water early last year, then all I could buy was the ESP32-C3 and their RISC-V was a problem.

You seem to be using the (lot older) ESP-DOWD ? You have done some great work in that repo but does it translate to more available chips like ESP32-S2 and boards like  Wemos S2 Mini ESP32-S2 ?

(I have moved my work over to RasPi Zero, lot more power but easier. And an ADS1115 A/D walks all over that RasPi Pico.  But be fun to test the ESP model.)

Davo
Michael Ring and I have tested building esp-idf for all controllers supported up to v5.1 (S2, S3, C2, C3, C6) I think and linking with FPC.  This works.  It does mean updating all Pascal bindings for new versions.  Espressif is rolling out new versions quite often, so keeping up with changes in bindings and testing it is very time consuming. Even now not all peripheral libraries have been translated even for esp-idf 4.3.  More manpower would help...

dbannon

  • Hero Member
  • *****
  • Posts: 3223
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Wifi signal strength test for ESP controllers + cantenna
« Reply #5 on: February 03, 2025, 09:09:30 am »
Yep, point taken.

From memory (I was distracted by some serious health issues and did not catch up again), the RISCV proved to be a problem with FPC. Maybe I am wrong ....

Anyway, how about a real Blue Sky suggestion ?  Google sponsors a project called PigWeed, https://opensource.googleblog.com/2024/08/introducing-pigweed-sdk.html

Intention is to deliver a middleware library API to 'lots' of controllers. Perhaps would we be better targeting their API that will change a lot less than the Espressif one. Rather sadly, the PigWeed project does, apparently target big team development, lot of emphasis on complicated tool chains. Swapping one complication for another ?  But they do have, now a large set of C++ libraries just waiting for wrappers, LLVM compiler ....

Lot of emphasis on RasPi Pico, not sure I'd use it again.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

MarkMLl

  • Hero Member
  • *****
  • Posts: 8227
Re: Wifi signal strength test for ESP controllers + cantenna
« Reply #6 on: February 03, 2025, 09:45:36 am »
I've used xnec2 to analyse the dimensions of my can.  The gain seems to be reasonable, but VSWR is terrible (> 10).  Next test should probably be a throughput test.

A couple more thoughts that have been knocking around.

The point of my question to EevBlog was the properties of the material out of which the waveguide was fabricated. In particular I was concerned about how good any joints had to be (getting a good join on stainless might need TIG), but also you need to consider the tradeoff between conductivity and price: copper conducts well but is easy to soft-solder, mild steel doesn't conduct as well but is much cheaper so can be made thicker (at the expense of more difficult joining, and potential problems with skin effects, but more robust). And so on.

Apropos your original figures: the ESP-01 came out well, but did you try turning it by 90 degrees in the horizontal and vertical planes: you might just have hit the best orientation of its onboard antenna.

The Raspberry Pi has a fairly good antenna of non-obvious shape, which I believe they've bought in from a Swedish company. In any event, there's limits to what you can do on a standard PCB, which is why high-end UHF and microwaves gear tends to use a ceramic substrate.

Having a NanoVNA is a godsend, since you can do a practical check of the frequency characteristic separate from the attenuation which would affect bitstream performance.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

ccrause

  • Hero Member
  • *****
  • Posts: 997
Re: Wifi signal strength test for ESP controllers + cantenna
« Reply #7 on: February 03, 2025, 12:36:50 pm »
I've used xnec2 to analyse the dimensions of my can.  The gain seems to be reasonable, but VSWR is terrible (> 10).  Next test should probably be a throughput test.

A couple more thoughts that have been knocking around.

The point of my question to EevBlog was the properties of the material out of which the waveguide was fabricated. In particular I was concerned about how good any joints had to be (getting a good join on stainless might need TIG), but also you need to consider the tradeoff between conductivity and price: copper conducts well but is easy to soft-solder, mild steel doesn't conduct as well but is much cheaper so can be made thicker (at the expense of more difficult joining, and potential problems with skin effects, but more robust). And so on.
My last cantenna (if I may call it that...) was made out of thin galvanized steel sheet ~ 0.4 mm thick.  Nice and sturdy, relatively easy to solder, no need for painting, cheap, decent performance.  The can was an all folded construction (by someone else) so in principle easy to construct (easy because you don't need special tools, one still needs a bit of skill to make it look neat).

Quote
Apropos your original figures: the ESP-01 came out well, but did you try turning it by 90 degrees in the horizontal and vertical planes: you might just have hit the best orientation of its onboard antenna.
Each board was checked in various orientations (although I cannot specifically recall turning it 90 degrees around each axis), the best for all the PCB type antennas was with the copper antenna facing the router with the long axis of the antenna in the horizontal position. The best orientation for the cantenna was with the antenna element in the vertical position.

Quote
The Raspberry Pi has a fairly good antenna of non-obvious shape, which I believe they've bought in from a Swedish company. In any event, there's limits to what you can do on a standard PCB, which is why high-end UHF and microwaves gear tends to use a ceramic substrate.

Having a NanoVNA is a godsend, since you can do a practical check of the frequency characteristic separate from the attenuation which would affect bitstream performance.

MarkMLl
Which version of NanoVNAare you using? It seems not all versions are good up to 2.5 GHz.  I will start looking for one, seems very useful to check construction quality.

ccrause

  • Hero Member
  • *****
  • Posts: 997
Re: Wifi signal strength test for ESP controllers + cantenna
« Reply #8 on: February 03, 2025, 12:53:27 pm »
Yep, point taken.

From memory (I was distracted by some serious health issues and did not catch up again), the RISCV proved to be a problem with FPC. Maybe I am wrong ....
RISCV in FPC support is already good enough for embedded in my opinion.

Quote
Anyway, how about a real Blue Sky suggestion ?  Google sponsors a project called PigWeed, https://opensource.googleblog.com/2024/08/introducing-pigweed-sdk.html

Intention is to deliver a middleware library API to 'lots' of controllers. Perhaps would we be better targeting their API that will change a lot less than the Espressif one. Rather sadly, the PigWeed project does, apparently target big team development, lot of emphasis on complicated tool chains. Swapping one complication for another ?  But they do have, now a large set of C++ libraries just waiting for wrappers, LLVM compiler ....

Lot of emphasis on RasPi Pico, not sure I'd use it again.

Davo
I struggle to decipher Google's marketing material.  Currently the project seems to be entirely ARM focused?  Good to have a unified interface, but the down side is potentially an abstraction layer on top of base libraries (or at least complicated templates)?

MarkMLl

  • Hero Member
  • *****
  • Posts: 8227
Re: Wifi signal strength test for ESP controllers + cantenna
« Reply #9 on: February 03, 2025, 01:16:34 pm »
Which version of NanoVNAare you using? It seems not all versions are good up to 2.5 GHz.  I will start looking for one, seems very useful to check construction quality.

Came from Shop4750004 on AliExpress, which at present is on holiday.

That's one of the older ones, metal-cased, SMAs on long edge and ~3" screen; I'm pretty sure it did >2.4GHz out of the box.

What /doesn't/ do 2.4GHz out of the box is the (related) "tinySA ULTRA" which I believe has some level of VNA capability but needs explicit unlocking before it will work above something like 800 MHz (because it wasn't designed for it, and the designer doesn't promise it will be reliable).

I've got both, and if I had to choose I'd go for the VNA since it allows you to check your antenna before using something else to actually look for an elusive signal. The "something else", in the case of Wi-Fi, being a cheap Ralink receiver which has the facilities needed by Kismet or Horst.

If you do have the time and cash, you're obviously best off tracking down the designer and using his preferred outlet. Regrettably, in the case of one of my receivers the firmware was written by somebody in Russia so at present I can't buy the upgrade I could do with.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018