RS485 on a Raspberry Pi

R-Pi RS485 GPIO Shield

R-Pi RS485 GPIO Shield

The Link Sprite RS485 GPIO Sheild for a Raspberry Pi alows you to make use of (abuse) the RS232 port in the R-Pi’s GPIO as an RS 485 Port.

There are several good advantages to RS 485 over 232 and some awsome ones.

RS485 is capable of both multidrop and very long cable legnths (even though the data rate can be a bit rubbish, and its normaly half duplex).

I picked up my R-Pi LinkSprite RS434 shield from RoboSavvy (schematics). The plan is to use RS485 from a R-Pi to several Arduino nodes for my Boat Automation.

To make it work I need to make a few changes to my standard Raspbian install:

The UART is /dev/ttyAMAO, it defaults to output system log. But since I want to use this UART to connect the RS485 board, I need to modify two files: /boot/cmdline.txt and /etc/inittab.

Modify /boot/cmdline.txt:

Replace the original content:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

With:

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Modify /etc/inittab:

Comment out the last line of /etc/inittab. To comment out, it simply addess a ‘#’.

$ sudo nano /etc/inittab

#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Save the changes, and reboot. the TX/RX pins with a baud rate of 115200.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current ye@r *

Project Wonderful
UK Waterways Ranking