1

I have a script on my pi that currently simply outputs some numbers from a sensor to the console, several times a second. I am using this for a demonstration, and need a way to reliably (not over the network) stream this data to my Linux-based laptop, so that a program there can read and interpret it to incorporate it into my demo. Can the pi's USB cable be used as some sort of serial output device, piping in my script's output and streaming this data to a socket or /dev entry on my main device? (And, of course, how could I pull this off?)

I am on a Raspberry Pi 3 B+. I don't have any additional hardware (console cable etc) nor the time or money to order one, I just want to establish some sort of socket / serial connection over the Pi's USB cable.

5
  • What model Pi are you using? Why can't you use the existing console cable? Have you considered a USB to serial dongle? May 9, 2018 at 0:55
  • @SteveRobillard I am on the Pi 3 B+. Actually, I wasn't aware that a GPIO pin solution was an option. Will look into it, looks like it might work perfectly. May 9, 2018 at 1:04
  • What do you mean by by "rpi outputs numbers from sensor to console"? Is it something like below? - rpi reads a sensor, say temperature sensor, then outputs the number value to the rpi terminal window, or IDLE python interpreter REPL window?
    – tlfong01
    May 9, 2018 at 1:04
  • @tlfong01 I mean my script prints numbers (as ASCII) line by line to stdout over time. I want to transmit this output to my PC instead for interpretation by another program, over wires instead of the wireless network (as my network access is limited there). May 9, 2018 at 1:06
  • @Ethan McTague. I have played these things before. Let me suggest an answer. I am very slow in English, and commenting here allows only 5 minutes at most, and editing only once, that is hard for me.
    – tlfong01
    May 9, 2018 at 1:15

1 Answer 1

3

This answer describes how to transfer plain text between PC and RpiB, using a serial cable.

At the PC side, an usb to serial adapter can be used to converts PC's USB signals to 5V UART serial signals .

At the Rpi3 side, there are 2 GPIO pins: UART0 Txd, Rxd for data transfer at 3.3V level.

These Rpi UART signals at 3.3V should be shifted up to 5V, then PC and Rpi can communicate at the same logical level.

/ to be continued, ...

USB to TTL UART adapter

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.