Ragooman
Posts: 13
Joined: Sun Jun 26, 2016 11:19 pm

Possible to transfer data with the USB port to the PC ?

Wed Nov 08, 2017 11:31 am

Hi,
I was wondering if I can do the same thing on the Raspberry PI as I do the Arduino and use the USB port as a COM port and transfer data to the PC. I did this with the Processing language and communicated with the Arduino. But now I like to use the RPI because it's more powerful. Then I can display this data in a table or graph. I like to use the Raspberry Pi without a monitor or keyboard, and place this in a small enclosure. Also, I would send all commands via the PC to start and stop certain tests to collect data.

User avatar
topguy
Posts: 6491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Possible to transfer data with the USB port to the PC ?

Wed Nov 08, 2017 2:58 pm

The Raspberry Pi Zero do support Linux USB-Gadget ( http://www.linux-usb.org/gadget/ ) so it can then emulate a serial device. But you will use the only USB port on the Zero.

For all the other models of the Raspberry Pi you will need to buy some kind USB2Serial device and connect to the USB port. But you probably also need one for the PC since PC's dont come with serial ports anymore.

So basically: Pi -> Usb2Serial -> Nullmodem cable of suitable length -> Usb2Serial -> PC.

Its about this time you should ask yourself: "hmmm.. this is complicated , why not use networkcable, wifi or even Bluetooth instead ?"

danjperron
Posts: 3502
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Possible to transfer data with the USB port to the PC ?

Wed Nov 08, 2017 3:34 pm

Like you said the Raspberry Pi is more powerfull. Then use the network!
The raspberry Pi could crunch the number, be a web server and the network is 100Mb/s instead of a serial at 115200 baud. This way you could interact with it using your phone, your computer and even be outside your home and get information.

I'm using my old Raspberry Pi first generation model B has a server to control my IOT devices with my echo dots and read all my sensors with it. This way I could just ask Alexa (echo dots) to read a specific sensor or turn a light on.

Also with the build-in web server it is easy to display all sensors info without the needs to another computer.

Also this gives you the possibility to add more than one Raspberry Pi . You are not stuck with a single point connection.

Ragooman
Posts: 13
Joined: Sun Jun 26, 2016 11:19 pm

Re: Possible to transfer data with the USB port to the PC ?

Wed Nov 08, 2017 6:33 pm

topguy wrote:
Wed Nov 08, 2017 2:58 pm
The Raspberry Pi Zero do support Linux USB-Gadget ( http://www.linux-usb.org/gadget/ ) so it can then emulate a serial device. But you will use the only USB port on the Zero.

For all the other models of the Raspberry Pi you will need to buy some kind USB2Serial device and connect to the USB port. But you probably also need one for the PC since PC's dont come with serial ports anymore.

So basically: Pi -> Usb2Serial -> Nullmodem cable of suitable length -> Usb2Serial -> PC.

Its about this time you should ask yourself: "hmmm.. this is complicated , why not use networkcable, wifi or even Bluetooth instead ?"
I see your point here, it becomes more cumbersome doing it that way
I'll have to think about moving to a network connection.
I've used UDP communication before to transfer data to the PC on the arduino using Processing - but I had to buy ethernet shield for this.
Since the ethernet port is included on the RPI board it maybe the best solution
thanks for the advice
Last edited by Ragooman on Wed Nov 08, 2017 6:35 pm, edited 1 time in total.

Ragooman
Posts: 13
Joined: Sun Jun 26, 2016 11:19 pm

Re: Possible to transfer data with the USB port to the PC ?

Wed Nov 08, 2017 6:34 pm

danjperron wrote:
Wed Nov 08, 2017 3:34 pm
Like you said the Raspberry Pi is more powerfull. Then use the network!
The raspberry Pi could crunch the number, be a web server and the network is 100Mb/s instead of a serial at 115200 baud. This way you could interact with it using your phone, your computer and even be outside your home and get information.

I'm using my old Raspberry Pi first generation model B has a server to control my IOT devices with my echo dots and read all my sensors with it. This way I could just ask Alexa (echo dots) to read a specific sensor or turn a light on.

Also with the build-in web server it is easy to display all sensors info without the needs to another computer.

Also this gives you the possibility to add more than one Raspberry Pi . You are not stuck with a single point connection.
I see your point here, I'll have to consider about moving to a network connection.
I've used UDP communication before to transfer data to the PC on the arduino using Processing - but I had to buy ethernet shield for this.
Since the ethernet port is included on the RPI board, it maybe the best solution
thanks for the advice

Return to “Beginners”