Read RS485 From DVR

I have DVR with Serial Port RS485 .... it can be managed by SW to send PTZ command trough RS485 port to move PTZ camera once event occur , but what I need when I send "any" command trough RS485 to trigger 5v relay ....

I thought of using RS485 to TTL with mini arduino to do job , but I'm thinking if there is simpler way and less cost way because I'm thinking of it to adopt it in my business , so I need less cost way and less complicated way ...

if not applicable I need support from those who can help to send me code for mini arduino

You seem to be confusing two things.

The RS485 to 5 V logic ("TTL" is not correct) is performed with an interface chip - such modules are readily available.

To interpret commands, you will clearly need an Arduino or similar, a Pro Mini would be the most appropriate and inexpensive.

You would be wanting to use a 5 V relay module rather than just a relay as it includes the switching transistor and commutating diode.

Just theorizing here, but if you had a MAX485 based RS485 module, wired in permanent receive mode, I think the RO output will be mostly high, then toggling low/high as data is sent on the RS485 bus.

If you then had a monostable timer (555?) triggered from a high/low transition of RO, then you could use the timer output to drive a relay module.

EDIT: You may be able to get a relay module with a built in time delay unit.

First of all thanks to you reply ..... But what kind of interface between 485 and arduino instead of TTL

Really thanks but you could give me more help if you just explain the idea more

Hi,
What model Arduino do you have?
Can you please post a circuit diagram?
Can you please post your code?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

Continuing the theory, if you had one of these RS485 modules (there are others as well):


If you connected the RE & DE pins to 0v, then the module would be in receive mode. The RO pin will output any data that's on the RS485 bus. When the 485 bus is idle, I think the RO pin will be high. At the first sign of any 485 activity, then the RO pin will go low (i.e the start bit of the first byte of data).

You could use this high to low transition to trigger a monostable timer which in turn drives a relay. You could also use something like this module that I found on AliExpress:


The description seems to indicate that it will trigger the built-in timer when the trig pin goes low, the timer is triggered and the relay energises for a pre-determined time. The original text is:

Providing a low pulse signal, or touch trigger key, relay and indicator lights, the output of the state: normally open (NO) and Common (COM) connected, normally closed (NC) and the common terminal (COM) is disconnected. After 0-24 seconds (this time can be adjusted according to your needs) relay off, back to the state before the trigger.

Thanks for help ... I have the materials I will do some trials and post you with result ...thanks for help again

Actually I have Nano and mini pro ... But eventuallay if things goes ok on nano I will do the prototype on mini to save money ...

About the code there is no specific code yet just trials to read the port..

I have RS485 to TTL with arduino thats my plan to do the job

I want to thank you for such really Great Help .... the trial was done with RS485-TTL Using Basic Relay module without delay timer the Prototype was able to interrupt any MSG from Port , and finally thats what I need simple basic inexpensive easy to deploy

The connection Was as you mentioned RO was giving trigger signal on each MSG DE/RE both on GND .

thanks for great help

Note I used after the simple Relay Module Sonoff Mini to add delay to signal and to have cloud control on the device that I want to control ...

another note if AB input swapped the RO signal inverts from H/L to L/H