Page 1 of 1
rs485
Posted: Thu May 21, 2015 11:42 pm
by hamza
hi
how can I configure the rpi pins (Tx,RX) gpio14,gpio 15 to RS-485???is there supported library??
Re: rs485
Posted: Fri May 22, 2015 12:36 am
by danjperron
For Rs-485 you need an external pin to indicate the direction of signal and the internal ttl serial only have rx and tx.
Because USB to RS-485 adapter is so cheap you should consider it!
I did post some try out with different adapters type.
viewtopic.php?p=563861#p563861
At the beginning of that post you will get a document about a water detect module. In the document I use a small PIC cpu to switch the direction of the rs-485 driver.
There is some adapter on the market that switch the direction when the transmit signal go TTL low (SPACE) but that method doesn't work well since there is no output when transmit TTL HIGH (MARK). So I use a small cpu to detect a transmission and switch to receive when the TTL stay high for ~2 character long.
Daniel
Re: rs485
Posted: Wed May 27, 2015 4:29 pm
by Skidmark
Your post on the RS-485 seems to come the closest to what I'm looking for so I have a few questions for you. The "cheeper" adapter/converter you are referring to. Exactly which converter is that. Can you be exact please. Also do you have any 'C' or 'C++' code for connecting to the converter?
I'm a seasoned Windows developer, but not Linux and need some start up help. If I can just get started with getting a RS-485 converter installed on the Pi and some basic code help I can run with from there I think.
Thanks much.
Al
Re: rs485
Posted: Wed May 27, 2015 7:18 pm
by danjperron
Re: rs485
Posted: Fri May 29, 2015 2:54 pm
by Skidmark
I've downloaded your code and will look at it. The code title implies PIC (very familiar with PIC products) but I'm only interested in the RBP code that communicates with the 485 converter. Which module has the RBP code that opens the 485 converter port and communicates with it?
Thanks Al
Re: rs485
Posted: Fri May 29, 2015 3:22 pm
by danjperron
You will find C code for the Raspberry Pi in configPIC.c
And python code for webiopi in Webrelais.py and PicModule.py. The last one is the class to access the module.
I do have a document in google drive.
https://docs.google.com/document/d/1lXs ... sp=sharing
Traducted from my french version
https://docs.google.com/document/d/1JIR ... sp=sharing
Re: rs485
Posted: Tue Jun 16, 2015 5:43 pm
by Skidmark
I received my USB RS-485 converter and hope to get busy coding as soon as I can. Does the RBP already have the driver included or do I need to download it form somewhere? If so where.
Does you code show how to turn the line around to transmit?
Thanks once more.
Al
Re: rs485
Posted: Tue Jun 16, 2015 6:36 pm
by danjperron
When the usb dongle will be connected to the Raspberry Pi, it will be recognized.
something like /dev/ttyUSB0
I used minimal modbus but I thing it is automatic. There is no need to set the direction of the signal.