1

I know it is possible to use arduino as usb to serial converter,and I know it is possible to communicate with raspberry console from laptop over serial cable.

I have RPi, arduino, 3 equal resistors and breadboard; I want to build a serial cable replacement from the parts I have to communicate from my laptop to my raspberry pi console.

Is that possible? How to do I achieve that?

3
  • that adafruit link doesn't work for me. is this the same resource? learn.adafruit.com/downloads/pdf/… Also, just to clarify are you wanting to go laptop-usb-arduino-serial-pi or lapatop-serial-arduino-usb-pi, both are possible
    – paddyg
    Jun 8, 2015 at 10:08
  • I want to connect this way: laptop usb - arduino usb; arduino serial - RPi serial
    – gerkirill
    Jun 8, 2015 at 10:19
  • P.S. PDF you mentioned is exactly the same (that adafruit webpage seems down right now).
    – gerkirill
    Jun 8, 2015 at 10:29

3 Answers 3

2

Arduino setup

  1. Make sure Arduino is not powered - we will power it later.
  2. Connect the RESET pin on the Arduino, to the GND pin on the Arduino. This isolates the processor from the IO-pins, so it does not mater if you have some sketch uploaded to your Arduino.

Wiring it all together

  1. Connect Arduino GND to RPi GND
  2. Connect Arduino TX directly to RPi XT
  3. Connect Arduino RX to RPi RX using voltage divider
  4. Connect Arduino to your laptop with USB cable
  5. Power your RPi if you haven't already done so

Voltage divider

Voltage divider allows to connect 5v output of Arduino RX pin to 3v RPi RX pin. This can be done for example with 3 equal resistors. You just need to connect them in series between Arduino RX and Arduino GND. Then you should connect RPi RX to the point shown below:

RX o --| R1 |-- o --| R2 |-- o --| R3 |-- o GND
                ^
             RPi RX

Accessing RPi serial console

Using Arduino IDE

  1. In arduino IDE go Tools -> Serial monitor
  2. In serial monitor window - select "Newline" as line ending and "115200 baud" rate
  3. Press "Send" button - this will send newline to RPi serial console and you'll get login prompt

Using Putty on Windows

  1. Check "Serial" connection type under "Session"
  2. Enter your COM port name into "Serial line" input (e.g. "COM3" - you can look into device manager to find it out)
  3. Enter "115200" into "Speed" input
  4. Press "Open" button, this will open new empty console window
  5. Press enter in console window and you'll be presented with login prompt
1
  • This answer is actually using an Arduino Uno (or similar) which has a separate ATmega16u2 for USB <> UART, and not an Arduino Micro, which does not. You can tell from the TX to TX and RX to RX connections (UART is usually RX to TX and vice versa), and the GND->RESET wire which completely disables the main Arduino chip on the board.
    – CletusW
    Jun 5, 2020 at 7:50
1

Some quite explicit instructions here, many others via google search "GPIO serial Raspberry Pi arduino"

http://blog.oscarliang.net/raspberry-pi-and-arduino-connected-serial-gpio/

If you knew before you purchased your arduino that you might need to do this you could have got one with 3V3 logic and avoided the logic level converter (three equal resistors won't be enough) But you can probably buy one on ebay for very little.

EDIT - thinking about it, you probably could use two of your resistors in parallel as the lower resistor and the third as the higher resistor of the voltage divider on the oscarliang.net page

2
  • That's not what I want. The article you mentioned is about communication between arduino and RPi over serial port. But I want co connect my laptop running windows and putty to RPi serial console using arduino. That's not the same.
    – gerkirill
    Jun 8, 2015 at 13:43
  • You would need some code on your aduino to read from an IO pin and write to USB and read from USB and write to a different IO pin. You will have to not use the standard tx, rx (pin 0, 1) as in that webpage and you would also need to load SoftwareSerial for communicating with the RPi. I'm sure someone will have done exactly what you are attempting if you search around.
    – paddyg
    Jun 8, 2015 at 15:36
1

If you're really using an Arduino Micro as specified in the title, the accepted answer (which uses an Uno) won't work due to the Micro's lack of separate USB chip.

Instead you'll want to

  1. Upload the SerialPassthrough example to your Micro.
  2. Connect Arduino GND to RPi GND
  3. Connect Arduino RX to RPi TX
  4. Connect Arduino TX to RPi RX using voltage divider
  5. Connect Arduino to your laptop with USB cable
  6. Power your RPi if you haven't already done so

Now you can communicate between your PC and your RPi as in the accepted answer.

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.