I'm trying to set up a Maxbotix Ultrasonic Rangefinder (LV-EZ0) with a Raspberry Pi 3 B+.
I've tried all the tips I could find:
raspi-config
disable serial interfacing for shell, but keep it on for port hardware
/boot/config.txt
I made sure that those lines were there or I added them myself:
enable_uart=1
dtoverlay=disable-bt (also tried dtoverlay=pi3-miniuart-bt)
# services
Stopped / Disabled bluetooth, serial-getty@ttyAMA0
I also tried to: sudo cat /dev/serial0 > catReading.txt
in one ssh window and sudo echo -en "test\n" > /dev/serial0
in another one, but catReading.txt stays empty because I get a "Permission denied" to write anything to serial0.
Command outputs
sudo dmesg | grep tty => [ 0.000901] console [tty1] enabled [ 1.023127] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, base_baud = 0) is a PL011 rev2
ls -l /dev/* =>
lrwxrwxrwx 1 root root 7 Jan 31 16:57 serial0 -> ttyAMA0
lrwxrwxrwx 1 root root 5 Jan 31 16:57 serial1 -> ttyS0
cat /boot/cmdline.txt =>
console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Wiring
- Sensor VCC to 5V pin on raspi
- Sensor GND to GND on raspi
- Sensor TX to TX on raspi (I tried to plug it to Raspi's RX as well, because I simply don't know what I'm doing here 😁. When I did that, I can read a few bytes, none of them starting with 'R' once decoded to utf-8, so probably not data sent by the sensor).
I looked up to see if there was any way to read a PWM input on the Raspi 3, but it's apparently not possible unless I add extra hardware.
Any suggestion from there?