Hot answers tagged

65

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 specify if you want a Serial console (probably no) then if you want the Serial Port hardware enabled (probably yes). Then use /dev/serial0 in any code which accesses ...


19

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 terminal or desktop and shell Configure the system with: sudo raspi-config Expand filesystem and enable serial on advanced page, exit and reboot. Step 2 -this ...


18

I think you would call them P*-Headers, where the * designates which one exactly (5/2/3/6). What you call Opportunity B is known as the P5-Header, and you can use it just like the GPIO-Pins next to it (see also this link). Opportunity A (P6) can be used to reset your Raspberry Pi: Shorten it it reset. Be careful, though, as doing this while your SD-Card is ...


15

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. Steps 2 and 3 should not be necessary if you do this step first, but in case it didn't work - check them also. Ensure /boot/cmdline.txt has no ttyAMA0 The ...


14

I finally solved this, but in a pretty unorthodox way. I abandoned bit-banging as too unreliable and tried to find other solutions which would allow me to the same thing without adding more hardware. I was considering writing a kernel driver, which would trigger an interrupt on GPIO and then reconfigure the pin to be SPI and use SPI to read an entire data ...


12

The Gammu documentation suggests (but doesn't go into any detail of) a workaround, Edit: Atmel has an Application Note that nicely describes the enumeration process. Enumeration changes because it happens in a conversation between host, hub and device, and response timing from each of these may vary, even if the setup is identical from one reboot to the ...


11

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.


10

The short answer to your question, how to safely connect the RPi to an Arduino, is indeed given at the first link you posted: http://blog.oscarliang.net/raspberry-pi-arduino-connected-i2c/. I have used the method given there with great success, and without damaging any components. But your question suggests that you don't trust that method, and I think the ...


9

It would seem that atleast without the real-time patches (CONFIG_PREEMPT_RT), the Raspberry Pi cannot reliably bit-bang a 9600 baud serial. I used a simple latency tester which configured all the linux side things optimally (sched_fifo, priority 99, cpu_dma_latench 0us, mlockall). I tried sleeping for 100 µsec (roughly 9600 baud) and checking the latency ...


9

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 SD card on the fat32 partition): dtoverlay=pi3-disable-bt Then plug it in, and the pi will directly print stuff on the console pins.


8

It is possible to connect the RPI to other devices via spi. You need to enable the kernel module and allow yourself access to the device. sudo modprobe spi_bcm2708 sudo chown `id -u`.`id -g` /dev/spidev0.* Then you can use this c file to test the dpi-device: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=Documentation/spi/...


8

@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 will allow it to access serial devices. sudo usermod -a -G dialout youruser


8

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 glitch. You will need to find a workaround as the fault will not be fixed.


8

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-23/2" can be used in the 'hours' field to specify command execution for every other hour (the alternative in the V7 standard is "0,2,4,6,8,10,12,14,16,...


8

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, the logic one (called "mark") is represented as a negative voltage which will kill the Pi. RS232 (Source): The standard specifies a maximum open-circuit ...


7

To talk to a serial device using Python, use the pyserial module. If it is not available in your distribution, it can be installed by getting a copy of the source from the pyserial project page and running "python setup.py install" Simple examples of using pyserial are available at the short introduction. The module for the PL-2303 is available by default -...


7

When [a] [Raspberry Pi] starts, I understand that it writes [boot messages] [to the serial port]. Can I disable [these messages] ? Yes, you can find instructions in several places including Hobbytronics Disable Serial Port Login To enable the serial port for your own use you need to disable login on the port. There are two files that need to be ...


7

You've partially answered your own question, but there is another way of doing it, especially for serial devices: the /dev/serial/* paths. I have a Prolific USB→RS232 interface on my Raspberry Pi which almost invariably shows up as /dev/ttyUSB0. But it also appears on the system as: /dev/serial/by-path/platform-bcm2708_usb-usb-0:1.3:1.0-port0 /dev/serial/by-...


7

If you don't want to spare your USB port of your Rpi, you can use GPIO Serial to communicate with your Arduino. There is a great tutorial of Conor O'Neill for connecting Rpi with a Arduino Pro Mini. The procedure is the same with your Arduino Uno. All you need is a LLC (Logic Level Converter) to be able to connect these two devices. As you've already ...


7

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 convenient. For inspiration here are two working examples of the mentioned applications. Serial console via TCP To connect directly to the serial port with socat ...


7

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.display(IMAGE)


7

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 Raspberry Pi Revision Number Using Python.


7

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-slave-system where any interaction has to be initiated by the master. The sensor itself is not able to write to the master, instead it is read by the master (...


6

You may use stty -F /dev/ttyAMA0 9600 to set the baud rate to 9600 from the command line. Try man stty to see other options.


6

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 should be using stock Linux USB serial drivers. Therefore, you can enable/disable the linkage of DTR to port open/close via the usual Linux method of clearing the ...


6

@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 reset after hangup with open(path) as f: attrs = termios.tcgetattr(f) attrs[2] = attrs[2] & ~termios.HUPCL termios.tcsetattr(f, termios.TCSAFLUSH, ...


6

You only need to connect GND, RXD, TXD GND => PIN 6 RXD => PIN 8 TXD => PIN 10


6

What you are referring to is called Software Serial, where bytes are bit banged and create the same effect as a serial port. Using a normal Linux distribution the answer is, No. The reason is because bit banging required real time processing of data, otherwise the data will just be junk. This answer at Electronics Stack shows a USB board with 4 hardware ...


6

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 30 seconds between each switch. You should be able to insert your logic for switching the images based on what you read from your RFID sensor. displayImages.py ...


5

I haven't tried this on a Pi, but I use python to access a serial port on a Beagle Bone. Python serial can be installed using sudo apt-get install python-serial Then you can use the following code snippet: import serial serialport = serial.Serial("/dev/ttyS0", 9600, timeout=0.5) serialport.write("What you want to send") response = serialport.readlines(None)...


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