How to use single wifi adapter for hotspot or access point?

P

P1X3

Guest
The linux machine that I have in my car, Raspberry Pi, has a single wifi adapter. When car is parked in a driveway, rpi connects to home network. Now, my goal is to use this single wifi adapter to connect to home or other saved networks, but when those networks are outside of range, I want the adapter to be used as hotspot.

Why do I need such setup?
When there is no saved wifi network available, raspberry pi will enable HSPA modem for internet connectivity, and share that connection with any devices connected to RPi's wifi network. If there is saved network available, as you might imagine, HSPA modem will turn off and wifi network will be used for internet connectivity.

What I have so far?
Well, as of now raspberry pi can connect to my saved networks whenever they are in range. However, I can run a script which will reconfigure wifi adapter to work as a router/hotspot and is sharing internet connectivity that modem provides. Another script reverts hotspot setup.

Solution?
1. Use two wifi adapters. One being setup as hotspot, and second used for connecting to other wifi networks. Only con to this is that power use will be higher which is critical in my setup.

2. Add GPS adapter. This might be the obvious choice because I planned to add GPS adapter to the raspberry pi, but I would rather use this as a backup solution.

?. Setup a magic script. When connection to saved wifi network is lost, script will retry for available networks. If none are found, the script will change wifi adapter into hotspot mode. Then periodically hotspot will be turned off and script will check if saved wifi networks are available. The biggest down side is the fact that this might cause interruption for devices that connect to raspberry pi.

Between two of the above mentioned solutions, which one seems more logical or appealing? Despite the fact that both of the solution are relatively easy and efficient, can a single wifi adapter be setup to automatically switch between hotspot and non-hotspot modes?
 



Members online


Top