0

I want to connect old Dell Latitude D630 laptop with my Raspberry pi 2 via serial port. I have been following tutorial on this page and another here.

Unfortunately I can't transmit any data from raspberry to dell laptop. I have created a small python script which uses serial module to listen to port every second and output the result. This script is started on Dell laptop. On my raspberry I am running another script that simply writes the keyboard input to serial port. I can see that something is transmitted because every time I type in a message and hit enter small orange light indicator blinks on my level shifter, and when running screen /dev/ttyAMA0 115200 it blinks with every keystroke I make, so something is going on. However the script on my dell laptop that runs in a loop reading its serial port /dev/ttyS0 reports nothing. Here is the script used on Dell laptop:

#!/usr/bin/env python
import time
import serial
ser = serial.Serial(
   port='/dev/ttyS0',
   baudrate = 115200,
   parity=serial.PARITY_NONE,
   stopbits=serial.STOPBITS_ONE,
   bytesize=serial.EIGHTBITS,
   timeout=1
)

while 1:
   print 'SERIAL PORT:', ser.readline()
   time.spleep(1)

Raspberry pi script

#!/usr/bin/env python
import time
import serial
ser = serial.Serial(
   port='/dev/ttyAMA0',
   baudrate = 115200,
   parity=serial.PARITY_NONE,
   stopbits=serial.STOPBITS_ONE,
   bytesize=serial.EIGHTBITS,
   timeout=1
)

while 1:
   message = input('>> ')
   ser.write(message)
   time.spleep(1)

With all connected and set up the first script outputs nothing when I am writing to port on raspberry pi. Needless to say that I tried various things, like screen, minicom -- the message is not transmitted from raspberry to dell although the light indicator is blinking. Both user of Dell and Rasppi is in "dialout" group, rasp pi has its ttyAMA0 port open and working. So, my question is -- what am I doing wrong? Maybe I should just write and read to the same port on the same machine? How do I transmit data then?

I am attaching photos of how the rasp pi is connected to the laptop:

Serial ports connected enter image description here enter image description here enter image description here

3

For a serial link you need to connect one ends TX to the other ends RX and vice versa.

From the photo you appear to have TX connected to TX and RX connected to RX.

You shouldn't really connect the 3V3 line. That should only be used if the other device is not powered. The Pi is powered.

  • hmm, ok, I shall definitely try it – minerals Aug 19 '15 at 20:43
  • Well, it didn't work either but I managed to make it working by reconnecting the pins. TX to TX and Ground to Ground only. Then I was able to send from rasp pi to laptop but not vice versa. When I changed pi TX to RX I could send data from laptop to pi. – minerals Aug 20 '15 at 18:08
  • I have no idea what is going on with your dongle. It seems bizarre. – joan Aug 20 '15 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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