Configure Wifi on a headless Raspberry Pi with your own access point

In the IoT context there are many devices build based on micro controllers like esp or stm32. If it comes to integration into your wifi at home all these devices offer its own access point where one can connect to configure everything, mostly include the “real” wifi and your done. Very easy. Also amazons echo devices work like that.

Why not configure a raspberry pi based “device” the same way?

When you ask google about “access point raspberry pi” it guides you in the right direction but more or less every article out there is about turning a pi into a routing access point that does routing and nat and all. We don’t need all that.

We basically need 3 things:

  1. An access point: we use hostapd for that.
  2. A very tiny dhcp server that hands out an ip. we use udhcpd.
  3. A tiny http server that offers some configuration page. at least for configuring wifi itself. we use lighttpd and s small cgi script.

As soon as we have a working wifi we stop the three above.

So automating this works simply like this:

  • Some time after boot, with some script check if then wlan0 interface has a valid ip address
  • if not start the 3 services mentioned above to gather config.
  • with user input write a wpa_supplicant.conf to /etc/wpa_supplicant and reboot.

To be continued …

Dieser Beitrag wurde unter Allgemein veröffentlicht. Setze ein Lesezeichen auf den Permalink.

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>