MartinSant.net

Software Engineering | MicroMachines

  • Airplane
  • Electronics
  • Model Trains
  • Chickens
  • 3D Design
  • German Shepherds
  • Garden
  • Protothrottle

Raspberry Pi Zero W Wifi Access Point

I finally got this to work after many tutorials, directions and configurations so I thought I would document it here.

You will need some parts in addition to the Raspberry Pi Zero W and the memory card.

Get one of these:

Ethernet and USB hub

And one of these:

HDMI mini to HDMI full

NOTES:

Need PiZeroW with all local hookup. Video, keyboard, ethernet, USB dongle, power
Best bet is the Adafruit all in one usb dongle. They have two.
Connects to USB keyboard and Ethernet.
Pi comes up in DHCP mode so if you have a dongle plugged into your local network, it will come up.

Get Raw Image (lite), burn to SD micro card with Etcher
Should auto Eject
Insert into RWZ
Power up with Dongle and kbd and ethernet active
Log in
pi, raspberry

Once up, reconfigure with raspi-config
Set Disk size

Convert keyboard to US with:
sudo nano /etc/default/keyboard
XKBLAYOUT=”gb”
change to
XKBLAYOUT=”us”

set WIFI country to US

reboot

install apache2, flask, dnsmasq, hostapd

get flask working with ethernet connection first

Running a Flask application under the Apache WSGI module


(not completely correct, use already installed flask/apache on ZeroW to review this)
I have more minimal version available on the RpiZW

For Access point to serve flask app:
follow directions at
https://www.raspberrypi.org/forums/viewtopic.php?t=196263

—————————————————————————————————————————–

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and ‘man dhcpcd.conf’

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto wlan0
iface wlan0 inet dhcp
wpa-ssid “CenturyLink1234”
wpa-psk “hjryteuuwvegwj”

Above will get you online via wifi

——————————————————————————————————-

Insure your OS is up to date.

Code: Select all

sudo apt-get update
sudo apt-get upgrade

Install the modules.

Code: Select all

sudo apt-get install dnsmasq hostapd

Edit /etc/rc.local and add this above “exit 0″. Note that is two underscores on __ap.

Code: Select all

service hostapd stop
service dnsmasq stop
iw dev wlan0 interface add uap0 type __ap
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
ifdown wlan0
ip link set uap0 up
ip addr add 192.168.4.1/24 broadcast 192.168.4.255 dev uap0
service hostapd start
ifup wlan0
service dnsmasq start

The /etc/dnsmasq.conf file

Code: Select all

interface=uap0
dhcp-range=192.168.4.20,192.168.4.100,255.255.255.0,12h

The /etc/hostapd/hostapd.conf file. If you change the wpa_passphrase, it must be 8 to 63 characters. No shorter or longer!

Code: Select all

interface=uap0
driver=nl80211
ssid=RPiNet
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=mypassphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Edit /etc/default/hostapd, uncomment and change this:

Code: Select all

DAEMON_CONF=”/etc/hostapd/hostapd.conf”

Edit /etc/sysctl.conf and uncomment

Code: Select all

net.ipv4.ip_forward=1

Reboot.

systemctl stop dnsmasq
systemctl stop hostapd

Reference- this is official pi document but not fully workable
https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md

review all of this
https://www.raspberrypi.org/forums/viewtopic.php?t=196263

Make sure you put a local line in dnsmasq.conf for your domain name on the local AP network
local=/rpinet/

and that /etc/hosts

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

127.0.1.1 rpinet
192.168.4.1 rpinet

  • Recent Posts

    • All finished, well almost
    • New Paint
    • Train Layout Rebuild
    • New Computer
    • Airplane Refurb
  • Pages

    • 2D vector drawings into 3D models
    • 3D Printed Figures
    • Android – Reels Game App
    • AVR Attiny 1634 s/w UART
    • Bluetooth Diagram and Descriptions
    • Building a G Scale Turnout
    • Burnley Country Store
    • Flying to York PA
    • New Puppy – Sophie
    • Protothrottle
    • Protothrottle to Airwire Beta
    • Rail Layout Editor
    • Raspberry Pi Zero W Wifi Access Point
    • RPi Android HTML5 Servo Control
    • Steam Engine and Dynamo
    • Tin Can Steam Boiler
    • Wixel Breakout Board
    • CRM C# Autonumber Plugin
    • Microsoft CRM and C#
    • EightWay Game
    • Dice In A Stone Box
    • About Martin
Proudly powered by WordPress Theme: Parament by Automattic.