Precision Landing Setup AdHoc Network


#1

I am encountering some issues setting up the RPi (buster) ad hoc network.
I have created a network bridge on a Windows laptop.
I built the copter environment and installed firmware using steps from ardupilot.org.
I modified dhcpcd.conf and created the /etc/interfaces.d/intwifi0 file as instructed.

  1. ls into /etc/network/interfaces.d did not list wlan0. But it is listed with ifconfig.

  2. sudo apt install isc-dhcp-server spawned connection errors… ?


#2

I simply couldn’t get the adhoc system to work either. Instead I use a hotspot on my cellphone to create a wifi network in the field. While trying the ad-hoc, I got my rpi to broadcast a wifi network on 192.168.4.X but could not get it recognized by any device. I think I was close but mobile hotspot is so much easier if you have a cell phone of course.

It seems like for ~$40, can get a 3/4G rpi chip though! This could be really cool for live streaming from different locations.

@DroneDojo, I’d recommend revisiting the ad-hoc/networking lessons, they’re a bit hard to follow and it seems like multiple accounts now of it now working. Perhaps a follow up lesson could be integrating the LTE chip.


#3

@jax200

After re-watching the video it appears my ad-hoc instructions were a bit unclear. This will be addressed shortly.

The wireless device that comes up when you type the ‘ifconfig’ command is the name of the file you want to make under /etc/network/interfaces.d/

So in your case, if wlan0 is the name of your wireless interface you would create the file named ‘wlan0’, and enter the configurations into the file as seen in the below picture.

image

Don’t forget to type the below into /etc/dhcpcd.conf:
denyinterfaces wlan0 #or whatever your interface name is

As for the connectivity issue, that does look odd. You for sure were connected to the internet while you were attempting to install isc-dhcp-server? Are you able to download anything else with apt installs, or just isc-dhcp-server? Did you try the sudo apt-get update?

@PhotonJon

I wonder if the wireless interface you were trying to access the ad-hoc network with didn’t support ad-hoc mode? If you’re curious you can check that on windows by typing “netsh wlan show driver” from the command prompt.

image

Glad to hear you found an easier workaround though! Perhaps the mobile hotspot should be the course standard for the ‘in the field’ networking, as not all wireless interfaces support ad-hoc mode.

Thanks for sharing that 3/4G chip, I had never seen that before! Imagine flying your 4G drone BLOS from your couch with a laptop- of course I would NEVER do this, FAA :wink: I might have to do some tinkering with that!

Totally agree on the lack of clear networking directions- I will be looking to update the ‘in-the-field’ networking method soon!


#4

@PhotonJon Nice idea, but then (more) monthly 4G cell fees for each installed chip?


#5

Oh it seems like my hosted network support is no! I’ll start with that then thanks :slight_smile:

@jax200 for sure there will be a monthly fee but it depends on your application’s finances of course. Most companies that can benefit from having a drone will not mind the recurring cost.

Also I live in Canada and Transport Canada requires licenses to fly drones here. For operating rpas without visual line of sight, we’re required to have a Special Flight Operations Certificate. So flying the drone from your couch can be dome, as long as you clear it with the air authority!


#6

No prob! I know for sure the TL-WDN4200 from TP-Link supports Ad-hoc, but it is getting kind of old. It is still available on eBay.

Also, I’m curious- do you know of many companies in Canada receiving permission for flying without visual line of site? Or is it extremely difficult? I know here in the USA the FAA has been very cautious granting permission to beyond-line-of-site flights.


#7

@caleberg The problem with installing isc-dhcp-server was solved by first running sudo update/upgrade.

However, as previously noted I saw wlan0, but I am unclear why now I do not :

ifconfig1

The bridged connection is working as expected.


#8

Hmmm, can you run this command:

systemctl status networking

That may give some clues. In your opening post it looks like you made the wlan0 file under /etc/interfaces.d/ instead of /etc/network/interfaces.d/ (could have been a typo but just checking). If you did create the file in the correct place, also make sure your file name is correct. If you don’t have an intwifi0 interface, remove that file under /etc/network/interfaces.d/ and replace it with wlan0 (or whatever your interface is called). Then try restarting with

sudo systemctl restart networking

My guess for why your wlan0 disappeared from ifconfig is that you successfully prohibited dhcpcd.conf from configuring wlan0 (by using denyinterfaces wlan0 at the end of /etc/dhcpcd.conf), but the networking daemon failed to configure the wlan0 interface (this is what systemctl status networking should give clues on).


#9

Yes, that was a typo and the structure is correct.

Here is what the command gave…

Based on your comments I backtracked to edit dhcpcd.conf and comment out the added statements, then verified wlan0. I proceeded on using your settings to successfully add the ad hoc network with the cable disconnected.

However, I got stuck when pinging the device -

ping


#10

Hmmm,

  1. Does your wireless interface show “Hosted Network Supported: Yes” when typing ‘netsh wlan show driver’ from the windows cmd?
  2. After running the commands below, did your device show a connection to the ad hoc network?

netsh wlan set profileparameter name=“DroneAdHoc” connectiontype=ibss
netsh wlan connect “DroneAdHoc”
image

  1. When you type ‘ipconfig’ from the cmd, is your wireless interface assigned an IP address on the 192.168.4.* subnet?
    image

If you did all of the above, you may also try disconnecting from the ad hoc network and retrying. Sometimes windows reports there is an ad hoc ‘network connection’ even when the drone isn’t broadcasting an ad hoc network.


#11

@caleberg

Hi -

  1. Yes
  2. Yes
  3. No (“Media disconnected”)

#12

Hmm so you have a Ad Hoc capable interface, your Ad Hoc network is broadcasting from the drone, but for some reason you cannot connect.

I’m sort of at a loss here, perhaps there is something wrong with the dhcp server on your Raspberry Pi? That’s the only thing I can think of. The Ad Hoc interface can communicate with the Raspberry Pi Ad Hoc network, but if the dhcp server isn’t working it won’t be able to assign an IP address to your windows Ad Hoc interface, so you can’t connect to the network and you therefore cannot ping it.

Could you try a systemctl status isc-dhcp-server and see if there are any clues that point to that hypothesis?


#13

The command results in

isc-dhcp-server.service - LSB: DHCP server
Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
Active: active (running) since Sun 2020-10-25


#14

Is there any helpful input below that? For example, when I run the command I can see the logging of when my desktop computer tried to log into the RPi, and it shows assigning 192.168.4.3 to my desktop. If it did refuse to assign the IP I think you’d see it in the logging below the ACTIVE line:


#15

I cannot share a screenshot since I cannot access the RPi other than with my keyboard. I tried to come up with a way to mail myself a screenshot, but haven’t determined how to do this. There are additional lines below the command, yet none of them reflect assignment of an ip address. I ran this with the bridge in place and RPi connected to DroneAdHoc. Ethernet shows Connected in the windows internet menu.

At this point I am a bit lost, and not sure how to backtrack to a starting point. What is the best next step? Re-install from scratch?


#16

Hmm I am wondering if this is it, try deleting your network bridge. I don’t think you can use the same wireless interface for ad hoc if it’s already being used as a network bridge.

If that doens’t work, I think the issue is something on the windows side, since your ipconfig results show a ‘media disconnected’. These directions might help resolve the ‘media disconnected’ error.


#17

I back-tracked all the changed files and once again followed these steps

AD HOC INTERFACE CONFIGURATION ON RPi
1 /etc/dhcpcd.conf #new program - used to instruct dhcp program to not auto configure interface
2 /etc/network/interfaces.d/ #old program - adhoc configure network interface
3 install isc-dhcp-server
4 /etc/default/isc-dhcp-server #tell program what network interface want DHCP server to operate on
5 /etc/dhcp/dhcpd.conf #further configures dhcp
6 reboot, removed ethernet cable
7 disconnect from previous network
8 manually set up DroneAdHoc network #Windows
9 netsh wlan set profileparameter name=“DroneAdHoc” connectiontype=ibss #Windows
10 netsh wlan connect “DroneAdHoc” #Windows

I deleted the bridge. At this point the laptop indicated connection to DroneAdHoc, but still couldn’t ping the RPi. The Windows WiFi was no longer connected (red X).

systemctl status isc-dhcp-server.service showed failed this time

systemctl


#18

Hmm odd. Cause you were able to start isc-dhcp-server before, right? That would definitely prevent your windows computer from connecting to the ad hoc network cause it couldn’t get an IP address from the PI.

Try sudo systemctl restart isc-dhcp-server
that sometimes fixes the issue if it was a one-off random event.

If that doesn’t work, I wonder if there is a syntax error in the /etc/default/isc-dhcp-server file? It would just be weird that the program was working before but now it can’t start.

Once that is up and running I bet you’ll be able to connect!


#19

The server file is ok, but there was a line item in etc/dhcp/dhcpd.conf accidentally uncommented. So the service is again now active (green). But I am not seeing “DHCPOFFER” as you marked with the blue line.

You mention to not use the same subnet as my home network. Mine is 192.168.1.x, but I used the same as yours at 192.168.4.x. I didn’t think this would be an issue, but could this be the problem? If so, what would be a better ip to use?

BTW, I wanted to upload a photo here but the upload icon seems to have disappeared?


#20

Hmmm… I’m running out of ideas with this. The 192.168.1.X subnet is different than the 192.168.4.X subnet so that wouldn’t interfere at all.

I’m wondering if at this point the mobile hotspot method mentioned by @PhotonJon would be the better tactic at this point. It seems that we’ve tried everything but there are a lot of moving parts here with Ad Hoc networks.

The phone’s hotspot can act as a modem and a router, and once activated your Raspberry Pi AND laptop could connect to the network.

Here is a video showing how to connect a Raspberry Pi to a mobile hotspot WiFi. Connecting with your laptop would be the same as connecting to any other WiFi network.