LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
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


Reply
  Search this Thread
Old 08-18-2022, 05:30 PM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 924

Rep: Reputation: 61
Talking 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.
 
Old 08-18-2022, 05:43 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,761

Rep: Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322
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.
Old 08-18-2022, 05:51 PM   #3
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 924

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by michaelk View Post
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!
 
Old 08-18-2022, 06:16 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,681

Rep: Reputation: 8154Reputation: 8154Reputation: 8154Reputation: 8154Reputation: 8154Reputation: 8154Reputation: 8154Reputation: 8154Reputation: 8154Reputation: 8154Reputation: 8154
Quote:
Originally Posted by wh33t View Post
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
 
Old 08-18-2022, 06:21 PM   #5
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 924

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by TB0ne View Post
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.
 
Old 08-18-2022, 06:30 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,761

Rep: Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322Reputation: 6322
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Over a decade on, and millions in legal fees, Supreme Court rules for Google over Oracle in Java API legal war LXer Syndicated Linux News 0 04-06-2021 12:03 PM
LXer: Patents, Legal Collaboration and our Legal Summit LXer Syndicated Linux News 0 03-15-2012 07:11 PM
LXer: How TCP Offload Engines scale up the TCP traffic bandwidth by up to 8x on existing Ethernet Ne LXer Syndicated Linux News 0 02-16-2012 10:01 PM
LXer: SCALE 8x Update: Jobs@SCALE (not Steve), T-shirts, SCALE Uni and UpSCALE talks LXer Syndicated Linux News 0 02-13-2010 01:10 PM
Managing saved html files in easily queryable fashion? bramadams Linux - Software 2 08-01-2004 06:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 11:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration