I have a project at work I could use some help with.
There are two RS232 serial devices that were never meant to talk to each other. The receiving instrument has some data registers that can be populated by input from its serial port from the sending device. It must be formatted in a specific way, of course, but really isn’t too complicated. Let’s say it needs a prefix of startvar1: and a suffix of endvar1. So an acceptable input would be
startvar1:10.0endvar1[CR][LF]
for a value of 10.0.
The sending device has a pretty simple output where the numeric value of interest is always within a particular window of the fixed length string. So an example transmit might be something like
Speed 10.0 m/s[CR][LF]
Another example is this:
Speed 100.0 m/s[CR][LF]
Both examples are 22 characters long. The numeric portion is space padded so that it always comes to 22 chars.
I’m looking for a device that takes the numeric value of the sending device, strips away the prefix (Speed) and the unit of measure (m/s). Then, it inserts the remaining number between the receiving device’s prefix and suffix.
I’d previously used a PS/2 keyboard wedge that happened to have a feature where you could redirect the parsed and inserted value to an output serial port on the wedge. However, these have been discontinued and the manufacturer has confirmed that they don’t have anything that will really work properly in the catalog anymore.
You could probably find some gadget that will let you program it to do what you want, but an ESP32 board (or Arduino with software serial) would let you do exactly what you need for under $25.
I’m pretty close to envisioning how the circuit would look and how the sketch* would be written, based on half a dozen examples I’ve seen floating around the web.
Well, you’d need an RS-232 level shifter (a MAX3232 or the like) for < $10 as well as an Arduino Uno or similar. Unless we’re using “RS-232” incorrectly and this is just TTL-level asynchronous serial?
I had to do a similar thing with an 8051 core processor. I found a nifty software-serial library that used the PCA for both send and receive, and it worked perfectly. The input to output translation was quite complicated, and bidirectional.
Well, yes, of course, a microcontroller or something more advanced could do it but there simply isn’t the time or budget for me trying to learn how to do all that. It’s not just getting it working on the breadboard, it would have to be a finished product in a housing with connectors for the DBx cables typically used for RS232.
I really need something ready built for this. Check page 11 (pdf page 15) of this manual:
That’s the entire setup screen. I’d check parsing/character removal, then non-numeric on the left for the input. Add my prefix and suffix to the output data format and it’s done.
I would doubt such a pre-made device exists, except that it obviously once did. The number of these types of devices I have heard of is now “one”, including the one you’re speaking of and can’t get any more.
Sorry, I am not aware of any existing products that do serial stream editing on the fly.
Yea, it’s kind of a dying yet lingering legacy standard. Their current wedge is a USB keyboard HID profile and does all of this and more but doesn’t have that RS232 pass through function. If I needed that string typed as text to a computer, it would be done.
Can you manage the programming aspect at least? You can buy “shields” for Arduinos that will handle the RS232 part. For example:
You can ignore the SD card part; you’re concerned about the dual RS232 ports. You’ll still need to shove it in a housing and do the programming (in C/C++).
I can see that now. And google tells me that anything you call a “wedge” in the data acquisition category is just that: serial in, USB HID or PS/2 keyboard out. The one you had was apparently unique, because I’m just not finding any on the current market with serial output as well as input.
Really, based on your description, I could whip something up in about 5 minutes. But you’ll still have to go through the initial learning curve of getting the environment set up, etc.
That’s exactly why I’m here. In the old days, a wedge would go inline between your keyboard and PC and ‘wedge’ the characters into the keyboard data. Wedges are almost all software now, running in the background and monitoring virtual com ports, usually to insert data into a computer program.
Hardware wedges have their uses, though. You can often install a keyboard (which is what the comp thinks the wedge is) without admin, unlike installing a software wedge. This also means it’s portable, you can use it in various places around the lab or office or plant. It is also probably going to be good at Windows updates since they should last as long as USB keyboards and I don’t see those going anywhere.
Is the receiving device a closed box, or is it software running on a standard PC?
Reason for asking: if the ultimate receiving end is on a PC, it seems like it ought to be possible to do this entirely in software (without modifying the application) - with a bit of code that reads the physical incoming serial port, makes the necessary changes, then outputs to a logical serial port that the receiving application is looking at.
At this point, I reckon Arduino probably is the most viable way forward. This is something that’s probably achievable with that RS232 shield linked by @Dr.Strangelove above, combined with a bit of copy/pasting of code from various internet resources - you won’t find it all in one place, but I think there will be copious examples of all of the pieces - i.e. how to read from the port; how to transform the string; how to output the result.
Not that I’m volunteering - I’m at the wrong end of the same learning curve.