bdring / Grbl_Esp32

A port of Grbl CNC Firmware for ESP32
GNU General Public License v3.0
1.69k stars 529 forks source link

Understanding different radio mode and communication protocol usage #323

Open mfarabee opened 4 years ago

mfarabee commented 4 years ago

f you don’t mind, I need your help in understanding the connection protocols and radio modes . I am pretty confused when to use (None, STA,AP,BT) and how they relate to Telnet, WebGui and USB (this might be good to document); (I am trying to use LaserWeb4 as well as other senders)

Radio Modes: None - I assume this does not create a web server, is that correct? If this is set, I would have to connect via USB only? STA - I believe this connects to an existing WiFi and the WebGui would be accessible via the assigned IP. Why would I use this mode (advantages, disadvantages)? When I first downloaded the firmware using the Arduino IDE, I was connected to my desktop. I could not get to the GUI because it was in AP mode. When I switched to STA, I could see the WebGUI without connecting to a different network. How would I know the IP address, if this was a stand alone system (I found it by doing an [ESP420] command in the debug window. Would I have to snoop all of the IP addresses on my network? AP - This creates an access point. I believe the access point can see WebGui (web server), but would be on its own network. Why would I use this instead of STA (advantages, disadvantages)? BT - This creates a Bluetooth connection that can be accessed. I was able to download a Grbl Bluetooth app and get this to work. I assume that when in BT mode, a web server is not created. It would be simple to create a GUI using “MIT App inventor” to create my own and I might try that.

Now for the real fun: When trying to communicate to the board, it looks like I need to have some form of serial communication setup. I can communicate via a network cable ,Bluetooth or WiFi. It also has the ability to communicate using Telnet protocol. I can also talk to the board via the WebGui (web server running on the ESP32).

What radio modes should I be in when I want a physical connection (via USB cable)? Does it matter? It almost looks like I can use any radio mode.

When using LaserWeb4, it has a Telnet option. I am really confused by this and can not get it to work. I think I am missing something pretty simple. When/Why would I connect using Telnet? Is Telnet the communication protocol used with WiFi or hard connection? Are there other protocols used? So far I have only been able to get LaserWeb4 connected using USB. How would I setup the connection using WiFi? They recommend using “localhost:8000” for the server connection. Is that correct? What are they connecting to when I do this? Is this only for the USB connection?

I hope this makes sense. I am just trying to understand all of the connection models and how they can be used. It looks like the different Gcode senders can communicate in different ways and I am trying to get my head around how to do it with ESP32_Grbl.

It may be good to explain how the ESp32 can run its own web server as well as Access Points. Thanks in advance and I appreciate all of your hard work!

bdring commented 4 years ago

The USB is always on. That will give you important information during bootup about the radio modes, SSIDs and IP addresses.

STA connects to your wifi. If it is able to connect you will see the IP assigned on the USB console. If it fails to connect to the STA wifi, it will create its own wifi access point. AP mode will skip trying to connect to your wifi.

I generally use STA mode. If I take my machine on the road, it will switch to AP automatically. It takes a few moments to give up on STA, so if you want a faster AP, put it in that mode.

BT is Bluetooth serial mode. It creates a serial port on the device connecting to it. That makes it compatible with existing gcode senders. There is no BT password yet. apparently it is not a priority for Espressif

Like I said before. USB is always on and survives a reboot. You will see bootup information before you could establish a wifi or Bluetooth connection. You can use it while any of the other ports are in use. Use It

Telnet works, but is very slow. If you are doing laser projects, it is likely to be too slow.