Go Down

Topic: Serial Communication With a stripped USB (Read 250 times) previous topic - next topic


Hello, I am a beginner in Arduino coding and I have a homework. I stripped a usb cable to get the RX, TX, VCC and GND. I connected my Arduino to my laptop with the USB cable.

I connected RX from USB to PIN 1, TX from USB to PIN 0, VCC to 5V, and GND to GND. How can I do a serial read from the USB cable and display the data to the serial monitor?

Thank you


You can't, because a USB cable doesn't have RX and TX. It has D+ and D- which carry data in a different format to the serial that an Arduino can read on Pin 0 and Pin 1.


As you are apparently unaware:
The Uno (and all other Arduino boards based on a chip that doesn't have native USB) uses a second chip on the board (16u2 on official classic AVR boards, CH340G on most clone boards, and something different on the newest boards) which serves as a USB-serial adapter. When you plug it into the USB port, your computer sees the USB-serial adapter. That adapter is connected to the TX and RX pins of the Arduino, and translates between serial and USB.

A word of terminology: "serial" when referring to an interface only indicates that the bits are transferred one at a time over a single wire (or differential pair), as opposed to a parallel interface, which transfers multiple bits simultaneously over multiple wires. That sense of "serial" is the S in USB, the S in SPI - but it does not indicate anything else about the protocol or how data is encoded. However, when someone refers to "serial" without qualification, it refers to UART or TTL Serial, which is the interface with the RX and TX pins that gets used when you call Serial.print()
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Go Up