Sign up ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

Can anybody throw some light on RS-485 communication between Raspi and various sensors.

Note: I would like to use it with Pyhton 2.7

Can i connect ADM485 to UART( Tx,Rx) of raspberry pi, I want too use minimalmodbus to communicate with Arduinos receiving information from multiple temperature sensors. Any references to this? I read the documentation of minimalmodbus, sounds great can i go forward or any other better python mdoules for a beginner like me.

share|improve this question

2 Answers 2

I do not think you will be able to directly connect the RS-485 to the RPi with software bitbanging.

It think the easiest way would be to use a USB <-> RS-485 device. Then you can use the USB as a serial port and let the rest happen as it should.

enter image description here

I did find something like that at Farnell and it says it supports Linux 2.4+ - But the driver might need to get tweaked to work on ARM version of Linux. Then just use Python or whatever using built in Serial Port tools and code!

enter image description here

Thanks to Phil Vallone for providing a solution to use the FTDI chip on the Pi

share|improve this answer
+1 Here is a answer which provides a link to the FTDI drivers… –  PhillyNJ May 19 '14 at 14:29
Thanks for the link. Really awesome that there is a solution. I will just add references to my answer also. THanks again. –  ppumkin May 19 '14 at 14:38
Happy to Help - Here is the text version. –  PhillyNJ May 19 '14 at 14:41
adding detail to ppumkin's answer : RS485 uses voltage levels that are different than the Pi has available. And also uses what is called "differential" output –  Marla May 19 '14 at 14:57
Well. What can I do? I answered you original question and you changed it substantially :( What's wrong with the USB device though? –  ppumkin May 27 '14 at 8:33

1- Managing the send / recieve modes by soft will result most likely in failure for the communication

[Ref.Link to be inserted here]

I am trying to hook up a Tristar TS-MPPT-60 to a Pi using a rs485 chip connected to the Pi UART, and eventually add my Arduinos to the network. I have some MAX485 chips and a Sparkfun rs-485 BOB to do my tests.

TS-MPPT-60 Manual:


rs-485 BOB:

2-To let the pi control the RTS / CTS you need access to Pins 30 and 31

Here is what I got hooked up but not tested yet: original img: enter image description here

3-To use the UART you need to have it released by the Pi internal use(undesired traffic):

The MakeFile is broken, do not forget to fix this code for the gpio_setfunc function to compile:

In the Makefile change the line:




To make this restart safe, we put the command into /etc/rc.local:

# enable CTS+RTS on P5 header for onboard serial
/usr/local/bin/gpio_setfunc 31 ALT3
/usr/local/bin/gpio_setfunc 30 ALT3

3-Here is a sample of code that should allow to communicate with slaves.

pymodbus rtu rs-485 communication

Pay attention to the corrections below the code block in the previous link.

temps  = client.read_input_registers(30001, 4, unit=0x0a) # address, count, slave address
print temps.registers
coil  = client.read_coils(10001, 8, unit=0x0a) # address, count, slave address
print coil.bits

In the sample code, replace the undesired usb port with the TTL one:


All of this is untested, but that is a resume of all my findings up to now.

Now my latest issue is that the Slave has a big 12v mark on the Modbus port. Will my Pi get fried? I'll keep you posted.

share|improve this answer
Welcome and thanks for what appears to be a thoughtful answer. I've removed your preamble about the nature of the Q&A, since, to clarify a significant detail indicated in comments on ppumkin's answer and the edit history, Ruthik asked a specific question and then a week later modified it to exclude the answer. That is NOT a good way to go about things -- it is asking other people to waste their time trying to help after you've been too lazy to make your requirements known in the first place. Something to consider WRT "nothing is more annoying than people who ...." ;) –  goldilocks Jun 14 at 20:25
Thank you for making my 1st post politically correct :-) –  Mathieu Berube Jun 14 at 20:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.