I am doing some project, and I need to send data from raspberry pi to arduino uno. For this purpose I use TXD/RXD pins on both devices, but it doesn't work :
I found out that code has no difference for arduino when connecting via usb and UART ports. And as I naively thought, to connect to arduino from raspberry, I just need to specify which tty it uses (when over usb it is /dev/ttyACM0). When I plugged TXD/RXD pins, and checked which port it uses by listening all suspicious ports. It turned out that it is /dev/ttyS0. For unknown reason, when I try to send data via UART, nothing going on : neither TRX pin blinks(but when using usb variant it does) nor anything else happends.
Also, I tried to listen arduino port on raspberry. When it connected via usb the port shows no output, and the program is working, but with UART everything is reverse : port shows my raspberry program stream desired to be sent to arduino and the sketch isn't working.
Of course, something is wrong. But what? I have my /dev/ttyAMA0 free, and nothng is running on it. I'm powering arduino with power bank through usb, but I'm not sure whether it's okay for UART or not, because when I have both usb and UART connected to pc(both to raspberry, or usb to PC and UART to raspberry), I can't even upload any script to it.
I don't know much about Raspberry Pis.
According to Raspberry Pi Documentation - Configuration all UARTs on the RPi is 3.3V
Arduino Uno is 5V
The Arduino Uno only has one hardware UART which is the USB-B connector.
.
ieee488:
The Arduino Uno only has one hardware UART which is the USB-B connector.
The UART is also present on pins 0 and 1 (Rx and Tx).
The 5v from the Arduino TX pin must be dropped to 3.3v for the RPi's Rx pin. But the 3.3v from the RPi's Tx pin should work fine with the Arduino's Rx pin. There must also be a GND connection between the RPi and Arduino.
...R
Serial Input Basics - simple reliable non-blocking ways to receive data.
Simple Python - Arduino demo
We gave up on getting connected to RPi UARTs.
So much easier to connect Serial port (hardware or software) to a FT232 module (can Rx, Tx, GND, can be 5V IO) and a cable to plug in to a RPi USB-A port and work from there.
Being a minicomputer, more or less, the FTDI just shows up as a COM port that you can read and write to.
My son connected wirelessly via SSH even (must be enabled on the Pi) and could see output that I was creating.
I am using 2nd serial port on a '1284P to talk to the Pi, but software serial would work also.
What pin configuration do you use? If you are connecting TX to TX and RX to RX, then you would damage your board because both the transmitter pins would be connected with each other and would cause conflicts. Connect TX to RX and RX to TX of the two devices for the communication. If you are using the correct configuration and still not receiving any signal between the devices, then make sure that the ground pins of both the devices are connected with each other. Or the current won't pass to the device.