Using the ESP32 / ESP-8266 as a serial port server

Hey all, long time no see. This will cause confusion, so please let me clarify what I’m asking:

  • I am NOT asking about using Chilipeppr to gain access to program or otherwise use an ESP. The existing workspaces for that are wonderful and exciting and that is NOT my current interest.

What I am asking about is: Has anyone already implemented, or thought about implementing and rejected it for some reason, using the ESP as a serial port server?

E.g. your target device, be that a laser, CNC, Arduino, another ESP, whatever and you talk to it through the ESP which is wifi connected to your PC and is providing the serial port connection to that target device.

The advantages here are:

  1. You don’t need to electrically connect the device to your PC. Isolation via WiFi. If the device shorts out, you don’t fear taking your PC with it.
  2. You don’t need a PC near the device. E.g. the loud CNC / smelly laser / remote device can be “over there” in an isolated space and you can monitor / run it from “over here” on your PC via Chilipeppr.
  3. It’s easy to connect to and run devices that are in hard to reach spaces or that need to be mobile. ESP’s are tiny and will run on cheap batteries for a while. PC’s are not. Put one in a mobile robot and use your PC to drive it around.

Just seems like something that should be done. I’ve used ESP’s to do this but NOT following the JSON server data format. I don’t see why that couldn’t be added.

Thoughts?

1 Like

I’ve used esp-link for some low speed stuff for a while but recently moved to just using an rPi.

I had a Java client app running on an rPi before just moving the rPi to the RS232 device.

2 Likes

Thanks for the link, however, esp-link does not appear to be compatible with ChiliPeppr. At least not as far as I can see. Are you running the ChiliPeppr compatible serial server on the rpi?

Are you talking about ChiliPeppr streaming ascii gcode? If so any esp serial bridge would do. Or does ChiliPeppr stream something else? you mention JSON above?
I’m not terribly familiar with ChiliPeppr and am kinda confused by the above.

Well, first, I’m ALSO new to ChiliPeppr so it’s entirely possible that I misunderstand, but when I connect to the “serial port server” via the web browser, I get a /list/ of the ports available in JSON format. I assUme that this is expected by the workspaces? I mean, how else would it know that I have 2 built in serial ports and a USB adapter plugged into the PC I’m using for my CNC machine now? I don’t see anything in the esp-link system which shows a JSON format list of ports. It does list the ports, and perhaps could be adapted to support ChiliPeppr, but doesn’t appear to /at this time/. Is yes? No?

Having learned a bit more about chilipeppr I can see more clearly what you are getting at, essentially you are thinking of an esp32 port of serial-port-json-server; which is currently written in Go and only runs on platforms that Go supports. eg *nix. *bsd and windoze.

Maybe some of the older Chilipeppr hands have seen something like that discussed before, nothing popped up via google.

PS(edit) In the absence of that you should check out Wifi Serial Bridges and servers; this might be a good place to start; it talks about how to run the esp-link code @dougl linked to above to provide a ‘virtual’ serial port you connect to as if it was a local usb port or device, but actually talks to the esp over the WIfi to communicate with the controller.

It’s important to note that using WiFi/Bluetooth comms from a PC to a CNC controller is essentially a ‘solved problem’, and many people have done this using tools like esp-link.

1 Like

Oh, I think I understand. esp-link connected to CNC. Local PC somehow sees that as a local “virtual” serial port. serial-port-json-server on local PC connects Chilipeppr to the virtual serial port? Bit of a kludge, but hey, if it works, it works! Thanks.

1 Like

Yes, that is how I imagine this would be set up.
There may be alternatives such as having a PI (or similar) connected via USB next to the machine running serial-port-json-server. There may be other ways, I’m just not familiar enough with this to know.