serialTerminal.com icon indicating copy to clipboard operation
serialTerminal.com copied to clipboard

Add important info to documentation.

Open janbbeck opened this issue 3 years ago • 12 comments

I found serialterminal.com though your posting here: https://stackoverflow.com/questions/30114474/communicate-with-the-serial-port-from-client-web-browser

In that page, there is some important information, that I think you should add to the readme, namely that

"As you can imagine, this is API is only supported by modern Chromium based desktop browsers right now (April 2020) but hopefully support will improve in the near future. At this moment you need to enable your browser's Experimental Web Platform Features, just copy and paste the right URL:

chrome://flags/#enable-experimental-web-platform-features opera://flags/#enable-experimental-web-platform-features edge://flags/#enable-experimental-web-platform-features "

janbbeck avatar Jun 02 '21 17:06 janbbeck

Are you sure that the needed flags are not enabled by default? It is my understanding that with the latest releases of google chrome and Microsoft edge that these were enabled by default. Release notes for chrome 89 list web serial api and also references how to disable for enterprise users. Release notes: https://storage.googleapis.com/support-kms-prod/aECCgflTiya0jTzyQXkX6Bi0np9Ue6dGKkr6 Feature status: https://www.chromestatus.com/feature/6577673212002304

mmiscool avatar Jun 02 '21 23:06 mmiscool

Maybe they changed it in some recent version, but the version that is shipped with the current Raspian does need to have it enabled. Tough they ship a pretty old one. I am currently recompiling chromium 90 for that Pi Zero, but it looks like the compile time will be 10 days!

janbbeck avatar Jun 02 '21 23:06 janbbeck

Chrome on a pi zero sounds like no no fun at all. You might want to look in to a command line method of talking to the serial port. Running X and chromium would be unbearably slow I imagine. Even the pi3 is rather painful for GUI stuff.

You might consider using minicom or screen to connect to serial devices from the command line. See the following examples screen /dev/device baud-rate screen /dev/ttyS0 19200 screen /dev/ttySUSB0 19200,cs8

You might also look at this link for some options. https://www.cyberciti.biz/hardware/5-linux-unix-commands-for-connecting-to-the-serial-console/

mmiscool avatar Jun 03 '21 00:06 mmiscool

Thanks for the suggestions. Screen works fine, of course. I'm evaluating the possibility of using the Pi Zero as a cheap adapter to turn serial data into a basic graphical display via HDMI. It may be too slow, I know... :P

janbbeck avatar Jun 03 '21 00:06 janbbeck

I should say that browsing with the built-in chrome was so-so at 1080p. So maybe at a quarter that resolution, it will work as a display...

janbbeck avatar Jun 03 '21 00:06 janbbeck

Just confirmed. Downloaded latest Raspbian and updated to latest software using apt. Uses Chromium version 88

janbbeck avatar Jun 08 '21 12:06 janbbeck

Ok, the data seems to come in and the web page updates quickly enough, but only if I plug and unplug the wire going in to the RX. As long as I leave the wire plugged in, there is no update. It just suddenly updates the window when I unplug the line.

Ideas?

janbbeck avatar Jun 08 '21 13:06 janbbeck

update: the performance improves dramatically after just updating GUI elements and removing the text box altogether. For example:

      // appendToTerminal(value);
      if (value.startsWith("vrms:")) {
        // starts with marker for voltage
        if (value.indexOf("\n") != -1) {
          // got the whole line
          voltageString = value.substring(5);
          var voltValue = parseInt(voltageString);
          if (typeof voltValue != "undefined") {
            if (typeof voltValue === "number") {
              if (!isNaN(voltValue)) {
                document.getElementById("voltage").value = voltValue;
                document.getElementById("voltage1").innerHTML ="Voltage: " + voltValue + " V";
              }
            }
          }
        }
      }

where voltage is a < meter > tag and voltage1 is a < H1> tag.

janbbeck avatar Jun 08 '21 15:06 janbbeck

And under android I get serial connection failed, even when enabling the experimental features (which are also disabled there by default; v91) using terminal program under android works fine.

janbbeck avatar Jun 10 '21 19:06 janbbeck

@janbbeck I do not believe that android has support for serial devices to be recognized by the browser at the moment. As far as I know no USB to serial drivers are built in to the android kernel. To interface with USB to serial devices from android the driver has to be built to use the raw USB functionality and package its own drivers in to the app.

If you were able to get this working on an android device I would be interested in knowing the manufacturer and model number along with the android and chrome versions.

mmiscool avatar Jun 15 '21 03:06 mmiscool

Interesting. However, the API that serialTerminal is using can also access USB devices via the USB ids, can it not? Any way to enable serial devices that way?

janbbeck avatar Jun 28 '21 15:06 janbbeck

No. There is a separate webUSB api but you need to write a specific driver to interface with a particular USB to serial converter. IE. Not universal.

mmiscool avatar Jul 03 '21 04:07 mmiscool