RS485 differential pair seems not so differential?
2277 Views - Created 22/01/2019
(You cannot see the "2" marker because it's under "3")
Now let's look at a sample from a commercial DMX USB interface hooked to a Windows running PC:
This time, 2 & 3 are clearly opposed, and more importantly, when you look at M, you can see the signal varies between negative and positive.
How do I get such a result with the RS485 board?
With the RS-485 protocol, the voltage is measured as the difference between the two wires A and B.
If A - B is less than -200mV then that is registered as binary 1. If A - B is more than +200mV then that is registered as binary 0.
The receiver only measures the voltage between the two wires so where they are relative to ground is not important. The specification for RS-485 and EIA-485 allows the voltage to be anywhere between -7V and +12V. The only important part is the difference between the two wires is more than 400mV.
As DMX uses the EIA-485 standard for its physical layer it should be compatible with the RS485 Pi. If the signal output on your commercial DMX USB interface is reversed compared to the RS485 Pi then you should be able to replicate this by swapping the A and B wires around.
In the 2nd screenshot, the difference signal (red) goes approx from -3V to +3V, which complies with what you described (more than +200mV, less than -200mV).
In the first one (output of RS485Pi), the difference never goes above 0V (or never below 0V it plugged in opposite direction), meaning either the <-200mV or the >200mV threshold won't be reached.
Wouldn't that be a problem?
The +200mV and -200mV are relative to the centre point between the two voltages, rather than relative to ground.
In the case of the RS485 Pi, the centre point would be 2.13V so to comply with the RS-485 standard the voltage needs to drop to less than 1.93V and rise to more than 2.33V. As the voltage shifts between 941mV and 3.07V or -1.06V to +1.06V, it should be compatible with any RS-485 device.
Do you have a sample code for python that has been proven to work?
The RS485 Pi behaves like a normal serial port when it is plugged into the Raspberry Pi so the RTS pin is not needed on the GPIO port. A MOSFET on the RS485 Pi automatically switches the RS485 transceiver into transmit mode when data is sent down the TXD line.
To use pySerial with the RS485 Pi you can use the serial class. The serial.rs485 class that is included with pySerial will not work properly with the RS485 Pi.
The examples below show a simple program that writes a series of numbers followed by a newline character to a slave RS485 Pi on a second Raspberry Pi. When the slave receives the data it sends it back to the master.
#!/usr/bin/env pythonimport serialdef main(): ''' Main Function ''' port = serial.Serial("/dev/ttyAMA0", baudrate=115200) # flush buffers port.reset_input_buffer() port.reset_output_buffer() # send a string to the slave port.write(b'123456789\n') # read the port until a newline character is found byteData = port.readline() print(str(byteData))if __name__ == "__main__": main()
#!/usr/bin/env pythonimport serialdef main(): ''' Main Function ''' port = serial.Serial("/dev/ttyAMA0", baudrate=115200) # flush buffers port.reset_input_buffer() port.reset_output_buffer() # read the port until a newline character is found and # write that data back to the port while(1): byteData = port.readline() port.write(byteData) print(str(byteData))if __name__ == "__main__": main()
At any rate the 470 Kohm BIAS opposition appears to be very peculiar to me, I get it ought to be 470 ohm. You could likewise attempt without them since network is so little. Kindly advise me on the off chance that it works.
pcb assembly quote
I have never tried converting RS232 to RS485, we only make boards that convert UART to RS232 and UART to RS485, so I am afraid that I wouldn't know if a 470Kohm bias resistor will work.
It may be worth posting your question on the EEVBlog forum as they have a larger user base who may have experience converting RS232 to 485.
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.