Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux? |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-18-2022, 05:30 PM
|
#1
|
Member
Registered: Oct 2003
Location: Canada
Posts: 924
Rep:
|
How might I go about making a serial device (legal for trade scale) queryable over TCP/IP?
So what I am trying to do is make a server running the LAMP stack retrieve a number off of a scale on the opposite side of the building. Network scales apparently exist, and if it comes down to it, we'll just bite the bullet and purchase one. But if possible, I'd like to consider my options for making serial data available over TCP/IP.
How it works right now, the scale is connected to a laptop over a rs232-to-USB cable. A win32 program is launched on the laptop, and when the number on the scale changes, the computer can read that number in essentially real time into this program. The staff can then click record and it outputs it into a CSV sheet.
IMO, the perfect upgrade to this whole system would be to somehow let Apache/PHP make a simple CURL or file_get_contents() request to an IP address of the scale, like http://192.168.10.13:/scale_display, and that page hit would return whatever number is currently displaying on the scale, maybe in JSON but any format would work.
Does such a device exist that would make something like this possible? I feel like I might be able to assemble this with an ESP32 and some trickery.
Any thoughts?
Last edited by wh33t; 08-18-2022 at 05:31 PM.
|
|
|
08-18-2022, 05:43 PM
|
#2
|
Moderator
Registered: Aug 2002
Posts: 26,761
|
There are commercial serial to ethernet boxes available but you can also use a Raspberry Pi or other SBC and use socat to do the same thing. If you know the serial commands to access data you can write any program of your choice.
You can also use ser2net on the far end to create a virtual serial port and then use any linux serial port based program to access the scale.
|
|
1 members found this post helpful.
|
08-18-2022, 05:51 PM
|
#3
|
Member
Registered: Oct 2003
Location: Canada
Posts: 924
Original Poster
Rep:
|
Quote:
Originally Posted by michaelk
There are commercial serial to ethernet boxes available but you can also use a Raspberry Pi or other SBC and use socat to do the same thing. If you know the serial commands to access data you can write any program of your choice.
You can also use ser2net on the far end to create a virtual serial port and then use any linux serial port based program to access the scale.
|
Brilliant, thank you!
|
|
|
08-18-2022, 06:16 PM
|
#4
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,681
|
Quote:
Originally Posted by wh33t
So what I am trying to do is make a server running the LAMP stack retrieve a number off of a scale on the opposite side of the building. Network scales apparently exist, and if it comes down to it, we'll just bite the bullet and purchase one. But if possible, I'd like to consider my options for making serial data available over TCP/IP.
How it works right now, the scale is connected to a laptop over a rs232-to-USB cable. A win32 program is launched on the laptop, and when the number on the scale changes, the computer can read that number in essentially real time into this program. The staff can then click record and it outputs it into a CSV sheet.
IMO, the perfect upgrade to this whole system would be to somehow let Apache/PHP make a simple CURL or file_get_contents() request to an IP address of the scale, like http://192.168.10.13:/scale_display, and that page hit would return whatever number is currently displaying on the scale, maybe in JSON but any format would work.
Does such a device exist that would make something like this possible? I feel like I might be able to assemble this with an ESP32 and some trickery.
|
A little confused...is this a Linux system that the scale is connected to? You mention a win32 program, which is why I ask. Also, it'd seem to be (if you have a full LAMP stack), that the "M" for MySQL would be far better to shove data into, rather than having it go to a CSV sheet. But without knowing what you're goals are for the data/CSV, it's hard to say.
This may also be in play: https://stackoverflow.com/questions/...nux-compatible
|
|
|
08-18-2022, 06:21 PM
|
#5
|
Member
Registered: Oct 2003
Location: Canada
Posts: 924
Original Poster
Rep:
|
Quote:
Originally Posted by TB0ne
A little confused...is this a Linux system that the scale is connected to? You mention a win32 program, which is why I ask. Also, it'd seem to be (if you have a full LAMP stack), that the "M" for MySQL would be far better to shove data into, rather than having it go to a CSV sheet. But without knowing what you're goals are for the data/CSV, it's hard to say.
This may also be in play: https://stackoverflow.com/questions/...nux-compatible
|
The scale is currently connected to a Windows laptop, the program that reads the serial output from the scale is a win32 binary, that win32 program saves the scale read outs in a CSV. That CSV eventually makes it to another department through email or memory stick, and it is then manually copied over into a section of our Intranet or imported through a script.
I want to do away with this whole setup and have the number directly make it into our LAMP server which runs the Intranet, and I want this to happen with a single click from the Intranet. The only part I am unsure of is how to get that number off the scale when the only access I have to that number is through serial. There is also 9 of these scales in various parts of the facility. I want to be able to connect to all of them over TCP/IP in this way.
|
|
|
08-18-2022, 06:30 PM
|
#6
|
Moderator
Registered: Aug 2002
Posts: 26,761
|
I was going to do something similar but my company was going to purchase a new scale with builtin ethernet/wifi capability. Of the electronic displays I looked at it was common to have several modes. Constant output (plain ASCII text) for a remote display which is probably how yours is currently working and some command mode that queries the scale which is what I was referencing.
You can also do a remote display with the Pi and then use TCP/IP to send it or make it available to where ever you need the data to go.
|
|
|
All times are GMT -5. The time now is 11:52 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|