Page 1 of 1

USB/RS232

Posted: 2019-09-12 02:04
by dharbitindy
One thing that would be very cool would be to have the ability to detect a signal from a USB, or RS232 comm port, and then count the elapsed time between the on / off /on signal. In other words, capture a cycle time from a machine if that makes sense. There may be a way to do than now, but I haven't seen any post referring to this. Basically, looking for a comm port and interacting with it.

Thanks,
David

Re: USB/RS232

Posted: 2019-09-12 05:49
by jsetzer
Maybe I did not get the point, yet. Can you please explain the use case a bit more.

As far as I know, the standard browsers cannot interact with the user's COM/USB ports or other hardware directly for security reasons. This means interaction with COM/USB can only work on the server's COM/USB ports.

From my experience such hardware-related interaction should be done by a separate service-application running on the server, for example a windows-service, which interacts with the hardward on the one hand side and then writes colllected data into your database on the other hand side. In the browser (on client side) you can use AJAX to get data from a serverside script which gets data from the database. But to be honest, this will never be real "realtime", I'm afraid, because every component takes its time.

There are libraries like SignalR (https://dotnet.microsoft.com/apps/aspnet/signalr) which offer "realtime interaction". It depends on the cycle, on the bandwidth, on the server's and the client's performance if it can work or not. If your COM-port signals change let's say in milliseconds this will be problematic. If it changes let's say every second, this will work many of the times. It it changes every couple of seconds, this will work most of the times.

Regards,
Jan

Re: USB/RS232

Posted: 2019-09-14 03:22
by dharbitindy
Jan,

Thank you very much for the reply and explanations. To explain the use case a bit further, I have a machine running in production and a typical cycle time would be 30 seconds between signals. The idea is to capture each cycle i.e., some machines are 30 seconds, some 45 seconds, etc. An I/O box could capture the signals and perhaps capture these to a database using Visual Basic, or some type of software perhaps. I'm just not sure how to get the data from there to the Website, but I'll certainly look at your suggestions that you mentioned and research this a bit more to see if I can understand it better. Thanks again for the detailed response.

Best regards,
David