Hot answers tagged

71 votes
Accepted

How do I make serial work on the Raspberry Pi3 (PiZeroW, Pi4 or later models)

This answer is still correct, and explains in more detail the nature of the changes, but most users of current Raspbian should just run sudo raspi-config Select Interfacing Options / Serial then ...
user avatar
  • 53.5k
21 votes

How do I make serial work on the Raspberry Pi3 (PiZeroW, Pi4 or later models)

finally this got work for my pi3 (os: debian jessie) please follow these 6 steps carefully. Step 1 - Install Raspbian Jessie onto a SD card and boot the Pi when connected to a network Login via ...
user avatar
16 votes
Accepted

Why my program won't communicate through ttyAMA0 on Raspbian (Jessie)?

Ensure terminal over serial is disabled in raspi-config Run sudo raspi-config and in "Advanced" choose "Serial" (Enable/Disable shell and kernel messages on the serial connection) and disable it....
user avatar
  • 276
11 votes

How do I make serial work on the Raspberry Pi3 (PiZeroW, Pi4 or later models)

Naseer's answer is correct but a bit elaborate if you just flashed the latest rasbian. All I needed to do, is just to add the following line to my config.txt (from e.g. windows where you plug in the ...
user avatar
  • 211
11 votes

What is /dev/ttyAMA0

@Milliways had the best answer in my opinion. His answer can be found here: Link given here ttyAMA0 can be the Tx, Rx pins for the Raspberry. But for the Raspberry Pi 3b it was used for the Bluetooth....
user avatar
  • 261
11 votes
Accepted

Bit waveform clarification

To me it looks like ser.write(1) has an implicit conversion to string. So your 1 becomes a "1" which is 00110001, which perfectly fits into your observation.
user avatar
  • 2,622
10 votes

Python serial permission issue

@LiWi's answer will work temporarily, but the permission change will be lost once the device is removed or the server rebooted. A permanent solution is to add your user to the dialout group, which ...
user avatar
  • 2,203
10 votes

How do I make serial work on the Raspberry Pi3 (PiZeroW, Pi4 or later models)

Raspberry Pi4 UART The Pi4 has 4 additional UART (uart2-uart5) in addition to uart0/1 on the older Pi (only one of which can be used as they share GPIO). Functionally these are equivalent to the fully ...
user avatar
  • 53.5k
9 votes
Accepted

Disable DTR on ttyUSB0

The properties of a USB serial converter have nothing to do with the hardware of the hosting system, but only with the USB serial chip itself, and the software stack of the hosting system. The pi ...
user avatar
9 votes
Accepted

python serial.Serial() module not found error

First uninstall serial with sudo pip uninstall serial (thank you so much Ali!) Then, if import serial does not work anymore: use sudo pip install pyserial. This will install the correct serial module ...
user avatar
  • 106
8 votes
Accepted

Raspberry Pi used as a cheap serial-to-WLAN converter

For basic network communication nc or netcat, as suggested by joan, is sufficient. However, if you for example want to forward a serial console or encrypt the connection socat is probably more ...
user avatar
  • 317
8 votes

Binary garbage on the UART when powering the RPi

The Pi's UART has a fault (in the firmware). Whenever the port is opened there is a 30 µs low glitch on TXD. See http://elinux.org/RPi_Serial_Connection#Unwanted_serial_garbage_input and search for ...
user avatar
  • 66.5k
8 votes

Cronjob is set to run every 5 minutes but runs every minute

From man 5 crontab: Step values can be used in conjunction with ranges. Following a range with "/<number>" specifies skips of the number's value through the range. For example, "0-...
user avatar
  • 55.8k
8 votes
Accepted

Reliable method to differentiate a Raspberry Pi 2 and 3?

cat /proc/cpuinfo | grep Revision RPi 2 boards will show board revisions a*1040, a*1041 or a*2042, while an RPi 3 board will give you a*2082. Here's a list of board revisions. See also: Getting Your ...
user avatar
8 votes
Accepted

RS232 to Raspberry Pi Zero W

Given the significant differences in the voltage levels it is not safe to directly connect any RS232 signal lines to the Pi's GPIO. Even if the voltage of some RS232 drivers might be as low as 3 V, ...
user avatar
  • 15.5k
8 votes

How many serial ports are on the Pi 3?

The Pi has 2 serial ports, but only 1 is accessible - the other is connected to Bluetooth. (It is possible to switch ports in Device Tree.) See How do I make serial work on the Raspberry Pi3 , Pi3B+, ...
user avatar
  • 53.5k
7 votes

How do I display an image file (PNG) in a simple window?

Wand has a display module/method. In the terminal $ python -m wand.display wandtests/assets/mona-lisa.jpg In a Python script import wand with Image(blob=file_data) as image: wand.display....
user avatar
  • 1,374
7 votes
Accepted

Colored console over serial connection?

The default bash prompt is set in a system wide file; for a complete explanation of how bash sources its configuration see INVOCATION near the top of man bash. In short, that system wide file is ...
user avatar
  • 55.8k
7 votes

How can Rpi read ADS1256 ADC Data

Any answer might only be of limited help to you as long as you have not understood how SPI actually works, so you should take a detailed look at this interface. Concerning question 1: SPI is a master-...
user avatar
  • 651
6 votes

Disable DTR on ttyUSB0

@ChrisStrattons post describes how to use stty -F /dev/ttyUSB0 to avoid the hangup which results in a reset. Here is a snippet to do it in Python: import termios path = '/dev/ttyACM0' # Disable ...
user avatar
  • 1,481
6 votes

How to configure serial port settings of /dev/ttyAMA0?

To configure the UART ttyAMA0 for your application (like minicom) pi@raspberrypi:~ $ lsb_release -a Distributor ID: Raspbian Description: Raspbian GNU/Linux 8.0 (jessie) Release: 8.0 ...
user avatar
6 votes
Accepted

How do I display an image file (PNG) in a simple window?

If you're using an X11 Desktop Environment such as LXDE, then you can accomplish this using the basic logic shown in this article. Here's what I came up with to switch displaying two images waiting ...
user avatar
  • 3,070
6 votes
Accepted

Reliably Reading from the Serial Port in Python

You should not re-create the object Serial at each iteration of the loop. I suppose that the line serialport = serial.Serial("/dev/ttyAMA0", 9600, timeout=0.5) closes and re-opens the serial port, ...
user avatar
  • 216
5 votes
Accepted

Why am I seeing some garbage bytes at the serial console login?

This is probably the well known bug of the spurious character when the serial port is opened. I don't remember the details, something to do with the TX line dropping for an instant so signalling a ...
user avatar
  • 66.5k
5 votes
Accepted

How can a USB Bluetooth Dongle be used as login TTY

Short answer: First setup dependancies sudo apt-get install bluez Then ensure your pi is discoverable: sudo hciconfig hci0 piscan Now append the following to /etc/inittab (using nano - and ...
user avatar
5 votes
Accepted

Serial vs I2C speed

There is no real comparison, these are designed for different purposes. Serial communication is designed for long distance communication. I have used it over 1000km. There are often speed/distance ...
user avatar
  • 53.5k
5 votes
Accepted

Is there a way to attach multiple serial port devices to a single raspberry pi?

You could: utilize a couple of USB to serial adapters like this one. you could use a microcontroller that has multiple serial ports (e.g. arduino mega) to gather the data and transfer it to the Pi, ...
user avatar
5 votes

Colored console over serial connection?

I read Walter's answer here and researched more and found: https://kb.iu.edu/d/acpy which indicated: TERM=ansi; export TERM does the job, you can add it to your .bashrc However, I still have grey ...
user avatar
  • 51
5 votes

Raspbian Wheezy, Raspberry Pi 3 and HC05

Wheezy will support the Pi-3 if it's firmware is first fully updated in an older pi with: sudo apt-get update && sudo apt-get upgrade then remove the SD card and put it in a Pi-3 and it will ...
user avatar
5 votes
Accepted

Raspberry Pi as Wiegand device - output Wiegand to receiver

Wiegand is quite straightforward. It is not a particularly onerous interface. For an example of transmitting Wiegand codes see http://abyz.me.uk/rpi/pigpio/examples.html#pdif2_tx_WD /* This ...
user avatar
  • 66.5k

Only top scored, non community-wiki answers of a minimum length are eligible