I am working on a project which requires RS485 transmission for displaying data on a PC screen. Allow me to explain it further, on one side ( Transmitter side ) I have atmega programmed to send some data through sn75176, on the other side ( Receiver side ) I have arduino connected through sn75176 and programmed to read serial. Everything works like a charm I can see received data on serial monitor which is great but that's not the issue here. Recently I have bought RS485 - CH340 converter like on the picture attached below, and I would like to swap the receiver side so the arduino, with that converter in order to display received data on the PC screen using Processing 3. Like I mentioned before it worked with arduino part but It doesn't with that converter, as a matter of fact I do not receive any data at all. I have tried using arduino serial monitor for that purpose, as well as Processing ( same sketch that worked for arduino before ), which displays nothing, obviously I am doing something wrong here. Could anyone point me into right direction and tell me what am I doing wrong? Or perhaps it is not possible to do it with that hardware and I just don't know about that. I would very much appreciate Your help guys.
PS : I opened up that converter and I've noticed that it is missing 120 Ohm resistors between A and B of max485, obviously I tried to connect such resistor but it still didn't solve the problem.
Please post your code! (and don't forget to use code tags, that's the </> button in the editor)
PS : I opened up that converter and I've noticed that it is missing 120 Ohm resistors between A and B of max485, obviously I tried to connect such resistor but it still didn't solve the problem.
These adapters usually have all resistors pre-installed (terminator, pull-up/-down of A/B), so if your's haven't them, other things might also be wrong. Have you tried replacing that adapter?
as for the receiving part of arduino it was simple sketch Serial.read then Serial.print and thats it.
And when it comes to the transmitter, unfortunately it is written in assembly and I do not have the code, but it sends some byte values.
I am 99% sure that there is not an issue with the code itself its the hardware problem but I might be wrong. Anyway for now I just want to establish connection between pc and that atmega without using arduino, I know it can be done with its help but I would like to avoid all unnecessary devices on the way and make it as simple as possible.
Schematic below, I even added picture of inside of that adapter as You can see it is missing R7 which is supposed to be 120 Ohm resistor but like I mentioned before i put one in between ARK connectors and still didn't help, other than that everything is in place.
Schematic on the top shows current picture so with the adapter the one below its for the working arduino setup, with the working code as well.
That code converts a byte to it's decimal ASCII representation. If the value sent by the ATmega is 57 it will send the bytes 53 ('5'), 55 ('7'), 13 (CR), 10 (LF) to the PC. And your Processing program expects it that way. So you might have to adapt that program.
Not quite, even if i don't convert it to Decimal it still displays data. But thats not the point if you read carefully what I wrote in first post, I would like to omit arduino and program part and simply receive data through that adapter or any other one, so the question remains, is that possible?? If yes how and which adapter should I use.
Do you want to see data or do you want to be able to read the data? Pylon's post is warning you that when you send '57' you will not see '57' on the screen but instead see '9' on the screen.
You don't list what sn75176 is, nor Programming 3. So unless someone that knows these parts stumbles across this thread, help on those may be slim coming.
I'm not able to compare the schematic posted to the OP. The OP talks of having at least 4 parts, the schematic shows 2. If one of your arduinos has a RS-485 converter on to send data to another arduino that is only being used to translate between RS-485 and USB, then the CH340 will do the same thing. If the data you see on the screen is garbled, then read and understand the implications of pylon's post #5.
sn75176 is rs485 transceiver optionally you can use max485 which is the same thing, datasheet below :
Processing 3 not programming 3, its Java based IDE for data visualization, often used along with Arduino for displaying data in a user-friendly way on the PC screen, link below :
adwsystems:
Do you want to see data or do you want to be able to read the data? Pylon's post is warning you that when you send '57' you will not see '57' on the screen but instead see '9' on the screen.
That shouldn't be a problem for me as long as "57" will always be displayed as 9 and so on.
I'm not able to compare the schematic posted to the OP. The OP talks of having at least 4 parts, the schematic shows 2. If one of your arduinos has a RS-485 converter on to send data to another arduino that is only being used to translate between RS-485 and USB, then the CH340 will do the same thing. If the data you see on the screen is garbled, then read and understand the implications of pylon's post #5.
Its a simplified schematic on the bottom You have 2 arduinos both having rs485 converter, on the top 1 arduino with rs485 connected straight to the adapter if its not possible with that one maybe I can do that with FTDI one would that be possible?
I think there is confusion about how the data is getting into your computer (e.g. the host where processing runs). On a typical Uno board, the host UART (which is a 16u2 used as a USB bride) TX connects to the 328p RX, and the host RX connects to the 328p TX. The board is labeled with the 328p connections so the TX line is going to the host RX through a 1k ohm resistor to help protect things.
I suggest thinking about the problem from the host computers point of view and then labeling the schematic as such, everything may make sense after doing that. To connect a remote Uno just hold the local Uno's 328p in reset with a jumper and connect the local TX to remote TX and same for RX. If you want to use RS485 then the local TX (which is the host RX) needs to receive data from the remote Uno over RS485 form its 328p TX line (keep in mind that the local 328p needs a jumper on its reset).
Terrius:
That shouldn't be a problem for me as long as "57" will always be displayed as 9 and so on.
What happens when "12" is sent? Nothing will be displayed. What happens when 130 is sent? You will get some funky character on the screen, maybe; if anything is displayed.
In short you should be able to swap the arduino being used to translate RS-485 to USB for your CH340 adapter, but be warned that you may not see all the data on the serial monitor.
That is a good looking board, but I don't think Arduino's serial console program is going to know how to operate the push to talk lines.
I call these lines "push to talk" because that is how radios use to work. Perhaps the FTDI software can be set to hold the receiver enabled while the serial console is opened, but I have doubts.
Update: I don't see anything on the Processing website or GitHub that indicates it can control the push to talk lines (it seems to be for RS232, which is full duplex and has no push to talk implements).