People love their phones. So, if you can have the user interface (UI) of your Maker project be their phone, do it. It also makes your project less expensive and with less parts to troubleshoot and maintain. This guide takes you through setting up the Pi as an ad hoc Wi Fi module so one can connecct. It then provides a simple web server example to serve as the interface.
-Raising Awesome ©2021
One thing to note - Windows 10 no longer will connect to ad hoc networks. Don't know why they chose to stop, but they don't. It has something to do with new drivers for wifi. If you need to access the Pi terminal while in ad hoc mode, I use an iPhone app called Pi Helper to connect.
Step 1: Make a backup of your Pi's existing wifi profile:
sudo cp interfaces backup-interface
Step 2: Create an ad hoc interface
sudo nano adhoc-interface
Step 3: Paste this into the file
auto wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
wireless-channel 4
wireless-essid MyPiAdHoc
wireless-mode ad-hoc
wireless-key YOURPASSWORD
Step 4: Install a DHCP Server
sudo apt-get install isc-dhcp-server
Step 5: Create a DHCPD Config File:
sudo nano /etc/dhcp/dhcpd.conf
ddns-update-style interim;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.5 192.168.1.150;
}
Step 6: Set the Pi to Use the Ad Hoc Interface Profile
sudo cp /etc/network/adhoc-interface /etc/network/interfaces
sudo cp /etc/network/backup-interface /etc/network/interfaces
Step 7: Get My Example Web Server
cd ~
git clone https://github.com/RaisingAwesome/CardReader.git
Step 8: Set the Webserver to Run at Startup
crontab -e
@reboot python3 /home/pi/CardReader/cardreader.py
Step 9: Reboot and Connect with your phone!
Enter 192.168.1.1 in your phone's browser to connect to your webserver interface.