Need to make nodemcu a station and a access at the same time

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
Damsam
Posts: 1
Joined: Sun Sep 25, 2016 5:28 am

Need to make nodemcu a station and a access at the same time

Post by Damsam » Sun Sep 25, 2016 5:46 am

I need the nodemcu connect to internet through a router and i need my laptop to connect to nodemcu and access the internet. I created AP and STA in nodemcu at the same time, nodemcu connects to the router, and laptop connects to network created by nodemcu, but the problem is they work as 2 separate networks, and can't communicate data between them. Can anyone help please :!: :!: :!: :!:

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Need to make nodemcu a station and a access at the same time

Post by platforma » Mon Sep 26, 2016 10:02 am

Connect your board to the router (check your IP via REPL with wlan.ifconfig().
Connect your laptop to the router (so you will have Internet connection).
You can ping your board from the laptop now with the IP you got from wlan.ifconfig(). Or you can use webrepl to interact with the board directly.

You can reserve the DHCP address of your board in the router interface so the local IP address doesn't change with every connection. You can add a startup script on the board to scan the wifi APs and connect to one if it's known, that way you can put your esp anywhere within the reach of your WiFi.

It's worth noting that this usage of webrepl is not officially supported (yet), but it works well for me.

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Need to make nodemcu a station and a access at the same time

Post by platforma » Mon Sep 26, 2016 10:02 am

Oh, and of course use your laptops local IP to communicate with it from the ESP!

chrisgp
Posts: 41
Joined: Fri Apr 01, 2016 5:29 pm

Re: Need to make nodemcu a station and a access at the same time

Post by chrisgp » Mon Sep 26, 2016 4:03 pm

Can you explain what you are trying to accomplish more generally? It sounds like you want the ESP8266 to bridge the station and access point connections so that the laptop connected via the ESP8266's access point can access the Internet.

If you take a look at this thread it may not be possible. You might be able to get it to work for a certain category of traffic like HTTP by running a very basic proxy though on the device though. I'm curious to hear what problem you're trying to solve in case there is another approach that might be easier.

jms
Posts: 108
Joined: Thu May 05, 2016 8:29 pm
Contact:

Re: Need to make nodemcu a station and a access at the same time

Post by jms » Wed Sep 28, 2016 11:18 am

This really sounds like a misuse of the product and is never going to work well.

Jon

Nukkul
Posts: 1
Joined: Sun Oct 09, 2016 9:57 am

Re: Need to make nodemcu a station and a access at the same time

Post by Nukkul » Sun Oct 09, 2016 10:02 am

Tried to do something similar, but due to the fact that my system uses a proxy server (http://advanced.name), little came of it. working with the spoofed ip complicates this thing twice.

Post Reply