Go Down

Topic: Firmata and rs485 (Read 97 times) previous topic - next topic

sbpeachey

hi i am new here so i hope i have posted in the same place. i recently started using arduino and have started experimenting with node red. i am successfully controlling a relay connected to arduino using node red on a raspberry pi using the firmata sketch. i would like to extend the distance from the pi to my arduino and i was wondering if i could use rs485 with this sketch? im pretty new to coding i have searched for a solution but have had no luck.

is there a sketch that i can use for this or is there anything i can do to change the firmata sketch to use rs 485 with node red?

thanks in advance


pylon

Quote
is there a sketch that i can use for this or is there anything i can do to change the firmata sketch to use rs 485 with node red?
That's not a software problem but rather a hardware update you have to do. The firmata protocol is sent over a serial interface so you don't need to change anything. But I would rather use the full-duplex version of RS485, called RS422 as firmata is not prepared for a half-duplex communication channel.

sbpeachey

thanks for the reply. whats the difference in hardware? i have 2 of the basic ttl to rs 485 adaptors is this compatible? or do i need something else ? thanks for the info. i will google rs 422 to find some info.

thanks

pylon

Quote
thanks for the reply. whats the difference in hardware?
Simplified it's just to have two RS-485 drivers on both ends of the cable, one for each direction.

Quote
i have 2 of the basic ttl to rs 485 adaptors is this compatible?
The ones I know aren't compatible but you forget to provide links to the actual product.

Quote
or do i need something else ?
A MAX488/489/490/491 may work as the driver chip (MAX488 the easiest for you) but you need some additional circuitry to make it functional. A quick search didn't show custom-off-the-shelf modules you could buy.

Do you really need this? What distance are we talking about? What speed?

sbpeachey

it for glasshouse control im trying. it will be a 100-300 meters and have a few arduino "i/o stations". tbh i have no idea what speeds as im new to this. i just know most control ive seen is rs485. it will have some sensors and some relays connected to each io station controlling irrigation and climate. is there a better way? again thanks for the replies. i appreciate your help

pylon

Quote
is there a better way?
That's not an easy question. If you want to continue to use Firmata you cannot use RS485 because Firmata doesn't allow half-duplex communications.
If you want to control a glasshouse I would say that Firmata is a rather bad choice and a RS485 based bus protocol like ModBus would be a much better choice. But that means you have to learn a new protocol, have the complete software reprogrammed and learn much before you can finish your project. It's up to you which way you want to go.

adwsystems

RS422 is not a "full duplex" version of RS485. RS422 uses completely different voltage and (typically) does no require termination, like RS485 does. Both RS422 and RS485 offer full duplex versions, it just depends on how the design of the hardware interface layer (is it design for full duplex or half duplex?)

Go Up