0

I have recently bought a NodeMCU, a WiFi device that creates a WiFi network that you can connect to, and you get a web server from it at 192.168.0.4. Is it possible to do this with the Pi so that I could plug it in and connect to the web server on its own network instead of connecting it to an existent network, setting up SSH, etc.?

anonymous
  • 135
  • 8

1 Answers1

1

This is a very broad question and I will address in broad terms.

Is it possible to do this with the Pi so that I could plug it in and connect to the web server on its own network instead of connecting it to an existent network, setting up SSH, etc.?

With regard to "on its own network", this means putting the wifi interface into access point mode -- whether it is an ESP8266 or a Raspberry Pi (or a smartphone, or a desktop, etc). It is somewhat more complicated on the Pi than it is with NodeMCU, since the pi is a general purpose computer running a multi-tasking operating system.

This question should get you going on the two key elements:

  1. hostapd http://linuxwireless.org/en/users/Documentation/hostapd/ You don't have to download and install from there, there is a package in Raspbian (apt-get install hostapd) and every other linux distro. That's just the official home page documentation; it may not be the easiest point of entry.

  2. A dhcp server (usually dhcpd -- beware this is NOT the same as dhcpcd, which is a dhcp client used for normal networking on Raspbian).

There is plenty of material around on the web if you search "linux access point" and not "raspberry pi access point" (feel free to try both of course, but don't restrict yourself to just the latter -- most of it is regurgitated from the former, sometimes in excessively terse and garbled form).1

You probably will run into a problem or something you don't understand, but at least then you can ask a more specific question (like the other one). Do not expect someone to just write out yet-another-access-point-tutorial for you ;)

Web server

Running a web server is a completely separate issue -- and almost certainly there are tens of thousands of pages online about running a web server on linux; 30-40% of the internet is linux based web servers. The most popular option for beginners is probably Apache; and the usual introduction to that is via the LAMP stack. Note you only need an SQL database if you want one, and the "P" could really be "_" to indicate just about any language can be used in place of PHP (the "LA__" stack: linux apache blank blank).

Looks like there's even an experimental lua module which is probably worth trying if you like that (except it will probably be shy on tutorials). You can also write a webserver directly in lua using the luasocket library, but this requires you understand a certain amount about how HTTP servers and networking generally work.

Another very popular choice on the Pi (and everywhere else) is Node.js.


1. It actually makes more sense to research things that are primarily about software in terms of the OS (which is usually a form of GNU/Linux), than the brand of hardware (Raspberry Pi). Then, if there's any uncertainty, you can ask here "How do I apply this on Raspbian?". If instead you search directly how to do it on Raspbian I think you will almost always find a relative paucity of materials.

goldilocks
  • 58,859
  • 17
  • 112
  • 227