0

I may be confusing a few concepts here so any help is appreciated.

Q1: Is it possible to attach any sensor in the world to the USB on my computer as long as it gives me analog data, and read its output? (e.g. pH, temperature, oxygen sensor etc as long as it gives me analog data)

Q2: If so, then what is the simplest way in python for me read such data.

Comment: I am trying to bypass using PLC's, and trying to see if I can get the output from the sensor directly to the PC. (I do not have drivers for these sensors)

Actual Need: I have an oxygen sensor connected to my computer via a USB. The oxygen sensor is able to send out analog data. The obvious way is to go through a PLC. However, I would like a solution which by-passes PLC's so I can connect the sensor directly to my PC via USB.

2 Answers 2

1

The USB port on your computer cannot read analog data because USBs work with digital signals. You would need an analog-to-digital converter (ADC).

Sign up to request clarification or add additional context in comments.

1 Comment

Is there an ADC built-into the motherboard of the PC which can be used for this process? Can programming alone solve this or is an external hardware required?
1

as @digitaLink answered, it is not possible directly via USB and yes, the obvious way is to use a PLC. I would go the PLC way - in fact, I did it a few times in the past - and start with an Arduino and later develop a custom PCB, put it in a box and done. Another possibility is to use a raspberry pi (or similar SBC), which has the GPIOs you can use for analog read.

Edit: there is another possibility. The sensor you use now is _very_likely_ a PLC in itself, that is, the sensor is attached to a microcontroller that uses the USB port for serial communication. Now, the drivers you are missing do nothing else but decode the data coming through the serial port. Take a look inside your harware and try to find out what components there are in. So what you could do is to try to find out how to communicate with the sensor via a serial terminal. It is probably possible to monitor serial communication (although I must admit, I don't know how to do that), reverse engineer the code and write your own driver in python. You could learn a lot from this, even if you don't succeed.

8 Comments

What is the difference between a Serial Terminal (Com Port 1, 2, etc...) and the USB? Sometimes I notice in the device manager that a COM Port 1 just shows up, and other times it is not there? Are these two different things? Can a USB turned into a COM Port?
USB can be used as a virtual COM port. Used mainly because of its relative simplicity/reliability and legacy stuff.
I am able to get USB outputs from the sensor now (digital). Would you know how I can take those digital outputs to my USB on the PC and read out the data? Without having the driver installed for the sensor. Just outputs coming in, and I need them to read out in a python program.
What do you mean by "I am able to get USB outputs from the sensor now (digital)."? What do you have, the readings?
Sorry, it was theoretical. That if I solved the analog problem.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.