2

DIY Wireless Serial Adapter Speaks (True) RS-232

 3 years ago
source link: https://hackaday.com/2021/04/18/diy-wireless-serial-adapter-speaks-true-rs-232/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

DIY Wireless Serial Adapter Speaks (True) RS-232

There is a gotcha lurking in wait for hackers who look at a piece of equipment, see a port labeled “Serial / RS-232”, and start to get ideas. The issue is the fact that the older the equipment, the more likely it is to be a bit old-fashioned about how it expects to speak RS-232. Vintage electronics may expect the serial data to be at bipolar voltage levels that are higher than what the typical microcontroller is used to slinging, and that was the situation [g3gg0] faced with some vintage benchtop equipment. Rather than deal with cables and wired adapters, [g3gg0] decided to design a wireless adapter with WiFi and Bluetooth on one end, and true RS-232 on the other.

The adapter features an ESP32 and is attached to a DB-9 plug, so it’s nice and small. It uses the ST3232 chip to communicate at 3 V logic levels on the microcontroller side, supports bipolar logic up to +/-13 V on the vintage hardware side, and a rudimentary web interface allows setting hardware parameters like baud rate. The nice thing about the ST3232 transceiver is that it is not only small, but can work from a 3 V supply with only four 0.1 uF capacitors needed for the internal charge pumps.

As for actually using the adapter, [g3gg0] says that the adapter’s serial port is exposed over TCP on port 23 (Telnet) which is supported by some programs and hardware. Alternately, one can connect an ESP32 to one’s computer over USB, and run firmware that bridges any serial data directly to the adapter on the other end.

Design files including schematic, bill of materials, and PCB design are shared online, and you can see a brief tour of the adapter in the video, embedded below.

RS-232 on serial interfaces was around for a long time, so we’ve definitely not seen the end of projects like this. [g3gg0]’s board would sure have made it easier to IoT-ify this old LED signboard.

Posted in Microcontrollers, Retrocomputing, Wireless HacksTagged adapter, bipolar locig, bluetooth, bridge, rs-232, rs232, serial, vintage, wifi, wireless

Post navigation

58 thoughts on “DIY Wireless Serial Adapter Speaks (True) RS-232”

  1. bigredlevy says:

    *DE-9 not DB-9
    D-subminiature 9 pin connector size E.
    https://en.m.wikipedia.org/wiki/D-subminiature

    1. Commodore Z says:

      Wow, someone beat me to it!

      1. Nick says:

        What I’m really struggling for at the moment is to connect an RS-232 only console device to a device which only has USB console.

        Several new models of enterprise UPS now come only with USB console, meaning we can’t connect it to our console servers.

        We have ethernet access to them of course, but always good to have console there as a backup.

        I’m wondering if one of these could be setup to connect to the UPS USB console, and pass that /dev/ttyUSBX interface out to a onboard DB-9 / DE-9 – or better – an RJ45 cisco/YOST port.

        1. Nick says:

          Sorry – inadvertently replied when I meant to post a new message.

        2. BobbyMac says:

          Are you trying to remote boot the server? or querying the UPS for event status? Most of the large servers I have worked with have alternate NIC adapters that allow direct rebooting/control via console of the server through that separate internet connection. Which can save you if a reboot doesn’t take after an update and the server is 500 miles away in a secure facility at night. So electrically “pulling the plug” if you will, but for the server, not the UPS.

          They do have inexpensive USB to RS232 adapters for like 12 bucks, a USB cable with a RS232 head that has the circuitry in it. The big problem I always found was that writing software with those devices can be hard to interface via USB if you are rolling something say in DOS that needs a special USB driver (since comm 1-4 was only available before USB without special boards) – given the USB cable installs comm as like COM32, etc. It shouldn’t be effected with terminal software, all of which I have seen address the issue and allow USBCOM with a very large range.

        3. Michal J. says:

          I struggled with that, too. And then I made a DE-9M to USB cable using cheap-o “cisco console” cable and a blank DE-9M to RJ45-female part from Startech.

          Details here: https://wejn.org/2021/02/howto-usb-cable-for-APC-Smart-UPS-SC450RMI1U/

          Maybe it can help?

          I mean, this solution is for sure sexier. :-)

          1. Nick says:

            Thanks – unfortunately that does the opposite of what I need

    2. Randy Kaminsky says:

      True. ‘B’ is a 25 pin while ‘E’ is 9.

      1. BobbyMac says:

        I’ve never heard of the “DE-9” connector. They are used interchangeably apparently. I always thought it was DB-9. “B” being the shell size – Weird. It’s also very possible that I have brain damage. I think it’s the miles, when I hit 60 stuff started failing….especially my brain. I know this because development projects that I created were done by someone WAY smarter than I am looking back now on the code. :)

  2. Nath says:

    I’d like to see such a simple.tiny adapter but for ethernet (to wifi) instead.

    1. Nathan says:

      So basically a router, but tiny?

      I’m prety sure the esp32 has an ethernet MAC, so should be prety simple on the hardware side. In fact, this might have been done by somebody on the internet.

    2. Slurm says:

      you can (could ?) already buy them. i have used a handfull of them. you are looking for a “wifi ethernet bridge”. there are a few solutions. i used to use the NETGEAR WNCE2001 Ethernet to Wireless Universal Adapter. it needs power, you connect it to the wifi over WPS (i think it also had a basic web interface) and it has one ethernet port and will brige between them. you could connect any device with an ethernet port to the wifi with this adapter. but i guess it is not as uesefull these days anymore. most devices have wifi build in nowadays.

      1. x says:

        But it’s *gigantic* in size.

        1. Slurm says:

          it’s over 10 years old and also EOL. it was just an example that this kind of device already exists for quite some time. someone has posted smaller devices below.

    3. g3gg0 says:
      1. Nath says:

        That’s the first device of its kind that is actually compact. Is it powered parasitically or does it need external 5V PSU ?

        1. BobbyMac says:

          The schematic shows a micro usb-B connector with 5v needed. It uses an AMS1117-3.3 regulator to reduce the operating voltage to 3.3 for the chip if I’m reading this correctly.

          1. g3gg0 says:

            Thats true for my ESP232 adapter. I think Nath referred to the aliexpress part that i linked.
            He was in search of an Ethernet/Wifi Adapter that small.

            That aliexpress thingie does not have any connector from the looks – you have to provide 5V there too.

          2. BobbyMac says:

            Looking at the schematic, it seems like this really isn’t true full RS232, it doesn’t have any hardware handshake protocols, only software handshake presumably – DTR is wired high all the time, which without a ring buffer/16 byte FIFO on a typical UART runs the risk of overrun, and since this will be connected to some old funky hardware – it’s unlikely that hardware will have overrun protection on it’s chips. Given I can’t see the code, even if you implement a ring buffer there you still can’t know if the device can receive a character unless it supports Xon/Xoff, and I can tell from experience a lot of hardware didn’t.

            Maybe I’m just being too critical. But figuring out how to pass RTS/CTS signals back and forth to the connectors would solve this issue I believe.

    4. Mike says:

      No one has heard of Lantronix ? These same things have been there for over 10 years.
      Ethernet to serial bridge or Wi-Fi to serial bridge.
      https://www.lantronix.com/products-class/wired-device-servers/

      1. robomonkey says:

        Or Comtrol.

        https://comtrol.com/products/devicemaster-ethernet-device-servers

        hmmm, how do I make that link??

      2. Wiregeek says:

        The Lantronix UDS-1100 and the 500-171-R adapter was such a wonderful thing for RS-485 work, astonishingly wide power input capability and astonishingly capable RS-485 just doonk doonk doonk right there. Sturdy units too! Had a failure mode once where the accumulated ice ripped the RS-485 wires in half… but the device server kept running!

  3. RndName says:

    USB is only used for power(D+,D- are unconnected)

    1. g3gg0 says:

      Yeah, correct.
      My text only meant that you could use a *second* ESP32 board and use it as a USB/WiFi/RS232 bridge.
      Maybe a bit misleading in wording, will clarify this.

  4. sasa says:

    +1 for the ESP232 name :)

  5. Owlman says:

    “a bit old-fashioned about how it expects to speak RS-232”

    How can you be old fashioned about adhering to a standard? This standard doesn’t say anything about the data format as you imply, it does say a lot about the physical and electrical characteristics.

    Asynchronous serial data using 0/3v3 or 0/5v has nothing whatsoever to do with RS232, beyond being capable of being converted to comply.

    1. BobbyMac says:

      Yeap, -12 to +12. It was always a pain to need to build dual power supplies for projects that used RS232. The Maxim chip made a big difference on that when it came out.

      1. Joshua says:

        The MAX232 was/is a bit limited, though. Only three or so data lines could be handled simultaneously, if memory serves. :(

        Anyway, the charge pumps (right English term?) were really useful. The MAX232 could be used as a generator for +/-12v, I believe.

        1. BobbyMac says:

          Right term “charge pumps”. It was that dual +/- supply that made it so attractive for projects. Of course you could always make a simple power tap with a few diodes off an existing step down transformer. And most TTL circuits were 5 volts since CMOS wasn’t widely used until the 80’s anyways – you were stuck trying for a dual power supply +5/ -12+12 . Although the +12/-12 supply was very low current and didn’t need anything beefy.

          But in a day when even transformers for 1 or 2 amps at 15v were like 20+ dollars at Radio Shack a hobbyist had to be careful what they used. The wall warts didn’t seem to be widely used at that time as an alternative – I think it was because they couldn’t provide enough current for any major device without becoming a large component in itself. The old ones I have (used on some modems – 300 baud speed demons) are like 3″x4″x3″ just for a 5v/2 amp output.

  6. Lee says:

    He offers the Schematics and Gerber files for the PCB but not the firmware….

    1. g3gg0 says:

      it’s nothing special, just a small arduino project with optional OTA enabled.
      the only special thing is the “enable OTA” mode when you bridge Rx/Tx.
      (had problems with OTA causing spurious resets within WiFiUDP code, thus i disabled it by default)

      will upload it the next days, stay tuned.

  7. Mart says:

    woah great stuff thks for sharing it, will order some boards

  8. James Forrest Longley says:

    RS-232 is a 25 pin physical standard. Is this EIA/TIA 574?

    1. BobbyMac says:

      Many manufacturers went to db9 connectors for terminals. Only the DCE stuff really used a full 25 pin connector since they were expensive back then and not really needed for terminals. So DTE would only use send, receive, signal ground, and DTR, maybe RTS/CTS. But most video terminals could handle 19200 baud without overrun so they didn’t bother with handshake other than Xon/Xoff and DTR for terminal ready. (Data Communications Equipment, Data Terminal Equipment)

      1. Jim Longley says:

        Since I used to teach serial communications, I understand all the leads, which is why I know that a 9 pin interface cannot be RS-232, thus my question, is it 574?

        1. BobbyMac says:

          RS232 is an electrical standard AND a protocol – sort of. While most People commonly see it as a connector style, it really isn’t. Originally RS232 used the DB-25 connector. The DE-9 (As I have been corrected) RS232 interface uses RS232 signal levels. They just crunched down the number of pins that were used into a smaller connectors when IBM went to the PC standard serial ports, other manufacturers, like Contel also used 9 pin connectors for their terminals, mimicking the pin positions as close as possible and the signal levels. Those MAY match 574, depends on who made the interface.

          There were a lot of different companies doing their own thing when it came to comms. It’s why RS232 was such a wild west area for a long time – you needed a breakout box on some systems to figure out the pin assignments, since many used the 8250 UART chip, others, not so much. On Contel systems we had to make custom cables for a given device, even though they followed the signal levels correctly. Another example is Honeywell Level 6 systems, they used RS232 levels, but inverse signals for things like RST/DTS from the standard.

          We think of DTE as pin 2,3,7 and 20 normally for RS232/DB-25. Obviously DCE commonly used for modems required the larger connector because it used more signals like RTS/CTS and may others. Since 574 is listed as a separate standard from RS232 I would say no, but I can’t speak to the electrical characteristic of that standard when compared. But that doesn’t mean they aren’t overlapping.

          Here is a datasheet with multiple standards listed individually with the pin outs, maybe that better explains the standards: https://www.ti.com/lit/an/snla039/snla039.pdf?ts=1618889377562&ref_url=https%253A%252F%252Fduckduckgo.com%252F

  9. BobbyMac says:

    If anyone is interested, I’m pretty sure this leads to putting a full wireless terminal on it with VGA output, it has multi-language keyboard and on board setup features, making it really easy to use. This is one I have built many times, which you can get the software for – VT100 emulator (Geoff’s Projects): https://geoffg.net/terminal.html

  10. Owlman says:

    The standard allowed a range from 15V to 5V, positive and negative as I recall – I still have a couple of the Maxim chips in my component drawers, they used +10 and -10 and worked with everything I ever tried them with.

    1. Owlman says:

      Rats! I replied to the wrong comment… oh well, BobbyMac, you know which comment I was replying to ;~P

      1. BobbyMac says:

        Yes. But I remember distinctly that +5/-5 wouldn’t work on may printers and terminals. They needed a higher swing/crossing voltage. It’s possible that it was 15v, I just always used +12/-12 since that was what the equipment I was working on used. Not sure I have ever used the maxim chip other than the terminal hardware I posted on. I just always used the spec I had been accustomed to. I still have 25 pin and 9 pin breakout connectors and cables for that stuff, even null modem cables – just can’t bring myself to throw them away. Interesting thing though, when People talk about “RS232 Standard” it never really was, I mean on paper – but if was pretty much the wild west in the 70’s and 80’s for RS232 and the pin outs. Remember 20ma current loop? Man that goes back a long way.

  11. Cbob says:

    RS-232 standards, pick one or make up your own. Quite some time ago, it was a running joke.

  12. zoobab says:

    You could combine an ESP8266 HC22 4 pins to the 4 pins of an RS232 MAX3232 TTL adaptor:

    http://zoobab.com/esp8266-hc22

    https://www.aliexpress.com/item/4000055222836.html

    And install the jeelabs firmware to do the serial bridge:

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

  13. Dennis says:

    A glimmer of hope for Ethernet-free CNC-machines e.g. from fanuc :)

  14. Nick says:

    I don’t work with ‘server’ servers – I’m a network engineer primarily :)

    I’m referring to console servers, like Lantronix, Perle, Comtrol etc.

    All ours are Serial only, and changing them out isn’t feasible (we’re talking thousands of them) Sadly these new UPSs only have usb console, no RS232 console, so I’m wondering whether we can hack together a microcontroller to convert from USB to Serial – but in the opposite direction to the way most people do.

    1. Nick says:

      LOL – I try to leave a root level comment and it replies to a random other comment, then I reply to a specific comment and it turns up as a root comment.

    2. BobbyMac says:
      1. Nick says:

        Unfortunately no – both of those are for connecting an RS232 device to a USB host.

        What I need is the opposite – to connect a USB client to an RS232 host.

        That is going to require an active device like a microcontroller or SBC that can connect to the USB device, get the virtual serialport (usually /dev/ttyUSBx or /dev/ttyACMx) and then connect that to an onboard DB9 that my console servers can interact with.

        I’ll probably give it a go with an RPi to prototype, but was wondering whether the microcontroller here would do it.

        Thanks all for the responses!

    3. zoobab says:

      CH559 has USB host, would be fun to do the reverse USB->TTL.

      1. Nick says:

        Interesting, I’ll take a look, thanks.

    4. rpavlik says:

      So a lot of micros have USB host capability (acting like the computer, not the peripheral) though I’m not sure I’ve seen any examples using cdc-acm USB serial. If your devices use some other proprietary USB serial adapter, you’d be even more on your own. (I assume you have fancy enough ups that they don’t use the HID UPS protocol like my consumer one? That would actually be easiest because hid is probably the most popular thing to host on USB on a micro. Cdc-acm always seems to be crazy complex, at least in the descriptors.)

  15. George says:

    Ah I remember the days of the Apple //e, 7 modems, and a little piece of software
    called Diversi-Dial. The modems were internal and took up the 7 slots in a //e.
    300 baud chat with a rudimentary email system, quite advanced for the time.
    I met my first love on such a system. I find it heartening that people still
    use RS232. Today, with our gigabit ethernet and multi-meg download speeds,
    that 300 baud seems ancient by comparison. Still, it’s nice to see people
    remembering the past, even if it is wirelss RS232.

  16. CheapB says:

    This is incredible nice and useful. If someone made this in a case for a reasonable price I would def be in the market instead of adding a RS232-TTL converter that is as big as the MCU.

  17. Er says:

    Isn’t this literally the reason why the ESP8266 exists, but it was “hacked” to become more in the form you know it today? Its still sold as a WiFi Serial adaptor

    1. rpavlik says:

      That’s ttl-level serial (well, lower actually, since I think technically ttl is 5v?): 0v to 3.3v. “RS232 serial” (desktop serial port serial) is the same basic protocol (as most often used – though it frequently has some extra control lines), but with a huge voltage swing, like -12 to +12V. That’s why there’s the extra chip on the back of the board – to convert the signal voltage levels.

      Back in the day rs232 meant more, I think, with all kinds of flow control, etc lines, but at least as far as I hear it uses, it mostly means tx, rx, maybe cts/rts/dtr, and a big bipolar voltage swing.

    2. spec says:

      Yes. The ESP8266 was originally brought to market as a wi-fi to serial bridge, and someone figured out how to stuff their own firmware on it. Esprif didn’t miss a beat and embraced people putting their own code on it and released an SDK. Funny how sometimes when things go full circle, people don’t realize that they’re back where they started.

Leave a Reply Cancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK