Many devices provide some form of serial interface. Routers, Robots (e.g. Roomba), 3D printers, or motion controllers for e.g. CNC (like the BOB Motion) have a standard serial port.* Using an ESP-8266, a simple to use, very low cost connection between those devices and the internet can be made.
On startup, the web connection unit loads a saved configuration which it uses to try to connect to a local router via WiFi. The default setup looks for a common public wifi provider, but it's unlikely that will connect. If the unit can't connect, and the config allows "admin mode", it presents it's own WiFi SSID, which includes the password and IP address, making the initial setup as easy as possible. Connecting to the device with a cell phone and hitting the default IP provides web forms (shown below) to enter your own routers SSID, password, and other network settings. Once the unit is connected to the router, it's IP address is available via the admin connection, or with a tool like Fing, or on the debug serial interface.
Part of the standard setup is the "Stream Server" which parcels out large
text files one line at a time... or several lines at a time, e.g.
to the connected device. This avoids the need for the local device to have or rely on large amounts of local memory while still allowing it to process very long complex sequences of instructions e.g. When the connected device is a 3D printer, or CNC mill, etc... The programming required to make this work on the server has, so far, been by far the most difficult issue. The basic server scripts and SQL procedures for importing text files into table for rapid random line access aren't that hard, but providing access, without opening security holes, has proven nearly impossible. We hope to provide documentation for easily spinning up a google cloud engine so users can provide this function for themselves.
On startup, all ESP-8266 devices send out a string of data about version,
etc... at a strange baud rate, 76,4884. There is no way to disable this.
That data could easily confuse or damage the device connected to the web
interface unit. To avoid this problem, we use the second serial pins available
on larger ESP units like the 7 or 12 or 12E, commonly available for under
$5. The standard Serial library uses UART0, which is mapped to pins GPIO1
(TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX)
by calling Serial.swap() after Serial.begin. Of course, level conversion
is necessary on those pins for TTL or RS232 connections. Calling swap again
maps UART0 back to GPIO1 and GPIO3. Use Serial.flush() to block until serial
sending is finished before swapping. A slight delay after the flush also
helps to ensure everything is done. This allows standard debug and programming
connections while still providing clean serial IO with the connected
Once you (via the web) and the device (via the 2nd serial port) are connected to the unit, sending data to the device is as simple as typing in the form presented when you connect to the ESP and pressing enter. Responses are shown back in the browser window.
If no browser is connected, the unit can log any data received from the device to the stream server, buffering a limited amount of data from the device if the server isn't accessible.
* Also vending machines, medical equipment, cell phone towers, etc...
|file: /Techref/ESP8266/WebSerial.htm, 4KB, , updated: 2018/9/22 10:35, local time: 2019/9/15 15:27,
|©2019 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://massmind.ecomorder.com/techref/ESP8266/WebSerial.htm"> ESP-8266 Serial to Web interface</A>
|Did you find what you needed?|
Welcome to ecomorder.com!
Welcome to massmind.ecomorder.com!