-->
Page 2 of 2

Re: Sending Commands to AP with ESP8266

PostPosted: Sun Feb 12, 2017 1:02 pm
by crood58
rudy wrote:I did a little searching and found this.

http://ogrforum.ogaugerr.com/topic/connecting-phone-to-lcs-wifi

The IP Address when the WiFi box is in "Join Network" mode is 192.168.254.18. Some how there needs to be a mechanism within the router that allows a device running the Bluetrain App to search for the assigned IP address. I am not a router expert but there seems to be a connectivity process using NAT or DMZ. Maybe NOT. I don't know...


Since you were not clear on what you are trying to connect to I don't know if this is applicable. As far as the port number, if it is connecting to a web page then start with a port number of 80.


The IP Address when the WiFi box is in "Join Network" mode is 192.168.254.18. Some how there needs to be a mechanism within the router that allows a device running the Bluetrain App to search for the assigned IP address. I am not a router expert but there seems to be a connectivity process using NAT or DMZ. Maybe NOT. I don't know...[/quote]

Since you were not clear on what you are trying to connect to I don't know if this is applicable. As far as the port number, if it is connecting to a web page then start with a port number of 80.[/quote]

I'm using the Lionel LCS wifi in access point mode. The LCS wifi can operate as it's own access point or join another network. Eventually I will have it on another network, but for right now I'm just using in access point mode. From what I can tell the LCS wifi assigns an IP address to the device when it connects by SSID. I have determined by connecting my computer to the LCS wifi that the IP address 192.168.99.3 is on port 139. When I try to connect as a client I get no connection. Like I said I was able to send to 192.168.99.3 on port 139 with Packet Sender and got a reply via TCP when my computer was connected to the same IP address. Here some screenshots.

Windows Wifi Properties.PNG


PacketSender.PNG


I guess one of my biggest questions is when WiFi.begin(ssid) and you then call WiFi.localIP(), is the local ip that of the ESP8266 or what it is connected to? See when I connect my computer and that gives the IP address of 192.168.99.3 that is the address of the LCS Wifi and not my computer, but the computer and the LCS Wifi are determining that by themselves.

I have also determined that the LCS Wifi has the following IP properties:
    Gateway = 192.168.99.1
    Subnet = 255.255.255.0
    DNS = Gateway

I'm sorry if I'm being somewhat dumb about this. This my first attempt with ESP8266 and wifi. I just don't know if I should connect as a client, server, or what.

I hope this helps and sorry if I wasn't clearer earlier. That wasn't my attention at all.

Chris

Re: Sending Commands to AP with ESP8266

PostPosted: Sun Feb 12, 2017 2:45 pm
by gdsports
Your program receives data from a TCP socket then sends the data out the UART port. There is a project that does that (WiFi <-> serial bridge) named esp-link. It might be easier to use it than developing your own from scratch. The ESP can be a station or AP. Configuration is done using a web interface.

https://github.com/jeelabs/esp-link#esp ... -wrestmqtt

Re: Sending Commands to AP with ESP8266

PostPosted: Tue Feb 14, 2017 8:34 pm
by rudy
Hi Chris. The Lionel LCS wifi should be a server and what you want to do is connect to it as a client. Use a client example to connect to Packet Sender set up as a server. Once you have that figured out then start looking at the Lionel LCS device.