WiFi Wireless Projects

From Wildsong
Revision as of 02:11, 15 September 2022 by Brian Wilson (talk | contribs) (→‎Alfa + MacBook)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Presence detection

Working on detecting when my phone enters and leaves the Wildsong AP. Presence detection

Alfa

Famous race condition causes it to come up sometime as wlan0 and other times as wlan1, basically annoying the daylights out of me.

I tried the raspi-config (really kalipi-config) "predicatable names" option and it failed.

Next I tried this, which works!!

sudo rm /etc/systemd/network/73-usb-net-by-mac.link
update-initramfs -k all -u
reboot

I think the .link file (which points to null) was masking the one with actual information in it in /lib/systemd/network/ Read carefully "man systemd.link", especially how the directories are searched in order, so the fake .link file was overwriting the real one. Now I have the builtin wifi at "wlan0" and the Alfa interface at wlx00c0ca52c04b. No more confusion as to which one is the Alfa.

Range extender / Wireless hotspot

A few years ago I wrote up an adventure where I set up a Ubiquiti dish antenna to access a wireless network at College of Marin.

This is another take on that. I have this obsolete Alfa device I want to use, and there are no current Mac or Windows drivers for it.

Alfa + Pi 3

But it works great on a Pi 3. So I am going to set up a Pi 3 with the Alfa. The Alfa will hopefully connect to my office when I am sitting on the hill at lunchtime, and become a hotspot, allowing me to connect via its internal WiFi or possibly its wired ethernet. The only reason to do this is to see if I can.

Some instructions to follow. https://thepi.io/how-to-use-your-raspberry-pi-as-a-wireless-access-point/

Install iptables, hostapd, bridge-utils and dnsmasq.

Edit /etc/dhcpcd.conf, /etc/dnsmasq.conf, /etc/hostapd/hostapd.conf, /etc/default/hostapd, /etc/sysctl.conf.

Enable MASQUERADE

Create a file to set iptables

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

Load it from /etc/rc.local

Add bridge interfaces

sudo brctl addbr br0
sudo brctl addif br0 enxb827eb6f44a5
sudo brctl addif br0 wlx00c0ca52c04b    <-- oh oh this failed

Alfa + MacBook

The Alfa also works with a Macintosh such as Swift, once I installed Elementary OS on it!

I tested it and found the antenna just does not see the office net. :-(

I need another antenna. Perhaps this High Gain Yagi??

Wardriving

Setting up a Raspberry Pi to do some wardriving (or warcycling or warwalking?) Will probably use an Alfa 802.11b/g/n adapter from Rokland.

  • Horst = Highly Optimized Radio Scanner Tool = low footprint
  • Kismet = been around longer, more features

Testing on Pi 4 Tenrec today with sudo iwlist wlan0 scan|grep SSID With the Alfa I see 35 stations. On the built in wlan0 I see 9. So, Alfa it is. The built in interface is dual band (2.4 and 5.8) but the Alfa is 2.4 only. I might want to replace the Alfa later but most access points advertise on both bands so I don't think it matters to me right now.

  • MAC on the Alfa is 00:c0:ca:52:c0:4b
  • MAC on the Pi WiFi is b8:27:eb:3a:11:f0

Quickie test: sudo iwlist wlx00c0ca52c04b scan

Examine interfaces with

sudo iw dev
sudo iw phy phy0 info
sudo iw phy phy1 info 

Packages on Pi 3 (Name "clear" because of the transparent case.)

apt install horst emacs-nox minicom

To-do:

  • Install and test Alfa (DONE)
  • Install and test Horst. Done but need to know more about it; logging? GPS?
  • Install and test Kismet
  • hook up a GPS (in car: UBlox AEK-4P walking? I have a little chip GPS around)
  • remove the Pi 4 from the 7" screen -or- go with a Pi 3 -or- even a Pi Zero?

Can I run this software on a Pi Zero? I just want to log data, nothing else. That would be Kali on Pi0W It works, but runs out of memory or drops messages or something. I decided to stick with a Pi3 on this project.

Disable automatic connection on Alfa

I want to use the Alfa only for monitoring so I don't want it connecting.

This does not do it.

systemctl disable wpa_supplicant@wlx00c0ca52c04b

GPS (and Cellular networks)

I tried the $12 GPS I picked up someplace (Amazon?) and it's been running since 7AM this morning and has no fix. Ptuii! I soldered the leads onto the 5" screen, and after disabling the Bluetooth I was able to see data coming in but not fix, so, out it goes.

See descriptions of the UARTs here. https://www.raspberrypi.com/documentation/computers/configuration.html#primary-and-secondary-uart

Fona 3G

Today I thought it would be cool to integrate cellphone tower locations into this project. Maybe using this Fona 3G? Lordy knows I paid enough for it. Then I realized the Fona 3G has a GPS in it!! So now I have 2 reasons to use it.

Most articles cover only the older 2G Fona 808. 2G is history.

Here is the Adafruit Learning article. Adafruit also has data sheets and tech docs.

Maybe this guy could help, he did not write up very much. https://hackaday.io/project/171023/logs

Here is an article on the Fona 808 -- https://www.digikey.com/en/maker/projects/cellular-gps-enabled-pi-3-fona-pi-3/d0cf660bfc144842a49bfbc5c1dc2ff0

I don't want to actually use the cellular modem for anything other than signal reports so I doubt it matters if it's 3G or 5G or if I have only one serial port. (There are actually 2 serial ports on the Pi 3, a fast robust one and a feeble one.)

To get anything at all to happen on the Fona, you have to do 2 things. Wire 3 volts (I took it from the Pi) to "Vio" and then you have to turn it on; you can hold down the push button 3-5 seconds or (what I did) wire "Key" to ground.

When it is On the power and network LEDs come on. Power is green, network is red (blinking).

Connect on USB port

minicom -D /dev/ttyUSB3 -b 115200

Turn on GPS

at+cgps=1

If I use the USB port then there will be virtual serial connections. (Hardware manual page 39)

  1. ttyUSB0 = SIMTECH USB modem
  2. ttyUSB1 = SIMTECH NMEA device
  3. ttyUSB2 = SIMTECH ATCOM device
  4. SIMTECH Diagnostics Interface
  5. SIMTECH Wireless Ethernet Adapter

It turns out the Fona won't work without an activated SIM card, I borrowed the card out of my phone.

OKAY, so after 30-40 minutes of watching useless NMEA sentences scroll by, I have no position data. BORING. Not going to work for me.

Delorme Earthmate

This one's been in my collection for many years. It's yellow. It still works. I added GPSd ("apt install gpsd") and fired up gpsmon. Yep. Works. GPS is done.

Narrowband

While reading Fona docs I learned Twilio now has access to narrowband IoT through T-Mobile, which is 400MHz (like LoRA). The Quectel developer board I found for it is $95 and also includes GPS. $3 for a SIM and $10 a year for 12MB for Narrowband. I wonder what it would take to use LoRa? I will end up using APRS.

Horst

There is a package for Raspbian but not Kali. I am leaning towards dumping Kali, which is 10# of software and I only need 1#. I wonder about the Re4son kernel?

git clone --recursive https://github.com/br101/horst
sudo apt-get install libncurses-dev libnl-3-dev libnl-genl-3-dev pkg-config

Kismet on Debian

The version in the repository won't install on Debian Bullseye

The following packages have unmet dependencies:
 kismet-core : Depends: libprotobuf17 but it is not installable
wget -O - https://www.kismetwireless.net/repos/kismet-release.gpg.key | sudo apt-key add -
echo 'deb https://www.kismetwireless.net/repos/apt/git/buster buster main' | sudo tee /etc/apt/sources.list.d/kismet.list
sudo apt update
sudo apt install kismet

5" display

I am using this 5" display and a Pi 3 from SEARC

https://elecrow.com/wiki/index.php?title=HDMI_Interface_5_Inch_800x480_TFT_Display

I tried installing the drivers per the instructions here and the board did not reboot. I will try again someday. Who needs a touch screen anyway?

Kali

I tried installing Kismet on Raspbian and it failed, so I installed Kali.

Kali runs X11 by default; it can be disabled with

systemctl disable lightdm

I would disable HDMI too, to save power, but I am afraid I will need to connect the KVM up in the near future to get access when WiFi is not available.

About the Re4son kernel

uname -a
Linux kali-raspberry-pi 5.15.44-Re4son-v8+ #1 SMP PREEMPT Debian kali-pi (2022-07-03) aarch64 GNU/Linux

What is Re4son?? It's a kernel that has support for some of the wireless drivers that I don't need right now. :-) See https://re4son-kernel.com/re4son-pi-kernel/ See also https://davidtavarez.github.io/2018/re4son_kernel_raspberry_pi/

It's probably pretty easy to install it later on top of Raspbian.

Kismet

sudo -s
systemctl enable kismet
systemctl start kismet

Now go to a browser go to for example http://zebra:2501/ and set a username and password.

Okay, it ran for a good 15 minutes and I think it wants at least a Pi 3. Starting again with a Pi 3 named "clear" since it's in a clear case. Or it would be if it all fit.

Wireless resources

Personal Telco Portland

WISP news

Frontier Broadband Industry News http://www.frontierbb.com/blogger.shtml

Broadband Wireless Exchange http://www.bbwexchange.com/

Wireless Internet Service Provider Association http://www.wispa.org

Equipment suppliers

Single board computers

Rokland Alfa high power WiFi USB adapters

Metrix Wireless development kits

Fleeman Anderson Bird Antennas and a lot more. Really like these folks.

Manufacturers

E-zy made the EZ-2-Go radios that I just got for Chintimini

RouterBoard

[Ubiquiti] makes some products that look interesting including the "Bullet".

Organizations

Certified Wireless Network Providers Bluetooth
IrDA
Wi-Fi
Wi-Max
Zigbee