I have simple app in python that should send data through serial port (serial0/ttyS0):

import RPi.GPIO as io
import time
import serial
import array


ser = serial.Serial(port="/dev/serial0",

text = "200\r\n"

And this app won't to send me data through serial port. How can I check if it really send anything? Maybe I can measure voltage on GPIO pin?

  • what's connected to the other end of the serial port? perhaps you have rx and tx connected incorrectly? – Jaromanda X Jan 15 '18 at 3:00
  • To the serial port IR sensor are connected. RXD works, I get data when IR receive signal, but I cannot send signal from the second IR sensor that is connected to TXD – Robert Jan 15 '18 at 7:05
  • 1
    so, TXD is connected to an IR emitter I hope (a sensor won't emit IR, it resieves it) - do you know how to check if anything is being sent via the IR emitter? if you have a mobile phone with a camera, watch the sensor through the camera when sending – Jaromanda X Jan 15 '18 at 7:13
  • Yes, you're right. I've checked IR emitter and it emitted only one time. I've checked as you wrote - by using camera from phone. Then when I run application several times after this first time the senser (IR emitter) doesn't emit signal (I don't see nothing in camera). I restarted RPi but without result – Robert Jan 15 '18 at 15:01
  • It works, problem was with text, it shoudn't contains \n at the end, probably python add eof by default. I removed \n and now it works – Robert Jan 17 '18 at 11:58

Your Answer

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

Browse other questions tagged or ask your own question.