This is my tenative first step trying to recieve data from a sensor via RS485. So far I have wired my MAX485 up as per the attached diagram. So I have a couple of questions before I plug IN Does this wiring look right? And would anyone be able to help me with some simple code to receive the data and print to serial so as to make sure its working - hopefully I can work out what to do after that?
I have a blog entry with how I wired up my RS485 PC interface.
You need to be able to control when you can TALK and Receive on the BUS. I much prefer Jan Axelson timer approach, which I used in my design.
The chip I used has the same pin out and roughly the same characteristics of the original MAXIM chip. You would just remove the MAX232 for interfacing with the Arduino... but without it... you need to remember that the MAX232 was "inverting" the TX/RX signals too.
There are only minor differences between the SN75176 and the MAX485
From what i gather you only want one-way communication by only receiving data.
Pin 1 (RO) should go to RX on the arduino
Pin 2 (RE) should go to ground on arduino this will enable Receiver mode
Pin 5 - Ground
Pin 8 - Vcc (5v from arduino)
Pin 6 (A) to A on other end
Pin 7 (B) to B on other end
A 150ohm resistor should be added between A&B at the start and end of the signal lines.
So looking at your diagram, theres no need for pins 3 and 4 to be connected, Rx should not be grounded, no need for a 100ohm resistor on ground pin and Tx does not need to be connect either if your just receiving.
If you want two way coms you will have to put pin 2 & 3 on the MAX485 to a digital pin and set it LOW for RX or HIGH for TX, since DE has a NOT gate.
Hi All - thanks for all the responses, very much appreciated - and I see I did get it pretty badly wrong !!! I have now rewired the circuit as per your diagram Bored123 (thanks again) and include the info I have on the RS485 output for mrmeval and anyone else who is interested. In theory I should be able to read 3 values from the sensor CO, Temperature and RH.... lets see if I can make an equally bad job of the code!... at this stage I need to work out what comes after #include <SoftwareSerial.h>
Hi, Sorry for the slow reply - I'm making some slow progress here so thanks again for your help.
I have put the hardware to one side at the moment to try and get to grips with the sesnor output - so I have the sensor conneceted to USB on my PC and have recieved data as expected every 3 seconds via a program called DockLight (anyone know if there a free software to do the same?).
I have looked at the data as hex & ascii but it makes little sense to me - do you know how should I be interpreting Modbus output?
eg:
13/04/2010 19:22:24.246 [COM11]
DD FD 95 AD 91 26 92 65 FD B1 1A 44 4C 2C FD E9 26 22 AA A5 F6 39 1A 24 CA D2 55 A7 A4 D5 A7 FF 49 44 A5 D2 29 26 29 A6 65 AD 6B 24 A6 AB 4D 55 EA 16